add "stopped" playback state and event handlers

This commit is contained in:
jeffvli
2026-06-29 20:23:46 -07:00
parent a221a84792
commit 37ada07ee2
14 changed files with 147 additions and 40 deletions
@@ -69,12 +69,12 @@ export function MpvPlayer() {
}, PLAY_PAUSE_FADE_INTERVAL);
});
if (status === PlayerStatus.PAUSED) {
await promise;
setLocalPlayerStatus(status);
} else if (status === PlayerStatus.PLAYING) {
if (status === PlayerStatus.PLAYING) {
setLocalPlayerStatus(status);
await promise;
} else {
await promise;
setLocalPlayerStatus(status);
}
},
[],
@@ -111,18 +111,18 @@ export function MpvPlayer() {
const status = properties.status;
const volume = usePlayerStore.getState().player.volume;
if (audioFadeOnStatusChange) {
if (status === PlayerStatus.PAUSED) {
fadeAndSetStatus(volume, 0, PLAY_PAUSE_FADE_DURATION, PlayerStatus.PAUSED);
} else if (status === PlayerStatus.PLAYING) {
if (status === PlayerStatus.PLAYING) {
fadeAndSetStatus(0, volume, PLAY_PAUSE_FADE_DURATION, PlayerStatus.PLAYING);
} else {
fadeAndSetStatus(volume, 0, PLAY_PAUSE_FADE_DURATION, status);
}
} else {
if (status === PlayerStatus.PAUSED) {
playerRef.current?.setVolume(0);
setLocalPlayerStatus(PlayerStatus.PAUSED);
} else if (status === PlayerStatus.PLAYING) {
if (status === PlayerStatus.PLAYING) {
playerRef.current?.setVolume(volume);
setLocalPlayerStatus(PlayerStatus.PLAYING);
} else {
playerRef.current?.setVolume(0);
setLocalPlayerStatus(status);
}
}
},