mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-24 03:16:43 +02:00
add "stopped" playback state and event handlers
This commit is contained in:
@@ -1235,12 +1235,26 @@ export const usePlayerStoreBase = createWithEqualityFn<PlayerState>()(
|
||||
mediaStop: (options?: { reset?: boolean }) => {
|
||||
const reset = options?.reset !== false;
|
||||
set((state) => {
|
||||
state.player.status = PlayerStatus.PAUSED;
|
||||
state.player.status = PlayerStatus.STOPPED;
|
||||
setTimestampStore(0);
|
||||
if (reset) {
|
||||
state.player.seekToTimestamp = uniqueSeekToTimestamp(0);
|
||||
}
|
||||
});
|
||||
|
||||
const currentState = get();
|
||||
const queue = currentState.getQueue();
|
||||
const currentIndex = currentState.player.index;
|
||||
const currentSong = queue.items[currentIndex];
|
||||
|
||||
eventEmitter.emit('PLAYER_STOP', {
|
||||
id: currentSong?._uniqueId,
|
||||
index:
|
||||
currentIndex !== undefined && currentIndex >= 0
|
||||
? currentIndex
|
||||
: undefined,
|
||||
reset,
|
||||
});
|
||||
},
|
||||
mediaToggleMute: () => {
|
||||
set((state) => {
|
||||
|
||||
Reference in New Issue
Block a user