aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/captions.js
diff options
context:
space:
mode:
authorAlbin Larsson <mail@albinlarsson.com>2018-05-28 17:54:25 +0200
committerAlbin Larsson <mail@albinlarsson.com>2018-05-28 17:54:25 +0200
commit64399e0717cf39f547594dad06097bb429cb9010 (patch)
tree96d663bf3e21368e28d2d2233c4655662607c005 /src/js/captions.js
parentf58e23b325a3b1d6ac30771d2167f22ea95fe54f (diff)
downloadplyr-64399e0717cf39f547594dad06097bb429cb9010.tar.lz
plyr-64399e0717cf39f547594dad06097bb429cb9010.tar.xz
plyr-64399e0717cf39f547594dad06097bb429cb9010.zip
Defer initial captions update to next tick, to avoid event being triggered to early
Diffstat (limited to 'src/js/captions.js')
-rw-r--r--src/js/captions.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/js/captions.js b/src/js/captions.js
index 52fdd8b3..30c4bc74 100644
--- a/src/js/captions.js
+++ b/src/js/captions.js
@@ -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() {