Youtube autoplay with subtitles

Hi,

I want to have the automatic subtitles in videos. But they are only shown when using the controls and manually clicking on the subtitle-button in youtube player. I use this script:

<script async src="https://www.youtube.com/iframe_api"></script>
<script>
function onYouTubeIframeAPIReady() {
  var player;
  player = new YT.Player('muteYouTubeVideoPlayer', {
    videoId: 'ImgUeGLvvw8',        // YouTube Video ID
    width: 530,               // Player width (in px)
    height: 308,              // Player height (in px)
    playerVars: {
      autoplay: 1,        // Auto-play the video on load
      controls: 1,        // Show pause/play buttons in player
      showinfo: 0,        // Hide the video title
      modestbranding: 1,  // Hide the Youtube Logo
      loop: 1,            // Run the video in a loop
      rel: 0,
      fs: 0,              // Hide the full screen button
      cc_load_policy: 1, // Hide closed captions
      iv_load_policy: 1,  // Hide the Video Annotations
      autohide: 0         // Hide video controls when playing
    },
    events: {
      onReady: function(e) {
        e.target.setVolume(0);
      }
    }
  });
 }

 // Written by @labnol 
</script>

Any idea how to get this to work?

Or is there any workaround by using jQuery to simulate a click on the subtitle button?

Thanks!

with your cc and iv load policy I’d expect it to show captions, assuming those are available on this video of course.

If the video itself has yt:cc=1 then that’s forced regardless of your setting, but obviously most videos do not have that.

I wonder if it would work if you would add
cc_lang_pref: en

to the playerVars

Thanks. With cc_lang_pref:en the video cannot load at all.

Interesting, I shall have a look at it tomorrow with the same video you’re testing with.

OK, thank you, will wait for your response.

Hi,

is there another possibilty to simulate a click?
When clicking on the subtitles button the subtitles are show, but this button has to be pushed every time again the video starts. As youtube is played in an iframe it does not work with jQuery.

So how could I achieve this behavior?

When using Internet Explorer and being logged in to Google/Youtube I can set in Youtube settings to always show subtitles, but this does not apply to Xibo player. In the player I am not “logged in” into Google/Youtube.

Any other idea? Thanks!