首頁  >  問答  >  主體

如何在 hbbtv 中實現 HLS 流

問題是在 HbbTV 中實作 HTTP Live Streaming(也稱為 HLS) 我找不到解決方案

例如我嘗試過這個

<!DOCTYPE html>
<html>
<head>
  <title>HbbTV Stream</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <script type="text/javascript">
    function initApp() {
      var videoElement = document.createElement("video");
      videoElement.setAttribute("type", "application/vnd.apple.mpegurl");
      videoElement.setAttribute("src", "http.//example.com/test.m3u8");
      videoElement.setAttribute("data-fullscreen", "true");
      videoElement.setAttribute("data-pauseonexit", "true");
      videoElement.setAttribute("autoplay", "");
      videoElement.addEventListener("error", function(e) {
        console.log("Video error:", e);
      });
      document.body.appendChild(videoElement);
    }
  </script>
</head>
<body onload="initApp()">
</body>
</html>

P粉278379495P粉278379495245 天前352

全部回覆(1)我來回復

  • P粉594941301

    P粉5949413012024-02-18 12:10:31

    這對舊設備沒有幫助,但如果您的目標是HBBTV 2.0.3 或更高版本,設備應支援媒體來源擴充,因此您可以嘗試使用基於javascript 的播放器,例如hls.js 或類似的。

    回覆
    0
  • 取消回覆