diff --git a/src/components/Player.vue b/src/components/Player.vue index 37cee9e..c9fbe4e 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -7,8 +7,8 @@ const playQueueStore = usePlayQueueStore() const player = useTemplateRef('playerRef') watch(() => playQueueStore.isPlaying, (newValue) => { - if (newValue) { - player.value?.play() + if (newValue) { + player.value?.play() setMetadata() } else { player.value?.pause() } @@ -16,6 +16,7 @@ watch(() => playQueueStore.isPlaying, (newValue) => { watch(() => playQueueStore.currentIndex, () => { setMetadata() + playQueueStore.isBuffering = true }) function artistsOrganize(list: string[]) { @@ -53,9 +54,9 @@ function playNext() { function playPrevious() { if (player.value && (player.value.currentTime ?? 0) < 5 && playQueueStore.currentIndex > 0) { - playQueueStore.currentIndex-- + playQueueStore.currentIndex-- player.value?.play() - } else { + } else { if (player.value) { player.value.currentTime = 0 } } } @@ -65,7 +66,9 @@ function playPrevious() {
- + + + + + + + +
diff --git a/src/stores/usePlayQueueStore.ts b/src/stores/usePlayQueueStore.ts index 323f50b..607e77f 100644 --- a/src/stores/usePlayQueueStore.ts +++ b/src/stores/usePlayQueueStore.ts @@ -6,6 +6,7 @@ export const usePlayQueueStore = defineStore('queue', () =>{ const currentIndex = ref(0) const isPlaying = ref(false) const queueReplaceLock = ref(false) + const isBuffering = ref(false) - return { list, currentIndex, isPlaying, queueReplaceLock } + return { list, currentIndex, isPlaying, queueReplaceLock, isBuffering } }) \ No newline at end of file