From 60af9ad596e5c2cb31d1e7bb616e415cf46ca761 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);