I have a WKWebView which allows to enable PiP mode on videos.
The problem is that when the user "closes" the WKWebView, I have to call wkWebView.pauseAllMediaPlayback()
, otherwise the sound keeps playing in the system even if I unload the WKWebView with = nil
.
This works great, but if PiP is enabled I want to keep the WKWebView alive and do not call the stop media playback method.
So is there a way to detect if PiP is opened?
I thought of attaching a delegate to the player inside WKWebView, but I'm not allowed to do that: