mirror of
https://github.com/austinried/subtracks.git
synced 2025-12-27 00:59:28 +01:00
fixed incorrect isPlaying state when shuffled
This commit is contained in:
parent
ea45678733
commit
9fda955df6
@ -246,11 +246,16 @@ export const useSetQueue = () => {
|
||||
export const useIsPlaying = () => {
|
||||
const queueContextId = useStore(selectTrackPlayer.queueContextId)
|
||||
const currentTrackIdx = useStore(selectTrackPlayer.currentTrackIdx)
|
||||
const shuffleOrder = useStore(selectTrackPlayer.shuffleOrder)
|
||||
|
||||
return (contextId: string | undefined, track: number) => {
|
||||
if (contextId === undefined) {
|
||||
return track === currentTrackIdx
|
||||
}
|
||||
if (shuffleOrder) {
|
||||
const shuffledTrack = shuffleOrder.findIndex(i => i === track)
|
||||
track = shuffledTrack !== undefined ? shuffledTrack : -1
|
||||
}
|
||||
return contextId === queueContextId && track === currentTrackIdx
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user