Skip to content

Commit

Permalink
fix(FEC-7106): captions on IE & edge (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
odedhutzler authored and OrenMe committed Oct 26, 2017
1 parent e4b11fe commit 4447c1d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,12 @@ export default class Player extends FakeEventTarget {
return this.dispatchEvent(event);
});
});
this._eventManager.listen(this._engine, Html5Events.SEEKED, () => {
const browser = this._env.browser.name;
if (browser === 'Edge' || browser === 'IE') {
this._removeTextCuePatch();
}
});
this._eventManager.listen(this._engine, CustomEvents.VIDEO_TRACK_CHANGED, (event: FakeEvent) => {
this._markActiveTrack(event.payload.selectedVideoTrack);
return this.dispatchEvent(event);
Expand Down Expand Up @@ -1096,6 +1102,24 @@ export default class Player extends FakeEventTarget {
}
}

/**
* Handles the cue text removal issue, when seeking to a time without captions in IE \ edge the previous captions
* are not removed
* @returns {void}
* @private
*/
_removeTextCuePatch(): void {
let filteredActiveTextCues = this._activeTextCues.filter((textCue) => {
const cueEndTime = textCue._endTime;
const cueStartTime = textCue._startTime;
const currTime = this.currentTime;
if (currTime < cueEndTime && currTime > cueStartTime) {
return textCue;
}
});
this._updateTextDisplay(filteredActiveTextCues);
}

/**
* Handles the playback options, from current state or config.
* @returns {void}
Expand Down

0 comments on commit 4447c1d

Please sign in to comment.