Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Airplay Button is not showing in Player Controls with AVPlayer

I created a Video Player using AVPlayer and AVPlayerViewController. I have set "allowsExternalPlayback" property to true and also "usesExternalPlaybackWhileExternalScreenIsActive" property to true. But still I am not getting Airplay Icon in Player Controls.

player = AVPlayer(URL: url!)
player!.allowsExternalPlayback = true
player?.usesExternalPlaybackWhileExternalScreenIsActive = true

I am running my app on ios 9.2.

like image 262
Abhishek Avatar asked Sep 25 '22 04:09

Abhishek


1 Answers

You need to add an MPVolumeView in order to get this. You can read about this here: https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/AirPlayGuide/EnrichYourAppforAirPlay/EnrichYourAppforAirPlay.html

like image 117
totiDev Avatar answered Sep 28 '22 07:09

totiDev