diff --git a/src/components/htmlMediaHelper.js b/src/components/htmlMediaHelper.js
index da53d6a063..82d6d790bc 100644
--- a/src/components/htmlMediaHelper.js
+++ b/src/components/htmlMediaHelper.js
@@ -185,6 +185,12 @@ import { Events } from 'jellyfin-apiclient';
return Promise.resolve();
}
+ export function resetSrc(elem) {
+ elem.src = '';
+ elem.innerHTML = '';
+ elem.removeAttribute('src');
+ }
+
function onSuccessfulPlay(elem, onErrorFn) {
elem.addEventListener('error', onErrorFn);
}
@@ -344,9 +350,7 @@ import { Events } from 'jellyfin-apiclient';
export function onEndedInternal(instance, elem, onErrorFn) {
elem.removeEventListener('error', onErrorFn);
- elem.src = '';
- elem.innerHTML = '';
- elem.removeAttribute('src');
+ resetSrc(elem);
destroyHlsPlayer(instance);
destroyFlvPlayer(instance);
diff --git a/src/plugins/htmlAudioPlayer/plugin.js b/src/plugins/htmlAudioPlayer/plugin.js
index b5fe063b07..baa396dbb8 100644
--- a/src/plugins/htmlAudioPlayer/plugin.js
+++ b/src/plugins/htmlAudioPlayer/plugin.js
@@ -221,6 +221,7 @@ class HtmlAudioPlayer {
self.destroy = function () {
unBindEvents(self._mediaElement);
+ htmlMediaHelper.resetSrc(self._mediaElement);
};
function createMediaElement() {
diff --git a/src/plugins/htmlVideoPlayer/plugin.js b/src/plugins/htmlVideoPlayer/plugin.js
index f3f9340189..e4692e5971 100644
--- a/src/plugins/htmlVideoPlayer/plugin.js
+++ b/src/plugins/htmlVideoPlayer/plugin.js
@@ -13,6 +13,7 @@ import {
getCrossOriginValue,
enableHlsJsPlayer,
applySrc,
+ resetSrc,
playWithPromise,
onEndedInternal,
saveVolume,
@@ -710,6 +711,8 @@ function tryRemoveElement(elem) {
videoElement.removeEventListener('waiting', this.onWaiting);
videoElement.removeEventListener('error', this.onError); // bound in htmlMediaHelper
+ resetSrc(videoElement);
+
videoElement.parentNode.removeChild(videoElement);
}