Skip to content

Commit

Permalink
fix: Fix uncaught global OBJECT_DESTROYED errors (#6460)
Browse files Browse the repository at this point in the history
Related to #6458
  • Loading branch information
joeyparrish committed May 7, 2024
1 parent ceb6a74 commit 08e736c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/media/media_source_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1817,7 +1817,12 @@ shaka.media.MediaSourceEngine = class {
this.destroyer_.ensureNotDestroyed();

this.eventManager_.listenOnce(this.video_, 'canplaythrough', () => {
this.destroyer_.ensureNotDestroyed();
// Don't use ensureNotDestroyed() from this event listener, because
// that results in an uncaught exception. Instead, just check the
// flag.
if (this.destroyer_.destroyed()) {
return;
}

this.video_.autoplay = previousAutoPlayState;
if (!previousPausedState) {
Expand Down

0 comments on commit 08e736c

Please sign in to comment.