From 64399e0717cf39f547594dad06097bb429cb9010 Mon Sep 17 00:00:00 2001 From: Albin Larsson Date: Mon, 28 May 2018 17:54:25 +0200 Subject: [PATCH] Defer initial captions update to next tick, to avoid event being triggered to early --- src/js/captions.js | 4 ++-- 1 file 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() {