What's the difference among AVAudioSessionPort

2019-03-27 17:05发布

问题:

There are three different Bluetooth related audio port types documented in Apple's AVAudioSessionPortDescription reference. But Apple doesn't explain much about these three types. Can somebody help explain more?

回答1:

AVAudioSessionPortBluetoothHFP | Input and Output

This is used when connected to a bluetooth devices through Hands-Free profile, like cars or earpieces. It can be accessed by setting your audio session category to AVAudioSessionCategoryPlayAndRecord and category option AVAudioSessionCategoryOptionAllowbluetooth.

AVAudioSessionPortBluetoothA2DP | Output only

This is mainly used for streaming audio using A2DP (advanced audio distribution profile). The small portable bluetooth speakers (like the Jambox) use this profile for streaming audio. It can be accessed by setting your audio session category to AVAudioSessionCategoryPlayback.

AVAudioSessionPortBluetoothLE | Output only

New as of iOS 7 however I am not aware of any devices that you can stream audio to that implement the Bluetooth Low Energy protocol.