Problems with youtube-iframe-api headers

The best part of yesterday was 12/12/2017 trying to understand why my subtitles did not work when I used the YouTube iframe embed code (generated using the Share> Embed button).

After much experimentation, I narrowed down the problem to what has already been identified. Closed captions did not work because subtitles were automatically generated. When I manually created closed captions, everything seemed to work fine. I didn’t even have to use the cc_load_policy = 1 parameter.

BUT ... Today, 6/13/2017, I had the opportunity to work with the same video files, and suddenly I got a different behavior. When I play a video from a regular YouTube page, I see subtitles. When I play video from the built-in iframe players, I do not. Tried all kinds of stupid things to make things work based on reading.

  • recreated an English closed signature (manually created a commercial at the beginning).
  • set cc_load_policy = 1 parameter
  • set yt: cc = on as tag
  • some other stupid things not worth mentioning.

Captioning

Note: in both cases the domain was: http://www.youtube.com I could only include 2 links in the message.

/watch? V = EExO_6PVIXk

NO CAPTIONING:

/ insert code / EExO _6PVIXk / insert code / EExO _6PVIXk? Cc_load_policy = 1

. .

+4
2

, - API iFrame YouTube (6/14/17), CC .

( ):

1) (6/15/17) CC CC, ( "yt-html5-player- :: subtitlesModuleData:: ".

2) "cc_load_policy = 1" URL- ( iFrame), .

3) , iframe :

    <iframe
      id="futusign_youtube"
      style="visibility: hidden;"
      frameborder="0"
      src="https://www.youtube.com/embed/XIMLoLxmTDw?enablejsapi=1"
    ></iframe>

CC playerVars:

    var player = new window.YT.Player('futusign_youtube', {
      playerVars: {
        'controls': 0,
        'enablejsapi': 1,
        'showinfo': 0,
        'rel': 0,
        'cc_load_policy': 1,
      },
      events: {
        'onReady': onPlayerReady,
        'onStateChange': onPlayerStateChange,
        'onError': onPlayerError,
      }
    });

4) - cc_load_policy = 1 URL- src iFrame.

    <iframe
      id="futusign_youtube"
      style="visibility: hidden;"
      frameborder="0"
      src="https://www.youtube.com/embed/XIMLoLxmTDw?enablejsapi=1&cc_load_policy=1"
    ></iframe>
0

, :

Youtube

... cc_lang_pref=en ( ) .

0

Source: https://habr.com/ru/post/1679177/


All Articles