簡體   English   中英

在Android WebView中使用HTML5視頻標簽顯示MPEG流

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM