mirror of
https://github.com/videojs/video.js.git
synced 2025-01-19 10:54:16 +02:00
fix: default subtitles not enabled (#5608)
This is a follow-up to this fix in VHS, after which default in-manifest subtitles were still not being correctly enabled. The reason is because Video.js's text track preselection logic was running before the media groups were set up in VHS. Text track preselection should happen on `loadedmetadata` instead of `loadstart`. According to the HTML spec, text track data is available on `loadedmetadata`, so we should be waiting until then to make preselection decisions.
This commit is contained in:
parent
6c1056b665
commit
8329e64e6f
@ -102,7 +102,7 @@ class TextTrackDisplay extends Component {
|
||||
|
||||
player.on('loadstart', Fn.bind(this, this.toggleDisplay));
|
||||
player.on('texttrackchange', updateDisplayHandler);
|
||||
player.on('loadstart', Fn.bind(this, this.preselectTrack));
|
||||
player.on('loadedmetadata', Fn.bind(this, this.preselectTrack));
|
||||
|
||||
// This used to be called during player init, but was causing an error
|
||||
// if a track should show by default and the display hadn't loaded yet.
|
||||
|
@ -218,7 +218,7 @@ if (!Html5.supportsNativeTextTracks()) {
|
||||
|
||||
// Force es as "user-selected" track
|
||||
player.cache_.selectedLanguage = { enabled: true, language: 'es', kind: 'captions' };
|
||||
player.trigger('loadstart');
|
||||
player.trigger('loadedmetadata');
|
||||
|
||||
assert.equal(spanishTrack.mode, 'showing', 'Spanish captions should be showing');
|
||||
assert.equal(englishTrack.mode, 'disabled', 'English captions should be disabled');
|
||||
|
Loading…
x
Reference in New Issue
Block a user