Skip to content

Commit

Permalink
fix(FEC-10662): incorrect flow in destroy process (#512)
Browse files Browse the repository at this point in the history
return promise which will be resolved or rejected at the end of reset.
  • Loading branch information
Yuvalke authored Dec 8, 2020
1 parent a287fa4 commit 5ffe16c
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions src/engines/html5/media-source/adapters/native-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,22 +521,28 @@ export default class NativeAdapter extends BaseMediaSourceAdapter {
*/
destroy(): Promise<*> {
NativeAdapter._logger.debug('destroy');
return super.destroy().then(() => {
this._drmHandler && this._drmHandler.destroy();
this._waitingEventTriggered = false;
this._progressiveSources = [];
this._loadPromise = null;
this._loadPromiseReject = null;
this._liveEdge = 0;
this._lastTimeUpdate = 0;
this._lastTimeDetach = NaN;
this._startTimeAttach = NaN;
this._videoDimensions = null;
this._clearHeartbeatTimeout();
if (this._liveDurationChangeInterval) {
clearInterval(this._liveDurationChangeInterval);
this._liveDurationChangeInterval = null;
}
return new Promise((resolve, reject) => {
super.destroy().then(
() => {
this._drmHandler && this._drmHandler.destroy();
this._waitingEventTriggered = false;
this._progressiveSources = [];
this._loadPromise = null;
this._loadPromiseReject = null;
this._liveEdge = 0;
this._lastTimeUpdate = 0;
this._lastTimeDetach = NaN;
this._startTimeAttach = NaN;
this._videoDimensions = null;
this._clearHeartbeatTimeout();
if (this._liveDurationChangeInterval) {
clearInterval(this._liveDurationChangeInterval);
this._liveDurationChangeInterval = null;
}
resolve();
},
() => reject
);
});
}

Expand Down

0 comments on commit 5ffe16c

Please sign in to comment.