编辑:根据我下面的评论,我已经能够将我的测试扩展到其他 Honeycomb 3.2 和 ICS 设备。实际上,在所有情况下,URL 都会出现,因此我可以验证自适应流。因此,这只是 Sony Blueray 的问题(当时,它是我唯一的自适应流媒体支持设备)。由于这不是 3.2+ 操作系统的问题,但只有一个制造商设备,所以自适应流测试不是问题,我可以撤回此支持请求。
我遇到了在 locat/DDMS 中阻止和抑制 URL 的问题。我正在尝试做的是验证我的 HLS 自适应流是否真的在适应。我打算如何做到这一点是监视 logcat 并观察被拾取的段。我遇到的问题是 URL 被抑制所以我不能看看发生了什么。这是我在 Logcat 中看到的一个片段。
05-15 14:05:03.499: D/AVAPIMediaPlayer(247): AVAPIMediaPlayer 构造
05-15 14:05:03.503: D/AVAPIMediaPlayer(247): initCheck 调用
05-15 14:05:03.503: D/AVAPIMediaPlayer(247 ): SetDataSource <BLOCKED>
05-15 14:05:03.503: D/AVAPIMediaPlayer(247): surfaceChangedCallback: 调用 setVideoRectangle 这个 0x66901738, x 480, y 180, w 1440, h 680
05-15 14:05:03.507: D /AVAPIMediaPlayer(247): 为 mime 类型 video/mp2t 创建播放器核心
05-15 14:05:03.507: D/AVSettingsBridge(247): prepare, handle:c560b6c8f9, type:0
05-15 14:05:03.507: I /AVSettingsBridge(247): IAVSettingsBridgeImpl::registerCb, 地图大小:0->1
05-15 14:05:03.511: I/LiveSession(247): onConnect <URL 抑制>
05-15 14:05:03.511: I/NuHTTPDataSource(247): 连接到 <URL 抑制> @0
现在我很快将这些追溯到 chrome 框架和隐身模式。一些框架来源:http ://androidxref.com/source/s?defs=kFlagIncognito&project=frameworks 。
81 if (!(mFlags & kFlagIncognito)) {
82 LOG_PRI(ANDROID_LOG_INFO, LOG_TAG, "connect to %s @%lld", uri, offset);
83 } else {
84 LOG_PRI(ANDROID_LOG_INFO, LOG_TAG,
85 "connect to <URL suppressed> @%lld", offset);
我还在 Android 3.0 中找到了一个参考资料:“浏览器包含让用户更有效地导航和组织的新功能。多个选项卡取代了浏览器窗口,新的“隐身”模式允许匿名浏览”。
我认为它可能默认进入隐身模式?
现在,我不是编码员,只是在为丢在我腿上的代码苦苦挣扎,但我突然意识到在 setDataSource(Context context, Uri uri) 或相关的 HTTP 标头中的某个地方可能有一个可以设置的标记/标志打开或关闭隐身模式。经验丰富的Android程序员可能很快就能弄清楚。
任何人都可以帮忙吗?
如果有帮助,我在下面有其他参考资料。
在我们的代码中引用:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent receivedIntent = this.getIntent();
receivedIntent = this.getIntent();
String title = receivedIntent.getExtras().getString("label");
String subtitle = receivedIntent.getExtras().getString("subtitle");
String description = receivedIntent.getExtras().getString("description");
String URI = receivedIntent.getExtras().getString("URI");
String imagePrefix = receivedIntent.getExtras().getString("imagePrefix");
setContentView(R.layout.video_page);
String fileName = Environment.getExternalStorageDirectory().toString() + "/CamaroPit/" + imagePrefix + ".mp4";
File file = new File(fileName);
if (!file.exists()) {
fileName = Environment.getExternalStorageDirectory().toString() + "/CamaroPit/alschevrolet.mp4";
}
Log.d("GTV", "Video to play: " + fileName);
TextView textTitle = (TextView) findViewById(R.id.video_page_title);
textTitle.setText(title);
TextView textSubtitle = (TextView) findViewById(R.id.video_page_subtitle);
if (subtitle.equals("subtitle")) {
subtitle = "Check out \""+ title + "\" and really get a feel for your Camaro.";
}
textSubtitle.setText(subtitle);
TextView textDescription = (TextView) findViewById(R.id.video_page_description);
textDescription.setText(description);
this.getWindow().setFormat(PixelFormat.TRANSPARENT);
final VideoView vView = (VideoView) findViewById(R.id.page_view);
vView.setMediaController(new MediaController(this));
vView.setVideoURI(Uri.parse(URI));
vView.requestFocus();
}
item.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
final VideoView vView = (VideoView) GTVHomeScreenSetup.this.homeScreen.findViewById(R.id.gtv_video_view);
MediaController mC = new MediaController(GTVHomeScreenSetup.this.homeScreen);
vView.setMediaController(mC);
mC.setAnchorView(vView);
VideoData clickedVideo = currentVideoList.get(item.position);
vView.setVideoURI(Uri.parse(homeScreen.getVideoURI(clickedVideo, cPath)));
vView.start();
item.requestFocus();
for (ImageItemView item : GTVHomeScreenSetup.this.imageItems) {
item.unSelect();
}
item.select();
来自框架的其他参考:
PS:它不会让我将超链接作为超链接发布。
// HTTPBase.h (http://androidxref.com/source/xref/frameworks/base/media/libstagefright/include/HTTPBase.h)
28 struct HTTPBase : public DataSource {
29 enum Flags {
30 // Don't log any URLs.
31 kFlagIncognito = 1
32 };
// HTTPLiveSource.h (http://androidxref.com/source/xref/frameworks/base/media/libmediaplayerservice/nuplayer/HTTPLiveSource.h)
struct NuPlayer::HTTPLiveSource : public NuPlayer::Source {
30 HTTPLiveSource(
31 const char *url,
32 const KeyedVector<String8, String8> *headers,
33 bool uidValid = false,
34 uid_t uid = 0);
35
36 virtual void start();
37
38 virtual status_t feedMoreTSData();
39
40 virtual sp<MetaData> getFormat(bool audio);
41 virtual status_t dequeueAccessUnit(bool audio, sp<ABuffer> *accessUnit);
42
43 virtual status_t getDuration(int64_t *durationUs);
44 virtual status_t seekTo(int64_t seekTimeUs);
45 virtual bool isSeekable();
46
47 protected:
48 virtual ~HTTPLiveSource();
51 enum Flags {
52 // Don't log any URLs.
53 kFlagIncognito = 1,
54 };
55
56 AString mURL;
57 KeyedVector<String8, String8> mExtraHeaders;
58 bool mUIDValid;
59 uid_t mUID;
60 uint32_t mFlags;
//HTTPLiveSession.h (http://androidxref.com/source/xref/frameworks/base/media/libstagefright/include/LiveSession.h#36)
33 struct LiveSession : public AHandler {
34 enum Flags {
35 // Don't log any URLs.
36 kFlagIncognito = 1,
37 };
38 LiveSession(uint32_t flags = 0, bool uidValid = false, uid_t uid = 0);
AwesomePlayer 140 隐身 = 0x8000,
PreviewPlayerBase.h 132 隐身= 32768,
//PreviewPlayerBase.cpp (http://androidxref.com/source/xref/frameworks/media/libvideoeditor/lvpp/PreviewPlayerBase.cpp)
247 status_t PreviewPlayerBase::setDataSource_l(
248 const char *uri, const KeyedVector<String8, String8> *headers) {
249 reset_l();
250
251 mUri = uri;
252
253 if (headers) {
254 mUriHeaders = *headers;
255
256 ssize_t index = mUriHeaders.indexOfKey(String8("x-hide-urls-from-log"));
257 if (index >= 0) {
258 // Browser is in "incognito" mode, suppress logging URLs.
259
260 // This isn't something that should be passed to the server.
261 mUriHeaders.removeItemsAt(index);
262
263 mFlags |= INCOGNITO;
264 }
265 }
266
267 if (!(mFlags & INCOGNITO)) {
268 LOGI("setDataSource_l('%s')", mUri.string());
269 } else {
270 LOGI("setDataSource_l(URL suppressed)");
271 }
272
273 // The actual work will be done during preparation in the call to
274 // ::finishSetDataSource_l to avoid blocking the calling thread in
275 // setDataSource for any significant time.
276
277 return OK;
278 }
279
30 struct ChromiumHTTPDataSource : public HTTPBase {
31 ChromiumHTTPDataSource(uint32_t flags = 0);
32
33 virtual status_t connect(
34 const char *uri,
35 const KeyedVector<String8, String8> *headers = NULL,
36 off64_t offset = 0);
37
38 virtual void disconnect();
39
40 virtual status_t initCheck() const;
41
42 virtual ssize_t readAt(off64_t offset, void *data, size_t size);
43 virtual status_t getSize(off64_t *size);
44 virtual uint32_t flags();