Fix radios starting from second track

This commit is contained in:
wvffle 2022-07-25 01:00:50 +00:00 committed by Georg Krause
parent bf67676010
commit 801c04c07e
2 changed files with 7 additions and 1 deletions

View File

@ -46,7 +46,12 @@ const createSound = (howl: Howl): Sound => ({
seek: (time?: number) => howl.seek(time),
duration: () => howl.duration(),
getSource: () => (howl as any)._sounds[0],
triggerSoundProgress: useThrottleFn((time: number, duration: number) => soundProgress.trigger({ node: (howl as any)._sounds[0]._node, time, duration }), 1000)
triggerSoundProgress: useThrottleFn((time: number, duration: number) => {
const node = (howl as any)._sounds[0]?._node
if (node) {
soundProgress.trigger({ node, time, duration })
}
}, 1000)
})
const loadSound = (track: Track): Sound => {

View File

@ -87,6 +87,7 @@ const store: Module<State, RootState> = {
const shouldPlay = state.tracks.length === 0
if (shouldPlay) {
index = 0
state.currentIndex = 0
}
if (index >= state.tracks.length) {