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) => {
if (status.property === 'playlist-pos') {
if (status.value === -1) {
mpv?.stop();
mpv?.pause();
}
if (status.value !== 0) {
@@ -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