Search code examples
iosxcodeairplay

Turn off mirroring programmatically in iOS while airplaying to apple tv?


I am working around airplaying in iOS and I can able to do that without any issues. My issue is when mirroring is turned on i can see my mobile screen on apple tv, but I want to turn off mirroring programmatically and have to show apple tv default player and this is possible because I seen Netflix app they are doing this.

So could any one help in this?


Solution

  • Set usesExternalPlaybackWhileExternalScreenIsActive property to YES. Go through the following doc

    https://developer.apple.com/documentation/avfoundation/avplayer/1624255-usesexternalplaybackwhileexterna