Reputation: 419
I am have implemented PIP in my app. When user goes to background while video was playing. App opens PIP and everything works fine. But when user locks the device , PIP is not stopping/Pausing the video.
Is there a way I can pause the Video when user locks the device?
Upvotes: 0
Views: 59
Reputation: 1
I had the same issue as well - unfortunately iOS clumps all the UIBackgroundModes
for Audio, AirPlay and Picture-in-Picture together so you can't enable one without the other.
What seems to work is setting the AVPlayer
instance's audiovisualBackgroundPlaybackPolicy
to .pauses
, which achieves what you want (pausing the PiP playback when screen is locked).
Upvotes: 0