Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

youtube embed - force subtitles in specific language with default

Tags:

youtube-api

i'm embedding youtube videos with subtitles in specific language (Hebrew, in my case). im using:

hl=He&cc_load_policy=1

to show the hebrew subtitles and that works fine.

However, if there are no subs in my language, i would like to see the English one (if there are any) as a default. is there a way to force that?

like image 562
OritK Avatar asked Oct 02 '12 06:10

OritK


People also ask

How do I set YouTube's automatic default subtitles language to English?

On the bar present at the bottom of the video screen, from the options to the right of the video's timeline, click on the Settings icon. Here, select the Subtitles/CC option. Further click on Auto-translate which would then present to you a list of languages.

How do I change the auto generate subtitle language on YouTube?

Pause the video you're playing. Tap Captions . Select the language you want Captions in. Select Caption style.


1 Answers

You can force the captions and language using cc_load_policy & cc_lang_pref options via

URL:

http://www.youtube.com/embed/M7lc1UVf-VE?cc_load_policy=1&cc_lang_pref=en

API:

var ytPlayer = new YT.Player(
    ...
    playerVars: {
        cc_load_policy: 1,
        cc_lang_pref: 'en'
    },
    ....
});

Credits: https://webapps.stackexchange.com/questions/27669/is-there-any-way-to-force-subtitles-in-a-youtube-video

like image 150
i-- Avatar answered Nov 30 '22 23:11

i--