【问题标题】:How to tell if AirPlay is mirroring?如何判断 AirPlay 是否在镜像?
【发布时间】:2015-10-13 20:15:58
【问题描述】:

我正在开发一款具有 AirPlay 功能的视频内容应用。当它通过 AirPlay (AVPlayer) 流式传输视频内容时,设备上的 UI 将成为播放器的遥控器,但是当 AirPlay 设置为镜像时,它将按预期在两个设备上显示相同的界面,因为所有我知道是连接了AirPlay,但我不知道它是否镜像。我使用以下代码检查 AirPlay 连接:

- (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;
}

我怎么知道它是否在镜像?

【问题讨论】:

    标签: ios airplay apple-tv


    【解决方案1】:

    我可以通过使用这个答案中的解决方案来解决这个问题:

    How to check if the device is connected via airplay?

    不是最好的解决方案,但可能是唯一可用的解决方案。

    【讨论】:

    • 你好兄弟,如何区分连接的是蓝牙还是Airplay设备?
    猜你喜欢
    • 2016-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-28
    • 2013-05-12
    • 1970-01-01
    • 1970-01-01
    • 2012-01-15
    相关资源
    最近更新 更多