Skip to content

Commit

Permalink
fix: kind !== 'options'
Browse files Browse the repository at this point in the history
  • Loading branch information
tsi committed Dec 11, 2023
1 parent 2875dac commit cf6a865
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions src/video-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit cf6a865

Please sign in to comment.