am 2881d6f3: am 9f88a60d: am 481f15c1: set youtube player lang based on user pref and enable captions when not English
* commit '2881d6f31b9daf9a3d701671eae3297040d84799': set youtube player lang based on user pref and enable captions when not English
This commit is contained in:
commit
96ac360b39
|
@ -595,6 +595,8 @@ function onYouTubeIframeAPIReady() {
|
||||||
function startYouTubePlayer(videoId) {
|
function startYouTubePlayer(videoId) {
|
||||||
var idAndHash = videoId.split("#");
|
var idAndHash = videoId.split("#");
|
||||||
var startTime = 0;
|
var startTime = 0;
|
||||||
|
var lang = getLangPref();
|
||||||
|
var captionsOn = lang == 'en' ? 0 : 1;
|
||||||
if (idAndHash.length > 1) {
|
if (idAndHash.length > 1) {
|
||||||
startTime = idAndHash[1].split("t=")[1] != undefined ? idAndHash[1].split("t=")[1] : 0;
|
startTime = idAndHash[1].split("t=")[1] != undefined ? idAndHash[1].split("t=")[1] : 0;
|
||||||
}
|
}
|
||||||
|
@ -603,7 +605,7 @@ function startYouTubePlayer(videoId) {
|
||||||
height: '529',
|
height: '529',
|
||||||
width: '940',
|
width: '940',
|
||||||
videoId: idAndHash[0],
|
videoId: idAndHash[0],
|
||||||
playerVars: {start: startTime},
|
playerVars: {start: startTime, hl: lang, cc_load_policy: captionsOn},
|
||||||
events: {
|
events: {
|
||||||
'onReady': onPlayerReady,
|
'onReady': onPlayerReady,
|
||||||
'onStateChange': onPlayerStateChange
|
'onStateChange': onPlayerStateChange
|
||||||
|
|
Loading…
Reference in New Issue