[web-src] Stop playback if playing a stream or a pipe

forked-daapd can not pause playback from a stream or a pipe and returns 
an error and aborts playback in that case. This works around this issue 
by stopping playback if the now playing item is a stream or a pipe.
This commit is contained in:
chme 2018-12-30 08:53:40 +01:00
parent c4cfbe024f
commit f2ea608a49
2 changed files with 12 additions and 2 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<a v-on:click="toggle_play_pause"> <a v-on:click="toggle_play_pause">
<span class="icon"><i class="mdi" v-bind:class="[icon_style, { 'mdi-play': !is_playing, 'mdi-pause': is_playing }]"></i></span> <span class="icon"><i class="mdi" v-bind:class="[icon_style, { 'mdi-play': !is_playing, 'mdi-pause': is_playing && is_pause_allowed, 'mdi-stop': is_playing && !is_pause_allowed }]"></i></span>
</a> </a>
</template> </template>
@ -15,13 +15,19 @@ export default {
computed: { computed: {
is_playing () { is_playing () {
return this.$store.state.player.state === 'play' return this.$store.state.player.state === 'play'
},
is_pause_allowed () {
return this.$store.getters.now_playing && this.$store.getters.now_playing.data_kind !== 'url' && this.$store.getters.now_playing.data_kind !== 'pipe'
} }
}, },
methods: { methods: {
toggle_play_pause: function () { toggle_play_pause: function () {
if (this.is_playing) { if (this.is_playing && this.is_pause_allowed) {
webapi.player_pause() webapi.player_pause()
} else if (this.is_playing && !this.is_pause_allowed) {
webapi.player_stop()
} else { } else {
webapi.player_play() webapi.player_play()
} }

View File

@ -91,6 +91,10 @@ export default {
return axios.put('/api/player/pause') return axios.put('/api/player/pause')
}, },
player_stop () {
return axios.put('/api/player/stop')
},
player_next () { player_next () {
return axios.put('/api/player/next') return axios.put('/api/player/next')
}, },