首页  >  问答  >  正文

如何在 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 天前347

全部回复(1)我来回复

  • P粉594941301

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

    这对旧设备没有帮助,但如果您的目标是 HBBTV 2.0.3 或更高版本,设备应支持 媒体源扩展,因此您可以尝试使用基于 javascript 的播放器,例如 hls.js 或类似的。

    回复
    0
  • 取消回复