1
0
mirror of https://github.com/videojs/video.js.git synced 2025-07-03 00:57:02 +02:00

@gkatsev fixed captions showing by default in Chrome and Safari. closes #1865

This commit is contained in:
Gary Katsevman
2015-02-13 16:23:55 -08:00
committed by heff
parent 4e5c28cc56
commit 52e6768526
2 changed files with 23 additions and 0 deletions

View File

@ -59,6 +59,10 @@ vjs.Html5 = vjs.MediaTechController.extend({
}
}
if (this['featuresNativeTextTracks']) {
this.on('loadstart', vjs.bind(this, this.hideCaptions));
}
// Determine if native controls should be used
// Our goal should be to get the custom controls on mobile solid everywhere
// so we can remove this all together. Right now this will block custom
@ -161,6 +165,24 @@ vjs.Html5.prototype.createEl = function(){
// jenniisawesome = true;
};
vjs.Html5.prototype.hideCaptions = function() {
var tracks = this.el_.textTracks,
track,
i = tracks.length,
kinds = {
'captions': 1,
'subtitles': 1
};
while (i--) {
track = tracks[i];
if (track && track['kind'] in kinds) {
track.mode = 'disabled';
}
}
};
// Make video events trigger player events
// May seem verbose here, but makes other APIs possible.
// Triggers removed using this.off when disposed