search

Home  >  Q&A  >  body text

How to implement HLS streaming in hbbtv

The problem is implementing HTTP Live Streaming (also known as HLS) in HbbTV I can't find the solution

For example I tried this

<!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粉278379495345 days ago432

reply all(1)I'll reply

  • P粉594941301

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

    This won't help with older devices, but if you're targeting HBBTV 2.0.3 or higher, the device should support Media Source Extensions, so you can try using javascript player, such as hls.js or similar.

    reply
    0
  • Cancelreply