问题描述
我有一个 MPMoviePlayerController
的实例,用于在iPhone应用上显示一些直播视频。这工作正常,但是我希望删除所有AirPlay功能。
I have an instance of a MPMoviePlayerController
which is being used to display some live streaming video on an iPhone app. This is working fine, however I wish to remove all AirPlay functionality.
可以肯定的是,我特意禁用AirPlay,如下所示:
To be sure, I specifically disable AirPlay like so:
if([self.moviePlayerController respondsToSelector:@selector(setAllowsAirPlay:)]) {
self.moviePlayerController.allowsAirPlay = NO;
}
然而,即使使用此代码,我仍会在视频中看到AirPlay图标控制。如果我选择此选项并选择我的AppleTV,则仅通过AirPlay发送音频 - 视频将继续在应用内播放。如果我将 allowsAirPlay
设置为 YES
,则视频&音频通过AirPlay发送。
However, even with this code, I still see the AirPlay icon on the video controls. If I select this, and select my AppleTV, only the audio is sent over AirPlay - the video continues to play within the app. If I set allowsAirPlay
to YES
, both the video & audio are sent over AirPlay.
有谁知道为什么会这样?这是OS的功能,允许通过AirPlay发送音频吗?
Does anyone know why this happens? Is this a feature of the OS, to allows allow the audio to be sent over AirPlay?
推荐答案
事实证明,AirPlay图标仍然可见(并应保持可见),以便音频可以路由到任何合适的设备,例如。蓝牙耳机。试图隐藏图标被认为是不好的做法。
It turns out that the AirPlay icon is still visible (and should remain visible) so that audio can be routed to any suitable device, eg. a Bluetooth headset. Attempting to hide the icon is considered bad practice.
这篇关于使用MPMoviePlayerController禁用AirPlay的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!