Skip to content

Commit

Permalink
Fix exception when destroying MediaSourceEngine twice
Browse files Browse the repository at this point in the history
A new WIP test accidentally destroyed MediaSourceEngine twice, which
should not result in an exception.  This fixes the exception.

Change-Id: I199e3072a3e7994083844c2013ac9c8f76406a63
  • Loading branch information
joeyparrish committed Nov 8, 2018
1 parent 36908b1 commit 46ce5bd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/media/media_source_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,11 @@ shaka.media.MediaSourceEngine.prototype.destroy = function() {
this.video_.load();
}

if (this.eventManager_) {
cleanup.push(this.eventManager_.destroy());
}

return Promise.all(cleanup).then(function() {
this.eventManager_.destroy();
this.eventManager_ = null;
this.video_ = null;
this.mediaSource_ = null;
Expand Down

0 comments on commit 46ce5bd

Please sign in to comment.