CXR-L(EN)
cxr-l-sdk · v1.0.1 · snapshot 2026-05-13· ↗ source

Audio

iOS: Audio

Scenario

Support recording, stopping recording, and pushing audio streams to the glasses for playback, and observe link state and data chunks via audioEventPublisher. Unlike Android where you directly startAudioStream to receive PCM, the API shape is different, but the business goal is the same: handle audio data after a session is established.

Prerequisites

  • Authentication is complete and the link is ready (see “Connection and Session”).
  • The glasses-side scene is built: the Custom View is running on the glasses, or the Custom App has been launched; only then start recording or streaming. Do not call startRecord / feedAudio when only the link is connected and the scene is not ready.

Key APIs (by name)

  • startRecord(_:codec:mode:) / stopRecord(_:): control recording capture.
  • audioEventPublisher: subscribe to started / stream events for UI and debug logs.
  1. Call startRecord to start capture → subscribe to audioEventPublisher.
  2. End: call stopRecord; if streaming was used, call stopPlayAudio.
  3. On page destroy, cancel subscriptions and stop timers to avoid memory leaks.

Development suggestions

  • Keep the type parameter consistent between startRecord and stopRecord (follow the SDK enums).

Sample entry points (typical)

ActionCommon demo method name
Start/stop recordingstartRecordTapped / stopRecordTapped
Event bindingbindAudioEvents

Please follow the actual Swift symbols in ios_cxr_l_sample.

Marcin Miazga