diff options
author | Sam Potts <sam@selz.com> | 2018-02-17 09:22:19 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-17 09:22:19 +1100 |
commit | 7ac732f45b961301f56877a61d7607b3232537f0 (patch) | |
tree | 3f6b9dbc32912a990d0bf1094c5bd33623eb8f59 /src/js/captions.js | |
parent | a59dcb2f53bfbe87812611b35832e1e0ba0f8daa (diff) | |
parent | c90f1bdf08c002b55e92222583f994433239fb37 (diff) | |
download | plyr-7ac732f45b961301f56877a61d7607b3232537f0.tar.lz plyr-7ac732f45b961301f56877a61d7607b3232537f0.tar.xz plyr-7ac732f45b961301f56877a61d7607b3232537f0.zip |
Merge branch 'beta' into gulp-unminified-js-output
Diffstat (limited to 'src/js/captions.js')
-rw-r--r-- | src/js/captions.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/js/captions.js b/src/js/captions.js index 847ef7ff..6ab8c69e 100644 --- a/src/js/captions.js +++ b/src/js/captions.js @@ -39,7 +39,7 @@ const captions = { // Only Vimeo and HTML5 video supported at this point if (!this.isVideo || this.isYouTube || (this.isHTML5 && !support.textTracks)) { // Clear menu and hide - if (this.config.controls.includes('settings') && this.config.settings.includes('captions')) { + if (utils.is.array(this.config.controls) && this.config.controls.includes('settings') && this.config.settings.includes('captions')) { controls.setCaptionsMenu.call(this); } @@ -68,7 +68,7 @@ const captions = { captions.show.call(this); // Set available languages in list - if (this.config.controls.includes('settings') && this.config.settings.includes('captions')) { + if (utils.is.array(this.config.controls) && this.config.controls.includes('settings') && this.config.settings.includes('captions')) { controls.setCaptionsMenu.call(this); } }, @@ -78,7 +78,7 @@ const captions = { // Setup HTML5 track rendering if (this.isHTML5 && this.isVideo) { captions.getTracks.call(this).forEach(track => { - // Remove previous bindings + // Show track utils.on(track, 'cuechange', event => captions.setCue.call(this, event)); // Turn off native caption rendering to avoid double captions @@ -124,7 +124,8 @@ const captions = { setCue(input) { // Get the track from the event if needed const track = utils.is.event(input) ? input.target : input; - const active = track.activeCues[0]; + const { activeCues } = track; + const active = activeCues.length && activeCues[0]; const currentTrack = captions.getCurrentTrack.call(this); // Only display current track |