From d7a70247b2c381f1ba1d129618e45771f0e58061 Mon Sep 17 00:00:00 2001 From: theodab Date: Fri, 20 May 2022 01:51:58 -0700 Subject: [PATCH] fix: Don't send drmsessionupdate after unload (#4248) There is an async call, waiting for sessions to update, right before the StreamingEngine fires off an drmsessionupdate event. This could potentially cause an error, as the StreamingEngine's player interface could potentially be set to null during destruction. This adds a check to see if the StreamingEngine has been destroyed, to catch that case. Based on a test failure of #4241 --- lib/media/drm_engine.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/media/drm_engine.js b/lib/media/drm_engine.js index 0603dd3416..b3d6c343f4 100644 --- a/lib/media/drm_engine.js +++ b/lib/media/drm_engine.js @@ -1424,6 +1424,9 @@ shaka.media.DrmEngine = class { } return; } + if (this.destroyer_.destroyed()) { + return; + } const updateEvent = new shaka.util.FakeEvent('drmsessionupdate'); this.playerInterface_.onEvent(updateEvent);