diff --git a/src/library/TrackContextMenu.vue b/src/library/TrackContextMenu.vue
index 40177c3..22b3fcf 100644
--- a/src/library/TrackContextMenu.vue
+++ b/src/library/TrackContextMenu.vue
@@ -3,7 +3,7 @@
-
+
Play next
@@ -36,8 +36,8 @@
}
this.starred = !this.starred
},
- playNext() {
- return this.$store.dispatch('player/playNext', this.track)
+ setNextInQueue() {
+ return this.$store.dispatch('player/setNextInQueue', this.track)
},
addToQueue() {
return this.$store.dispatch('player/addToQueue', this.track)
diff --git a/src/library/TrackList.vue b/src/library/TrackList.vue
index e05f5f1..d8802a6 100644
--- a/src/library/TrackList.vue
+++ b/src/library/TrackList.vue
@@ -120,9 +120,9 @@
if ((this.tracks as any)[index].id === this.playingTrackId) {
return this.$store.dispatch('player/playPause')
}
- return this.$store.dispatch('player/playQueue', {
+ return this.$store.dispatch('player/playTrackList', {
index,
- queue: this.tracks,
+ tracks: this.tracks,
})
},
dragstart(id: string, event: any) {
diff --git a/src/library/album/AlbumDetails.vue b/src/library/album/AlbumDetails.vue
index 3ced200..fa782a2 100644
--- a/src/library/album/AlbumDetails.vue
+++ b/src/library/album/AlbumDetails.vue
@@ -60,9 +60,9 @@
methods: {
play() {
if (this.album?.tracks) {
- return this.$store.dispatch('player/playQueue', {
+ return this.$store.dispatch('player/playTrackList', {
index: 0,
- queue: this.album.tracks,
+ tracks: this.album.tracks,
})
}
},
diff --git a/src/library/radio/RadioStations.vue b/src/library/radio/RadioStations.vue
index 75b1c3c..321d5e5 100644
--- a/src/library/radio/RadioStations.vue
+++ b/src/library/radio/RadioStations.vue
@@ -59,7 +59,10 @@
if (this.items[index].id === this.playingTrackId) {
return this.$store.dispatch('player/playPause')
}
- return this.$store.dispatch('player/playQueue', { index, queue: this.items })
+ return this.$store.dispatch('player/playTrackList', {
+ index,
+ tracks: this.items
+ })
},
}
})
diff --git a/src/player/store.ts b/src/player/store.ts
index 81bf158..4a3e1e7 100644
--- a/src/player/store.ts
+++ b/src/player/store.ts
@@ -87,20 +87,26 @@ export const playerModule: Module = {
},
actions: {
- async playQueue({ commit }, { queue, index }) {
+ async playTrackList({ commit }, { queue, index }) {
commit('setQueue', [...queue])
commit('setQueueIndex', index)
commit('setPlaying')
await audio.play()
},
- async play({ commit }) {
+ async resume({ commit }) {
commit('setPlaying')
await audio.play()
},
- pause({ commit }) {
+ async pause({ commit }) {
audio.pause()
commit('setPaused')
},
+ async playPause({ state, dispatch }) {
+ if (state.isPlaying) {
+ return dispatch('pause')
+ }
+ return dispatch('resume')
+ },
async next({ commit, state }) {
commit('setQueueIndex', state.queueIndex + 1)
commit('setPlaying')
@@ -111,23 +117,18 @@ export const playerModule: Module = {
commit('setPlaying')
await audio.play()
},
- playPause({ state, dispatch }) {
- if (state.isPlaying) {
- return dispatch('pause')
- }
- return dispatch('play')
- },
seek({ commit, state }, value) {
if (isFinite(state.duration)) {
commit('setPosition', state.duration * value)
}
},
- playNext({ commit }, track) {
- commit('setNextInQueue', track)
},
addToQueue({ commit }, track) {
commit('addToQueue', track)
},
+ setNextInQueue({ commit }, track) {
+ commit('setNextInQueue', track)
+ },
},
getters: {
@@ -172,7 +173,7 @@ export function setupAudio(store: Store) {
if (mediaSession) {
mediaSession.setActionHandler('play', () => {
- store.dispatch('player/play')
+ store.dispatch('player/resume')
})
mediaSession.setActionHandler('pause', () => {
store.dispatch('player/pause')