Type Property

bluetoothLE

Output to a Bluetooth Low Energy (LE) peripheral.

Declaration

static let bluetoothLE: AVAudioSession.Port

Discussion

Apple supports the use of Bluetooth Low Energy (LE) hearing aids. Apps don’t have control over routing to these devices. Instead, the system automatically decides when routing to Bluetooth LE is appropriate.

To determine if audio is currently routed to a Bluetooth LE device, inspect the current audio route and look for the presence of a Bluetooth LE port type (see example).

Listing 1

Determining if audio is routed to a Bluetooth LE device

var routingToBLE = false
let session = AVAudioSession.sharedInstance()
// Iterate over the currentRoute's outputs
for portDesc in session.currentRoute.outputs {
    if portDesc.portType == AVAudioSessionPortBluetoothLE {
        routingToBLE = true
        break
    }
}