2021-08-18 00:01:11 +02:00
|
|
|
<template>
|
2021-11-26 22:46:07 +01:00
|
|
|
<div class="w-full -mt-6">
|
|
|
|
<div class="w-full relative mb-1">
|
2024-04-04 01:41:41 +02:00
|
|
|
<div class="absolute -top-10 lg:top-0 right-0 lg:right-2 flex items-center h-full">
|
2022-06-03 00:54:07 +02:00
|
|
|
<!-- <span class="material-icons text-2xl cursor-pointer" @click="toggleFullscreen(true)">expand_less</span> -->
|
2022-06-01 03:13:46 +02:00
|
|
|
|
2022-11-27 19:36:10 +01:00
|
|
|
<ui-tooltip direction="top" :text="$strings.LabelVolume">
|
2024-04-23 00:53:29 +02:00
|
|
|
<controls-volume-control ref="volumeControl" v-model="volume" @input="setVolume" class="mx-2 hidden sm:block" />
|
2022-11-20 18:50:34 +01:00
|
|
|
</ui-tooltip>
|
2022-03-05 19:30:46 +01:00
|
|
|
|
2024-06-29 00:01:28 +02:00
|
|
|
<ui-tooltip v-if="!hideSleepTimer" direction="top" :text="$strings.LabelSleepTimer">
|
2024-02-15 01:28:19 +01:00
|
|
|
<button :aria-label="$strings.LabelSleepTimer" class="text-gray-300 hover:text-white mx-1 lg:mx-2" @mousedown.prevent @mouseup.prevent @click.stop="$emit('showSleepTimer')">
|
2022-11-20 18:50:34 +01:00
|
|
|
<span v-if="!sleepTimerSet" class="material-icons text-2xl">snooze</span>
|
|
|
|
<div v-else class="flex items-center">
|
|
|
|
<span class="material-icons text-lg text-warning">snooze</span>
|
|
|
|
<p class="text-xl text-warning font-mono font-semibold text-center px-0.5 pb-0.5" style="min-width: 30px">{{ sleepTimerRemainingString }}</p>
|
|
|
|
</div>
|
2024-02-15 01:28:19 +01:00
|
|
|
</button>
|
2022-11-20 18:50:34 +01:00
|
|
|
</ui-tooltip>
|
2022-03-05 19:30:46 +01:00
|
|
|
|
2024-06-29 00:01:28 +02:00
|
|
|
<ui-tooltip v-if="!isPodcast && !hideBookmarks" direction="top" :text="$strings.LabelViewBookmarks">
|
2024-02-15 01:28:19 +01:00
|
|
|
<button :aria-label="$strings.LabelViewBookmarks" class="text-gray-300 hover:text-white mx-1 lg:mx-2" @mousedown.prevent @mouseup.prevent @click.stop="$emit('showBookmarks')">
|
2022-11-20 18:50:34 +01:00
|
|
|
<span class="material-icons text-2xl">{{ bookmarks.length ? 'bookmarks' : 'bookmark_border' }}</span>
|
2024-02-15 01:28:19 +01:00
|
|
|
</button>
|
2022-11-20 18:50:34 +01:00
|
|
|
</ui-tooltip>
|
2022-03-05 19:30:46 +01:00
|
|
|
|
2022-11-20 18:50:34 +01:00
|
|
|
<ui-tooltip v-if="chapters.length" direction="top" :text="$strings.LabelViewChapters">
|
2024-02-15 01:28:19 +01:00
|
|
|
<button :aria-label="$strings.LabelViewChapters" class="text-gray-300 hover:text-white mx-1 lg:mx-2" @mousedown.prevent @mouseup.prevent @click.stop="showChapters">
|
2022-11-20 18:50:34 +01:00
|
|
|
<span class="material-icons text-2xl">format_list_bulleted</span>
|
2024-02-15 01:28:19 +01:00
|
|
|
</button>
|
2022-11-20 18:50:34 +01:00
|
|
|
</ui-tooltip>
|
2022-06-19 08:55:34 +02:00
|
|
|
|
2022-11-27 19:36:10 +01:00
|
|
|
<ui-tooltip v-if="playerQueueItems.length" direction="top" :text="$strings.LabelViewQueue">
|
2024-02-15 01:28:19 +01:00
|
|
|
<button :aria-label="$strings.LabelViewQueue" class="outline-none text-gray-300 mx-1 lg:mx-2 hover:text-white" @mousedown.prevent @mouseup.prevent @click.stop="$emit('showPlayerQueueItems')">
|
2022-11-27 20:34:50 +01:00
|
|
|
<span class="material-icons text-2.5xl sm:text-3xl">playlist_play</span>
|
2022-11-20 18:50:34 +01:00
|
|
|
</button>
|
|
|
|
</ui-tooltip>
|
2022-11-12 23:48:35 +01:00
|
|
|
|
2022-11-09 00:10:08 +01:00
|
|
|
<ui-tooltip v-if="chapters.length" direction="top" :text="useChapterTrack ? $strings.LabelUseFullTrack : $strings.LabelUseChapterTrack">
|
2024-02-15 01:28:19 +01:00
|
|
|
<button :aria-label="useChapterTrack ? $strings.LabelUseFullTrack : $strings.LabelUseChapterTrack" class="text-gray-300 mx-1 lg:mx-2 hover:text-white" @mousedown.prevent @mouseup.prevent @click.stop="setUseChapterTrack">
|
2022-06-19 17:04:15 +02:00
|
|
|
<span class="material-icons text-2xl sm:text-3xl transform transition-transform" :class="useChapterTrack ? 'rotate-180' : ''">timelapse</span>
|
2024-02-15 01:28:19 +01:00
|
|
|
</button>
|
2022-06-19 17:04:15 +02:00
|
|
|
</ui-tooltip>
|
2021-08-18 00:01:11 +02:00
|
|
|
</div>
|
|
|
|
|
2022-06-19 17:04:15 +02:00
|
|
|
<player-playback-controls :loading="loading" :seek-loading="seekLoading" :playback-rate.sync="playbackRate" :paused="paused" :has-next-chapter="hasNextChapter" @prevChapter="prevChapter" @nextChapter="nextChapter" @jumpForward="jumpForward" @jumpBackward="jumpBackward" @setPlaybackRate="setPlaybackRate" @playPause="playPause" />
|
2021-08-18 00:01:11 +02:00
|
|
|
</div>
|
|
|
|
|
2023-04-08 01:05:23 +02:00
|
|
|
<player-track-bar ref="trackbar" :loading="loading" :chapters="chapters" :duration="duration" :current-chapter="currentChapter" :playback-rate="playbackRate" @seek="seek" />
|
2022-06-01 03:13:46 +02:00
|
|
|
|
2021-11-26 22:46:07 +01:00
|
|
|
<div class="flex">
|
2022-06-19 17:04:15 +02:00
|
|
|
<p ref="currentTimestamp" class="font-mono text-xxs sm:text-sm text-gray-100 pointer-events-auto">00:00:00</p>
|
|
|
|
<p class="font-mono text-sm hidden sm:block text-gray-100 pointer-events-auto"> / {{ progressPercent }}%</p>
|
2021-11-26 22:46:07 +01:00
|
|
|
<div class="flex-grow" />
|
2022-06-19 17:04:15 +02:00
|
|
|
<p class="text-xs sm:text-sm text-gray-300 pt-0.5">
|
2024-05-30 23:23:27 +02:00
|
|
|
{{ currentChapterName }} <span v-if="useChapterTrack" class="text-xs text-gray-400"> ({{ $getString('LabelPlayerChapterNumberMarker', [currentChapterIndex + 1, chapters.length]) }})</span>
|
2022-06-19 17:04:15 +02:00
|
|
|
</p>
|
2021-11-26 22:46:07 +01:00
|
|
|
<div class="flex-grow" />
|
2022-06-19 17:04:15 +02:00
|
|
|
<p class="font-mono text-xxs sm:text-sm text-gray-100 pointer-events-auto">{{ timeRemainingPretty }}</p>
|
2021-11-26 22:46:07 +01:00
|
|
|
</div>
|
2021-08-18 00:01:11 +02:00
|
|
|
|
2023-04-08 01:05:23 +02:00
|
|
|
<modals-chapters-modal v-model="showChaptersModal" :current-chapter="currentChapter" :playback-rate="playbackRate" :chapters="chapters" @select="selectChapter" />
|
2021-08-18 00:01:11 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
2021-09-08 16:15:54 +02:00
|
|
|
loading: Boolean,
|
2022-02-23 00:33:55 +01:00
|
|
|
paused: Boolean,
|
2021-09-08 16:15:54 +02:00
|
|
|
chapters: {
|
|
|
|
type: Array,
|
|
|
|
default: () => []
|
2021-10-25 01:25:44 +02:00
|
|
|
},
|
|
|
|
bookmarks: {
|
|
|
|
type: Array,
|
|
|
|
default: () => []
|
2022-03-05 19:30:46 +01:00
|
|
|
},
|
|
|
|
sleepTimerSet: Boolean,
|
2022-04-12 02:42:09 +02:00
|
|
|
sleepTimerRemaining: Number,
|
2024-06-29 00:01:28 +02:00
|
|
|
isPodcast: Boolean,
|
|
|
|
hideBookmarks: Boolean,
|
|
|
|
hideSleepTimer: Boolean
|
2021-08-18 00:01:11 +02:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2021-10-21 01:54:05 +02:00
|
|
|
volume: 1,
|
2021-08-21 01:29:10 +02:00
|
|
|
playbackRate: 1,
|
2021-08-18 00:01:11 +02:00
|
|
|
audioEl: null,
|
2021-09-08 16:15:54 +02:00
|
|
|
seekLoading: false,
|
2021-09-21 23:42:01 +02:00
|
|
|
showChaptersModal: false,
|
2021-09-22 00:28:43 +02:00
|
|
|
currentTime: 0,
|
2022-06-19 08:55:34 +02:00
|
|
|
duration: 0,
|
|
|
|
useChapterTrack: false
|
2021-08-18 00:01:11 +02:00
|
|
|
}
|
|
|
|
},
|
2023-04-08 01:05:23 +02:00
|
|
|
watch: {
|
|
|
|
playbackRate() {
|
|
|
|
this.updateTimestamp()
|
|
|
|
}
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
computed: {
|
2022-03-05 19:30:46 +01:00
|
|
|
sleepTimerRemainingString() {
|
|
|
|
var rounded = Math.round(this.sleepTimerRemaining)
|
|
|
|
if (rounded < 90) {
|
|
|
|
return `${rounded}s`
|
|
|
|
}
|
|
|
|
var minutesRounded = Math.round(rounded / 60)
|
|
|
|
if (minutesRounded < 90) {
|
|
|
|
return `${minutesRounded}m`
|
|
|
|
}
|
|
|
|
var hoursRounded = Math.round(minutesRounded / 60)
|
|
|
|
return `${hoursRounded}h`
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
token() {
|
2021-08-24 01:31:04 +02:00
|
|
|
return this.$store.getters['user/getToken']
|
2021-08-18 00:01:11 +02:00
|
|
|
},
|
2021-10-25 01:25:44 +02:00
|
|
|
timeRemaining() {
|
2022-06-19 08:55:34 +02:00
|
|
|
if (this.useChapterTrack && this.currentChapter) {
|
|
|
|
var currChapTime = this.currentTime - this.currentChapter.start
|
|
|
|
return (this.currentChapterDuration - currChapTime) / this.playbackRate
|
|
|
|
}
|
2022-02-23 00:33:55 +01:00
|
|
|
return (this.duration - this.currentTime) / this.playbackRate
|
2021-10-25 01:25:44 +02:00
|
|
|
},
|
|
|
|
timeRemainingPretty() {
|
2021-11-13 02:43:16 +01:00
|
|
|
if (this.timeRemaining < 0) {
|
|
|
|
return this.$secondsToTimestamp(this.timeRemaining * -1)
|
|
|
|
}
|
2021-10-25 01:25:44 +02:00
|
|
|
return '-' + this.$secondsToTimestamp(this.timeRemaining)
|
|
|
|
},
|
|
|
|
progressPercent() {
|
2022-06-19 17:04:15 +02:00
|
|
|
const duration = this.useChapterTrack ? this.currentChapterDuration : this.duration
|
|
|
|
const time = this.useChapterTrack ? Math.max(this.currentTime - this.currentChapterStart) : this.currentTime
|
|
|
|
|
|
|
|
if (!duration) return 0
|
|
|
|
return Math.round((100 * time) / duration)
|
2021-10-25 01:25:44 +02:00
|
|
|
},
|
2021-09-21 23:42:01 +02:00
|
|
|
currentChapter() {
|
|
|
|
return this.chapters.find((chapter) => chapter.start <= this.currentTime && this.currentTime < chapter.end)
|
2021-10-25 01:25:44 +02:00
|
|
|
},
|
2021-11-26 22:46:07 +01:00
|
|
|
currentChapterName() {
|
|
|
|
return this.currentChapter ? this.currentChapter.title : ''
|
2022-06-01 03:13:46 +02:00
|
|
|
},
|
2022-06-19 08:55:34 +02:00
|
|
|
currentChapterDuration() {
|
2022-06-19 17:04:15 +02:00
|
|
|
if (!this.currentChapter) return 0
|
|
|
|
return this.currentChapter.end - this.currentChapter.start
|
|
|
|
},
|
|
|
|
currentChapterStart() {
|
|
|
|
if (!this.currentChapter) return 0
|
|
|
|
return this.currentChapter.start
|
2022-06-19 08:55:34 +02:00
|
|
|
},
|
2022-06-01 03:13:46 +02:00
|
|
|
isFullscreen() {
|
|
|
|
return this.$store.state.playerIsFullscreen
|
2022-06-04 19:07:38 +02:00
|
|
|
},
|
|
|
|
currentChapterIndex() {
|
|
|
|
if (!this.currentChapter) return 0
|
|
|
|
return this.chapters.findIndex((ch) => ch.id === this.currentChapter.id)
|
|
|
|
},
|
|
|
|
hasNextChapter() {
|
|
|
|
if (!this.chapters.length) return false
|
|
|
|
return this.currentChapterIndex < this.chapters.length - 1
|
2022-08-28 20:12:38 +02:00
|
|
|
},
|
|
|
|
playerQueueItems() {
|
|
|
|
return this.$store.state.playerQueueItems || []
|
2021-08-18 00:01:11 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2022-06-01 03:13:46 +02:00
|
|
|
toggleFullscreen(isFullscreen) {
|
|
|
|
this.$store.commit('setPlayerIsFullscreen', isFullscreen)
|
2022-03-05 22:37:30 +01:00
|
|
|
|
2022-06-01 03:13:46 +02:00
|
|
|
var videoPlayerEl = document.getElementById('video-player')
|
|
|
|
if (videoPlayerEl) {
|
|
|
|
if (isFullscreen) {
|
|
|
|
videoPlayerEl.style.width = '100vw'
|
|
|
|
videoPlayerEl.style.height = '100vh'
|
|
|
|
videoPlayerEl.style.top = '0px'
|
|
|
|
videoPlayerEl.style.left = '0px'
|
|
|
|
} else {
|
|
|
|
videoPlayerEl.style.width = '384px'
|
|
|
|
videoPlayerEl.style.height = '216px'
|
|
|
|
videoPlayerEl.style.top = 'unset'
|
|
|
|
videoPlayerEl.style.bottom = '80px'
|
|
|
|
videoPlayerEl.style.left = '16px'
|
2022-03-05 22:37:30 +01:00
|
|
|
}
|
2022-06-01 03:13:46 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
setDuration(duration) {
|
|
|
|
this.duration = duration
|
2022-02-23 00:33:55 +01:00
|
|
|
},
|
|
|
|
setCurrentTime(time) {
|
|
|
|
this.currentTime = time
|
|
|
|
this.updateTimestamp()
|
2022-06-01 03:13:46 +02:00
|
|
|
if (this.$refs.trackbar) this.$refs.trackbar.setCurrentTime(time)
|
2022-02-23 00:33:55 +01:00
|
|
|
},
|
|
|
|
playPause() {
|
|
|
|
this.$emit('playPause')
|
|
|
|
},
|
|
|
|
jumpBackward() {
|
|
|
|
this.$emit('jumpBackward')
|
|
|
|
},
|
|
|
|
jumpForward() {
|
|
|
|
this.$emit('jumpForward')
|
|
|
|
},
|
|
|
|
increaseVolume() {
|
|
|
|
if (this.volume >= 1) return
|
|
|
|
this.volume = Math.min(1, this.volume + 0.1)
|
|
|
|
this.setVolume(this.volume)
|
|
|
|
},
|
|
|
|
decreaseVolume() {
|
|
|
|
if (this.volume <= 0) return
|
|
|
|
this.volume = Math.max(0, this.volume - 0.1)
|
|
|
|
this.setVolume(this.volume)
|
|
|
|
},
|
|
|
|
setVolume(volume) {
|
|
|
|
this.$emit('setVolume', volume)
|
|
|
|
},
|
|
|
|
toggleMute() {
|
|
|
|
if (this.$refs.volumeControl && this.$refs.volumeControl.toggleMute) {
|
|
|
|
this.$refs.volumeControl.toggleMute()
|
2021-11-13 02:43:16 +01:00
|
|
|
}
|
|
|
|
},
|
2022-02-23 00:33:55 +01:00
|
|
|
increasePlaybackRate() {
|
2023-04-08 18:17:17 +02:00
|
|
|
if (this.playbackRate >= 10) return
|
|
|
|
this.playbackRate = Number((this.playbackRate + 0.1).toFixed(1))
|
|
|
|
this.setPlaybackRate(this.playbackRate)
|
2021-11-13 02:43:16 +01:00
|
|
|
},
|
2022-02-23 00:33:55 +01:00
|
|
|
decreasePlaybackRate() {
|
2023-04-08 18:17:17 +02:00
|
|
|
if (this.playbackRate <= 0.5) return
|
|
|
|
this.playbackRate = Number((this.playbackRate - 0.1).toFixed(1))
|
|
|
|
this.setPlaybackRate(this.playbackRate)
|
2021-11-13 02:43:16 +01:00
|
|
|
},
|
2022-02-23 00:33:55 +01:00
|
|
|
setPlaybackRate(playbackRate) {
|
|
|
|
this.$emit('setPlaybackRate', playbackRate)
|
2021-11-13 02:43:16 +01:00
|
|
|
},
|
2021-09-08 16:15:54 +02:00
|
|
|
selectChapter(chapter) {
|
|
|
|
this.seek(chapter.start)
|
|
|
|
this.showChaptersModal = false
|
|
|
|
},
|
2022-06-19 08:55:34 +02:00
|
|
|
setUseChapterTrack() {
|
2022-12-17 21:50:01 +01:00
|
|
|
this.useChapterTrack = !this.useChapterTrack
|
|
|
|
if (this.$refs.trackbar) this.$refs.trackbar.setUseChapterTrack(this.useChapterTrack)
|
2022-06-19 08:55:34 +02:00
|
|
|
|
2022-12-17 21:50:01 +01:00
|
|
|
this.$store.dispatch('user/updateUserSettings', { useChapterTrack: this.useChapterTrack })
|
2022-06-19 17:04:15 +02:00
|
|
|
this.updateTimestamp()
|
2022-06-19 08:55:34 +02:00
|
|
|
},
|
2022-07-14 02:38:34 +02:00
|
|
|
checkUpdateChapterTrack() {
|
|
|
|
// Changing media in player may not have chapters
|
|
|
|
if (!this.chapters.length && this.useChapterTrack) {
|
|
|
|
this.useChapterTrack = false
|
|
|
|
if (this.$refs.trackbar) this.$refs.trackbar.setUseChapterTrack(this.useChapterTrack)
|
|
|
|
}
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
seek(time) {
|
2022-02-23 00:33:55 +01:00
|
|
|
this.$emit('seek', time)
|
2021-08-18 00:01:11 +02:00
|
|
|
},
|
|
|
|
restart() {
|
|
|
|
this.seek(0)
|
|
|
|
},
|
2022-06-04 19:07:38 +02:00
|
|
|
prevChapter() {
|
|
|
|
if (!this.currentChapter || this.currentChapterIndex === 0) {
|
|
|
|
return this.restart()
|
|
|
|
}
|
|
|
|
var timeInCurrentChapter = this.currentTime - this.currentChapter.start
|
|
|
|
if (timeInCurrentChapter <= 3 && this.chapters[this.currentChapterIndex - 1]) {
|
|
|
|
var prevChapter = this.chapters[this.currentChapterIndex - 1]
|
|
|
|
this.seek(prevChapter.start)
|
|
|
|
} else {
|
|
|
|
this.seek(this.currentChapter.start)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
nextChapter() {
|
|
|
|
if (!this.currentChapter || !this.hasNextChapter) return
|
|
|
|
var nextChapter = this.chapters[this.currentChapterIndex + 1]
|
|
|
|
this.seek(nextChapter.start)
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
setStreamReady() {
|
2022-06-01 03:13:46 +02:00
|
|
|
if (this.$refs.trackbar) this.$refs.trackbar.setPercentageReady(1)
|
2021-08-18 00:01:11 +02:00
|
|
|
},
|
|
|
|
setChunksReady(chunks, numSegments) {
|
|
|
|
var largestSeg = 0
|
|
|
|
for (let i = 0; i < chunks.length; i++) {
|
|
|
|
var chunk = chunks[i]
|
|
|
|
if (typeof chunk === 'string') {
|
|
|
|
var chunkRange = chunk.split('-').map((c) => Number(c))
|
|
|
|
if (chunkRange.length < 2) continue
|
|
|
|
if (chunkRange[1] > largestSeg) largestSeg = chunkRange[1]
|
|
|
|
} else if (chunk > largestSeg) {
|
|
|
|
largestSeg = chunk
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var percentageReady = largestSeg / numSegments
|
2022-06-01 03:13:46 +02:00
|
|
|
if (this.$refs.trackbar) this.$refs.trackbar.setPercentageReady(percentageReady)
|
2021-08-18 00:01:11 +02:00
|
|
|
},
|
|
|
|
updateTimestamp() {
|
2023-04-08 01:05:23 +02:00
|
|
|
const ts = this.$refs.currentTimestamp
|
2021-08-18 00:01:11 +02:00
|
|
|
if (!ts) {
|
|
|
|
console.error('No timestamp el')
|
|
|
|
return
|
|
|
|
}
|
2022-06-19 17:04:15 +02:00
|
|
|
const time = this.useChapterTrack ? Math.max(0, this.currentTime - this.currentChapterStart) : this.currentTime
|
2023-04-08 01:05:23 +02:00
|
|
|
ts.innerText = this.$secondsToTimestamp(time / this.playbackRate)
|
2022-02-23 00:33:55 +01:00
|
|
|
},
|
|
|
|
setBufferTime(bufferTime) {
|
2022-06-01 03:13:46 +02:00
|
|
|
if (this.$refs.trackbar) this.$refs.trackbar.setBufferTime(bufferTime)
|
2021-08-18 00:01:11 +02:00
|
|
|
},
|
2021-09-08 16:15:54 +02:00
|
|
|
showChapters() {
|
2021-10-23 23:49:34 +02:00
|
|
|
if (!this.chapters.length) return
|
|
|
|
this.showChaptersModal = !this.showChaptersModal
|
2021-09-08 16:15:54 +02:00
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
init() {
|
2021-08-24 01:31:04 +02:00
|
|
|
this.playbackRate = this.$store.getters['user/getUserSetting']('playbackRate') || 1
|
2022-07-14 02:38:34 +02:00
|
|
|
|
2022-12-17 21:50:01 +01:00
|
|
|
const _useChapterTrack = this.$store.getters['user/getUserSetting']('useChapterTrack') || false
|
2022-07-14 02:38:34 +02:00
|
|
|
this.useChapterTrack = this.chapters.length ? _useChapterTrack : false
|
|
|
|
|
2022-06-19 17:04:15 +02:00
|
|
|
if (this.$refs.trackbar) this.$refs.trackbar.setUseChapterTrack(this.useChapterTrack)
|
2023-04-08 18:17:17 +02:00
|
|
|
this.setPlaybackRate(this.playbackRate)
|
2021-08-24 01:31:04 +02:00
|
|
|
},
|
|
|
|
settingsUpdated(settings) {
|
|
|
|
if (settings.playbackRate && this.playbackRate !== settings.playbackRate) {
|
2022-02-23 00:33:55 +01:00
|
|
|
this.setPlaybackRate(settings.playbackRate)
|
2021-10-23 03:08:02 +02:00
|
|
|
}
|
|
|
|
},
|
2021-10-23 23:49:34 +02:00
|
|
|
closePlayer() {
|
2022-06-01 03:13:46 +02:00
|
|
|
if (this.isFullscreen) {
|
|
|
|
this.toggleFullscreen(false)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-10-23 23:49:34 +02:00
|
|
|
if (this.loading) return
|
|
|
|
this.$emit('close')
|
|
|
|
},
|
|
|
|
hotkey(action) {
|
2022-02-23 00:33:55 +01:00
|
|
|
if (action === this.$hotkeys.AudioPlayer.PLAY_PAUSE) this.playPause()
|
|
|
|
else if (action === this.$hotkeys.AudioPlayer.JUMP_FORWARD) this.jumpForward()
|
|
|
|
else if (action === this.$hotkeys.AudioPlayer.JUMP_BACKWARD) this.jumpBackward()
|
|
|
|
else if (action === this.$hotkeys.AudioPlayer.VOLUME_UP) this.increaseVolume()
|
|
|
|
else if (action === this.$hotkeys.AudioPlayer.VOLUME_DOWN) this.decreaseVolume()
|
2021-10-24 21:02:49 +02:00
|
|
|
else if (action === this.$hotkeys.AudioPlayer.MUTE_UNMUTE) this.toggleMute()
|
|
|
|
else if (action === this.$hotkeys.AudioPlayer.SHOW_CHAPTERS) this.showChapters()
|
|
|
|
else if (action === this.$hotkeys.AudioPlayer.INCREASE_PLAYBACK_RATE) this.increasePlaybackRate()
|
|
|
|
else if (action === this.$hotkeys.AudioPlayer.DECREASE_PLAYBACK_RATE) this.decreasePlaybackRate()
|
|
|
|
else if (action === this.$hotkeys.AudioPlayer.CLOSE) this.closePlayer()
|
2021-08-18 00:01:11 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
2021-10-23 03:08:02 +02:00
|
|
|
this.$eventBus.$on('player-hotkey', this.hotkey)
|
2022-12-17 21:50:01 +01:00
|
|
|
this.$eventBus.$on('user-settings', this.settingsUpdated)
|
|
|
|
|
|
|
|
this.init()
|
2021-08-24 01:31:04 +02:00
|
|
|
},
|
|
|
|
beforeDestroy() {
|
2021-10-23 03:08:02 +02:00
|
|
|
this.$eventBus.$off('player-hotkey', this.hotkey)
|
2022-12-17 21:50:01 +01:00
|
|
|
this.$eventBus.$off('user-settings', this.settingsUpdated)
|
2021-08-18 00:01:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2021-08-21 01:29:10 +02:00
|
|
|
<style>
|
2021-08-19 01:31:19 +02:00
|
|
|
.loadingTrack {
|
|
|
|
animation-name: loadingTrack;
|
|
|
|
animation-duration: 1s;
|
|
|
|
animation-iteration-count: infinite;
|
|
|
|
}
|
|
|
|
@keyframes loadingTrack {
|
|
|
|
0% {
|
|
|
|
left: -25%;
|
|
|
|
}
|
|
|
|
100% {
|
|
|
|
left: 100%;
|
|
|
|
}
|
|
|
|
}
|
2024-06-29 00:01:28 +02:00
|
|
|
</style>
|