This is primarily a note to self post, but could hopefully also be useful for others. At least, I spent a little too long to figure out to embed a YouTube video with a specific language on the subtitles.
The starting point is that I had this project video that I wanted to embed on a project website:
However, then I found that you can add info about the specific language you want to use by adding this snippet after the URL:
?hl=en&cc_lang_pref=en&cc=1
This means ?hl=en
is the language of the controls, &cc_lang_pref=en
is the language of the subtitles and &cc=1
turns on the subtitles. The complete block is:
<iframe allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/qGN2zbic3JM?hl=en&cc_lang_pref=en&cc=1" width="560"></iframe>
And the embedded video looks like this:
To play the same video with Norwegian subtitles on the Norwegian web page, I use this block:
<iframe allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/qGN2zbic3JM?hl=no&cc_lang_pref=no&cc=1" width="560"></iframe>
And this looks like:
Simple when you have found the solution!