[web-src] skip fwd/back only for non url/pipe

This commit is contained in:
whatdoineed2do/Ray 2019-05-01 08:58:05 +01:00 committed by chme
parent cb6b1919a8
commit 45e7816637
2 changed files with 26 additions and 4 deletions

View File

@ -1,6 +1,11 @@
<template> <template>
<a v-on:click="play_skip_back"> <a v-on:click="play_skip_back">
<span class="icon"><i class="mdi mdi-replay"></i></span> <i v-if="is_skip_allowed">
<span class="icon"><i class="mdi mdi-replay"></i></span>
</i>
<i v-else>
<span class="icon has-text-grey-light"><i class="mdi mdi-replay"></i></span>
</i>
</a> </a>
</template> </template>
@ -11,9 +16,15 @@ export default {
name: 'PlayerButtonSkipBack', name: 'PlayerButtonSkipBack',
props: [ 'when_ms' ], props: [ 'when_ms' ],
computed: {
is_skip_allowed () {
return this.$store.state.player.state !== 'stop' && this.$store.getters.now_playing && this.$store.getters.now_playing.data_kind !== 'url' && this.$store.getters.now_playing.data_kind !== 'pipe'
}
},
methods: { methods: {
play_skip_back: function () { play_skip_back: function () {
if (this.$store.state.player.state !== 'stop') { if (this.is_skip_allowed) {
webapi.player_seek(this.when_ms - 10000) webapi.player_seek(this.when_ms - 10000)
} }
} }

View File

@ -1,6 +1,11 @@
<template> <template>
<a v-on:click="play_skip_fwd"> <a v-on:click="play_skip_fwd">
<span class="icon"><i class="mdi mdi-flip-h mdi-replay"></i></span> <i v-if="is_skip_allowed">
<span class="icon"><i class="mdi mdi-flip-h mdi-replay"></i></span>
</i>
<i v-else>
<span class="icon has-text-grey-light"><i class="mdi mdi-flip-h mdi-replay"></i></span>
</i>
</a> </a>
</template> </template>
@ -11,9 +16,15 @@ export default {
name: 'PlayerButtonSkipFwd', name: 'PlayerButtonSkipFwd',
props: [ 'when_ms' ], props: [ 'when_ms' ],
computed: {
is_skip_allowed () {
return this.$store.state.player.state !== 'stop' && this.$store.getters.now_playing && this.$store.getters.now_playing.data_kind !== 'url' && this.$store.getters.now_playing.data_kind !== 'pipe'
}
},
methods: { methods: {
play_skip_fwd: function () { play_skip_fwd: function () {
if (this.$store.state.player.state !== 'stop') { if (this.is_skip_allowed) {
webapi.player_seek(this.when_ms + 10000) webapi.player_seek(this.when_ms + 10000)
} }
} }