AOQ SDK media stream send/stop control
enableSendMediaStream controls whether the client sends audio or video media streams to the AI service, giving you precise control over when media transmission starts in AOQ protocol scenarios.
Overview
enableSendMediaStream controls whether the client sends audio or video media streams to the AI service. In AOQ protocol scenarios, some models require a session.updated confirmation before they can accept media data. Use this API to start sending at the right time.
API definition
- iOS / Mac
- Android
- HarmonyOS (ArkTS)
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Media track type: .audio or .video |
| enable | Bool | true = start sending; false = pause sending |
Control flow
A typical media stream control flow is as follows:
Example (iOS Swift)
Disable sending before connect
Enable after receiving session.updated
Important notes
- When to call: Must be called after
createEngine. Calling before the engine is created has no effect. - Default behavior: If this API is not called, the SDK starts sending media streams immediately after a successful connection.
- Model compatibility: Some models require a
session.updatedevent before they accept media data. Use the "disable first, then enable" pattern for maximum compatibility. - Independent control: Audio and video can be controlled independently -- for example, you can send audio without sending video.
Common scenarios
| Scenario | Action | Description |
|---|---|---|
| Before connecting to the model | enable(.audio, false) | Wait for session.updated before sending |
| After receiving session.updated | enable(.audio, true) | AI is ready; start sending |