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">
|
2023-06-30 15:41:40 -04:00
|
|
|
<mdicon
|
|
|
|
name="rewind-10"
|
|
|
|
:size="icon_size"
|
|
|
|
:title="$t('player.button.seek-backward')"
|
|
|
|
/>
|
2020-04-17 00:23:28 -04:00
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PlayerButtonSeekBack',
|
2022-04-16 04:14:03 -04:00
|
|
|
props: {
|
|
|
|
seek_ms: Number,
|
|
|
|
icon_size: {
|
|
|
|
type: Number,
|
|
|
|
default: 16
|
|
|
|
}
|
|
|
|
},
|
2020-04-17 00:23:28 -04:00
|
|
|
|
|
|
|
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: {
|
2023-06-07 15:25:54 -04:00
|
|
|
seek() {
|
2020-04-17 00:23:28 -04:00
|
|
|
if (!this.disabled) {
|
|
|
|
webapi.player_seek(this.seek_ms * -1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|