From 234beefb73ea7f8a7442112eb2efb78d619a13cb Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Wed, 14 Dec 2022 14:34:04 -0800 Subject: [PATCH] fix: Fix rare exception after StreamingEngine teardown (#4830) In some cases, the timing of certain events can cause a seek callback to fire on StreamingEngine after it has been destroyed. This checks for that condition to avoid an exception. Closes #4813 --- lib/media/streaming_engine.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/media/streaming_engine.js b/lib/media/streaming_engine.js index e2b2e8df06..927b0d7400 100644 --- a/lib/media/streaming_engine.js +++ b/lib/media/streaming_engine.js @@ -622,6 +622,11 @@ shaka.media.StreamingEngine = class { * within the presentation timeline. */ seeked() { + if (!this.playerInterface_) { + // Already destroyed. + return; + } + const presentationTime = this.playerInterface_.getPresentationTime(); const ContentType = shaka.util.ManifestParserUtils.ContentType; const newTimeIsBuffered = (type) => {