From 6d9406e109810433c9fc09a736a9920dfbc13185 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Fri, 19 Apr 2024 13:38:24 +0400 Subject: [PATCH] Story: Fix video clean up when unmounted (#4473) --- src/util/browser/unloadVideo.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/browser/unloadVideo.ts b/src/util/browser/unloadVideo.ts index bbd831ba8..8bea0e8cf 100644 --- a/src/util/browser/unloadVideo.ts +++ b/src/util/browser/unloadVideo.ts @@ -2,5 +2,9 @@ export default function unloadVideo(video: HTMLVideoElement) { video.pause(); // https://github.com/shaka-project/shaka-player/commit/0e3d10e61cb08cc35750e48face4e58f24542fc8 video.removeAttribute('src'); + while (video.firstChild) { + video.removeChild(video.firstChild); + } + video.load(); }