From 271bb7a5d10ab384507fb3fb3da0577c15399a5d Mon Sep 17 00:00:00 2001 From: Phan An Date: Fri, 7 Jun 2024 15:08:50 +0200 Subject: [PATCH] fix: allowing prev and next on iOS --- resources/assets/js/components/podcast/EpisodeItem.vue | 2 +- resources/assets/js/components/screens/PodcastScreen.vue | 8 ++++---- resources/assets/js/components/screens/QueueScreen.vue | 4 ++-- .../assets/js/components/song/PlayableContextMenu.vue | 6 +++--- resources/assets/js/components/song/SongList.vue | 4 ++-- resources/assets/js/components/song/SongThumbnail.vue | 6 +++--- resources/assets/js/components/ui/FooterPlayButton.vue | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/resources/assets/js/components/podcast/EpisodeItem.vue b/resources/assets/js/components/podcast/EpisodeItem.vue index 00c3c9bb..82259f88 100644 --- a/resources/assets/js/components/podcast/EpisodeItem.vue +++ b/resources/assets/js/components/podcast/EpisodeItem.vue @@ -111,7 +111,7 @@ const playOrPause = async () => { queueStore.replaceQueueWith(orderBy(await episodeStore.fetchForPodcast(podcast.value.id), 'created_at')) } - playbackService.play(episode.value, currentPosition.value >= episode.value.length ? 0 : currentPosition.value) + await playbackService.play(episode.value, currentPosition.value >= episode.value.length ? 0 : currentPosition.value) } diff --git a/resources/assets/js/components/screens/PodcastScreen.vue b/resources/assets/js/components/screens/PodcastScreen.vue index 0593845c..f26a66a2 100644 --- a/resources/assets/js/components/screens/PodcastScreen.vue +++ b/resources/assets/js/components/screens/PodcastScreen.vue @@ -179,14 +179,14 @@ const playButtonLabel = computed(() => { return inProgress.value ? 'Continue' : 'Start Listening' }) -const playOrPause = () => { +const playOrPause = async () => { if (podcastPlaying.value) { playbackService.pause() return } if (currentPlayingItemIsPartOfPodcast.value) { - playbackService.resume() + await playbackService.resume() return } @@ -194,13 +194,13 @@ const playOrPause = () => { const currentEpisode = episodes.value?.find(episode => episode.id === podcast.value?.state.current_episode) if (!currentEpisode) return - playbackService.play(currentEpisode, podcast.value?.state.progresses[currentEpisode.id] || 0) + await playbackService.play(currentEpisode, podcast.value?.state.progresses[currentEpisode.id] || 0) return } if (!episodes.value?.length) return queueStore.replaceQueueWith(orderBy(episodes.value, 'created_at')) - playbackService.playFirstInQueue() + await playbackService.playFirstInQueue() } const refresh = async () => { diff --git a/resources/assets/js/components/screens/QueueScreen.vue b/resources/assets/js/components/screens/QueueScreen.vue index f8d10382..714e4bcd 100644 --- a/resources/assets/js/components/screens/QueueScreen.vue +++ b/resources/assets/js/components/screens/QueueScreen.vue @@ -111,14 +111,14 @@ const clearQueue = () => { queueStore.clear() } -const removeSelected = () => { +const removeSelected = async () => { if (!selectedPlayables.value.length) return const currentSongId = queueStore.current?.id queueStore.unqueue(selectedPlayables.value) if (currentSongId && selectedPlayables.value.find(({ id }) => id === currentSongId)) { - playbackService.playNext() + await playbackService.playNext() } } diff --git a/resources/assets/js/components/song/PlayableContextMenu.vue b/resources/assets/js/components/song/PlayableContextMenu.vue index c090cc01..fe0b5136 100644 --- a/resources/assets/js/components/song/PlayableContextMenu.vue +++ b/resources/assets/js/components/song/PlayableContextMenu.vue @@ -183,7 +183,7 @@ const canBeRemovedFromPlaylist = computed(() => { const isQueueScreen = computed(() => isCurrentScreen('Queue')) const isFavoritesScreen = computed(() => isCurrentScreen('Favorites')) -const doPlayback = () => trigger(() => { +const doPlayback = () => trigger(async () => { if (!playables.value.length) return switch (playables.value[0].playback_state) { @@ -192,11 +192,11 @@ const doPlayback = () => trigger(() => { break case 'Paused': - playbackService.resume() + await playbackService.resume() break default: - playbackService.play(playables.value[0]) + await playbackService.play(playables.value[0]) break } }) diff --git a/resources/assets/js/components/song/SongList.vue b/resources/assets/js/components/song/SongList.vue index ebd43c0a..1d8ed5d5 100644 --- a/resources/assets/js/components/song/SongList.vue +++ b/resources/assets/js/components/song/SongList.vue @@ -389,12 +389,12 @@ const openContextMenu = async (row: PlayableRow, event: MouseEvent) => { eventBus.emit('PLAYABLE_CONTEXT_MENU_REQUESTED', event, selectedPlayables.value) } -const onPlay = (playable: Playable) => { +const onPlay = async (playable: Playable) => { if (shouldTriggerContinuousPlayback.value) { queueStore.replaceQueueWith(getAllPlayablesWithSort()) } - playbackService.play(playable) + await playbackService.play(playable) } defineExpose({ diff --git a/resources/assets/js/components/song/SongThumbnail.vue b/resources/assets/js/components/song/SongThumbnail.vue index 26952a59..d4b82e75 100644 --- a/resources/assets/js/components/song/SongThumbnail.vue +++ b/resources/assets/js/components/song/SongThumbnail.vue @@ -48,12 +48,12 @@ const title = computed(() => { return 'Play' }) -const playOrPause = () => { +const playOrPause = async () => { if (playable.value.playback_state === 'Stopped') { // @todo play at the right playback position for Episodes - play() + await play() } else if (playable.value.playback_state === 'Paused') { - playbackService.resume() + await playbackService.resume() } else { playbackService.pause() } diff --git a/resources/assets/js/components/ui/FooterPlayButton.vue b/resources/assets/js/components/ui/FooterPlayButton.vue index 248e2ff6..79cffb3a 100644 --- a/resources/assets/js/components/ui/FooterPlayButton.vue +++ b/resources/assets/js/components/ui/FooterPlayButton.vue @@ -54,7 +54,7 @@ const initiatePlayback = async () => { break } - playbackService.queueAndPlay(playables) + await playbackService.queueAndPlay(playables) go('queue') }