diff --git a/components/app/AudioPlayer.vue b/components/app/AudioPlayer.vue index c2972b8d..baf6e254 100644 --- a/components/app/AudioPlayer.vue +++ b/components/app/AudioPlayer.vue @@ -15,7 +15,7 @@

{{ isDirectPlayMethod ? 'Direct' : isLocalPlayMethod ? 'Local' : 'Transcode' }}

-
+

{{ currentTimePretty }}

@@ -147,6 +147,7 @@ export default { touchStartTime: 0, touchEndY: 0, useChapterTrack: false, + useTotalTrack: true, lockUi: false, isLoading: false, touchTrackStart: false, @@ -180,6 +181,11 @@ export default { items.push( ...[ + { + text: 'Total Track', + value: 'total_track', + icon: this.useTotalTrack ? 'check_box' : 'check_box_outline_blank' + }, { text: 'Chapter Track', value: 'chapter_track', @@ -705,11 +711,20 @@ export default { this.$localStore.setPlayerLock(this.lockUi) } else if (action === 'chapter_track') { this.useChapterTrack = !this.useChapterTrack + this.useTotalTrack = !this.useChapterTrack || this.useTotalTrack this.updateTimestamp() this.updateTrack() this.updateReadyTrack() this.$localStore.setUseChapterTrack(this.useChapterTrack) + } else if (action === 'total_track') { + this.useTotalTrack = !this.useTotalTrack + this.useChapterTrack = !this.useTotalTrack || this.useChapterTrack + + this.updateTimestamp() + this.updateTrack() + this.updateReadyTrack() + this.$localStore.setUseTotalTrack(this.useTotalTrack) } else if (action === 'close') { this.closePlayback() } diff --git a/plugins/localStore.js b/plugins/localStore.js index f7119512..df92bc1d 100644 --- a/plugins/localStore.js +++ b/plugins/localStore.js @@ -60,6 +60,24 @@ class LocalStorage { } } + async setUseTotalTrack(useTotalTrack) { + try { + await Storage.set({ key: 'useTotalTrack', value: useTotalTrack ? '1' : '0' }) + } catch (error) { + console.error('[LocalStorage] Failed to set use total track', error) + } + } + + async getUseTotalTrack() { + try { + var obj = await Storage.get({ key: 'useTotalTrack' }) || {} + return obj.value === '1' + } catch (error) { + console.error('[LocalStorage] Failed to get use total track', error) + return false + } + } + async setPlayerLock(lock) { try { await Storage.set({ key: 'playerLock', value: lock ? '1' : '0' })