fix audio.onended
This commit is contained in:
parent
8621d06fbc
commit
4211966433
@ -132,7 +132,10 @@ export const playerModule: Module<State, any> = {
|
|||||||
}
|
}
|
||||||
return dispatch('resume')
|
return dispatch('resume')
|
||||||
},
|
},
|
||||||
async next({ commit, state }) {
|
async next({ commit, state, getters, dispatch }) {
|
||||||
|
if (!state.repeat && !getters.hasNext) {
|
||||||
|
return dispatch('resetQueue')
|
||||||
|
}
|
||||||
commit('setQueueIndex', state.queueIndex + 1)
|
commit('setQueueIndex', state.queueIndex + 1)
|
||||||
commit('setPlaying')
|
commit('setPlaying')
|
||||||
await audio.play()
|
await audio.play()
|
||||||
@ -199,11 +202,7 @@ export function setupAudio(store: Store<any>) {
|
|||||||
store.commit('player/setDuration', audio.duration)
|
store.commit('player/setDuration', audio.duration)
|
||||||
}
|
}
|
||||||
audio.onended = () => {
|
audio.onended = () => {
|
||||||
if (store.state.repeat) {
|
|
||||||
store.dispatch('player/next')
|
store.dispatch('player/next')
|
||||||
} else {
|
|
||||||
store.dispatch('player/resetQueue')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
audio.onerror = () => {
|
audio.onerror = () => {
|
||||||
store.commit('player/setPaused')
|
store.commit('player/setPaused')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user