Search code examples
iosaudiobluetoothcore-bluetoothairplay

Approximating audio latency in iOS for airplay, bluetooth and related technologies


Is there a method of determining the delay in audio when playing to bluetooth (or some other device, like airplay) on iOS?

I've searched and found a few things. The advanced audio distribution spec, for example, makes several references to "delay" reporting, but I'm not clear how to access this from iOS in the more general case of audio playback to some device.

If there were a method, iOS would use that method to play videos with the audio and video in sync which it doesn't seem to do. However, I do see some references to other systems being able to compensate for this (eg apparently the android YouTube player can compensate: Detect or Approximate Bluetooth Latency on Android (Audio Playback))


Solution

  • I came across this issue myself. AvAudioSession provides properties for outputLatency as well as inputLatency. I do see differences in the values when I connect to a pair of bluetooth headphones, vs the iPhone microphone and speaker, though I cannot speak to how accurate these numbers are.