Это мое решение
- (BOOL)isAudioSessionUsingAirplayOutputRoute
{
/**
* I found no other way to check if there is a connection to an airplay device
* airPlayVideoActive is NO as long as the video hasn't started
* and this method is true as soon as the device is connected to an airplay device
*/
AVAudioSession* audioSession = [AVAudioSession sharedInstance];
AVAudioSessionRouteDescription* currentRoute = audioSession.currentRoute;
for (AVAudioSessionPortDescription* outputPort in currentRoute.outputs){
if ([outputPort.portType isEqualToString:AVAudioSessionPortAirPlay])
return YES;
}
return NO;
}
Чтобы проверить подключение AirPlay зеркальное отображение вы просто должны проверить рассчитывать на экраны.
if ([[UIScreen screens] count] < 2)) {
//streaming
}
else {
//mirroring
}
Если есть лучшее решение, дайте мне знать
мне нужно проверить его на протяжении всего приложения, так, где я буду писать этот код. Я смущен, пожалуйста, помогите. :) –