Embed YouTube Live Stream in a Layout

CMS Version: Version 4.0.6 Self hosted Docker Install
Player Version: windows 4 R402.1-402

Hello,

I’m trying to create a layout that features a YouTube live stream.

The preview of the layout works as intended (in the CMS).

Once the layout is published and assigned to players, I receive a YouTube error on my displays.

Embedded Module

HTML

<!-- BROWSER=edge-->
<div id="player"></div>

Head

<script>    

  var tag = document.createElement('script');
  tag.src = "https://www.youtube.com/iframe_api";
  var firstScriptTag = document.getElementsByTagName('script')[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
  var player;
  function onYouTubePlayerAPIReady() {
    player = new YT.Player('player', {
      videoId: 'jfKfPfyJRdk',
      height: '1080',
      width: '1920',
      events: {
        'onReady': onPlayerReady,
      }
    });
  }
  function onPlayerReady(event) {
    event.target.playVideo();
  }
</script>

Is there a better way (or one that will work) to have a layout feature a YouTube live stream?

You can only use this in windows until the R203 version that uses Edge as embeded browser.

Newest versions of the Windows player uses CefSharp browser that don’t allow youtube videos.

2 Likes

take a look in what i did as workaround reading this topic:

2 Likes