本文介绍了使用AVPlayer的播放器控件中未显示Airplay按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用AVPlayer和AVPlayerViewController创建了一个视频播放器.我已将"allowsExternalPlayback"属性设置为true,并且还将"usesExternalPlaybackWhileExternalScreenIsActive"属性设置为true.但是我仍然没有在播放器控件中看到"Airplay图标".

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

我正在ios 9.2上运行我的应用程序.

I am running my app on ios 9.2.

推荐答案

您需要添加MPVolumeView才能获得此功能.您可以在此处阅读以下内容: https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/AirPlayGuide/EnrichYourAppforAirPlay/EnrichYourAppforAirPlay.html

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

这篇关于使用AVPlayer的播放器控件中未显示Airplay按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 21:09