fix: WebAudio not being properly disposed when reinitiating playback (#2280)

This could be reproduced by switching tracks initiating new reproductions (for example, by clicking in individual tracks inside an album).

Signed-off-by: Fernando Fernández <ferferga@hotmail.com>
This commit is contained in:
Fernando Fernández 2024-03-30 21:19:46 +01:00 committed by GitHub
parent 55d5d37327
commit 9600525033
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -166,11 +166,12 @@ watch(
);
watch(mediaElementRef, async () => {
await nextTick();
detachHls();
await detachWebAudio();
if (mediaElementRef.value) {
await nextTick();
if (mediaElementType.value === 'video' && hls) {
hls.attachMedia(mediaElementRef.value);
hls.on(Events.ERROR, onHlsEror);
@ -182,7 +183,10 @@ watch(mediaElementRef, async () => {
);
mediaWebAudio.sourceNode.connect(mediaWebAudio.context.destination);
}
});
/**
* Needed so WebAudio is properly disposed
*/
}, { flush: 'sync' });
watch(
() => playbackManager.currentSourceUrl,