简体   繁体   中英

Handle when AVPlayerViewController goes full screen

My application is implemented just for the portrait mode. With the MPMoviePlayerController player there were notifications like MPMoviePlayerWillEnterFullscreenNotification and MPMoviePlayerWillExitFullscreenNotification. I could then adjust the supportedInterfaceOrientationsForWindow in the app delegate. It was working well.

Is it possible to handle any property change using KVO with the new player/item so that I can detect the moment when it goes full screen without a private api? I tried to observe the bounds, the presentation mode. But nothing has changed when the Full Screen button was pressed. Why is it not possible to handle the buttons of the AVPlayerViewController?

The answer is here suggesting to observe the videoBounds of the AVPlayerViewController that I initially observed but did not work for me.

This solution is not always working. The notification related to the videoBounds property of the AVPlayerViewController controller is not always issued.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM