2022-06-01 03:13:46 +02:00
|
|
|
<template>
|
|
|
|
<div class="flex pt-4 pb-2 md:pt-0 md:pb-2">
|
|
|
|
<div class="flex-grow" />
|
|
|
|
<template v-if="!loading">
|
2022-06-04 19:07:38 +02:00
|
|
|
<div class="cursor-pointer flex items-center justify-center text-gray-300 mr-4 md:mr-8" @mousedown.prevent @mouseup.prevent @click.stop="prevChapter">
|
2022-06-19 17:04:15 +02:00
|
|
|
<span class="material-icons text-2xl sm:text-3xl">first_page</span>
|
2022-06-01 03:13:46 +02:00
|
|
|
</div>
|
|
|
|
<div class="cursor-pointer flex items-center justify-center text-gray-300" @mousedown.prevent @mouseup.prevent @click.stop="jumpBackward">
|
2022-06-19 17:04:15 +02:00
|
|
|
<span class="material-icons text-2xl sm:text-3xl">replay_10</span>
|
2022-06-01 03:13:46 +02:00
|
|
|
</div>
|
2022-06-04 19:07:38 +02:00
|
|
|
<div class="cursor-pointer p-2 shadow-sm bg-accent flex items-center justify-center rounded-full text-primary mx-4 md:mx-8" :class="seekLoading ? 'animate-spin' : ''" @mousedown.prevent @mouseup.prevent @click.stop="playPause">
|
2022-11-21 14:18:10 +01:00
|
|
|
<span class="material-icons text-2xl">{{ seekLoading ? 'autorenew' : paused ? 'play_arrow' : 'pause' }}</span>
|
2022-06-01 03:13:46 +02:00
|
|
|
</div>
|
|
|
|
<div class="cursor-pointer flex items-center justify-center text-gray-300" @mousedown.prevent @mouseup.prevent @click.stop="jumpForward">
|
2022-06-19 17:04:15 +02:00
|
|
|
<span class="material-icons text-2xl sm:text-3xl">forward_10</span>
|
2022-06-01 03:13:46 +02:00
|
|
|
</div>
|
2022-06-04 19:07:38 +02:00
|
|
|
<div class="flex items-center justify-center ml-4 md:ml-8" :class="hasNextChapter ? 'text-gray-300 cursor-pointer' : 'text-gray-500'" @mousedown.prevent @mouseup.prevent @click.stop="nextChapter">
|
2022-06-19 17:04:15 +02:00
|
|
|
<span class="material-icons text-2xl sm:text-3xl">last_page</span>
|
2022-06-04 19:07:38 +02:00
|
|
|
</div>
|
2022-06-19 17:04:15 +02:00
|
|
|
<controls-playback-speed-control v-model="playbackRateInput" @input="playbackRateUpdated" @change="playbackRateChanged" />
|
2022-06-01 03:13:46 +02:00
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<div class="cursor-pointer p-2 shadow-sm bg-accent flex items-center justify-center rounded-full text-primary mx-8 animate-spin">
|
|
|
|
<span class="material-icons">autorenew</span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<div class="flex-grow" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
loading: Boolean,
|
|
|
|
seekLoading: Boolean,
|
|
|
|
playbackRate: Number,
|
2022-06-04 19:07:38 +02:00
|
|
|
paused: Boolean,
|
|
|
|
hasNextChapter: Boolean
|
2022-06-01 03:13:46 +02:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {}
|
|
|
|
},
|
2022-06-19 17:04:15 +02:00
|
|
|
computed: {
|
|
|
|
playbackRateInput: {
|
|
|
|
get() {
|
|
|
|
return this.playbackRate
|
|
|
|
},
|
|
|
|
set(val) {
|
|
|
|
this.$emit('update:playbackRate', val)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2022-06-01 03:13:46 +02:00
|
|
|
methods: {
|
|
|
|
playPause() {
|
|
|
|
this.$emit('playPause')
|
|
|
|
},
|
2022-06-04 19:07:38 +02:00
|
|
|
prevChapter() {
|
|
|
|
this.$emit('prevChapter')
|
|
|
|
},
|
|
|
|
nextChapter() {
|
|
|
|
if (!this.hasNextChapter) return
|
|
|
|
this.$emit('nextChapter')
|
2022-06-01 03:13:46 +02:00
|
|
|
},
|
|
|
|
jumpBackward() {
|
|
|
|
this.$emit('jumpBackward')
|
|
|
|
},
|
|
|
|
jumpForward() {
|
|
|
|
this.$emit('jumpForward')
|
|
|
|
},
|
|
|
|
playbackRateUpdated(playbackRate) {
|
|
|
|
this.$emit('setPlaybackRate', playbackRate)
|
|
|
|
},
|
|
|
|
playbackRateChanged(playbackRate) {
|
|
|
|
this.$emit('setPlaybackRate', playbackRate)
|
|
|
|
this.$store.dispatch('user/updateUserSettings', { playbackRate }).catch((err) => {
|
|
|
|
console.error('Failed to update settings', err)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {}
|
|
|
|
}
|
|
|
|
</script>
|