From fa3b78583fe1d9325cfa43dcee63968f911a1cc4 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Tue, 24 Aug 2021 22:19:49 -0700 Subject: avmerge: Close streams to avoid errors while changing quality MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a fetchRange network request finished after the quality was changed, there would be a "InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable" because appendSegment was trying to append to the sourceBuffer that was unusable after the video src was changed to a new mediaSource. Adds a close method to the AVMerge class to properly clean and close everything so these sorts of errors won't happen. Signed-off-by: Jesús --- youtube/templates/watch.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'youtube/templates/watch.html') diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index 2c85e16..912237a 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -119,6 +119,8 @@ var videoPaused = video.paused; var videoSpeed = video.playbackRate; var videoSource; + if (avMerge) + avMerge.close(); if (selection.type == 'uni'){ videoSource = data['uni_sources'][selection.index]; video.src = videoSource.url; -- cgit v1.2.3