1

I'm working on a video content app that has AirPlay capabilities. When it streams the video content over AirPlay (AVPlayer), the UI on the device would be a remote control for the player, but when AirPlay is set to mirror, it'll display the same interface on both devices as expected, since all I know is that AirPlay is connected, but I don't know whether it's mirroring or not. I use the following code to check for AirPlay connection:

- (BOOL)isAirPlayTVOutput {
    return ([self isAirplayActive] && ![self isBluetoothOutputType]);
}

- (BOOL)isAirplayActive {
    self.deviceOutputType = nil;
    self.airplayDeviceName = nil;

    AVAudioSessionRouteDescription *routeDescription = [[AVAudioSession sharedInstance] currentRoute];
    for (AVAudioSessionPortDescription *portDescription in routeDescription.outputs) {
        self.deviceOutputType = portDescription.portType;
        self.airplayDeviceName = portDescription.portName;

        if ([portDescription.portType isEqualToString:AVAudioSessionPortAirPlay]) {
            return YES;
        }
    }

    return NO;
}

How would I know if it's mirroring or not?

Bruno Machado - vargero
  • 2,690
  • 5
  • 33
  • 52

1 Answers1

0

I could solve this by using the solution in this answer:

How to check if the device is connected via airplay?

Not the best solution, but probably the only available one.

Community
  • 1
  • 1
Bruno Machado - vargero
  • 2,690
  • 5
  • 33
  • 52
  • Hi bro in this how to differentiate whether connected one is Bluetooth or Airplay device ? – Yohan Jul 11 '16 at 07:23