From cf6a86553cf3d5949f3fde93ac49755ec28714c3 Mon Sep 17 00:00:00 2001 From: Tsachi Shlidor Date: Mon, 11 Dec 2023 17:42:58 +0200 Subject: [PATCH] fix: kind !== 'options' --- src/video-player.js | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/video-player.js b/src/video-player.js index 9f7f6ae9..701c4493 100644 --- a/src/video-player.js +++ b/src/video-player.js @@ -74,7 +74,9 @@ class VideoPlayer extends Utils.mixin(Eventable) { this.videoElement.classList.add('video-js'); // Handle WebFont loading - Utils.fontFace(this.videoElement, this.playerOptions); + if (this.playerOptions.cloudinary.fontFace) { + Utils.fontFace(this.videoElement, this.playerOptions.cloudinary.fontFace); + } // Handle play button options Utils.playButton(this.videoElement, this._videojsOptions); @@ -228,19 +230,25 @@ class VideoPlayer extends Utils.mixin(Eventable) { const kinds = Object.keys(conf); const allTracks = []; for (const kind of kinds) { - const tracks = Array.isArray(conf[kind]) ? conf[kind] : [conf[kind]]; - for (const track of tracks) { - allTracks.push({ - ...track, - kind: kind, - label: track.label, - srclang: track.language, - default: !!(track.default), - src: track.url - }); + if (kind !== 'options') { + const tracks = Array.isArray(conf[kind]) ? conf[kind] : [conf[kind]]; + for (const track of tracks) { + allTracks.push({ + ...track, + kind: kind, + label: track.label, + srclang: track.language, + default: !!(track.default), + src: track.url + }); + } } } - Utils.filterAndAddTextTracks(allTracks, this.videojs); + Utils.addTextTracks(allTracks, this.videojs); + + if (conf.options && this.videojs.styledTextTracks) { + this.videojs.styledTextTracks(conf.options); + } } }