Android HoneyComb webview video not showing
My android app has a WebView that embeds a video and audio. When the app runs on Android 2.3.x, the video streams and the audio plays.
I modified the app to run on HoneyComb (3.1) on a Samsung Tab 10.1 Tablet, the video do not stream and the audio does not play. The video streams when the URL is entered in the Tab browser.
This is the java code:
mWebView.setWebChromeClient(new WebChromeClient());
mWebView.setWebViewClient(new WebViewClient());
mWebView.getSettings().setAllowFileAccess(true)
mFileName = fileName_items[item_position];
mFullPath = "file:///android_asset/"开发者_StackOverflow中文版+mFileName+".html";
mWebView.loadUrl(mFullPath);
In the HTML I tried both the embed tag and the video tag. The embed tag does not show anything whereas the video tag shows the controls and I can toggle the play/pause, but not video is displayed.
<video controls="controls" style="align:center;" height="300" width="300">
<source src="http://www.at.com/videos/an1.mp4" type="video/mp4">
</video>
<embed type="video/mp4" src="http://www.at.com/videos/an1.mp4" width="340" height="140" />
I found the same thing. But, here is some more info:
- when I set hardwareAccelerated to true, videos show, but in landscape mode show only part of the video
- youtube plays ok in portrait mode with hardware acceleration enabled
Also, I experience crashes with hardware acceleration turned on and while loading data from some urls. (It sometimes crashes, sometimes - not)
精彩评论