I'm attempting to enable AirPlay with my `AVPlayerViewController`. In the document:

<https://developer.apple.com/reference/avkit/avplayerviewcontroller>

It states 

> 
> AVPlayerViewController automatically supports AirPlay, but you need to perform some project and audio session configuration before it can be enabled in your application.
> 
> 
> 

Under the `Capabilities` tab, I did enable the Background Mode for Audio, AirPlay, and Picture in Picture. I have created the `AVPlayerViewController` as follows:

```
// Create the view controller and player
let moviePlayerViewController: AVPlayerViewController = AVPlayerViewController()
let moviePlayer = AVPlayer(url: videoUrl!)

moviePlayer.allowsExternalPlayback = true
moviePlayer.usesExternalPlaybackWhileExternalScreenIsActive = true

// Initialize the AVPlayer
moviePlayerViewController.player = moviePlayer

// Present movie player and play when completion
self.present(moviePlayerViewController, animated: false, completion: {
    moviePlayerViewController.player?.play()
})

```

I thought the two lines

```
moviePlayer.allowsExternalPlayback = true
moviePlayer.usesExternalPlaybackWhileExternalScreenIsActive = true

```

Would add the AirPlay support but I'm wrong. I have read that AirPlay can be used by adding `MPVolumeView`, but that's for a custom video controller, not the built in one. Any help would be greatly appreciated.