Description
The Web Audio API specifies AudioContext.baseLatency and AudioContext.outputLatency. Neither is exposed by react-native-audio-api at 0.12.2 — not natively, and the web wrapper doesn't pass the browser's values through either (no baseLatency/outputLatency anywhere in the published types).
Why it matters
Any app that records against playing audio (overdub recording, call-and-response, rhythm games) needs recording latency compensation: a take performed in time lands outputLatency + inputLatency late on the timeline unless the app shifts it back. Right now there is no API surface to get those numbers, so apps must ship their own native module or a loopback-calibration flow. For scale: on an iPhone 16 speaker route (playAndRecord), I measure a ~188 ms end-to-end record round-trip through the library — all of it invisible to JS today.
The platform data already exists:
- iOS:
AVAudioSession.{outputLatency, inputLatency, ioBufferDuration} map directly (outputLatency → spec outputLatency; ioBufferDuration-derived term → baseLatency).
- Android: the library owns the Oboe streams —
AudioStream::calculateLatencyMillis() and stream timestamps are available on the open stream.
- Web: pass through the browser's own properties.
Proposal
context.baseLatency / context.outputLatency per spec (getters, snapshot per call).
- Bonus for the recording side: an equivalent input figure (e.g.
AudioRecorder.inputLatency or a field on the onAudioReady event) — the spec has nothing here, but AVAudioSession.inputLatency and the Oboe input stream both report it.
Together with #1103 (populate the recorder when), this would make sample-accurate overdub placement possible without any app-side native code.
Environment
react-native-audio-api 0.12.2, iOS + Android + web, new architecture.
Description
The Web Audio API specifies
AudioContext.baseLatencyandAudioContext.outputLatency. Neither is exposed by react-native-audio-api at 0.12.2 — not natively, and the web wrapper doesn't pass the browser's values through either (nobaseLatency/outputLatencyanywhere in the published types).Why it matters
Any app that records against playing audio (overdub recording, call-and-response, rhythm games) needs recording latency compensation: a take performed in time lands
outputLatency + inputLatencylate on the timeline unless the app shifts it back. Right now there is no API surface to get those numbers, so apps must ship their own native module or a loopback-calibration flow. For scale: on an iPhone 16 speaker route (playAndRecord), I measure a ~188 ms end-to-end record round-trip through the library — all of it invisible to JS today.The platform data already exists:
AVAudioSession.{outputLatency, inputLatency, ioBufferDuration}map directly (outputLatency→ specoutputLatency;ioBufferDuration-derived term →baseLatency).AudioStream::calculateLatencyMillis()and stream timestamps are available on the open stream.Proposal
context.baseLatency/context.outputLatencyper spec (getters, snapshot per call).AudioRecorder.inputLatencyor a field on theonAudioReadyevent) — the spec has nothing here, butAVAudioSession.inputLatencyand the Oboe input stream both report it.Together with #1103 (populate the recorder
when), this would make sample-accurate overdub placement possible without any app-side native code.Environment
react-native-audio-api 0.12.2, iOS + Android + web, new architecture.