AVPlayerViewController Airplay in the presence of external UIScene

I have a UISceneConfiguration for external screen which is triggered when external display is connected to iOS device.

// MARK: UISceneSession Lifecycle
@available(iOS 13.0, *)
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
    // Called when a new scene session is being created.
    // Use this method to select a configuration to create the new scene with.
           switch connectingSceneSession.role {
               case  .windowApplication:
                   return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
               case .windowExternalDisplay:
                   return UISceneConfiguration(name: "External Screen", sessionRole: connectingSceneSession.role)
               default:
                   fatalError("Unknown Configuration \(connectingSceneSession.role.rawValue)")
               }
}

I display a custom view in the external screen this way in a new UIScene linked to external display. But the problem now is if I also have an AVPlayerViewController in the flow of application, it no longer displays to external screen. I suppose AVPlayerViewController does it's own configuration for external display playback perhaps, but now I have a custom view embedded on external screen it is unable to override it. What do I need to do so that AVPlayerViewController can display content to external screen the way it does normally?

Replies

Dear UIKit/AVFoundation Engineers,

Please look into this question, still looking for an answer.

AVPlayerViewController is part of AVKit, so you'll probably have better luck in that part of the forums.