potential fix for mpv clear (#1360)

This commit is contained in:
Jeff
2025-12-10 01:49:45 -08:00
committed by GitHub
parent 32062d7c0f
commit eeb0a786fd
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -114,7 +114,7 @@ const createMpv = async (data: {
mpv.on('status', (status) => { mpv.on('status', (status) => {
if (status.property === 'playlist-pos') { if (status.property === 'playlist-pos') {
if (status.value === -1) { if (status.value === -1) {
mpv?.stop(); mpv?.pause();
} }
if (status.value !== 0) { if (status.value !== 0) {
@@ -156,10 +156,12 @@ export const MpvPlayerEngine = (props: MpvPlayerEngineProps) => {
mpvPlayer.setQueue(currentSrc, nextSrc, playerStatus !== PlayerStatus.PLAYING); mpvPlayer.setQueue(currentSrc, nextSrc, playerStatus !== PlayerStatus.PLAYING);
setPreviousCurrentSrc(currentSrc); setPreviousCurrentSrc(currentSrc);
} else { } else {
// Clear queue if no current song // Only clear queue if we had a previous currentSrc (intentional clear)
if (previousCurrentSrc !== undefined) {
mpvPlayer.setQueue(undefined, undefined, true); mpvPlayer.setQueue(undefined, undefined, true);
setPreviousCurrentSrc(undefined); setPreviousCurrentSrc(undefined);
} }
}
} else { } else {
// If currentSrc hasn't changed but nextSrc has, update position 1 // If currentSrc hasn't changed but nextSrc has, update position 1
// This happens when the next song changes but current song stays the same // This happens when the next song changes but current song stays the same