YouTube视频web视图中不显示 [英] youtube video not showing in webView
问题描述
我是新来的机器人。谁能告诉怎么玩YouTube视频。我的要求是视频应该在'的WebView最初和窃听的是,视频应该获得出场显示。
web视图=(的WebView)findViewById(R.id.webView1);
WebSettings websets = webView.getSettings();
websets.setJavaScriptEnabled(真);
registerForContextMenu(web视图);
webView.loadUrl(文件:///android_asset/youtubes.html);
也许这会有所帮助,我来到翻过这篇文章:<一href=\"http://stackoverflow.com/questions/5383364/flash-video-not-displaying-in-webview-for-android-3-0-1/5439573#5439573\">link
事实上,我基本上只需要添加到应用程序清单XML:
的android:hardwareAccelerated =真
和瞧,就连YouTube视频开始播放
仅适用于Android 3.0(API级别11)
I am new to android. Can anyone please tell how to play youtube video. My requirement is the video should display in the 'WebView' initially and on tapping that, the video should get played.
webView = (WebView)findViewById(R.id.webView1);
WebSettings websets = webView.getSettings();
websets.setJavaScriptEnabled(true);
registerForContextMenu(webView);
webView.loadUrl("file:///android_asset/youtubes.html");
Maybe this helps, I came accross this post: link
And indeed, I basically only needed to add to the application manifest xml:
android:hardwareAccelerated="true"
And voila, even the youtube video's started playing
Only available from Android 3.0 (API level 11)
这篇关于YouTube视频web视图中不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!