How can you enable Picture-in-Picture on a Swift WebView from WebKit?
At the moment, when you watch a video in a webView and switch to the home screen, you briefly see the picture-in-picture view in the top right on the home screen, but it disappears after a second.
How can you retain it so it doesn't disappear?
Thanks in advance!
Make sure you enabled Picture in Picture under BackgroundModes in Xcode.
TARGETS -> Signing & Capabilities -> Background Mode
If you are trying to embed a youtube video in your webView, PiP won't work. Youtube blocking PiP in iOS webView and Safari.
For youtube videos embedding is better to use the youtube-ios-player-helper framework.