Skip to content

Instantly share code, notes, and snippets.

@drance
Created November 3, 2014 20:45
Show Gist options
  • Save drance/3ba4d0748251f0cf5bc0 to your computer and use it in GitHub Desktop.
Save drance/3ba4d0748251f0cf5bc0 to your computer and use it in GitHub Desktop.
Get the currently-routed AppleTV's name.
// Use in conjunction with e.g. KVO on AVPlayer.externalPlaybackActive
AVAudioSessionPortDescription *port = [AVAudioSession sharedInstance].currentRoute.outputs.firstObject;
if ([port.portType isEqualToString:AVAudioSessionPortAirPlay]) {
NSLog(@"Now playing on '%@'", port.portName);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment