diff options
author | Albin Larsson <mail@albinlarsson.com> | 2018-06-16 01:23:47 +0200 |
---|---|---|
committer | Albin Larsson <mail@albinlarsson.com> | 2018-06-16 01:34:55 +0200 |
commit | 8f359adf9c510a2c4c5a9fc4ecea542c2b782083 (patch) | |
tree | fedf3b06feb8a801eca502d2a9e5310d2ff62705 /src/js/captions.js | |
parent | 1f09493ba2253eb234803b5ebe74ad1649253bb9 (diff) | |
download | plyr-8f359adf9c510a2c4c5a9fc4ecea542c2b782083.tar.lz plyr-8f359adf9c510a2c4c5a9fc4ecea542c2b782083.tar.xz plyr-8f359adf9c510a2c4c5a9fc4ecea542c2b782083.zip |
Fix captions.toggle order
Diffstat (limited to 'src/js/captions.js')
-rw-r--r-- | src/js/captions.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/js/captions.js b/src/js/captions.js index d6666cf2..94500290 100644 --- a/src/js/captions.js +++ b/src/js/captions.js @@ -156,6 +156,12 @@ const captions = { // Update state and trigger event if (active !== toggled) { + // When passive, don't override user preferences + if (!passive) { + this.captions.active = active; + this.storage.set({ captions: active }); + } + // Force language if the call isn't passive and there is no matching language to toggle to if (!this.language && active && !passive) { const tracks = captions.getTracks.call(this); @@ -183,12 +189,6 @@ const captions = { // Update settings menu controls.updateSetting.call(this, 'captions'); - // When passive, don't override user preferences - if (!passive) { - this.captions.active = active; - this.storage.set({ captions: active }); - } - // Trigger event (not used internally) triggerEvent.call(this, this.media, active ? 'captionsenabled' : 'captionsdisabled'); } @@ -241,13 +241,13 @@ const captions = { triggerEvent.call(this, this.media, 'languagechange'); } + // Show captions + captions.toggle.call(this, true, passive); + if (this.isHTML5 && this.isVideo) { // If we change the active track while a cue is already displayed we need to update it captions.updateCues.call(this); } - - // Show captions - captions.toggle.call(this, true, passive); }, // Set captions by language |