Due to requirements with our content providers our app needs to be able to disable the ability to Airplay Mirror our player while in Picture in Picture with the application in the background.
While the application is in the foreground we observe the UIScreenDidConnectNotification, and utilize that in order to present another screen, but when the application has gone into the background the observer is not notified until the application has come back into the foreground. This allows our DRM video content to be mirrored to an AppleTV while Picture in Picture is active.
We have also tried to observe the 'isExternalPlaybackActive' property of the AVPlayer instance, but even with using a sample project utilizing a AVPlayerViewController, we were unable to observe any changes to that value. With a timer we also verified that even with the app in foreground, and the AVPlayer instance in full screen, that when mirroring content that value does not change. The only time Key Value Observing shows that value change is when it is initially set as well.
We have also attempted to setup a timer that using NSOperation will continue in the background while Picture in Picture is active. With Picture in Picture active and the application in the background it was observed that there was no change to the UIScreen.screens.count remaining at the same value of 1. It was also observed that the isExternalPlaybackActive property for the AVPlayer instance remained 'false'.
Another attempt we have made is to set the AVPlayer's 'usesExternalPlaybackWhileExternalScreenIsActive' and 'allowsExternalPlayback', but this also failed at preventing the player from displaying through Airplay Mirroring.
With those attempts we have exhausted the resources from the documentation, and would like to find a solution that still allows us to enable Picture in Picture with the app in background.
0 comments:
Post a Comment