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 3 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
25 changes: 25 additions & 0 deletions src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,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._removeCueTextPatch();
}
});
this._eventManager.listen(this._engine, CustomEvents.VIDEO_TRACK_CHANGED, (event: FakeEvent) => {
this._markActiveTrack(event.payload.selectedVideoTrack);
return this.dispatchEvent(event);
Expand Down Expand Up @@ -1044,6 +1050,25 @@ 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
*/
_removeCueTextPatch(): void {
const textCue = this._activeTextCues;
if (textCue.length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_activeTextCues can be an array so need to iterate over all of it and throw out the out of bound cues and keep the ones in it

const cueEndTime = textCue[0].endTime;
const cueStartTime = textCue[0].startTime;
const currTime = this.currentTime;
if (currTime > cueEndTime || currTime < cueStartTime) {
processCues(window, [], this._textDisplayEl);
}
}

}

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