fix mpv playback resume on queue end / stop

This commit is contained in:
jeffvli
2026-07-11 18:18:06 -07:00
parent c5d074be16
commit bafc14b55a
2 changed files with 12 additions and 1 deletions
+9
View File
@@ -1299,6 +1299,11 @@ export const usePlayerStoreBase = createWithEqualityFn<PlayerState>()(
});
},
mediaTogglePlayPause: () => {
// Restarting from STOPPED (e.g. end of queue) needs a full play
// event so engines like mpv can reload the current track — play()
// alone is a no-op when mpv's playlist-pos is -1.
const wasStopped = get().player.status === PlayerStatus.STOPPED;
set((state) => {
if (state.player.status === PlayerStatus.PLAYING) {
state.player.status = PlayerStatus.PAUSED;
@@ -1306,6 +1311,10 @@ export const usePlayerStoreBase = createWithEqualityFn<PlayerState>()(
state.player.status = PlayerStatus.PLAYING;
}
});
if (wasStopped) {
emitPlayerPlayEvent(undefined, set, get);
}
},
moveSelectedTo: (items: QueueSong[], uniqueId: string, edge: 'bottom' | 'top') => {
const itemUniqueIds = items.map((item) => item._uniqueId);