Skip to content

Commit

Permalink
fix: seek doesn't work before video finished loading (#94)
Browse files Browse the repository at this point in the history
Solve FEC-9316.
unlisten of loaded_data wasn't always earlier enough, fix with check for seeked so don't seek after loaded_data
  • Loading branch information
Yuvalke committed Nov 7, 2019
1 parent 7f3a181 commit c25663e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/dash-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
}
this._init();
const _seekAfterDetach = () => {
if (isNaN(this._lastTimeDetach)) return;
if (parseInt(this._lastTimeDetach) === parseInt(this.duration)) {
this.currentTime = 0;
} else {
Expand All @@ -462,9 +463,8 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
};
if (!isNaN(this._lastTimeDetach)) {
this._eventManager.listenOnce(this._videoElement, EventType.LOADED_DATA, _seekAfterDetach);
this._eventManager.listenOnce(this._videoElement, EventType.SEEKED, () =>
this._eventManager.unlisten(this._videoElement, EventType.LOADED_DATA, _seekAfterDetach)
);
//change to NaN to avoid the seek after detach whenever seeked fired before - SmartTV issue
this._eventManager.listenOnce(this._videoElement, EventType.SEEKED, () => (this._lastTimeDetach = NaN));
}
}
}
Expand Down

0 comments on commit c25663e

Please sign in to comment.