The AOQ Client SDK for Android provides a full set of real-time audio/video communication capabilities, including engine lifecycle management, audio/video capture and playback, codec configuration, external audio stream injection, audio file mixing, real-time messaging, and audio/video frame callbacks. This document is the complete Java API reference for the Android platform.
NoteThe AOQ SDK provides generic video APIs. Qwen-Audio-Realtime does not support video input or output. For the media capabilities of other models, see their access documentation.
API index
Engine lifecycle
| API | Description |
|---|---|
| createEngine | Create an engine instance (singleton) |
| destroy | Destroy the engine instance |
| getVersion | Get the SDK version |
| 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 listener |
| 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 listener |
| enableVideoFrameObserver | Enable or disable video frame callbacks at a specified stage |
Real-time messages
| API | Description |
|---|---|
| sendDataMsg | Send a real-time data message |
AoqClientListener 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 |
| onScreenCaptureStateChanged | Screen capture status change callback |
| onVideoDeviceStateChanged | Video device operation status change callback |
| onAudioDeviceFocusChanged | Audio focus change callback |
| onAudioFileState | Audio file playback status callback |
| onLocalAudioVolumeIndication | Local capture volume indication callback |
| onDataMsg | Received real-time data message callback |
AoqAudioFrameListener 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, such as echo cancellation and noise suppression. |
| onPublishAudioFrame | Called for an audio frame before publishing, immediately before encoding and transmission. |
| onPlaybackAudioFrame | Called for a remote audio frame before playback, after decoding and mixing. |
AoqVideoFrameListener callbacks
| API | Description |
|---|---|
| onCapturedVideoFrame | Called when a raw video frame is captured, before preprocessing. |
| 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).
Engine lifecycle
createEngineCreate the engine instance. The SDK holds the engine as a global singleton; calling this method again returns the existing instance.
@NonNull
public static AoqClientEngine createEngine(
@NonNull Context context,
@NonNull AoqCreateConfig config,
@NonNull AoqClientListener listener)
Parameter | Type | Description |
|---|---|---|
context | Context | Android application context |
config | AoqCreateConfig | Engine creation configuration |
listener | AoqClientListener | Engine event callback listener |
Returns: AoqClientEngine instance; never null.
destroyDestroys the engine instance and releases all resources. Call createEngine again before using the SDK after destruction.
public static int destroy()
Parameters: None.
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
getVersionGets the current SDK version. Can be called before createEngine.
@NonNull
public static String getVersion()
Parameters: None.
Return value: A version string, such as "1.3.0".
connectConnects to the Relay server. The AppServer sends the connection parameters to the client. This call returns immediately. The actual connection result is reported through the onConnectionStatusChange callback.
NoteIn the generic SDK API documentation, the AppServer allocates connection parameters through /api/v1/allocate. For a specific model, see Qwen-Omni-Realtime AOQ access, Qwen-Audio-Realtime AOQ access, or Qwen-LiveTranslate-Realtime AOQ access.
public abstract int connect(@NonNull AoqConnectConfig config)
| Parameter | Type | Description |
|---|---|---|
| config | AoqConnectConfig | Connection configuration, including Token, SID, Relay endpoints, and publishing/subscription tracks |
Return value: 0 indicates that the call has been dispatched for asynchronous execution. A nonzero value indicates parameter validation failure and corresponds to AoqErrorCode.
NoteThe Screen track supports upstream transmission only; downstream subscription is not implemented. Do not include AoqTrackTypeScreen in config.subscribeTracks. Otherwise, AoqECUnSupport is returned and no connection is initiated. Do not enable media sending with enableSendMediaStream(true) before the connection succeeds. Enable it after onConnectionStatusChange reports Connected.
Disconnects from the server and releases connection resources. Returns immediately. The disconnection result is reported through onConnectionStatusChange.
public abstract int disconnect()
Parameters: None.
Return value: 0 indicates that the call has been dispatched for asynchronous execution. A nonzero value indicates failure and corresponds to AoqErrorCode.
Audio device management
startAudioCapture
Opens the audio capture device (microphone) and starts capturing local audio. For external audio input (pushAudioExternalStreamData), set isExternal to true. In this mode, the microphone is not opened.
public abstract int startAudioCapture(@NonNull AoqAudioCaptureConfig config)
| Parameter | Type | Description |
|---|---|---|
| config | AoqAudioCaptureConfig | Audio capture configuration |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode. For example, AoqECAudioDeviceRecordingAuthFailed indicates that recording permission has not been granted.
NoteOn Android, request the RECORD_AUDIO permission before calling this method. Device state changes are reported through onAudioDeviceStateChanged.
stopAudioCapture
Closes the audio capture device and stops local audio capture.
public abstract int stopAudioCapture()
Parameters: None.
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
muteAudioCapture
Mutes or unmutes audio capture. Unlike stopAudioCapture, muting keeps capture running but sends silent frames.
public abstract int muteAudioCapture(boolean mute)
| Parameter | Type | Description |
|---|---|---|
| mute | boolean | true mutes capture; false unmutes it. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteThis method takes effect only after startAudioCapture is called.
startAudioPlayer
Starts audio rendering and plays remote audio through the speaker or earpiece. For external rendering (playing PCM yourself), set isExternal to true.
public abstract int startAudioPlayer(@NonNull AoqAudioPlaybackConfig config)
| Parameter | Type | Description |
|---|---|---|
| config | AoqAudioPlaybackConfig | Audio playback configuration |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode. For example, AoqECAudioDevicePlayoutOccupied indicates that the playback device is occupied.
NoteDevice state changes are reported through onAudioDeviceStateChanged. Output route changes are reported through onAudioDeviceRouteChanged.
stopAudioPlayer
Stops audio rendering and closes the playback device.
public abstract int stopAudioPlayer()
Parameters: None.
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
pauseAudioPlayer
Pauses audio rendering with optional fade-out. Remote audio data continues to arrive while paused but is not played.
public abstract int pauseAudioPlayer(int fadeMs)
| Parameter | Type | Description |
|---|---|---|
| fadeMs | int | Fade-out duration in milliseconds. 0 pauses playback immediately. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
resumeAudioPlayer
Resumes audio rendering with optional fade-in. Call this method after pauseAudioPlayer.
public abstract int resumeAudioPlayer(int fadeMs)
| Parameter | Type | Description |
|---|---|---|
| fadeMs | int | Fade-in duration in milliseconds. 0 resumes playback immediately. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
interruptAudioPlayer
Interrupts the current audio conversation and clears the playback buffer. This is commonly used when a user interrupts AI speech in a conversation.
public abstract int interruptAudioPlayer(@NonNull AoqTrackType trackType, int fadeMs)
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Type of the track to interrupt |
| fadeMs | int | Fade-out duration in milliseconds. 0 interrupts playback immediately. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
enableSpeakerphone
Switches audio output to the speaker or earpiece. Takes effect only after startAudioPlayer.
public abstract int enableSpeakerphone(boolean enable)
| Parameter | Type | Description |
|---|---|---|
| enable | boolean | true switches to the speaker; false switches to the earpiece. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode. For example, AoqECAudioDeviceEarpieceRequiresVoipMode indicates that the earpiece requires VoIP mode.
NoteSwitching to the earpiece requires AoqAudioPlaybackConfig.isVoipMode=true. Route changes are reported through onAudioDeviceRouteChanged.
isSpeakerphoneEnabled
Checks whether audio is currently output through the speaker.
public abstract boolean isSpeakerphoneEnabled()
Parameters: None.
Return value: true indicates speaker output. false indicates the earpiece or another route.
Audio codec configuration
Audio encoding configuration
setAudioEncoderConfig
Configures audio encoding for publishing. Configuration changes take effect immediately.
public abstract int setAudioEncoderConfig(@NonNull AoqAudioCodecConfig config)
| Parameter | Type | Description |
|---|---|---|
| config | AoqAudioCodecConfig | Audio encoding configuration. Set trackType to AoqTrackTypeAudio. |
Return value: 0 on success; non-zero on failure (an AoqErrorCode value, such as AoqECParamInvalid for invalid parameters).
NotecodecType specifies the encoding format (Opus by default). sampleRate and channel must match the capture settings. bitrate applies only to lossy codecs such as Opus.
setAudioDecoderConfig
Configures audio decoding for subscribed audio. The settings must match the remote encoding settings.
public abstract int setAudioDecoderConfig(@NonNull AoqAudioCodecConfig config)
| Parameter | Type | Description |
|---|---|---|
| config | AoqAudioCodecConfig | Audio decoding configuration. Set trackType to AoqTrackTypeAudio. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NotesampleRate must match the output sample rate of the remote encoder. A mismatch may cause decoding errors or audio quality issues.
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.
public abstract int startAudioFile(@NonNull String fileId, @NonNull AoqAudioFileMixConfig config)
| Parameter | Type | Description |
|---|---|---|
| fileId | String | Application-defined file identifier used for subsequent control |
| config | AoqAudioFileMixConfig | Audio file playback configuration |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NotePlayback state changes are reported through onAudioFileState. Repeated calls with the same fileId replace the previous playback.
stopAudioFile
Stops audio file playback.
public abstract int stopAudioFile(@NonNull String fileId)
| Parameter | Type | Description |
|---|---|---|
| fileId | String | File identifier, matching the value passed to startAudioFile |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
pauseAudioFile
Pauses audio file playback.
public abstract int pauseAudioFile(@NonNull String fileId)
| Parameter | Type | Description |
|---|---|---|
| fileId | String | File identifier |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
resumeAudioFile
Resumes audio file playback. Call this method after pauseAudioFile.
public abstract int resumeAudioFile(@NonNull String fileId)
| Parameter | Type | Description |
|---|---|---|
| fileId | String | File identifier |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
getAudioFileDuration
Gets the total duration of an audio file.
public abstract long getAudioFileDuration(@NonNull String fileId)
| Parameter | Type | Description |
|---|---|---|
| fileId | String | File identifier |
Return value: The total duration in milliseconds. Returns 0 if the file is not loaded or does not exist.
getAudioFileCurrentPosition
Gets the current playback position of an audio file.
public abstract long getAudioFileCurrentPosition(@NonNull String fileId)
| Parameter | Type | Description |
|---|---|---|
| fileId | String | File identifier |
Return value: The current playback position in milliseconds. Returns 0 if the file is not loaded or does not exist.
setAudioFilePositionMillis
Sets the playback position of an audio file (seek).
public abstract int setAudioFilePositionMillis(@NonNull String fileId, long positionMillis)
| Parameter | Type | Description |
|---|---|---|
| fileId | String | File identifier |
| positionMillis | long | Target playback position in milliseconds |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
setAudioFileVolume
Sets the audio file volume. Streaming and local playback volumes can be controlled separately.
public abstract int setAudioFileVolume(@NonNull String fileId, @NonNull AoqAudioStreamDirection type, int volume)
| Parameter | Type | Description |
|---|---|---|
| fileId | String | File identifier |
| type | AoqAudioStreamDirection | Volume direction. AoqAudioStreamPublish controls streaming; AoqAudioStreamPlayout controls playback. |
| volume | int | Volume. Valid values: 0-100. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
getAudioFileVolume
Gets the current audio file volume.
public abstract int getAudioFileVolume(@NonNull String fileId, @NonNull AoqAudioStreamDirection type)
| Parameter | Type | Description |
|---|---|---|
| fileId | String | File identifier |
| type | AoqAudioStreamDirection | Volume direction |
Return value: The current volume (0-100). Returns 0 if the file does not exist.
External audio streams
addAudioExternalStream
Adds an external audio stream. Multiple independent streams can be created and distinguished by streamId.
public abstract int addAudioExternalStream(@NonNull String streamId, @NonNull AoqAudioExternalStreamConfig config)
| Parameter | Type | Description |
|---|---|---|
| streamId | String | Application-defined external stream identifier |
| config | AoqAudioExternalStreamConfig | External audio stream configuration |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
pushAudioExternalStreamData
Feeds external PCM audio data into the specified stream.
public abstract int pushAudioExternalStreamData(@NonNull String streamId, @NonNull AoqAudioFrameData data)
| Parameter | Type | Description |
|---|---|---|
| streamId | String | External stream identifier |
| data | AoqAudioFrameData | PCM audio frame data |
Return value: 0 indicates success. A nonzero value indicates failure. AoqECAudioExternalBufferFull(110) is returned when the buffer is full. data needs to remain valid only during the call; the SDK copies it internally. The sample rate and channel count must match the configuration passed to addAudioExternalStream.
setAudioExternalStreamVolume
Sets the external audio stream volume. Streaming and local playback volumes can be controlled separately.
public abstract int setAudioExternalStreamVolume(@NonNull String streamId, @NonNull AoqAudioStreamDirection type, int volume)
| Parameter | Type | Description |
|---|---|---|
| streamId | String | External stream identifier |
| type | AoqAudioStreamDirection | Volume direction |
| volume | int | Volume. Valid values: 0-100. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
getAudioExternalStreamVolume
Gets the current external audio stream volume.
public abstract int getAudioExternalStreamVolume(@NonNull String streamId, @NonNull AoqAudioStreamDirection type)
| Parameter | Type | Description |
|---|---|---|
| streamId | String | External stream identifier |
| type | AoqAudioStreamDirection | Volume direction |
Return value: The current volume (0-100). Returns 0 if the stream does not exist.
clearAudioExternalStreamBuffer
Clears the external audio stream buffer with optional fade-out. Commonly used to interrupt current playback.
public abstract void clearAudioExternalStreamBuffer(@NonNull String streamId, int fadeoutMs)
| Parameter | Type | Description |
|---|---|---|
| streamId | String | External stream identifier |
| fadeoutMs | int | 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. |
Return value: None (void).
NoteIf the buffer is full, pushAudioExternalStreamData returns AoqECAudioExternalBufferFull(110). Wait 30 ms before retrying.
removeAudioExternalStream
Removes an external audio stream and releases its resources.
public abstract int removeAudioExternalStream(@NonNull String streamId)
| Parameter | Type | Description |
|---|---|---|
| streamId | String | External stream identifier |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
Audio frame callbacks
setAudioFrameObserver
Sets the audio frame listener. Pass listener=null to remove it.
public abstract int setAudioFrameObserver(@Nullable AoqClientListener.AoqAudioFrameListener listener)
| Parameter | Type | Description |
|---|---|---|
| listener | AoqAudioFrameListener | Audio frame listener. Pass null to remove it. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteUse this method to set the listener first, then call enableAudioFrameObserver to enable callbacks at the required positions.
enableAudioFrameObserver
Enables or disables audio frame callbacks at the specified position.
public abstract int enableAudioFrameObserver(boolean enabled, @NonNull AoqAudioSource audioSource, @NonNull AoqAudioObserverConfig config)
| 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 |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode. Callback data is valid only during the callback. Make a copy for asynchronous use.
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.
public abstract int enableLocalAudioVolumeIndication(@NonNull AoqAudioVolumeIndicationConfig config)
| Parameter | Type | Description |
|---|---|---|
| config | AoqAudioVolumeIndicationConfig | Volume indication configuration. interval<=0 disables callbacks. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteCall this method after startAudioCapture to obtain volume data. Values of interval>0 and <10 are treated as 10.
Video device management
startVideoCapture
Opens the video capture device (camera). Captured video is sent over AoqTrackTypeVideo. For external video input (pushExternalVideoCapturedFrame), set isExternal to true; the camera is not opened in this mode.
public abstract int startVideoCapture(@NonNull AoqVideoCaptureConfig config)
| Parameter | Type | Description |
|---|---|---|
| config | AoqVideoCaptureConfig | Video capture configuration. |
Return value: 0 on success; non-zero on failure (an AoqErrorCode value, such as AoqECVideoDeviceCameraAuthFailed when camera permission has not been granted).
NoteOn Android, request CAMERA permission before calling this method. Device state changes are reported through onVideoDeviceStateChanged.
stopVideoCapture
Closes the video capture device and stops local video capture.
public abstract int stopVideoCapture()
Parameters: None.
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
switchCamera
Switches between the front and rear cameras. Call this method after startVideoCapture(isExternal=false).
public abstract int switchCamera(@NonNull AoqCameraDirection direction)
| Parameter | Type | Description |
|---|---|---|
| direction | AoqCameraDirection | Target camera direction: AoqCameraDirectionFront for the front camera and AoqCameraDirectionBack for the rear camera. |
Return value: 0 on success; < 0 on failure (an AoqErrorCode value).
NoteThis method has no effect in external capture mode (isExternal=true).
setLocalView
Sets or removes the local video rendering view. Pass canvas=null or canvas.view=null to remove rendering.
public abstract int setLocalView(@NonNull AoqTrackType trackType, @Nullable AoqVideoCanvas canvas)
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type |
| canvas | AoqVideoCanvas | Video rendering canvas. Pass null to remove rendering. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
setRemoteView
Sets or removes the remote video rendering view. Pass canvas=null or canvas.view=null to unbind it.
public abstract int setRemoteView(@NonNull AoqTrackType trackType, @Nullable AoqVideoCanvas canvas)
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type |
| canvas | AoqVideoCanvas | Video rendering canvas. Pass null to unbind it. |
Return value: 0 on success; non-zero on failure. If trackType is AoqTrackTypeScreen, returns AoqECUnSupport and does not bind the view.
NoteThe Screen track currently supports publishing only and has no remote video to render. Do not set trackType to AoqTrackTypeScreen.
Video encoding and external input
setVideoEncoderConfig
Configures video encoding for publishing. If isExternal=true, pushExternalVideoEncodedFrame sends encoded frames directly by trackType without re-encoding by the SDK.
public abstract int setVideoEncoderConfig(@NonNull AoqVideoCodecConfig config)
| Parameter | Type | Description |
|---|---|---|
| config | AoqVideoCodecConfig | Video encoding configuration. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteBefore using pushExternalVideoEncodedFrame, call this method with isExternal=true. This mode bypasses the capture pipeline and does not require startVideoCapture/startScreenCapture. When using pushExternalVideoCapturedFrame, keep isExternal=false so that the SDK encodes the frames.
setVideoDecoderConfig
Configures video decoding for subscribed video, routed by config.trackType.
Only trackType, codecType, width, height, fps, and bitrate apply to decoding. The other fields apply only to encoding.
public abstract int setVideoDecoderConfig(@NonNull AoqVideoCodecConfig config)
| Parameter | Type | Description |
|---|---|---|
| config | AoqVideoCodecConfig | Video decoding configuration. |
Return value: 0 on success; non-zero on failure. If config.trackType is AoqTrackTypeScreen, returns AoqECUnSupport and does not apply the configuration.
NoteThe Screen track currently supports publishing only, not subscribing. Do not set config.trackType to AoqTrackTypeScreen.
pushExternalVideoCapturedFrame
Pushes external raw video frames for encoding and transmission by the SDK. Frames are routed by trackType. External capture must be enabled for the corresponding track.
public abstract int pushExternalVideoCapturedFrame(@NonNull AoqTrackType trackType, @NonNull AoqVideoFrame frame)
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type. For AoqTrackTypeVideo, call startVideoCapture(isExternal=true) first. For AoqTrackTypeScreen, call startScreenCapture(isExternal=true) first. |
| frame | AoqVideoFrame | External video frame data. |
Return value: 0 on success; AoqECVideoExternalCaptureNotEnabled(211) if external capture is not enabled for the track; < 0 on failure. Frame data is valid only during the call. The SDK copies it internally.
pushExternalVideoEncodedFrame
Pushes external encoded video frames. The SDK packetizes and sends them without re-encoding. Frames are consumed only after setVideoEncoderConfig(isExternal=true) is called for the corresponding trackType. startVideoCapture/startScreenCapture is not required.
public abstract int pushExternalVideoEncodedFrame(@NonNull AoqTrackType trackType, @NonNull AoqVideoEncodedFrame frame)
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type |
| frame | AoqVideoEncodedFrame | External encoded video frame. |
Return value: 0 on success; AoqECVideoExternalEncoderNotEnabled(212) if external encoding is not enabled for the track; < 0 on failure.
Noteframe.timeStamp is passed through unchanged. The SDK does not fill it in. The caller must ensure that timestamps increase monotonically.
NotepushExternalVideoCapturedFrame consumes Video frames after startVideoCapture(isExternal=true) and Screen frames after startScreenCapture(isExternal=true). If the internal buffer is full, the method returns AoqECVideoExternalBufferFull (210).
Screen capture
public abstract int startScreenCapture(@NonNull AoqScreenCaptureConfig config)
public abstract int stopScreenCapture()
trackType supports AoqTrackTypeAudio, AoqTrackTypeVideo, and AoqTrackTypeScreen.
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. 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 through MediaProjection. Starting capture again while it is active returns AoqECStateInvalid; stopping is idempotent.
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
Enables or disables sending a local media stream, selected by trackType. When sending is disabled, capture and encoding continue, but data is not sent over the network.
public abstract int enableSendMediaStream(@NonNull AoqTrackType trackType, boolean enable)
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type. Supports AoqTrackTypeAudio/AoqTrackTypeVideo/AoqTrackTypeScreen. |
| enable | boolean | true enables sending; false disables sending. |
Return value: 0 indicates a successful call. A value less than 0 indicates failure and corresponds to AoqErrorCode.
NoteAfter initialization, call enableSendMediaStream(false) first. Enable sending after onConnectionStatusChange reports Connected to avoid losing data before the connection is established.
Video frame callbacks
setVideoFrameObserver
Sets the video frame listener. Pass listener=null to remove it.
public abstract int setVideoFrameObserver(@Nullable AoqClientListener.AoqVideoFrameListener listener)
| Parameter | Type | Description |
|---|---|---|
| listener | AoqVideoFrameListener | Video frame listener. Pass null to remove it. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteUse this method to set the listener first, then call enableVideoFrameObserver to enable callbacks at the required positions.
enableVideoFrameObserver
Enables or disables video frame callbacks at the specified position.
public abstract int enableVideoFrameObserver(boolean enabled, @NonNull AoqVideoSource videoSource, @NonNull AoqVideoObserverConfig config)
| 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. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteCallbacks run on internal SDK threads. Do not perform time-consuming operations in them. Only I420 supports read-write mode (mode=ReadWrite); other formats are read-only.
AoqClientListener callbacks
AoqClientListener is the unified delivery point for all asynchronous events from the SDK. All callback methods have a default empty implementation, so you only need to override the ones you care about.
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.
public abstract int sendDataMsg(@NonNull AoqDataMsg msg)
| Parameter | Type | Description |
|---|---|---|
| msg | AoqDataMsg | Data message |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteThe remote end receives the message through onDataMsg. Message size is subject to internal SDK limits. Split oversized messages into smaller parts before sending.
AoqClientListener callbacks
onError
Engine error callback. Triggered when an unrecoverable error occurs.
public void onError(int code, String message)
| Parameter | Type | Description |
|---|---|---|
| code | int | Error code corresponding to an AoqErrorCode enum value |
| message | String | Error description |
Return value: None (void).
onWarning
Engine warning callback. Triggered by recoverable exceptions that do not prevent the SDK from continuing to run.
public void onWarning(int code, String message)
| Parameter | Type | Description |
|---|---|---|
| code | int | Warning code corresponding to an AoqWarningCode enum value |
| message | String | Warning description |
Return value: None (void).
onConnectionStatusChange
Connection state change callback. State transitions: Disconnected → Connecting → Connected/Failed → Disconnected.
public void onConnectionStatusChange(@NonNull AoqClientEngine.AoqConnectionStatus status)
| Parameter | Type | Description |
|---|---|---|
| status | AoqConnectionStatus | Current connection state |
Return value: None (void).
NoteEnable media sending with enableSendMediaStream(true) after receiving Connected.
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.
public void onStats(@NonNull AoqClientEngine.AoqStats stats)
| Parameter | Type | Description |
|---|---|---|
| stats | AoqStats | Statistics for audio/video/data message publishing and subscription, and network statistics |
Return value: None (void).
onAudioDeviceStateChanged
Callback for audio device capture/playback state changes.
public void onAudioDeviceStateChanged(@NonNull AoqClientEngine.AoqAudioDeviceState state)
| Parameter | Type | Description |
|---|---|---|
| state | AoqAudioDeviceState | Audio device state, including state (state code) and reason (error reason) |
Return value: None (void).
onAudioDeviceRouteChanged
Callback for audio output route changes.
public void onAudioDeviceRouteChanged(int routeType)
| Parameter | Type | Description |
|---|---|---|
| routeType | int | Current audio output route, corresponding to an AoqAudioDeviceRouteType enum value |
Return value: None (void).
onAudioDeviceInterrupted
Audio device interruption callback. Triggered by system interruptions, such as incoming calls or another app taking audio focus.
public void onAudioDeviceInterrupted(boolean interrupt)
| Parameter | Type | Description |
|---|---|---|
| interrupt | boolean | true indicates interruption; false indicates recovery from interruption. |
Return value: None (void).
onScreenCaptureStateChanged
Reports screen capture state changes using AoqScreenCaptureStateCode and the unified AoqErrorCode. Notifications are delivered in order on the Android main thread.
public void onScreenCaptureStateChanged(@NonNull AoqClientEngine.AoqScreenCaptureState state)
| Parameter | Type | Description |
|---|---|---|
| state | AoqScreenCaptureState | Screen capture state, including state (state code) and reason (error cause). |
Return value: None (void).
NoteStarted indicates that capture or external input is ready, not that media has been sent. Fail and Stopped are terminal states after cleanup. Capture failures are reported only through this callback.
onVideoDeviceStateChanged
Callback for video device capture state changes.
public void onVideoDeviceStateChanged(@NonNull AoqClientEngine.AoqVideoDeviceState state)
| Parameter | Type | Description |
|---|---|---|
| state | AoqVideoDeviceState | Video device state, including state (state code) and reason (error reason) |
Return value: None (void).
onAudioDeviceFocusChanged
Callback for audio focus changes.
public void onAudioDeviceFocusChanged(int audioFocus)
| Parameter | Type | Description |
|---|---|---|
| audioFocus | int | Android AUDIOFOCUS_* constant, such as AUDIOFOCUS_GAIN, AUDIOFOCUS_LOSS, or AUDIOFOCUS_LOSS_TRANSIENT |
Return value: None (void).
onAudioFileState
Audio file playback state callback.
public void onAudioFileState(@NonNull AoqClientEngine.AoqAudioFileState state)
| Parameter | Type | Description |
|---|---|---|
| state | AoqAudioFileState | Audio file playback state, including fileId, stateCode, and errorCode |
Return value: None (void).
onLocalAudioVolumeIndication
Reports the locally captured audio volume. Triggered only after volume indications are enabled through enableLocalAudioVolumeIndication.
public void onLocalAudioVolumeIndication(@NonNull AoqClientEngine.AoqAudioVolume volume)
| Parameter | Type | Description |
|---|---|---|
| volume | AoqAudioVolume | Local volume information, including isSpeech (whether speech is detected) and volume (smoothed instantaneous volume [0-255]). |
Return value: None (void).
onDataMsg
Callback for received real-time data messages.
public void onDataMsg(@NonNull AoqClientEngine.AoqDataMsg msg)
| Parameter | Type | Description |
|---|---|---|
| msg | AoqDataMsg | Data message |
Return value: None (void). Message data is valid only during the callback. Make a copy for asynchronous use.
AoqAudioFrameListener callbacks
Audio frame listener interface. All methods have empty default implementations and can be overridden as needed.
public interface AoqAudioFrameListener {
default void onCapturedAudioFrame(@NonNull AoqAudioFrameData frame) {}
default void onProcessCapturedAudioFrame(@NonNull AoqAudioFrameData frame) {}
default void onPublishAudioFrame(@NonNull AoqTrackType trackType, @NonNull AoqAudioFrameData frame) {}
default void onPlaybackAudioFrame(@NonNull AoqAudioFrameData frame) {}
}
| Method | When triggered | Parameter |
|---|---|---|
| onCapturedAudioFrame | When a raw audio frame is captured | frame: AoqAudioFrameData |
| onProcessCapturedAudioFrame | Audio frame after 3A processing | frame: AoqAudioFrameData |
| onPublishAudioFrame | Audio frame before publishing | trackType: track type; frame: AoqAudioFrameData |
| onPlaybackAudioFrame | Remote audio frame before playback | frame: AoqAudioFrameData |
Return value: None (void). Frame data is valid only during the callback.
onCapturedAudioFrame
Called when a raw audio frame is captured. The frame contains unprocessed PCM data.
void onCapturedAudioFrame(@NonNull AoqAudioFrameData frame)
| Parameter | Type | Description |
|---|---|---|
| frame | AoqAudioFrameData | Captured audio frame data |
Return value: None (void).
Noteframe.dataPtr references SDK-managed memory and is valid only during the callback. Copy the data before using it asynchronously.
onProcessCapturedAudioFrame
Called for an audio frame after 3A processing, such as echo cancellation and noise suppression.
void onProcessCapturedAudioFrame(@NonNull AoqAudioFrameData frame)
| Parameter | Type | Description |
|---|---|---|
| frame | AoqAudioFrameData | Audio frame data after 3A processing |
Return value: None (void).
Noteframe.dataPtr references SDK-managed memory and is valid only during the callback. Copy the data before using it asynchronously.
onPublishAudioFrame
Called for an audio frame before publishing, immediately before encoding and transmission.
void onPublishAudioFrame(@NonNull AoqTrackType trackType, @NonNull AoqAudioFrameData frame)
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type |
| frame | AoqAudioFrameData | Audio frame data before publishing |
Return value: None (void).
Noteframe.dataPtr references SDK-managed memory and is valid only during the callback. Copy the data before using it asynchronously.
onPlaybackAudioFrame
Called for a remote audio frame before playback, after decoding and mixing.
void onPlaybackAudioFrame(@NonNull AoqAudioFrameData frame)
| Parameter | Type | Description |
|---|---|---|
| frame | AoqAudioFrameData | Remote audio frame data before playback |
Return value: None (void).
Noteframe.dataPtr references SDK-managed memory and is valid only during the callback. Copy the data before using it asynchronously.
AoqVideoFrameListener callbacks
Video frame listener interface. All methods have default implementations that return false, indicating no data modification. Each of the three callbacks includes trackType to distinguish Video and Screen tracks.
public interface AoqVideoFrameListener {
default boolean onCapturedVideoFrame(@NonNull AoqTrackType trackType, @NonNull AoqVideoFrameData frame) { return false; }
default boolean onPreEncodeVideoFrame(@NonNull AoqTrackType trackType, @NonNull AoqVideoFrameData frame) { return false; }
default boolean onRemoteVideoFrame(@NonNull AoqTrackType trackType, @NonNull AoqVideoFrameData frame) { return false; }
}
| Method | When triggered | Parameter |
|---|---|---|
| onCapturedVideoFrame | When a raw video frame is captured (before preprocessing) | trackType: track type; frame: AoqVideoFrameData |
| onPreEncodeVideoFrame | Video frame before encoding (after preprocessing) | trackType: track type; frame: AoqVideoFrameData |
| onRemoteVideoFrame | Remote video frame after decoding and before rendering | trackType: track type; frame: AoqVideoFrameData |
Return value: boolean. true indicates that the data was modified and must be written back to the SDK (supported only for I420). false indicates no modification.
NoteCallbacks are triggered only after enableVideoFrameObserver enables the corresponding AoqVideoSource. frame.data and textureId reference internal SDK memory and are valid only during the callback. Make a copy for asynchronous use.
onCapturedVideoFrame
Called when a raw video frame is captured, before preprocessing.
boolean onCapturedVideoFrame(@NonNull AoqTrackType trackType, @NonNull AoqVideoFrameData frame)
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type (Video/Screen) |
| frame | AoqVideoFrameData | Captured video frame data |
Return value: boolean. true indicates that modified data must be written back to the SDK (supported only for I420). false indicates no modification.
NoteCallbacks are triggered only after enableVideoFrameObserver enables the corresponding AoqVideoSource. frame.data and textureId reference internal SDK memory and are valid only during the callback. Make a copy for asynchronous use.
onPreEncodeVideoFrame
Called for a video frame after preprocessing and before encoding.
boolean onPreEncodeVideoFrame(@NonNull AoqTrackType trackType, @NonNull AoqVideoFrameData frame)
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type (Video/Screen) |
| frame | AoqVideoFrameData | Video frame data before encoding |
Return value: boolean. true indicates that modified data must be written back to the SDK (supported only for I420). false indicates no modification.
NoteCallbacks are triggered only after enableVideoFrameObserver enables the corresponding AoqVideoSource. frame.data and textureId reference internal SDK memory and are valid only during the callback. Make a copy for asynchronous use.
onRemoteVideoFrame
Called for a remote video frame after decoding and before rendering.
boolean onRemoteVideoFrame(@NonNull AoqTrackType trackType, @NonNull AoqVideoFrameData frame)
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type (Video/Screen) |
| frame | AoqVideoFrameData | Decoded remote video frame data |
Return value: boolean. true indicates that modified data must be written back to the SDK (supported only for I420). false indicates no modification.
NoteCallbacks are triggered only after enableVideoFrameObserver enables the corresponding AoqVideoSource. frame.data and textureId reference internal SDK memory and are valid only during the callback. Make a copy for asynchronous use.
Data types and enumerations
Common types
AoqRelayEndpoint
Relay endpoint.
| Field | Type | Default value | Description |
|---|---|---|---|
| routeIndex | int | -1 | Route index |
| endpoint | String | "" | Relay server domain name or IP address |
| port | int | 0 | Relay server UDP port |
| tcpPort | int | 0 | Relay server TCP port |
AoqTrackParam
Track properties.
| Field | Type | Default value | Description |
|---|---|---|---|
| trackType | AoqTrackType | AoqTrackTypeAudio | Track type |
| trackMode | AoqTrackMode | AoqTrackModeSegment | Streaming or non-streaming mode. Applies only to downstream audio. |
AoqTrackParam.trackMode
| Field | Type | Default | Description |
|---|---|---|---|
| trackMode | AoqTrackMode | AoqTrackModeSegment | Applies only to downstream audio. |
Field | Type | Default | Description |
|---|---|---|---|
workDir | String | "" | SDK working directory |
isBTScoMode | boolean | false | true: Bluetooth SCO mode; false: A2DP mode |
enableDumpAudio | boolean | false | Enable audio dump (for debugging) |
extras | String | "" | Extra parameters string |
| maxEncodedVideoFrameBytes | int | 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. |
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 | List<AoqRelayEndpoint> | empty | List of Relay endpoints |
workspaceIdHash | String | "" | Workspace ID hash |
publishTracks | List<AoqTrackParam> | empty | Local tracks to publish |
subscribeTracks | List<AoqTrackParam> | empty | Remote tracks to subscribe to |
Statistics types
AoqNetworkStatsField | Type | Description |
|---|---|---|
sendBitrate | int | Send bitrate (bps) |
sendBytes | long | Cumulative bytes sent |
recvBitrate | int | Receive bitrate (bps) |
recvBytes | long | Cumulative bytes received |
loss | int | Packet loss rate (0–100) |
rtt | int | Round-trip time (ms) |
AoqStats
Engine statistics. Reported periodically through onStats. All fields can be null.
| Field | Type | Description |
|---|---|---|
| audioPublishStats | AoqAudioPublishStats array | Audio publishing statistics array (@Nullable) |
| videoPublishStats | AoqVideoPublishStats array | Video publishing statistics array (@Nullable) |
| dataMsgPublishStats | AoqDataMsgPublishStats array | Data message publishing statistics array (@Nullable) |
| audioSubscribeStats | AoqAudioSubscribeStats array | Audio subscription statistics array (@Nullable) |
| videoSubscribeStats | AoqVideoSubscribeStats array | Video subscription statistics array (@Nullable) |
| dataMsgSubscribeStats | AoqDataMsgSubscribeStats array | Data message subscription statistics array (@Nullable) |
| networkStats | AoqNetworkStats | Network statistics (@Nullable) |
AoqAudioPublishStats
Audio publishing statistics.
| Field | Type | Default value | Description |
|---|---|---|---|
| trackType | AoqTrackType | AoqTrackTypeAudio | Track type |
| bitrate | int | 0 | Bitrate in bps |
| bytes | long | 0 | Total bytes sent |
| encodeVolume | int | 0 | Publishing encoding volume |
AoqVideoPublishStats
Video publishing statistics.
| Field | Type | Default value | Description |
|---|---|---|---|
| trackType | AoqTrackType | AoqTrackTypeVideo | Track type |
| bitrate | int | 0 | Bitrate in bps |
| bytes | long | 0 | Total bytes sent |
| encodeFps | int | 0 | Encoding frame rate |
AoqDataMsgPublishStats
Data message publishing statistics.
| Field | Type | Default value | Description |
|---|---|---|---|
| trackType | AoqTrackType | AoqTrackTypeData | Track type |
| bitrate | int | 0 | Bitrate in bps |
| bytes | long | 0 | Total bytes sent |
AoqAudioSubscribeStats
Audio subscription statistics.
| Field | Type | Default value | Description |
|---|---|---|---|
| trackType | AoqTrackType | AoqTrackTypeAudio | Track type |
| bitrate | int | 0 | Bitrate in bps |
| bytes | long | 0 | Total bytes received |
| playVolume | int | 0 | Playback volume |
AoqVideoSubscribeStats
Video subscription statistics.
| Field | Type | Default value | Description |
|---|---|---|---|
| trackType | AoqTrackType | AoqTrackTypeVideo | Track type |
| bitrate | int | 0 | Bitrate in bps |
| bytes | long | 0 | Total bytes received |
| decodeFps | int | 0 | Decoding frame rate |
| renderFps | int | 0 | Rendering frame rate |
AoqDataMsgSubscribeStats
Data message subscription statistics.
| Field | Type | Default value | Description |
|---|---|---|---|
| trackType | AoqTrackType | AoqTrackTypeData | Track type |
| bitrate | int | 0 | Bitrate in bps |
| bytes | long | 0 | Total bytes received |
Enumerations
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. |
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 |
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 |
Enum value | Value | Description |
|---|---|---|
AoqTrackTypeAudio | 0 | Audio track |
AoqTrackTypeVideo | 1 | Video track |
AoqTrackTypeData | 2 | Data messaging track |
| AoqTrackTypeScreen | 3 | Screen sharing track. Uplink only. |
Enum value | Value | Description |
|---|---|---|
AoqEncoderTypeUnknown | 0 | Unknown format |
AoqEncoderTypeAudioPCM | 1 | Audio PCM |
AoqEncoderTypeAudioOpus | 2 | Audio Opus |
AoqEncoderTypeVideoH264 | 3 | Video H.264 |
AoqEncoderTypeVideoJpeg | 4 | Video JPEG |
AoqEncoderTypeDataText | 5 | Data text |
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.
| Enum value | Value | Description |
|---|---|---|
| AoqOrientationModeAuto | 0 | Automatic |
| AoqOrientationModePortrait | 1 | Portrait |
| AoqOrientationModeLandscape | 2 | Landscape |
Audio types
AoqAudioCaptureConfigField | Type | Default | Description |
|---|---|---|---|
isExternal | boolean | false | Whether to use external capture mode |
isVoipMode | boolean | false | Whether to enable VoIP mode (affects device routing, e.g., earpiece) |
channel | int | 1 | Channel count (default: mono) |
Field | Type | Default | Description |
|---|---|---|---|
isVoipMode | boolean | false | Whether to enable VoIP mode (hardware AEC); applies to mobile |
isDefaultSpeaker | boolean | true | Whether to default to the speaker; applies to mobile |
isExternal | boolean | false | Whether to use external playback mode |
channel | int | 1 | Channel count (default: mono) |
Field | Type | Default | Description |
|---|---|---|---|
trackType | AoqTrackType | Audio | Track type |
codecType | AoqEncoderType | AudioOpus | Codec format |
sampleRate | int | 48000 | Sample rate (Hz) |
channel | int | 1 | Channel count |
bitrate | int | 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 capture and playback state.
| Field | Type | Default value | Description |
|---|---|---|---|
| state | AoqAudioDeviceStateCode | AoqAudioDeviceNone | Device operation state |
| reason | int | 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
Audio file playback configuration.
| Field | Type | Default value | Description |
|---|---|---|---|
| fileName | String | "" | File name including its path. Must not be empty. |
| cycles | int | -1 | Loop count. -1 loops indefinitely. |
| startPosMs | long | 0 | Initial playback position in milliseconds |
| publishVolume | int | 100 | Publishing volume. Valid values: 0-100. |
| playoutVolume | int | 100 | Playback volume. Valid values: 0-100. |
AoqAudioFileStateCode
Audio file playback 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 playback 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 identifier |
| stateCode | AoqAudioFileStateCode | AoqAudioFileNone | File playback state code |
| errorCode | AoqAudioFileErrorCode | AoqAudioFileNoError | File error code |
External audio stream and volume types
AoqAudioExternalStreamToggle
External audio stream toggle states.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioExternalStreamToggleNormal | 0 | Normal state |
| AoqAudioExternalStreamTogglePause | 1 | Paused state |
AoqAudioFrameData
External audio frame data.
| Field | Type | Default value | Description |
|---|---|---|---|
| dataPtr | byte array | null | Raw PCM audio data (@Nullable) |
| dataSize | int | 0 | PCM data size in bytes |
| numOfSamples | int | 0 | Number of samples per channel |
| bytesPerSample | int | 0 | Bytes per sample |
| numOfChannels | int | 0 | Number of channels |
| samplesPerSec | int | 0 | Samples per second (sample rate) |
| pushSequence | int | 0 | PCM input round |
| timeStamp | long | 0 | Timestamp |
| autoGenMute | boolean | false | Valid in data callbacks. true indicates SDK-generated silence. |
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 |
AoqAudioObserverConfig
Audio frame callback configuration.
| Field | Type | Default value | Description |
|---|---|---|---|
| sampleRate | int | 48000 | Callback audio sample rate in Hz |
| channels | int | 1 | Callback audio channel count |
| mode | AoqAudioObserverMode | AoqAudioObserverModeReadOnly | Read-write mode |
AoqAudioVolumeIndicationConfig
| Field | Type | Default | Description |
|---|---|---|---|
| reportSpeech | boolean | false | Whether to detect speech. |
| interval | int | 0 | Callback interval in milliseconds. Values of 0 or less disable callbacks; values between 0 and 10 use 10. |
| smooth | int | 3 | Smoothing factor, from 0 to 10. Higher values produce smoother results. |
AoqAudioVolume
| Field | Type | Default | Description |
|---|---|---|---|
| isSpeech | boolean | false | Whether speech is detected. |
| volume | int | 0 | Smoothed instantaneous volume, from 0 to 255. |
Video types
AoqRenderMode
Rendering modes.
| Enum value | Value | Description |
|---|---|---|
| AoqRenderModeAuto | 0 | Automatic mode |
| AoqRenderModeStretch | 1 | Stretch mode |
| AoqRenderModeFill | 2 | Fill mode |
| AoqRenderModeCrop | 3 | Crop mode |
AoqVideoCanvas
Video rendering canvas.
| Field | Type | Default value | Description |
|---|---|---|---|
| view | View | null | Android View used for rendering (@Nullable) |
| renderMode | AoqRenderMode | AoqRenderModeAuto | Rendering mode |
AoqCameraDirection
Camera direction.
| Enum value | Value | Description |
|---|---|---|
| AoqCameraDirectionFront | 0 | Front camera |
| AoqCameraDirectionBack | 1 | Rear camera |
AoqScreenCaptureConfig
| Field | Type | Default | Description |
|---|---|---|---|
| isExternal | boolean | false | Whether the application supplies raw screen frames. |
| mediaProjectionIntent | Intent | null | Pass an existing MediaProjection permission intent, or null to let the SDK request permission. Ignored for external capture. |
| notificationFactory | AoqScreenShareNotificationFactory | null | Foreground service notification factory. Null uses the default notification. Ignored for external capture. |
Field | Type | Default | Description |
|---|---|---|---|
width | int | 1280 | Capture width (pixels); ignored when |
height | int | 720 | Capture height (pixels); ignored when |
fps | int | 15 | Capture frame rate; ignored when |
isExternal | boolean | false | External capture mode; when true, the camera is not opened |
cameraDirection | AoqCameraDirection | Front | Camera direction; ignored when |
Field | Type | Default | Description |
|---|---|---|---|
trackType | AoqTrackType | Video | Track type |
codecType | AoqEncoderType | VideoH264 | Codec format |
width | int | 540 | Encoding width (pixels) |
height | int | 960 | Encoding height (pixels) |
fps | int | 5 | Encoding frame rate |
bitrate | int | 500000 | Target bitrate (bps) |
minBitrate | int | 128000 | Minimum bitrate (bps) |
keyframeInterval | int | 2 | Keyframe interval (seconds) |
mirrorMode | AoqMirrorMode | Disabled | Mirror mode |
orientationMode | AoqOrientationMode | Auto | Video orientation mode |
isExternal | boolean | false | When true, the SDK skips re-encoding; use |
Enum value | Value | Description |
|---|---|---|
AoqVideoPixelFormatUnknown | 0 | Unknown format |
AoqVideoPixelFormatI420 | 1 | I420 (YUV planar) |
AoqVideoPixelFormatNV12 | 2 | NV12 (YUV semi-planar) |
AoqVideoPixelFormatNV21 | 3 | NV21 (YUV semi-planar) |
AoqVideoPixelFormatBGRA | 4 | BGRA 32-bit |
AoqVideoPixelFormatRGBA | 5 | RGBA 32-bit |
AoqVideoPixelFormatTextureOES | 7 | External OES texture |
AoqVideoPixelFormatTexture2D | 8 | Standard 2D texture |
AoqVideoFrame
External video data.
| Field | Type | Default value | Description |
|---|---|---|---|
| format | AoqVideoPixelFormat | AoqVideoPixelFormatUnknown | Pixel format |
| width | int | 0 | Video width in pixels |
| height | int | 0 | Video height in pixels |
| data | byte array | null | Packed-format data (NV12/NV21/BGRA/RGBA) (@Nullable) |
| dataY | byte array | null | I420 Y plane data (@Nullable) |
| dataU | byte array | null | I420 U plane data (@Nullable) |
| dataV | byte array | null | I420 V plane data (@Nullable) |
| strideY | int | 0 | Y plane stride |
| strideU | int | 0 | U plane stride |
| strideV | int | 0 | V plane stride |
| textureId | int | 0 | Texture ID (valid for TEXTURE_OES/TEXTURE_2D) |
| transformMatrix | float array | null | 4×4 row-major texture transformation matrix (@Nullable) |
| eglContext | EGLContext | null | Shared EGL context (@Nullable) |
| timeStamp | long | 0 | Timestamp in milliseconds. If 0, the SDK fills it in using the local clock. |
AoqVideoCodecType
Codec type for externally encoded frames.
| Enum value | Value | Description |
|---|---|---|
| AoqVideoCodecTypeJPEG | 0 | JPEG encoding |
AoqVideoEncodedFrame
Externally encoded video frame. The application encodes the frame; the SDK packages and sends it without re-encoding.
| Field | Type | Default value | Description |
|---|---|---|---|
| codec | AoqVideoCodecType | AoqVideoCodecTypeJPEG | Encoding format |
| data | byte array | null | Encoded data (@Nullable) |
| width | int | 0 | Width in pixels |
| height | int | 0 | Height in pixels |
| timeStamp | long | 0 | Timestamp in milliseconds. If 0, the SDK fills it in using the local clock. |
AoqVideoDeviceStateCode
Video device capture state codes.
| Enum value | Value | Description |
|---|---|---|
| AoqVideoDeviceNone | 0 | No state |
| AoqVideoDeviceCaptureStarting | 1 | Capture starting |
| AoqVideoDeviceCaptureStarted | 2 | Capture started |
| AoqVideoDeviceCaptureStopping | 3 | Capture stopping |
| AoqVideoDeviceCaptureStopped | 4 | Capture stopped |
| AoqVideoDeviceCaptureFail | 5 | Capture failed |
AoqVideoDeviceState
Video device capture state.
| Field | Type | Default value | Description |
|---|---|---|---|
| state | AoqVideoDeviceStateCode | AoqVideoDeviceNone | Device capture state |
| reason | int | 0 | Error reason code (see AoqErrorCode) |
Field | Type | Default | Description |
|---|---|---|---|
trackType | AoqTrackType | Audio | Audio track type |
codecType | AoqEncoderType | AudioPCM | Audio stream format |
channels | int | 1 | Channel count |
sampleRate | int | 48000 | Sample rate (Hz) |
playoutVolume | int | 100 | Playback volume [0–100] |
publishVolume | int | 100 | Publishing volume [0–100] |
maxBufferDuration | int | 1000 | Maximum buffer duration (milliseconds) |
enable3A | boolean | false | Whether to apply 3A processing to input PCM |
Enum value | Value | Description |
|---|---|---|
AoqAudioStreamPublish | 0 | Publish stream (send) |
AoqAudioStreamPlayout | 1 | Playout stream (receive) |
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 | AoqScreenCaptureNone | Screen capture state. |
| reason | int | 0 | 0 for normal states; an AoqErrorCode on failure. |
AoqScreenShareNotificationFactory
public interface AoqScreenShareNotificationFactory {
@Nullable Notification createNotification(@NonNull Context serviceContext);
}
Return null to use the default notification. Create the NotificationChannel with createNotificationChannel before returning a custom notification; otherwise, the foreground service fails to start.
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 |
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
Video frame callback configuration.
| Field | Type | Default value | Description |
|---|---|---|---|
| trackType | AoqTrackType | AoqTrackTypeVideo | Video track to observe. Only Video and Screen are supported. |
| format | AoqVideoPixelFormat | AoqVideoPixelFormatI420 | Desired callback pixel format |
| alignment | AoqVideoObserverAlignment | AoqVideoObserverAlignmentDefault | Width alignment policy |
| mode | AoqVideoObserverMode | AoqVideoObserverModeReadOnly | Read/write mode. Only I420 supports read-write access. |
| mirrorApplied | boolean | false | Whether to mirror callback data |
AoqVideoFrameData
Video frame callback data. The byte/texture fields reference internal SDK memory and are valid only during the callback. Make a copy for asynchronous use.
| Field | Type | Default value | Description |
|---|---|---|---|
| format | AoqVideoPixelFormat | AoqVideoPixelFormatUnknown | Pixel format |
| width | int | 0 | Width in pixels |
| height | int | 0 | Height in pixels |
| data | ByteBuffer | null | Packed-format data (NV12/NV21/BGRA/RGBA). The direct ByteBuffer references native memory (@Nullable). |
| dataY | ByteBuffer | null | I420 Y plane (@Nullable) |
| dataU | ByteBuffer | null | I420 U plane (@Nullable) |
| dataV | ByteBuffer | null | I420 V plane (@Nullable) |
| strideY | int | 0 | Y plane stride |
| strideU | int | 0 | U plane stride |
| strideV | int | 0 | V plane stride |
| textureId | int | 0 | Texture ID (valid for TEXTURE_OES/TEXTURE_2D) |
| transformMatrix | float array | null | 4×4 row-major texture transformation matrix (valid for TEXTURE_OES/TEXTURE_2D) (@Nullable) |
| timeStamp | long | 0 | Timestamp in milliseconds |
Data message types
AoqDataMsgField | Type | Default | Description |
|---|---|---|---|
data | byte[] | new byte[0] | Message data (byte array) |