mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-07 19:19:59 +02:00
add "stopped" playback state and event handlers
This commit is contained in:
@@ -89,13 +89,13 @@ export function WebPlayer() {
|
||||
}, PLAY_PAUSE_FADE_INTERVAL);
|
||||
});
|
||||
|
||||
if (status === PlayerStatus.PAUSED) {
|
||||
if (status === PlayerStatus.PLAYING) {
|
||||
setLocalPlayerStatus(status);
|
||||
await promise;
|
||||
} else {
|
||||
await promise;
|
||||
setLocalPlayerStatus(status);
|
||||
playerRef.current?.setVolume(startVolume);
|
||||
} else if (status === PlayerStatus.PLAYING) {
|
||||
setLocalPlayerStatus(status);
|
||||
await promise;
|
||||
}
|
||||
},
|
||||
[],
|
||||
@@ -241,7 +241,7 @@ export function WebPlayer() {
|
||||
// If mediaAutoNext resulted in a paused state (e.g. end of queue,
|
||||
// or pauseOnNextSongEnd flag), stop all audio instead of restoring volume.
|
||||
const currentStatus = usePlayerStoreBase.getState().player.status;
|
||||
if (currentStatus === PlayerStatus.PAUSED) {
|
||||
if (currentStatus !== PlayerStatus.PLAYING) {
|
||||
playerRef.current?.pause();
|
||||
} else {
|
||||
playerRef.current?.setVolume(volume);
|
||||
@@ -260,7 +260,7 @@ export function WebPlayer() {
|
||||
playerRef.current?.player2()?.ref?.getInternalPlayer().pause();
|
||||
|
||||
const currentStatus = usePlayerStoreBase.getState().player.status;
|
||||
if (currentStatus === PlayerStatus.PAUSED) {
|
||||
if (currentStatus !== PlayerStatus.PLAYING) {
|
||||
playerRef.current?.pause();
|
||||
} else {
|
||||
playerRef.current?.setVolume(volume);
|
||||
@@ -313,9 +313,9 @@ export function WebPlayer() {
|
||||
|
||||
const status = properties.status;
|
||||
|
||||
// Reset crossfade transition if paused during a crossfade transition
|
||||
// Reset crossfade transition if paused/stopped during a crossfade transition
|
||||
if (
|
||||
status === PlayerStatus.PAUSED &&
|
||||
status !== PlayerStatus.PLAYING &&
|
||||
isTransitioning &&
|
||||
transitionType === PlayerStyle.CROSSFADE
|
||||
) {
|
||||
@@ -331,18 +331,18 @@ export function WebPlayer() {
|
||||
}
|
||||
|
||||
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(volume);
|
||||
setLocalPlayerStatus(PlayerStatus.PAUSED);
|
||||
} else if (status === PlayerStatus.PLAYING) {
|
||||
if (status === PlayerStatus.PLAYING) {
|
||||
playerRef.current?.setVolume(volume);
|
||||
setLocalPlayerStatus(PlayerStatus.PLAYING);
|
||||
} else {
|
||||
playerRef.current?.setVolume(volume);
|
||||
setLocalPlayerStatus(status);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user