CXR-L(EN)
CXR-L(EN)
IntroductionQuick StartDevelopment Flow & State-MachineTerms and Abbreviations
Feature Development
Version HistoryAndroid
iOS
cxr-l-sdk · v1.0.3 · snapshot 2026-06-02· ↗ source
Audio
Android: Audio
Overview
On an established CXRLink session, start the glasses-side audio stream. The SDK delivers PCM chunks via IAudioStreamCbk.onAudioReceived. Typical format: 16 kHz, mono, 16 bit.
Prerequisites
- Global
CXRLinkcreated andconnectcompleted. - Scene building completed:
- CustomView:
customViewOpensucceeded andonCustomViewOpenedreceived - CustomApp: target app started via
appStart
- CustomView:
GlassPermission.MICROPHONErecommended.
Do not call startAudioStream with link-only connectivity before scene building.
Core APIs
| Method | Description |
|---|---|
setCXRAudioCbk(IAudioStreamCbk) | Register audio callbacks |
startAudioStream(codecType: Int) | Start capture; use codecType = 1 |
stopAudioStream() | Stop capture |
IAudioStreamCbk callbacks
| Callback | Description |
|---|---|
onAudioReceived(data, offset, length) | PCM chunk; guard offset/length bounds |
onAudioStreamStateChanged(started: Boolean) | Stream state |
onAudioError(code, info?) | Error; stop stream and notify user |
PCM parameters
| Parameter | Value |
|---|---|
| Sample rate | 16000 Hz |
| Channels | 1 (mono) |
| Bit depth | 16 bit |
Duration estimate: pcmBytes / (16000 * 2) seconds.
Lifecycle
- Call
stopAudioStream()in sub-pageonDestroy; do notdisconnect(). - Stop capture before page destruction.
- Optional: use
onGlassAiInterruptto auto-start recording on AI interrupt.
Constraints
- Do not stream when link is down.
- Flush writes periodically for file persistence.
- Both CustomView and CustomApp support audio after scene building.
Appendix: reference sample
RenewCXRLSample AudioUsageViewModel — PCM capture, WAV packaging, playback.