Embed Youtube with Captions on by default not work

2019-05-18 05:52发布

问题:

I'm trying to embed a Youtube movie, and would like Captions to be on by default.

From https://developers.google.com/youtube/player_parameters#cc_load_policy I understand I should use cc_load_policy=1.

I use the code html code below but it doesn't seem to work. That is, it loads with the captions off (you can manually turn captions on, so the video does have captions). What am I doing wrong?

I've tried the following two options:

<iframe src="https://www.youtube-nocookie.com/embed/xxxxxx?rel=0&amp;&showinfo=0&cc_load_policy=1" frameborder="0" allowfullscreen></iframe>
<iframe src="https://www.youtube-nocookie.com/embed/xxxxxx?rel=0&amp;&showinfo=0" cc_load_policy="1" frameborder="0" allowfullscreen></iframe>

回答1:

Try adding cc_lang_pref , you wouldn't find in the official docs. but it's required

cc_load_policy=1&cc_lang_pref=en

You can change pref. language as per the locale representation of the language you have put in the video caption