2020-04-17 00:23:28 -04:00
|
|
|
<template>
|
2022-02-19 00:39:14 -05:00
|
|
|
<a v-if="visible" :disabled="disabled" @click="seek">
|
|
|
|
<span class="icon"><i class="mdi mdi-rewind" :class="icon_style" /></span>
|
2020-04-17 00:23:28 -04:00
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PlayerButtonSeekBack',
|
|
|
|
props: ['seek_ms', 'icon_style'],
|
|
|
|
|
|
|
|
computed: {
|
2022-02-19 00:39:14 -05:00
|
|
|
now_playing() {
|
2020-04-17 00:23:28 -04:00
|
|
|
return this.$store.getters.now_playing
|
|
|
|
},
|
2022-02-19 00:39:14 -05:00
|
|
|
is_stopped() {
|
2020-04-17 00:23:28 -04:00
|
|
|
return this.$store.state.player.state === 'stop'
|
|
|
|
},
|
2022-02-19 00:39:14 -05:00
|
|
|
disabled() {
|
|
|
|
return (
|
|
|
|
!this.$store.state.queue ||
|
|
|
|
this.$store.state.queue.count <= 0 ||
|
|
|
|
this.is_stopped ||
|
|
|
|
this.now_playing.data_kind === 'pipe'
|
|
|
|
)
|
2020-04-17 00:23:28 -04:00
|
|
|
},
|
2022-02-19 00:39:14 -05:00
|
|
|
visible() {
|
2020-04-17 00:23:28 -04:00
|
|
|
return ['podcast', 'audiobook'].includes(this.now_playing.media_kind)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
seek: function () {
|
|
|
|
if (!this.disabled) {
|
|
|
|
webapi.player_seek(this.seek_ms * -1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|