fix: #2061
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2346>
This commit is contained in:
parent
d3b3463415
commit
b21edbb64d
|
@ -192,7 +192,14 @@ export const usePlayer = createGlobalState(() => {
|
|||
return sound.isErrored.value
|
||||
})
|
||||
|
||||
const { start: startErrorTimeout, stop: stopErrorTimeout } = useTimeoutFn(() => playNext(), 3000, { immediate: false })
|
||||
const { start: startErrorTimeout, stop: stopErrorTimeout } = useTimeoutFn(() => {
|
||||
if (looping.value !== LoopingMode.LoopTrack) {
|
||||
return playNext()
|
||||
}
|
||||
|
||||
isPlaying.value = false
|
||||
}, 3000, { immediate: false })
|
||||
|
||||
watch(currentIndex, stopErrorTimeout)
|
||||
whenever(errored, startErrorTimeout)
|
||||
|
||||
|
|
|
@ -109,6 +109,18 @@ export const useTracks = createGlobalState(() => {
|
|||
return soundPromise
|
||||
}
|
||||
|
||||
// Skip when errored
|
||||
const { start: soundUnplayable, stop: abortSoundUnplayableTimeout } = useTimeoutFn(() => {
|
||||
const { isPlaying, looping, LoopingMode } = usePlayer()
|
||||
const { playNext } = useQueue()
|
||||
|
||||
if (looping.value !== LoopingMode.LoopTrack) {
|
||||
return playNext()
|
||||
}
|
||||
|
||||
isPlaying.value = false
|
||||
}, 3000, { immediate: false })
|
||||
|
||||
// Preload next track
|
||||
const { start: startPreloadTimeout } = useTimeoutFn(async (index) => {
|
||||
const { queue } = useQueue()
|
||||
|
@ -118,7 +130,9 @@ export const useTracks = createGlobalState(() => {
|
|||
|
||||
// Create track from queue
|
||||
const createTrack = async (index: number) => {
|
||||
const { queue, currentIndex, playNext, hasNext } = useQueue()
|
||||
abortSoundUnplayableTimeout()
|
||||
|
||||
const { queue, currentIndex } = useQueue()
|
||||
if (queue.value.length <= index || index === -1) return
|
||||
console.log('LOADING TRACK', index)
|
||||
|
||||
|
@ -126,14 +140,7 @@ export const useTracks = createGlobalState(() => {
|
|||
const sound = await createSound(track)
|
||||
|
||||
if (!sound.playable) {
|
||||
setTimeout(() => {
|
||||
if (hasNext.value && index !== queue.value.length - 1) {
|
||||
return playNext(true)
|
||||
}
|
||||
|
||||
const { isPlaying } = usePlayer()
|
||||
isPlaying.value = false
|
||||
}, 3000)
|
||||
soundUnplayable()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue