potential fix for mpv clear

This commit is contained in:
jeffvli
2025-12-10 01:26:32 -08:00
parent 32062d7c0f
commit 3ad6a4ac8f
2 changed files with 6 additions and 4 deletions

View File

@@ -114,7 +114,7 @@ const createMpv = async (data: {
mpv.on('status', (status) => {
if (status.property === 'playlist-pos') {
if (status.value === -1) {
mpv?.stop();
mpv?.pause();
}
if (status.value !== 0) {

View File

@@ -156,9 +156,11 @@ export const MpvPlayerEngine = (props: MpvPlayerEngineProps) => {
mpvPlayer.setQueue(currentSrc, nextSrc, playerStatus !== PlayerStatus.PLAYING);
setPreviousCurrentSrc(currentSrc);
} else {
// Clear queue if no current song
mpvPlayer.setQueue(undefined, undefined, true);
setPreviousCurrentSrc(undefined);
// Only clear queue if we had a previous currentSrc (intentional clear)
if (previousCurrentSrc !== undefined) {
mpvPlayer.setQueue(undefined, undefined, true);
setPreviousCurrentSrc(undefined);
}
}
} else {
// If currentSrc hasn't changed but nextSrc has, update position 1