![](/img/trans.png)
[英]Video in sdcard not playing in android webview using video tag in html5
[英]Displaying MPEG stream using HTML5 video tag inside an Android WebView
我正在尝试使用以下URL在Android设备上显示来自网络http://user:password@camera-ip:port/video.cgi
的视频供稿: http://user:password@camera-ip:port/video.cgi
。
我想在网页上显示此内容,所以我试图使用HTML5来显示。 我在SO上关注了几个问题,这些问题告诉我MPEG-1和MPEG-2均不受支持。 我的主管告诉我,有一种方法(可能是黑客攻击)在<video>
标签上显示我们想要的流。 如下:
<html>
<body>
<video poster="http://user:password@camera-ip:port/video.cgi" controls autoplay></video>
</body>
</html>
它可以在Chrome,Firefox和Safari上运行良好。 我不仅不明白为什么在海报中添加链接可以实现功能解决方案(没有源标签!),而且我无法在Android WebView中运行它。
我试过的
WebView webview = (WebView)findViewById(R.id.webview);
webview.setWebChromeClient(new WebChromeClient());
webview.getSettings().setJavaScriptEnabled(true); // this was for another attempt
webview.getSettings().setAllowFileAccess(true); // this was for another attempt
(Activity.java)
android:hardwareAccelerated="true"
(Android清单)
-
在我的Android设备上显示此供稿的任何帮助将不胜感激。
我设法通过开发API级别21(Lolipop)而不是API级别15(冰淇淋三明治)来解决此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.