3

I'm trying to identify the name of the device when AirPlay is active. I would like to use the name for VoiceOver.

Test Case

With the snippet below, all I'm getting is "AirPlay".

Here is a snippet:

var externalDeviceName: String {
    let currentRoute = AVAudioSession.sharedInstance().currentRoute
    var port: String?

    for output in currentRoute.outputs where output.portType == AVAudioSession.Port.airPlay {
        port = output.portName
    }
    return port ?? "unknown"
}

I referenced a couple of posts so far, for example this one.

Is getting the device name not possible?

Clint_M
  • 31
  • 1

0 Answers0