Skip to content

Commit

Permalink
fix: TextTrackButton on Safari and iOS (#4350)
Browse files Browse the repository at this point in the history
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_`.
  • Loading branch information
gkatsev authored May 12, 2017
1 parent b5c60f3 commit 3dcfa95
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/js/control-bar/text-track-controls/text-track-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ class TextTrackButton extends TrackButton {
options.tracks = player.textTracks();

super(player, options);

if (!Array.isArray(this.kinds_)) {
this.kinds_ = [this.kind_];
}
}

/**
Expand Down Expand Up @@ -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];

Expand Down

0 comments on commit 3dcfa95

Please sign in to comment.