AVPlayer display on external screen transform

I have an AVPlayerLayer and AVPlayer setup for playback on external screen as follows:


 var player = AVPlayer()
 playerView.player = player
      
 player.usesExternalPlaybackWhileExternalScreenIsActive = true

 player.allowsExternalPlayback = true

playerView is just a UIView that has AVPlayerLayer as it's main layer. This code works and automatically starts displaying and playing video on external screen. The thing is I want an option to invert the AVPlayerLayer on the external screen. I tried setting transform on playerView but that is ignored on the external screen. How do I gain more control on the external screen window?

I also tried to manually add playerView to external screen window and set

player.usesExternalPlaybackWhileExternalScreenIsActive = true

I can also display AVPlayerLayer manually this way. But again, setting a transform on this screen has no effect on external display. So it may also be a UIKit issue.

The problem has been fixed. I forgot to set player.usesExternalPlaybackWhileExternalScreenIsActive to false.

AVPlayer display on external screen transform
 
 
Q