Blank
Blank

Reputation: 11

How to implement an HLS stream into hbbtv

The problem is implementing an HTTP Live Streaming (also known as HLS) in HbbTV I cannot find a solution for it

I tried this for example

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

Upvotes: 0

Views: 317

Answers (1)

Anonymous Coward
Anonymous Coward

Reputation: 1273

It won't help on older devices but if you are targeting HBBTV 2.0.3 or later, devices should have support for Media Source Extensions, so you could try use a javascript-based player such as hls.js or similar.

Upvotes: 1

Related Questions