fix: allowing prev and next on iOS

This commit is contained in:
Phan An 2024-06-07 15:08:50 +02:00
parent 31a8284c88
commit 271bb7a5d1
7 changed files with 16 additions and 16 deletions

View file

@ -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)
}
</script>

View file

@ -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 () => {

View file

@ -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()
}
}

View file

@ -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
}
})

View file

@ -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({

View file

@ -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()
}

View file

@ -54,7 +54,7 @@ const initiatePlayback = async () => {
break
}
playbackService.queueAndPlay(playables)
await playbackService.queueAndPlay(playables)
go('queue')
}
</script>