Skip to content

Commit

Permalink
fix: Fix uncaught global OBJECT_DESTROYED errors
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyparrish committed Apr 19, 2024
1 parent 1dbfafc commit 6fcd14a
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 @@ -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 6fcd14a

Please sign in to comment.