Reputation: 25
I have an app using the standard AVPlayerViewController
that enables Picture in Picture, it works as expected, however when the app transitions to PiP the PiP default background view (pictured below - the black screen that says "this video is playing in picture-in-picture" briefly presents before dismissing itself from the screen.
I should mention the set up: I have a view that has a carousel with two separate videos in it. The videos autoplays based on the user's location in the carousel. If the user taps on one of the videos an AVPlayerViewController
is presented using the same instance of the video that the user tapped on. If the user taps on the PiP button the scenario I mentioned above occurs. The AVPlayerViewController
dismisses and the video is now in PiP, but the original view with the carousel shows instead of the PiP background.
How can I get the PiP is playing background to stay on the screen and not be dismissed? Is it automatically dismissing because the main view with the carousel also has an instance of this video that can be played?
Edit: it's a transition view, but how can I get it to stay like other apps? .
Upvotes: -1
Views: 111
Reputation: 25
In order to get the placeholder view to stay instead of being dismissed you need to return true
for the AVPlayerViewControllerDelegate function playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart
.
Upvotes: 1