'How to detect whether PictureInPicture is active when my app is in the foreground

I'm working on an app that necessitates the user not being distracted for safety reasons. I am wondering if there's a way to detect whether another app has a PictureInPicture video playing so I can advise the user not to play video.

In looking at Apple docs, I see much about integrating PictureInPicture (PiP) for your own app, but nothing about system-level notifications about any app starting PiP or a way to check system state about PiP (like we are able to check, for example, that VoiceOver is active).



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source