Last active
August 29, 2015 14:02
-
-
Save akhenakh/458edbacbd768ab9d205 to your computer and use it in GitHub Desktop.
airPlayVideoActive property returns false while between two streams, here is a way to detect airplay in all condition from: http://www.ask-coder.com/3162230/how-to-customize-the-airplay-button-when-airplay-is-active
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)isAirPlayActive{ | |
CFDictionaryRef currentRouteDescriptionDictionary = nil; | |
UInt32 dataSize = sizeof(currentRouteDescriptionDictionary); | |
AudioSessionGetProperty(kAudioSessionProperty_AudioRouteDescription, &dataSize, ¤tRouteDescriptionDictionary); | |
if (currentRouteDescriptionDictionary) { | |
CFArrayRef outputs = CFDictionaryGetValue(currentRouteDescriptionDictionary, kAudioSession_AudioRouteKey_Outputs); | |
if(outputs && CFArrayGetCount(outputs) > 0) { | |
CFDictionaryRef currentOutput = CFArrayGetValueAtIndex(outputs, 0); | |
CFStringRef outputType = CFDictionaryGetValue(currentOutput, kAudioSession_AudioRouteKey_Type); | |
return (CFStringCompare(outputType, kAudioSessionOutputRoute_AirPlay, 0) == kCFCompareEqualTo); | |
} | |
} | |
return NO; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment