From 9be29f581b8bf9d781e980bcfa3be8471346bf1c Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 11 Nov 2022 18:50:20 +0100 Subject: [PATCH] Fix queue row opening --- Shared/Player/PlayerQueueRow.swift | 43 +++++++++++++++++++----------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/Shared/Player/PlayerQueueRow.swift b/Shared/Player/PlayerQueueRow.swift index 615c377b..2185bf74 100644 --- a/Shared/Player/PlayerQueueRow.swift +++ b/Shared/Player/PlayerQueueRow.swift @@ -34,27 +34,40 @@ struct PlayerQueueRow: View { player.avPlayerBackend.startPictureInPictureOnPlay = player.playingInPictureInPicture player.videoBeingOpened = item.video - player.show() - if history { - player.playHistory(item, at: watchStoppedAt) - } else { - player.advanceToItem(item, at: watchStoppedAt) - } + let playItem = { + if history { + player.playHistory(item, at: watchStoppedAt) + } else { + player.advanceToItem(item, at: watchStoppedAt) + } - if fullScreen { - withAnimation { - fullScreen = false + if fullScreen { + withAnimation { + fullScreen = false + } + } + + if closePiPOnNavigation, player.playingInPictureInPicture { + player.closePiP() + } + + if autoplay { + player.resetAutoplay() } } - if closePiPOnNavigation, player.playingInPictureInPicture { - player.closePiP() - } + #if os(iOS) + if player.presentingPlayer { + playItem() + } else { + player.onPresentPlayer.append(playItem) + } + #else + playItem() + #endif - if autoplay { - player.resetAutoplay() - } + player.show() } label: { VideoBanner(video: item.video, playbackTime: watchStoppedAt, videoDuration: watch?.videoDuration) }