Heim  >  Fragen und Antworten  >  Hauptteil

So implementieren Sie HLS-Streaming in hbbtv

Das Problem besteht in der Implementierung von HTTP Live Streaming (auch bekannt als HLS) in HbbTV Ich kann die Lösung nicht finden

Zum Beispiel habe ich das ausprobiert

<!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 Tage vor349

Antworte allen(1)Ich werde antworten

  • P粉594941301

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

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

    Antwort
    0
  • StornierenAntwort