Fix radios starting from second track
This commit is contained in:
parent
bf67676010
commit
801c04c07e
|
@ -46,7 +46,12 @@ const createSound = (howl: Howl): Sound => ({
|
||||||
seek: (time?: number) => howl.seek(time),
|
seek: (time?: number) => howl.seek(time),
|
||||||
duration: () => howl.duration(),
|
duration: () => howl.duration(),
|
||||||
getSource: () => (howl as any)._sounds[0],
|
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 => {
|
const loadSound = (track: Track): Sound => {
|
||||||
|
|
|
@ -87,6 +87,7 @@ const store: Module<State, RootState> = {
|
||||||
const shouldPlay = state.tracks.length === 0
|
const shouldPlay = state.tracks.length === 0
|
||||||
if (shouldPlay) {
|
if (shouldPlay) {
|
||||||
index = 0
|
index = 0
|
||||||
|
state.currentIndex = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index >= state.tracks.length) {
|
if (index >= state.tracks.length) {
|
||||||
|
|
Loading…
Reference in New Issue