Defer initial captions update to next tick, to avoid event being triggered to early

This commit is contained in:
Albin Larsson 2018-05-28 17:54:25 +02:00
parent f58e23b325
commit 64399e0717

View File

@ -77,8 +77,8 @@ const captions = {
utils.on(this.media.textTracks, 'addtrack removetrack', captions.update.bind(this));
}
// Update available languages in list
captions.update.call(this);
// Update available languages in list next tick (the event must not be triggered before the listeners)
setTimeout(captions.update.bind(this), 0);
},
update() {