1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-27 11:22:06 +02:00

fix: TextTrackButton on Safari and iOS (#4350)

On Safari and iOS, we use native text tracks, so, during text track
button creation, textTracks() is populated. However, `this.kinds_` isn't
necessarily set and ends up throwing.

Instead, we want to move the fallback for `this.kinds_` from the
constructor and right above the usage of `this.kinds_`.
This commit is contained in:
Gary Katsevman 2017-05-12 14:51:12 -04:00 committed by GitHub
parent b5c60f339b
commit 3dcfa9568a

View File

@ -26,10 +26,6 @@ class TextTrackButton extends TrackButton {
options.tracks = player.textTracks();
super(player, options);
if (!Array.isArray(this.kinds_)) {
this.kinds_ = [this.kind_];
}
}
/**
@ -61,6 +57,10 @@ class TextTrackButton extends TrackButton {
const tracks = this.player_.textTracks();
if (!Array.isArray(this.kinds_)) {
this.kinds_ = [this.kind_];
}
for (let i = 0; i < tracks.length; i++) {
const track = tracks[i];