fix: always restart album and playlist playback
This commit is contained in:
2 files changed
+8
-1
No files matched your search
@@ -859,6 +859,7 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
recorded.origin ??
|
||||
(recorded.playlistId ? `playlist:${recorded.playlistId}` : undefined)
|
||||
resetQueuePlayback()
|
||||
store.update(playbackQueue.clearQueue)
|
||||
store.update(recipe)
|
||||
const firstSongId = store.getState().queue[0]
|
||||
if (!firstSongId) return
|
||||
|
||||
@@ -388,6 +388,7 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
|
||||
const [queueOpen, setQueueOpen] = useState(false)
|
||||
const [isPlaying, setIsPlaying] = useState(false)
|
||||
const [playbackStartVersion, setPlaybackStartVersion] = useState(0)
|
||||
const [currentTime, setCurrentTime] = useState(0)
|
||||
const [measuredDuration, setMeasuredDuration] = useState<{
|
||||
songId: string
|
||||
@@ -890,7 +891,7 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
return () => {
|
||||
audio.removeEventListener("canplay", onCanPlay)
|
||||
}
|
||||
}, [isPlaying, currentSongId, attemptPlayback])
|
||||
}, [isPlaying, currentSongId, playbackStartVersion, attemptPlayback])
|
||||
|
||||
useEffect(() => {
|
||||
const audio = audioRef.current
|
||||
@@ -1069,6 +1070,7 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
recorded.origin ??
|
||||
(recorded.playlistId ? `playlist:${recorded.playlistId}` : undefined)
|
||||
const previousSongId = store.getState().queue[0]
|
||||
store.update(playbackQueue.clearQueue)
|
||||
store.update(recipe)
|
||||
const firstSongId = store.getState().queue[0]
|
||||
if (!firstSongId) {
|
||||
@@ -1078,7 +1080,11 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
if (firstSongId === previousSongId) {
|
||||
seekTo(0)
|
||||
}
|
||||
// Repeated Play/Shuffle presses must request playback even when the
|
||||
// first song and playing state have not changed.
|
||||
isPlayingRef.current = true
|
||||
setIsPlaying(true)
|
||||
setPlaybackStartVersion((version) => version + 1)
|
||||
recordPlay(
|
||||
recorded.playlistId
|
||||
? { playlistId: recorded.playlistId }
|
||||
|
||||
Reference in new issue
Block a user