Browse Source

fix: SoundCloud player wasn't destroyed properly

Kristian Vos 1 năm trước cách đây
mục cha
commit
23250d2bf6

+ 2 - 1
frontend/src/composables/useSoundcloudPlayer.ts

@@ -243,13 +243,14 @@ export const useSoundcloudPlayer = () => {
 
 
 	const changeIframeUrl = url => {
 	const changeIframeUrl = url => {
 		iframeUrl.value = url;
 		iframeUrl.value = url;
-		if (window.soundcloudIframeLockUuid !== uuid) {
+		if (url && window.soundcloudIframeLockUuid !== uuid) {
 			// Don't change the iframe src if the player hasn't initialized and isn't allowed to initialize yet
 			// Don't change the iframe src if the player hasn't initialized and isn't allowed to initialize yet
 			if (url) window.soundcloudIframeLockUuids.add(uuid);
 			if (url) window.soundcloudIframeLockUuids.add(uuid);
 			if (!window.soundcloudIframeLockUuid)
 			if (!window.soundcloudIframeLockUuid)
 				document.dispatchEvent(new Event("soundcloudUnlock"));
 				document.dispatchEvent(new Event("soundcloudUnlock"));
 			return;
 			return;
 		}
 		}
+		if (!url) widgetId.value = null;
 		soundcloudIframeElement.value.setAttribute("src", url);
 		soundcloudIframeElement.value.setAttribute("src", url);
 	};
 	};