From ef522eeb38de4bfff0705549c5a467f6fd2c3377 Mon Sep 17 00:00:00 2001 From: katspaugh <381895+katspaugh@users.noreply.github.com> Date: Fri, 24 Jan 2025 18:27:02 +0100 Subject: [PATCH] Fix: reset media element on load (#4010) --- src/player.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/player.ts b/src/player.ts index 5c609e7b4..273ca24f9 100644 --- a/src/player.ts +++ b/src/player.ts @@ -72,6 +72,12 @@ class Player extends EventEmitter { if (url && src === url) return this.revokeSrc() const newSrc = blob instanceof Blob && (this.canPlayType(blob.type) || !url) ? URL.createObjectURL(blob) : url + + // Reset the media element, otherwise it keeps the previous source + if (src) { + this.media.src = '' + } + try { this.media.src = newSrc } catch (e) {