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 Apr 19, 2024
1 parent 1dbfafc commit 32d7054
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/media/media_source_engine.js
Expand Up @@ -1879,7 +1879,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 32d7054

Please sign in to comment.