AOQ Client SDK HarmonyOS (OHOS) API reference. The platform language is ArkTS (.ets), bridged to the C++ engine via NAPI.
API index
Engine lifecycle
| API | Description |
|---|---|
| createEngine | Create an engine instance (static singleton factory) |
| destroy | Destroy the engine instance (static method) |
| getVersion | Get the SDK version (static method) |
| connect | Connect to the Relay server |
| disconnect | Disconnect from the server |
Audio device management
| API | Description |
|---|---|
| startAudioCapture | Open the audio capture device (microphone) |
| stopAudioCapture | Close the audio capture device |
| muteAudioCapture | Mute or unmute audio capture |
| startAudioPlayer | Start audio rendering (remote audio playback) |
| stopAudioPlayer | Stop audio rendering |
| pauseAudioPlayer | Pause audio rendering, with optional fade-out |
| resumeAudioPlayer | Resume audio rendering, with optional fade-in |
| interruptAudioPlayer | Interrupt the current audio session |
| enableSpeakerphone | Switch audio output between the speaker and earpiece |
| isSpeakerphoneEnabled | Check whether audio output uses the speaker |
Audio encoding configuration
| API | Description |
|---|---|
| setAudioEncoderConfig | Set audio encoding parameters |
| setAudioDecoderConfig | Set audio decoding parameters |
Audio file playback
| API | Description |
|---|---|
| startAudioFile | Start playing and publishing a local audio file |
| stopAudioFile | Stop audio file playback |
| pauseAudioFile | Pause audio file playback |
| resumeAudioFile | Resume audio file playback |
| getAudioFileDuration | Get the total duration of the audio file |
| getAudioFileCurrentPosition | Get the current playback position of the audio file |
| setAudioFilePositionMillis | Seek to a position in the audio file |
| setAudioFileVolume | Set the audio file volume |
| getAudioFileVolume | Get the current audio file volume |
External audio streams
| API | Description |
|---|---|
| addAudioExternalStream | Add an external audio stream |
| pushAudioExternalStreamData | Push external PCM audio data |
| setAudioExternalStreamVolume | Set the external audio stream volume |
| getAudioExternalStreamVolume | Get the external audio stream volume |
| clearAudioExternalStreamBuffer | Clear the external audio stream buffer |
| removeAudioExternalStream | Remove an external audio stream |
Audio frame callbacks
| API | Description |
|---|---|
| setAudioFrameObserver | Set the audio frame callback observer |
| enableAudioFrameObserver | Enable or disable audio frame callbacks at a specified stage |
Local audio volume indication
| API | Description |
|---|---|
| enableLocalAudioVolumeIndication | Enable or disable local capture volume indication |
Video device management
| API | Description |
|---|---|
| startVideoCapture | Open the video capture device (camera) |
| stopVideoCapture | Close the video capture device |
| switchCamera | Switch between front and rear cameras |
| setLocalView | Set or remove the local video rendering window |
| setRemoteView | Set or remove the remote video rendering window |
Video encoding and external input
| API | Description |
|---|---|
| setVideoEncoderConfig | Set video encoding parameters |
| setVideoDecoderConfig | Set video decoding parameters |
| pushExternalVideoCapturedFrame | Push externally captured video frames |
| pushExternalVideoEncodedFrame | Push externally encoded video frames |
Screen capture
| API | Description |
|---|---|
| startScreenCapture | Start screen capture |
| stopScreenCapture | Stop screen capture |
Media stream transmission control
| API | Description |
|---|---|
| enableSendMediaStream | Enable or disable local media stream transmission |
Video frame callbacks
| API | Description |
|---|---|
| setVideoFrameObserver | Set the video frame callback observer |
| enableVideoFrameObserver | Enable or disable video frame callbacks at a specified stage |
Real-time messages
| API | Description |
|---|---|
| sendDataMsg | Send a real-time data message |
AoqEngineEventListener callbacks
| API | Description |
|---|---|
| onError | Engine error callback |
| onWarning | Engine warning callback |
| onConnectionStatusChange | Connection status change callback |
| onStats | Engine statistics callback |
| onAudioDeviceStateChanged | Audio device operation status change callback |
| onAudioDeviceRouteChanged | Audio output route change callback |
| onAudioDeviceInterrupted | Audio device interruption callback |
| onVideoDeviceStateChanged | Video device operation status change callback |
| onScreenCaptureStateChanged | Screen capture status change callback |
| onAudioFileState | Audio file playback status callback |
| onLocalAudioVolumeIndication | Local capture volume indication callback |
| onDataMsg | Received real-time data message callback |
IAudioFrameObserver callbacks
| API | Description |
|---|---|
| onCapturedAudioFrame | Called when a raw audio frame is captured. The frame contains unprocessed PCM data. |
| onProcessCapturedAudioFrame | Called for an audio frame after 3A processing: acoustic echo cancellation, noise suppression, and automatic gain control. |
| onPublishAudioFrame | Called for an audio frame before publishing. The frame will be encoded and sent to the Relay server. |
| onPlaybackAudioFrame | Called for a remote audio frame before playback. The frame has been decoded but not yet mixed. |
IVideoFrameObserver callbacks
| API | Description |
|---|---|
| onCapturedVideoFrame | Called when a raw video frame is captured, before preprocessing. The frame comes from camera or screen capture and has not been preprocessed. |
| onPreEncodeVideoFrame | Called for a video frame after preprocessing and before encoding. |
| onRemoteVideoFrame | Called for a remote video frame after decoding and before rendering. |
API details
pushExternalVideoCapturedFrame supports Video and Screen. Enable external capture on the corresponding track first; otherwise, it returns AoqECVideoExternalCaptureNotEnabled (211). pushExternalVideoEncodedFrame requires external encoding on the corresponding track; otherwise, it returns AoqECVideoExternalEncoderNotEnabled (212).
Engine lifecycle
createEngine
Create the engine instance. The SDK holds the engine as a global singleton; calling this method again returns the existing instance. Returns null if the native engine fails to initialize.
Parameter | Type | Description |
|---|---|---|
config | AoqCreateConfig | Engine creation configuration |
listener | AoqEngineEventListener | null | Engine event callback listener (interface; all callbacks are optional); may be null |
context | common.Context | UIAbility/Page context, used for aki+ACPM initialization |
AoqClientEngine | null — null if native creation fails.
context must be a valid UIAbility or Page context.destroy
Destroy the engine singleton and release all resources. You must call createEngine again before resuming use.
getVersion
Get the current SDK version string.
"1.0.0".
connect
Connect to the Relay server. Connection parameters are allocated by the application server via /api/v1/allocate and delivered to the client.
Parameter | Type | Description |
|---|---|---|
config | AoqConnectConfig | Connection configuration, including token, SID, and Relay endpoint list |
onConnectionStatusChange. It is recommended to call enableSendMediaStream(false) before calling connect.disconnect
Disconnects from the server and releases connection resources. Returns immediately. The disconnection result is reported through onConnectionStatusChange.
Audio device management
startAudioCapture
Open the audio capture device (microphone).
Parameter | Type | Description |
|---|---|---|
config | AoqAudioCaptureConfig | Capture configuration |
stopAudioCapture
Close the audio capture device.
muteAudioCapture
Mute or unmute audio capture.
Parameter | Type | Description |
|---|---|---|
mute | boolean | true: mute; false: unmute |
startAudioPlayer
Start audio playback (play remote audio through the speaker or earpiece).
Parameter | Type | Description |
|---|---|---|
config | AoqAudioPlaybackConfig | Playback configuration |
stopAudioPlayer
Stops audio rendering and closes the playback device.
pauseAudioPlayer
Pause audio playback with an optional fade-out for a smooth transition.
Parameter | Type | Description |
|---|---|---|
fadeMs | number | Fade-out duration (milliseconds); 0 means immediate |
resumeAudioPlayer
Resume audio playback with an optional fade-in for a smooth transition.
Parameter | Type | Description |
|---|---|---|
fadeMs | number | Fade-in duration (milliseconds); 0 means immediate |
interruptAudioPlayer
Interrupt the current audio call turn.
Parameter | Type | Description |
|---|---|---|
trackType | AoqTrackType | Target track type; typically |
fadeMs | number | Fade-out duration (milliseconds) |
enableSpeakerphone
Switch the audio output route between the speaker and the earpiece.
Parameter | Type | Description |
|---|---|---|
enable | boolean | true: use speaker; false: use earpiece |
isSpeakerphoneEnabled
Query whether the speaker is currently active.
Audio codec configuration
Audio encoding configuration
setAudioEncoderConfig
Configures audio encoding for publishing. Configuration changes take effect immediately.
| Parameter | Type | Description |
|---|---|---|
| config | AoqAudioCodecConfig | Audio encoding configuration. Set trackType to AoqTrackType.AoqTrackTypeAudio. |
setAudioDecoderConfig
Configures audio decoding for subscribed audio. The settings must match the remote encoding settings.
| Parameter | Type | Description |
|---|---|---|
| config | AoqAudioCodecConfig | Audio decoding configuration. Set trackType to AoqTrackType.AoqTrackTypeAudio. |
Audio file playback
startAudioFile
Starts streaming and playing a local audio file. Remote streaming and local playback can run simultaneously, with their volumes controlled by publishVolume and playoutVolume, respectively.
| Parameter | Type | Description |
|---|---|---|
| fileId | string | Application-defined file identifier used for subsequent control |
| config | AoqAudioFileMixConfig | Audio file playback configuration |
stopAudioFile
Stops audio file playback.
| Parameter | Type | Description |
|---|---|---|
| fileId | string | File identifier, matching the value passed to startAudioFile |
pauseAudioFile
Pauses audio file playback.
| Parameter | Type | Description |
|---|---|---|
| fileId | string | File identifier |
resumeAudioFile
Resumes audio file playback. Call this method after pauseAudioFile.
| Parameter | Type | Description |
|---|---|---|
| fileId | string | File identifier |
getAudioFileDuration
Gets the total duration of an audio file.
| Parameter | Type | Description |
|---|---|---|
| fileId | string | File identifier |
getAudioFileCurrentPosition
Gets the current playback position of an audio file.
| Parameter | Type | Description |
|---|---|---|
| fileId | string | File identifier |
setAudioFilePositionMillis
Sets the playback position of an audio file (seek).
| Parameter | Type | Description |
|---|---|---|
| fileId | string | File identifier |
| positionMillis | number | Target playback position in milliseconds |
setAudioFileVolume
Sets the audio file volume. Streaming and local playback volumes can be controlled separately.
| Parameter | Type | Description |
|---|---|---|
| fileId | string | File identifier |
| type | AoqAudioStreamDirection | Volume direction. AoqAudioStreamPublish controls streaming; AoqAudioStreamPlayout controls playback. |
| volume | number | Volume. Valid values: 0-100. |
getAudioFileVolume
Gets the current audio file volume.
| Parameter | Type | Description |
|---|---|---|
| fileId | string | File identifier |
| type | AoqAudioStreamDirection | Volume direction |
External audio streams
addAudioExternalStream
Adds an external audio stream. Multiple independent streams can be created and distinguished by streamId.
| Parameter | Type | Description |
|---|---|---|
| streamId | string | Application-defined external stream identifier |
| config | AoqAudioExternalStreamConfig | External audio stream configuration |
pushAudioExternalStreamData
Feeds external PCM audio data into the specified stream.
| Parameter | Type | Description |
|---|---|---|
| streamId | string | External stream identifier |
| data | AoqAudioFrameData | PCM audio frame data |
setAudioExternalStreamVolume
Sets the external audio stream volume. Streaming and local playback volumes can be controlled separately.
| Parameter | Type | Description |
|---|---|---|
| streamId | string | External stream identifier |
| type | AoqAudioStreamDirection | Volume direction |
| vol | number | Volume. Valid values: 0-100. |
getAudioExternalStreamVolume
Gets the current external audio stream volume.
| Parameter | Type | Description |
|---|---|---|
| streamId | string | External stream identifier |
| type | AoqAudioStreamDirection | Volume direction |
clearAudioExternalStreamBuffer
Clears the external audio stream buffer with optional fade-out. Commonly used to interrupt current playback.
| Parameter | Type | Description |
|---|---|---|
| streamId | string | External stream identifier |
| fadeoutMs | number | Fade-out duration in milliseconds. -1 uses the default value, 0 clears the buffer immediately, and a value greater than 0 retains the specified duration for fade-out. |
removeAudioExternalStream
Removes an external audio stream and releases its resources.
| Parameter | Type | Description |
|---|---|---|
| streamId | string | External stream identifier |
Audio frame callbacks
setAudioFrameObserver
Sets the audio frame observer. Pass observer=null to remove it.
| Parameter | Type | Description |
|---|---|---|
| observer | IAudioFrameObserver | null | Audio frame listener. Pass null to remove it. |
enableAudioFrameObserver
Enables or disables audio frame callbacks at the specified position.
| Parameter | Type | Description |
|---|---|---|
| enabled | boolean | true enables callbacks; false disables them. |
| audioSource | AoqAudioSource | Audio source position: capture, after 3A processing, publishing, or playback |
| config | AoqAudioObserverConfig | Callback configuration |
Local audio volume indication
enableLocalAudioVolumeIndication
Enables or disables local captured audio volume indications. When enabled, the SDK invokes onLocalAudioVolumeIndication at config.interval intervals to report the local captured volume and whether speech is detected.
| Parameter | Type | Description |
|---|---|---|
| config | AoqAudioVolumeIndicationConfig | Volume indication configuration. interval<=0 disables callbacks. |
Video device management
startVideoCapture
Opens the video capture device (camera). Captured video is sent over AoqTrackType.AoqTrackTypeVideo. For external video input (pushExternalVideoCapturedFrame), set isExternal to true; the camera is not opened in this mode.
| Parameter | Type | Description |
|---|---|---|
| config | AoqVideoCaptureConfig | Video capture configuration. |
stopVideoCapture
Closes the video capture device and stops local video capture.
switchCamera
Switch between the front and rear cameras.
Parameter | Type | Description |
|---|---|---|
direction | AoqCameraDirection |
|
setLocalView
Set or remove the local video rendering view.
Parameter | Type | Description |
|---|---|---|
trackType | AoqTrackType |
|
canvas | AoqVideoCanvas | null | Rendering canvas configuration; pass null or set |
XComponent.onLoad callback. Pass an AoqXComponentController instance as canvas.view.setRemoteView
Set or remove the remote video rendering view.
Parameter | Type | Description |
|---|---|---|
trackType | AoqTrackType |
|
canvas | AoqVideoCanvas | null | Rendering canvas configuration; pass null or set |
Video encoding and external input
setVideoEncoderConfig
Configures video encoding for publishing, routed by config.trackType. If isExternal=true, pushExternalVideoEncodedFrame sends encoded frames directly without re-encoding by the SDK.
| Parameter | Type | Description |
|---|---|---|
| config | AoqVideoCodecConfig | Video encoding configuration. |
setVideoDecoderConfig
config specifies video decoding settings. Only the following fields take effect: trackType, codecType, width, height, fps, bitrate. Other fields apply only to encoding.
Screen does not support downstream decoding. If config.trackType is Screen, the method returns AoqECUnSupport without applying the configuration.
Returns 0 on success or a nonzero value on failure.
pushExternalVideoCapturedFrame
Push an externally captured raw video frame.
Parameter | Type | Description |
|---|---|---|
trackType | AoqTrackType |
|
frame | AoqVideoFrame | Video frame data |
startVideoCapture(isExternal=true) first. For Screen, call startScreenCapture(isExternal=true) first. Supported formats: NV12, NV21, BGRA, RGBA, I420.
If the internal buffer is full, the method returns AoqECVideoExternalBufferFull (210). Sleep and retry; do not busy-loop.
pushExternalVideoEncodedFrame
Push an externally encoded video frame. The SDK sends it directly without re-encoding.
Parameter | Type | Description |
|---|---|---|
trackType | AoqTrackType |
|
frame | AoqVideoEncodedFrame | Encoded frame data |
setVideoEncoderConfig(isExternal=true) is configured.
Screen capture
config specifies screen capture settings. Screen content is sent on the AoqTrackTypeScreen track.
For start, 0 means that the request is accepted; onScreenCaptureStateChanged reports the result asynchronously. A nonzero return rejects the request synchronously without a duplicate failure event. Stop returns 0 on success or a nonzero value on failure, and reports the stopped state through this callback.
With isExternal=false, the SDK captures the screen and the system prompts for permission. You do not need to wait for Started before enabling transmission or producing external frames.
For external raw frames, set isExternal=true and supply raw Screen frames through pushExternalVideoCapturedFrame for SDK encoding. For external encoded frames, configure the Screen track for external encoding with setVideoEncoderConfig, then call pushExternalVideoEncodedFrame; startScreenCapture is not required.
Media stream transmission control
enableSendMediaStream
Enable or disable local media stream sending. The call is routed to the track specified by trackType.
Parameter | Type | Description |
|---|---|---|
trackType | AoqTrackType |
|
enable | boolean | true: enable sending; false: disable sending |
enableSendMediaStream(trackType, false) after initialization, then enable once the connection is established and the session handshake completes (onConnectionStatusChange reports AoqConnectionStatusConnected).
Video frame callbacks
setVideoFrameObserver
Sets the video frame observer. Pass observer=null to remove it.
| Parameter | Type | Description |
|---|---|---|
| observer | IVideoFrameObserver | null | Video frame listener. Pass null to remove it. |
enableVideoFrameObserver
Enables or disables video frame callbacks at the specified position.
| Parameter | Type | Description |
|---|---|---|
| enabled | boolean | true enables callbacks; false disables them. |
| videoSource | AoqVideoSource | Video source position: after capture, before encoding, or after remote decoding |
| config | AoqVideoObserverConfig | Callback configuration. Use config.trackType to observe the Video or Screen track. |
AoqEngineEventListener callbacks
All callbacks are optional properties (?).
Real-time messages
sendDataMsg
Sends a real-time data message to the remote end. Call this method after connect succeeds and enableSendMediaStream(Data, true) is called.
| Parameter | Type | Description |
|---|---|---|
| msg | AoqDataMsg | Data message |
AoqEngineEventListener callbacks
onError
Engine error callback. Triggered when an unrecoverable error occurs.
| Parameter | Type | Description |
|---|---|---|
| code | number | Error code corresponding to an AoqErrorCode enum value |
| message | string | Error description |
onWarning
Engine warning callback. Triggered by recoverable exceptions that do not prevent the SDK from continuing to run.
| Parameter | Type | Description |
|---|---|---|
| code | number | Warning code corresponding to an AoqWarningCode enum value |
| message | string | Warning description |
onConnectionStatusChange
Connection state change callback. State transitions: Disconnected → Connecting → Connected/Failed → Disconnected.
| Parameter | Type | Description |
|---|---|---|
| status | AoqConnectionStatus | Current connection state |
onStats
Engine statistics callback. The SDK periodically reports audio/video publishing and subscription statistics and network statistics to monitor call quality and network conditions and diagnose audio/video issues.
| Parameter | Type | Description |
|---|---|---|
| stats | AoqStats | Statistics for audio/video/data message publishing and subscription, and network statistics |
onAudioDeviceStateChanged
Callback for audio device capture/playback state changes.
| Parameter | Type | Description |
|---|---|---|
| state | AoqAudioDeviceState | Audio device state, including state (state code) and reason (error reason) |
onAudioDeviceRouteChanged
Callback for audio output route changes.
| Parameter | Type | Description |
|---|---|---|
| routeType | number | Current audio output route, corresponding to an AoqAudioDeviceRouteType enum value |
onAudioDeviceInterrupted
Audio device interruption callback. Triggered by system interruptions, such as incoming calls or another application taking audio focus.
| Parameter | Type | Description |
|---|---|---|
| interrupt | boolean | true indicates interruption; false indicates recovery from interruption. |
onVideoDeviceStateChanged
Callback for video device capture state changes.
| Parameter | Type | Description |
|---|---|---|
| state | AoqVideoDeviceState | Video device state, including state (state code) and reason (error reason) |
onScreenCaptureStateChanged
Reports screen capture state changes using AoqScreenCaptureStateCode and the unified AoqErrorCode. Notifications are delivered asynchronously on the JS thread. Screen capture failures are not also reported through onError.
| Parameter | Type | Description |
|---|---|---|
| state | AoqScreenCaptureState | Screen capture state, including state (state code) and reason (error cause). |
onAudioFileState
Audio file playback state callback.
| Parameter | Type | Description |
|---|---|---|
| state | AoqAudioFileState | Audio file playback state, including fileId, stateCode, and errorCode |
onLocalAudioVolumeIndication
Reports the locally captured audio volume. Triggered only after volume indications are enabled through enableLocalAudioVolumeIndication.
| Parameter | Type | Description |
|---|---|---|
| volume | AoqAudioVolume | Local volume information, including isSpeech (whether speech is detected) and volume (smoothed instantaneous volume [0-255]). |
onDataMsg
Callback for received real-time data messages.
| Parameter | Type | Description |
|---|---|---|
| msg | AoqDataMsg | Data message |
IAudioFrameObserver callbacks
Audio frame observer interface. All methods are optional; implement them as needed. frame.dataPtr is a Uint8Array copy of native memory and is currently read-only (ReadWrite is planned for a future release).
| Method | When triggered | Parameter |
|---|---|---|
| onCapturedAudioFrame | When a raw audio frame is captured (AoqAudioSourceCaptured) | frame: AoqAudioFrameData |
| onProcessCapturedAudioFrame | Audio frame after 3A processing (AoqAudioSourceProcessCaptured) | frame: AoqAudioFrameData |
| onPublishAudioFrame | Audio frame before publishing (AoqAudioSourcePublish) | trackType: track type; frame: AoqAudioFrameData |
| onPlaybackAudioFrame | Remote audio frame before playback (AoqAudioSourcePlayback) | frame: AoqAudioFrameData |
onCapturedAudioFrame
Called when a raw audio frame is captured. The frame contains unprocessed PCM data.
| Parameter | Type | Description |
|---|---|---|
| frame | AoqAudioFrameData | Captured audio frame data |
onProcessCapturedAudioFrame
Called for an audio frame after 3A processing: acoustic echo cancellation, noise suppression, and automatic gain control.
| Parameter | Type | Description |
|---|---|---|
| frame | AoqAudioFrameData | Audio frame data after 3A processing |
onPublishAudioFrame
Called for an audio frame before publishing. The frame will be encoded and sent to the Relay server.
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type |
| frame | AoqAudioFrameData | Audio frame data before publishing |
onPlaybackAudioFrame
Called for a remote audio frame before playback. The frame has been decoded but not yet mixed.
| Parameter | Type | Description |
|---|---|---|
| frame | AoqAudioFrameData | Remote audio frame data before playback |
IVideoFrameObserver callbacks
Video frame observer interface. All methods are optional and return boolean. Return values are currently ignored; data is read-only, and ReadWrite is planned for a future release. Each of the three callbacks includes trackType to distinguish Video and Screen tracks.
| Method | When triggered | Parameter |
|---|---|---|
| onCapturedVideoFrame | When a raw video frame is captured (before preprocessing, AoqVideoSourceCaptured) | trackType: track type; frame: AoqVideoFrame |
| onPreEncodeVideoFrame | Video frame before encoding (after preprocessing, AoqVideoSourcePreEncode) | trackType: track type; frame: AoqVideoFrame |
| onRemoteVideoFrame | Remote video frame after decoding and before rendering (AoqVideoSourceRemote) | trackType: track type; frame: AoqVideoFrame |
onCapturedVideoFrame
Called when a raw video frame is captured, before preprocessing. The frame comes from camera or screen capture and has not been preprocessed.
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type: Video or Screen |
| frame | AoqVideoFrame | Captured video frame data |
onPreEncodeVideoFrame
Called for a video frame after preprocessing and before encoding.
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type: Video or Screen |
| frame | AoqVideoFrame | Video frame data before encoding |
onRemoteVideoFrame
Called for a remote video frame after decoding and before rendering.
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type: Video or Screen |
| frame | AoqVideoFrame | Decoded remote video frame data |
Data types and enumerations
In v1.3.0, Index.ets exports the following enums and interfaces:
- Enums:
AoqTrackMode,AoqScreenCaptureStateCode. - Interfaces:
AoqAudioVolumeIndicationConfig,AoqAudioVolume,AoqScreenCaptureConfig,AoqScreenCaptureState.
Common types
AoqCreateConfig
Field | Type | Default | Description |
|---|---|---|---|
workDir | string | "" | SDK working directory |
enableDumpAudio | boolean | false | Enable raw audio dump (for debugging) |
extras | string | "" | Extra parameters string |
| maxEncodedVideoFrameBytes | number | 190 × 1024 | Maximum encoded frame size in bytes. Applies only to the SDK internal JPEG encoder. |
| enableDropOversizedVideoFrame | boolean | false | For the SDK internal JPEG encoder, whether to drop a frame that remains oversized at the lowest quality. |
AoqCreateConfig on HarmonyOS does not include isBTScoMode.
AoqConnectConfig
subscribeTracks must not include AoqTrackTypeScreen; otherwise, connect returns AoqECUnSupport without starting a connection. setRemoteView also returns AoqECUnSupport for Screen.
Field | Type | Default | Description |
|---|---|---|---|
token | string | "" | Authentication token |
sid | string | "" | Session ID |
certFingerprint | string | "" | Server certificate fingerprint |
relayEndpoints | AoqRelayEndpoint[] | [] | List of Relay endpoints |
workspaceIdHash | string | "" | Workspace ID hash |
publishTracks | AoqTrackParam[] | [] | Local tracks to publish |
subscribeTracks | AoqTrackParam[] | [] | Remote tracks to subscribe to |
AoqRelayEndpoint
Field | Type | Description |
|---|---|---|
endpoint | string | Relay server hostname or IP |
port | number | Relay server port |
| routeIndex | number | Route index. Default: -1. |
| tcpPort | number | Default: 0. TCP fallback port. A value of 0 uses the SDK default port, 443. |
AoqTrackParam
Field | Type | Description |
|---|---|---|
trackType | AoqTrackType | Track type |
| trackMode | AoqTrackMode | Default: AoqTrackModeSegment. Applies only to downstream audio. |
Enumerations
AoqErrorCode
Enum value | Value | Description |
|---|---|---|
AoqECOK | 0 | Success |
AoqECParamInvalid | 1 | Invalid parameter |
AoqECStateInvalid | 2 | Invalid state |
AoqECUnSupport | 3 | Not supported |
AoqECAudio | 100 | Audio generic error |
AoqECAudioExternalBufferFull | 110 | External audio buffer full |
AoqECAudioDevice | 120 | Audio device generic error |
AoqECAudioDeviceRecordingAuthFailed | 121 | Recording permission not granted |
AoqECAudioDeviceRecordingOccupied | 122 | Recording device in use |
AoqECAudioDeviceRecordingBackgroundStart | 123 | Failed to start recording in background |
AoqECAudioDeviceRecordingStartFail | 124 | Recording start failed |
AoqECAudioDevicePlayoutOccupied | 125 | Playback device in use |
AoqECAudioDevicePlayoutBackgroundStart | 126 | Failed to start playback in background |
AoqECAudioDevicePlayoutStartFail | 127 | Playback start failed |
AoqECAudioDeviceEarpieceRequiresVoipMode | 128 | Earpiece requires VoIP mode |
AoqECVideo | 200 | Video generic error |
AoqECVideoExternalBufferFull | 210 | External video buffer full |
AoqECVideoExternalCaptureNotEnabled | 211 | External video capture not enabled |
AoqECVideoExternalEncoderNotEnabled | 212 | External video encoder not enabled |
AoqECVideoDevice | 220 | Video device generic error |
AoqECVideoDeviceCameraOpenFail | 221 | Camera open failed |
AoqECVideoDeviceCameraAuthFailed | 222 | Camera permission not granted |
AoqECVideoDeviceCameraOccupied | 223 | Camera in use |
AoqECVideoDeviceCameraRunningError | 224 | Camera runtime error |
AoqECVideoCodec | 230 | Video codec generic error |
AoqECVideoCodecEncoderInitFail | 231 | Video encoder initialization failed |
AoqECVideoRender | 240 | Video rendering generic error |
AoqECVideoRenderCreateFail | 241 | Video renderer creation failed |
AoqECVideoRenderDrawError | 242 | Video rendering draw error |
| AoqECScreen | 300 | General screen sharing error |
| AoqECScreenAuthFailed | 310 | Screen sharing permission denied |
| AoqECScreenStartFailed | 311 | Failed to start screen sharing |
AoqWarningCode
Enum value | Value | Description |
|---|---|---|
AoqWCOK | 0 | No warning |
AoqWCAudio | 100 | Audio generic warning |
AoqWCAudioHowling | 101 | Audio howling detected |
AoqWCAudioDevice | 120 | Audio device generic warning |
AoqWCAudioDeviceMicEnumerateError | 121 | Microphone enumeration error |
AoqWCAudioDeviceMicStartTimeout | 122 | Microphone start timeout |
AoqWCAudioDeviceRecordingError | 123 | Recording error |
AoqWCAudioDeviceSpeakerEnumerateError | 124 | Speaker enumeration error |
AoqWCAudioDeviceSpeakerStartTimeout | 125 | Speaker start timeout |
AoqWCAudioDevicePlayoutError | 126 | Playback error |
AoqWCVideo | 200 | Video generic warning |
AoqWCVideoCameraEnumerateError | 201 | Camera enumeration error |
AoqWCVideoEncoderSwitched | 202 | Video encoder switched |
AoqWCVideoRenderDowngrade | 203 | Video rendering downgraded |
AoqTrackType
Enum value | Value | Description |
|---|---|---|
AoqTrackTypeAudio | 0 | Audio track |
AoqTrackTypeVideo | 1 | Video track |
AoqTrackTypeData | 2 | Data messaging track |
| AoqTrackTypeScreen | 3 | Screen sharing track. Uplink only. |
AoqEncoderType
Track media encoding formats.
| Enum value | Value | Description |
|---|---|---|
| AoqEncoderTypeUnknown | 0 | Unknown format |
| AoqEncoderTypeAudioPCM | 1 | PCM audio |
| AoqEncoderTypeAudioOpus | 2 | Opus audio |
| AoqEncoderTypeVideoH264 | 3 | H.264 video |
| AoqEncoderTypeVideoJpeg | 4 | JPEG video |
| AoqEncoderTypeDataText | 5 | Text data |
AoqTrackMode
| Value | Number | Description |
|---|---|---|
| AoqTrackModeSegment | 0 | Segment mode: delivers data in semantic segments, such as sentences. Applies only to downstream audio. |
| AoqTrackModeStream | 1 | Stream mode: delivers data continuously. Applies only to downstream audio. |
AoqConnectionStatus
Enum value | Value | Description |
|---|---|---|
AoqConnectionStatusDisconnected | 0 | Disconnected |
AoqConnectionStatusConnecting | 1 | Connecting |
AoqConnectionStatusConnected | 2 | Connected |
AoqConnectionStatusFailed | 3 | Connection failed |
AoqMirrorMode
Mirror mode.
| Enum value | Value | Description |
|---|---|---|
| AoqMirrorModeDisabled | 0 | Mirroring disabled |
| AoqMirrorModeEnabled | 1 | Mirroring enabled |
AoqOrientationMode
Video orientation modes.
| Enum value | Value | Description |
|---|---|---|
| AoqOrientationModeAuto | 0 | Automatic |
| AoqOrientationModePortrait | 1 | Portrait |
| AoqOrientationModeLandscape | 2 | Landscape |
Audio types
AoqAudioCaptureConfig
Field | Type | Default | Description |
|---|---|---|---|
isExternal | boolean | false | true: use external audio input |
isVoipMode | boolean | false | true: enable VoIP mode (hardware AEC) |
channel | number | 1 | Channel count: 1 or 2 |
AoqAudioPlaybackConfig
Field | Type | Default | Description |
|---|---|---|---|
isVoipMode | boolean | false | true: enable VoIP mode (hardware AEC); first-write-wins between capture and playback config |
isDefaultSpeaker | boolean | true | true: default to speaker; false: default to earpiece |
isExternal | boolean | false | true: use external audio output |
channel | number | 1 | Channel count: 1 or 2 |
AoqAudioCodecConfig
Field | Type | Default | Description |
|---|---|---|---|
trackType | AoqTrackType | AoqTrackTypeAudio | Target track |
codecType | AoqEncoderType | AoqEncoderTypeAudioOpus | Codec format |
sampleRate | number | 48000 | Sample rate (Hz) |
channel | number | 1 | Channel count |
bitrate | number | 32000 | Bitrate (bps) |
AoqAudioDeviceStateCode
Audio device capture and playback state codes.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioDeviceNone | 0 | No state |
| AoqAudioDeviceRecordStarting | 1 | Capture starting |
| AoqAudioDeviceRecordStarted | 2 | Capture started |
| AoqAudioDeviceRecordStopping | 3 | Capture stopping |
| AoqAudioDeviceRecordStopped | 4 | Capture stopped |
| AoqAudioDeviceRecordFail | 5 | Capture failed |
| AoqAudioDevicePlayStarting | 6 | Playback starting |
| AoqAudioDevicePlayStarted | 7 | Playback started |
| AoqAudioDevicePlayStopping | 8 | Playback stopping |
| AoqAudioDevicePlayStopped | 9 | Playback stopped |
| AoqAudioDevicePlayFail | 10 | Playback failed |
AoqAudioDeviceState
Audio device state.
| Field | Type | Default value | Description |
|---|---|---|---|
| state | AoqAudioDeviceStateCode | AoqAudioDeviceNone | State code |
| reason | number | 0 | Error reason code (see AoqErrorCode) |
AoqAudioDeviceRouteType
Audio device route types.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioDeviceRouteDefault | 0 | Default route |
| AoqAudioDeviceRouteHeadset | 1 | Headset with microphone |
| AoqAudioDeviceRouteEarpiece | 2 | Earpiece |
| AoqAudioDeviceRouteHeadsetNoMic | 3 | Headset without microphone |
| AoqAudioDeviceRouteSpeakerPhone | 4 | Speaker |
| AoqAudioDeviceRouteUsb | 5 | USB audio device |
| AoqAudioDeviceRouteBluetooth | 6 | Bluetooth SCO mode |
| AoqAudioDeviceRouteBluetoothA2dp | 7 | Bluetooth A2DP mode |
Audio file types
AoqAudioFileMixConfig
Field | Type | Default | Description |
|---|---|---|---|
fileName | string | "" | File name (including path) |
cycles | number | -1 | Loop count; -1 means loop indefinitely |
startPosMs | number | 0 | Starting playback position (ms) |
publishVolume | number | 100 | Publishing volume [0, 100] |
playoutVolume | number | 100 | Local playback volume [0, 100] |
AoqAudioFileStateCode
Audio file state codes.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioFileNone | 0 | No state |
| AoqAudioFileStarted | 1 | Playback started |
| AoqAudioFileStopped | 2 | Playback stopped |
| AoqAudioFilePaused | 3 | Playback paused |
| AoqAudioFileResumed | 4 | Playback resumed |
| AoqAudioFileEnded | 5 | Playback ended |
| AoqAudioFileBuffering | 6 | Playback buffering |
| AoqAudioFileBufferingEnd | 7 | Buffering ended |
| AoqAudioFileFailed | 8 | Playback failed |
AoqAudioFileErrorCode
Audio file error codes.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioFileNoError | 0 | No error |
| AoqAudioFileOpenFailed | 1 | Failed to open file |
| AoqAudioFileDecodeFailed | 2 | Failed to decode file |
AoqAudioFileState
Audio file state.
| Field | Type | Default value | Description |
|---|---|---|---|
| fileId | string | "" | File ID |
| stateCode | AoqAudioFileStateCode | AoqAudioFileNone | State code |
| errorCode | AoqAudioFileErrorCode | AoqAudioFileNoError | Error code |
External audio stream and volume types
AoqAudioStreamDirection
External audio stream directions.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioStreamPublish | 0 | Publishing stream |
| AoqAudioStreamPlayout | 1 | Playback stream |
AoqAudioExternalStreamToggle
External audio stream toggle states.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioExternalStreamToggleNormal | 0 | Normal state |
| AoqAudioExternalStreamTogglePause | 1 | Paused state |
AoqAudioExternalStreamConfig
Field | Type | Default | Description |
|---|---|---|---|
trackType | AoqTrackType | AoqTrackTypeAudio | Track type |
codecType | AoqEncoderType | AoqEncoderTypeAudioPCM | Audio format |
channels | number | 1 | Channel count |
sampleRate | number | 48000 | Sample rate (Hz) |
playoutVolume | number | 100 | Playback volume [0, 100] |
publishVolume | number | 100 | Publishing volume [0, 100] |
maxBufferDuration | number | 1000 | Maximum buffer duration (ms) |
enable3A | boolean | false | Whether to apply 3A processing to input PCM |
AoqAudioFrameData
Field | Type | Description |
|---|---|---|
dataPtr | ArrayBuffer | Uint8Array | null | Raw PCM audio data |
dataSize | number | PCM data size (bytes) |
numOfSamples | number | Sample count (mono) |
bytesPerSample | number | Bytes per sample |
numOfChannels | number | Channel count |
samplesPerSec | number | Sample rate |
pushSequence | number | PCM push sequence number |
timeStamp | number | Timestamp |
autoGenMute | boolean | true: this is SDK-generated silence data |
AoqAudioSource
Audio frame callback data sources.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioSourceCaptured | 0 | Captured audio data |
| AoqAudioSourceProcessCaptured | 1 | Audio data after 3A processing |
| AoqAudioSourcePublish | 2 | Published audio data |
| AoqAudioSourcePlayback | 3 | Playback audio data |
AoqAudioObserverMode
Audio frame callback modes.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioObserverModeReadOnly | 0 | Read-only mode |
| AoqAudioObserverModeReadWrite | 1 | Read-write mode (the current OHOS NAPI path does not perform write-back and behaves as ReadOnly) |
AoqAudioObserverConfig
Field | Type | Default | Description |
|---|---|---|---|
sampleRate | number | 48000 | Callback sample rate |
channels | number | 1 | Callback channel count |
mode | AoqAudioObserverMode | ReadOnly | Read/write mode |
AoqAudioVolumeIndicationConfig
| Field | Type | Default | Description |
|---|---|---|---|
| reportSpeech | boolean | false | Whether to detect speech. |
| interval | number | 0 | Callback interval in milliseconds. Values of 0 or less disable callbacks; values between 0 and 10 use 10. |
| smooth | number | 3 | Smoothing factor, from 0 to 10. Higher values produce smoother results. |
AoqAudioVolume
| Field | Type | Description |
|---|---|---|
| isSpeech | boolean | Whether speech is detected. |
| volume | number | Smoothed instantaneous volume, from 0 to 255. |
Video types
AoqRenderMode
Rendering modes.
| Enum value | Value | Description |
|---|---|---|
| AoqRenderModeAuto | 0 | Automatic mode |
| AoqRenderModeStretch | 1 | Stretch mode. The image may be distorted. |
| AoqRenderModeFill | 2 | Letterbox mode. The entire image is preserved. |
| AoqRenderModeCrop | 3 | Crop mode. Part of the image may be lost. |
AoqVideoCanvas
Field | Type | Default | Description |
|---|---|---|---|
view | Object | null | null |
|
renderMode | AoqRenderMode | AoqRenderModeAuto | Display mode |
AoqCameraDirection
Camera direction.
| Enum value | Value | Description |
|---|---|---|
| AoqCameraDirectionFront | 0 | Front camera |
| AoqCameraDirectionBack | 1 | Rear camera |
AoqVideoCaptureConfig
Field | Type | Default | Description |
|---|---|---|---|
width | number | 1280 | Capture width; ignored when |
height | number | 720 | Capture height |
fps | number | 15 | Capture frame rate |
isExternal | boolean | false | true: do not open the camera; provide frames via |
cameraDirection | AoqCameraDirection | Front | Camera direction |
AoqScreenCaptureConfig
| Field | Type | Default | Description |
|---|---|---|---|
| isExternal | boolean | false | Whether the application supplies raw screen frames. |
AoqVideoPixelFormat
Enum value | Value | Description |
|---|---|---|
AoqVideoPixelFormatUnknown | 0 | Unknown |
AoqVideoPixelFormatI420 | 1 | I420 |
AoqVideoPixelFormatNV12 | 2 | NV12 |
AoqVideoPixelFormatNV21 | 3 | NV21 |
AoqVideoPixelFormatBGRA | 4 | BGRA |
AoqVideoPixelFormatRGBA | 5 | RGBA |
AoqVideoFrame
Field | Type | Description |
|---|---|---|
format | AoqVideoPixelFormat | Pixel format |
width | number | Width (pixels) |
height | number | Height (pixels) |
dataPtr | ArrayBuffer | Uint8Array | null | Packed format data |
dataSize | number | Packed data size (bytes) |
dataY / dataU / dataV | ArrayBuffer | Uint8Array | null | I420 planes |
strideY / strideU / strideV | number | Plane stride |
timeStamp | number | Timestamp (ms); when 0, the SDK uses the local clock |
AoqVideoCodecType
Codec type for externally encoded frames.
| Enum value | Value | Description |
|---|---|---|
| AoqVideoCodecTypeJPEG | 0 | JPEG encoding |
AoqVideoEncodedFrame
Field | Type | Description |
|---|---|---|
codec | AoqVideoCodecType | Encoding format ( |
data | ArrayBuffer | Uint8Array | Encoded frame data |
width | number | Width |
height | number | Height |
timeStamp | number | Timestamp (ms) |
AoqVideoCodecConfig
Field | Type | Default | Description |
|---|---|---|---|
trackType | AoqTrackType | AoqTrackTypeVideo | Target track |
codecType | AoqEncoderType | AoqEncoderTypeVideoH264 | Codec format |
width | number | 540 | Encoding width |
height | number | 960 | Encoding height |
fps | number | 5 | Frame rate |
bitrate | number | 500000 | Bitrate (bps) |
minBitrate | number | 128000 | Minimum bitrate (bps) |
keyframeInterval | number | 2 | Keyframe interval (seconds) |
mirrorMode | AoqMirrorMode | Disabled | Mirror mode |
orientationMode | AoqOrientationMode | Auto | Video orientation |
isExternal | boolean | false | true: the SDK skips re-encoding |
AoqVideoDeviceStateCode
Video device capture state codes.
| Enum value | Value | Description |
|---|---|---|
| AoqVideoDeviceNone | 0 | No state |
| AoqVideoDeviceCaptureStarting | 1 | Camera starting |
| AoqVideoDeviceCaptureStarted | 2 | Camera started |
| AoqVideoDeviceCaptureStopping | 3 | Camera stopping |
| AoqVideoDeviceCaptureStopped | 4 | Camera stopped |
| AoqVideoDeviceCaptureFail | 5 | Camera startup failed |
AoqVideoDeviceState
Video device state.
| Field | Type | Default value | Description |
|---|---|---|---|
| state | AoqVideoDeviceStateCode | AoqVideoDeviceNone | State code |
| reason | number | 0 | Error reason code (see AoqErrorCode) |
AoqScreenCaptureStateCode
| Value | Number | Description |
|---|---|---|
| AoqScreenCaptureNone | 0 | None |
| AoqScreenCaptureStarting | 1 | Starting |
| AoqScreenCaptureStarted | 2 | Input ready; does not indicate transmission |
| AoqScreenCaptureStopping | 3 | Stopping |
| AoqScreenCaptureStopped | 4 | Stopped |
| AoqScreenCaptureFail | 5 | Start or runtime failure |
AoqScreenCaptureState
| Field | Type | Default | Description |
|---|---|---|---|
| state | AoqScreenCaptureStateCode | — | Screen capture state. |
| reason | number | — | 0 for normal states; an AoqErrorCode on failure. |
Video frame callback types
AoqVideoSource
Video frame callback data sources (pipeline positions).
| Enum value | Value | Description |
|---|---|---|
| AoqVideoSourceCaptured | 0 | Video data after capture (before preprocessing) |
| AoqVideoSourcePreEncode | 1 | Video data before encoding (after preprocessing) |
| AoqVideoSourceRemote | 2 | Remote video data after decoding and before rendering |
AoqVideoObserverMode
Video frame callback modes.
| Enum value | Value | Description |
|---|---|---|
| AoqVideoObserverModeReadOnly | 0 | Read-only mode |
| AoqVideoObserverModeReadWrite | 1 | Read-write mode (the current OHOS NAPI path does not perform write-back and behaves as ReadOnly) |
AoqVideoObserverAlignment
Video output width alignment.
| Enum value | Value | Description |
|---|---|---|
| AoqVideoObserverAlignmentDefault | 0 | Default alignment |
| AoqVideoObserverAlignmentEven | 1 | Even alignment |
| AoqVideoObserverAlignment4 | 2 | 4-byte alignment |
| AoqVideoObserverAlignment8 | 3 | 8-byte alignment |
| AoqVideoObserverAlignment16 | 4 | 16-byte alignment |
AoqVideoObserverConfig
Field | Type | Default | Description |
|---|---|---|---|
format | AoqVideoPixelFormat | I420 | Callback pixel format |
alignment | AoqVideoObserverAlignment | Default | Width alignment |
mode | AoqVideoObserverMode | ReadOnly | Read/write mode |
mirrorApplied | boolean | false | Whether to apply mirroring |
| trackType | AoqTrackType | AoqTrackTypeVideo | Video track to observe. Supports Video and Screen only. |
Data message types
AoqDataMsg
Real-time message data structure.
| Field | Type | Default value | Description |
|---|---|---|---|
| data | ArrayBuffer / Uint8Array | Required | Message data |
Statistics types
AoqStats
Field | Type | Description |
|---|---|---|
audioPublishStats | AoqAudioPublishStats[] | Audio publish statistics |
videoPublishStats | AoqVideoPublishStats[] | Video publish statistics |
dataMsgPublishStats | AoqDataMsgPublishStats[] | Data message publish statistics |
audioSubscribeStats | AoqAudioSubscribeStats[] | Audio subscribe statistics |
videoSubscribeStats | AoqVideoSubscribeStats[] | Video subscribe statistics |
dataMsgSubscribeStats | AoqDataMsgSubscribeStats[] | Data message subscribe statistics |
networkStats | AoqNetworkStats | null | Network statistics |
AoqAudioPublishStats
Audio publishing statistics.
| Field | Type | Description |
|---|---|---|
| trackType | number | Track type (corresponding to AoqTrackType) |
| bitrate | number | Bitrate in bps |
| bytes | number | Total bytes sent |
| encodeVolume | number | Publishing encoding volume |
AoqVideoPublishStats
Video publishing statistics.
| Field | Type | Description |
|---|---|---|
| trackType | number | Track type (corresponding to AoqTrackType) |
| bitrate | number | Bitrate in bps |
| bytes | number | Total bytes sent |
| encodeFps | number | Encoding frame rate |
AoqDataMsgPublishStats
Data message publishing statistics.
| Field | Type | Description |
|---|---|---|
| trackType | number | Track type (corresponding to AoqTrackType) |
| bitrate | number | Bitrate in bps |
| bytes | number | Total bytes sent |
AoqAudioSubscribeStats
Audio subscription statistics.
| Field | Type | Description |
|---|---|---|
| trackType | number | Track type (corresponding to AoqTrackType) |
| bitrate | number | Bitrate in bps |
| bytes | number | Total bytes received |
| playVolume | number | Playback volume |
AoqVideoSubscribeStats
Video subscription statistics.
| Field | Type | Description |
|---|---|---|
| trackType | number | Track type (corresponding to AoqTrackType) |
| bitrate | number | Bitrate in bps |
| bytes | number | Total bytes received |
| decodeFps | number | Decoding frame rate |
| renderFps | number | Rendering frame rate |
AoqDataMsgSubscribeStats
Data message subscription statistics.
| Field | Type | Description |
|---|---|---|
| trackType | number | Track type (corresponding to AoqTrackType) |
| bitrate | number | Bitrate in bps |
| bytes | number | Total bytes received |
AoqNetworkStats
Network statistics.
| Field | Type | Description |
|---|---|---|
| sendBitrate | number | Send bitrate in bps |
| sendBytes | number | Total bytes sent |
| recvBitrate | number | Receive bitrate in bps |
| recvBytes | number | Total bytes received |
| loss | number | Packet loss rate (0-100) |
| rtt | number | Round-trip latency in milliseconds |