Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FEC-7106): captions on IE & edge #147

Merged
merged 6 commits into from
Oct 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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