7

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(airplays) 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?

One way might be to remove and re-add external screen UIScene dynamically at run time before starting AVPlayerViewController, but I am not sure if that is possible.

Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131

0 Answers0