Skip to main content

AOQ Client SDK Android API reference

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.

API index

Engine lifecycle

APIDescription
createEngineCreate an engine instance (singleton)
destroyDestroy the engine instance
getVersionGet the SDK version
connectConnect to the Relay server
disconnectDisconnect from the server

Audio device management

APIDescription
startAudioCaptureOpen the audio capture device (microphone)
stopAudioCaptureClose the audio capture device
muteAudioCaptureMute or unmute audio capture
startAudioPlayerStart audio rendering (remote audio playback)
stopAudioPlayerStop audio rendering
pauseAudioPlayerPause audio rendering, with optional fade-out
resumeAudioPlayerResume audio rendering, with optional fade-in
interruptAudioPlayerInterrupt the current audio session
enableSpeakerphoneSwitch audio output between the speaker and earpiece
isSpeakerphoneEnabledCheck whether audio output uses the speaker

Audio encoding configuration

APIDescription
setAudioEncoderConfigSet audio encoding parameters
setAudioDecoderConfigSet audio decoding parameters

Audio file playback

APIDescription
startAudioFileStart playing and publishing a local audio file
stopAudioFileStop audio file playback
pauseAudioFilePause audio file playback
resumeAudioFileResume audio file playback
getAudioFileDurationGet the total duration of the audio file
getAudioFileCurrentPositionGet the current playback position of the audio file
setAudioFilePositionMillisSeek to a position in the audio file
setAudioFileVolumeSet the audio file volume
getAudioFileVolumeGet the current audio file volume

External audio streams

APIDescription
addAudioExternalStreamAdd an external audio stream
pushAudioExternalStreamDataPush external PCM audio data
setAudioExternalStreamVolumeSet the external audio stream volume
getAudioExternalStreamVolumeGet the external audio stream volume
clearAudioExternalStreamBufferClear the external audio stream buffer
removeAudioExternalStreamRemove an external audio stream

Audio frame callbacks

APIDescription
setAudioFrameObserverSet the audio frame callback listener
enableAudioFrameObserverEnable or disable audio frame callbacks at a specified stage

Local audio volume indication

APIDescription
enableLocalAudioVolumeIndicationEnable or disable local capture volume indication

Video device management

APIDescription
startVideoCaptureOpen the video capture device (camera)
stopVideoCaptureClose the video capture device
switchCameraSwitch between front and rear cameras
setLocalViewSet or remove the local video rendering window
setRemoteViewSet or remove the remote video rendering window

Video encoding and external input

APIDescription
setVideoEncoderConfigSet video encoding parameters
setVideoDecoderConfigSet video decoding parameters
pushExternalVideoCapturedFramePush externally captured video frames
pushExternalVideoEncodedFramePush externally encoded video frames

Screen capture

APIDescription
startScreenCaptureStart screen capture
stopScreenCaptureStop screen capture

Media stream transmission control

APIDescription
enableSendMediaStreamEnable or disable local media stream transmission

Video frame callbacks

APIDescription
setVideoFrameObserverSet the video frame callback listener
enableVideoFrameObserverEnable or disable video frame callbacks at a specified stage

Real-time messages

APIDescription
sendDataMsgSend a real-time data message

AoqClientListener callbacks

APIDescription
onErrorEngine error callback
onWarningEngine warning callback
onConnectionStatusChangeConnection status change callback
onStatsEngine statistics callback
onAudioDeviceStateChangedAudio device operation status change callback
onAudioDeviceRouteChangedAudio output route change callback
onAudioDeviceInterruptedAudio device interruption callback
onScreenCaptureStateChangedScreen capture status change callback
onVideoDeviceStateChangedVideo device operation status change callback
onAudioDeviceFocusChangedAudio focus change callback
onAudioFileStateAudio file playback status callback
onLocalAudioVolumeIndicationLocal capture volume indication callback
onDataMsgReceived real-time data message callback

AoqAudioFrameListener callbacks

APIDescription
onCapturedAudioFrameCalled when a raw audio frame is captured. The frame contains unprocessed PCM data.
onProcessCapturedAudioFrameCalled for an audio frame after 3A processing, such as echo cancellation and noise suppression.
onPublishAudioFrameCalled for an audio frame before publishing, immediately before encoding and transmission.
onPlaybackAudioFrameCalled for a remote audio frame before playback, after decoding and mixing.

AoqVideoFrameListener callbacks

APIDescription
onCapturedVideoFrameCalled when a raw video frame is captured, before preprocessing.
onPreEncodeVideoFrameCalled for a video frame after preprocessing and before encoding.
onRemoteVideoFrameCalled 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

createEngine Create 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. destroy Destroys 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. getVersion Gets 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". connect Connects to the Relay server. The application's AppServer allocates connection parameters through /api/v1/allocate and sends them to the client. This method returns immediately. The connection result is reported through onConnectionStatusChange.
public abstract int connect(@NonNull AoqConnectConfig config)
ParameterTypeDescription
configAoqConnectConfigConnection 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.
The 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.
disconnect 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)
ParameterTypeDescription
configAoqAudioCaptureConfigAudio 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.
On 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)
ParameterTypeDescription
mutebooleantrue mutes capture; false unmutes it.
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
This 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)
ParameterTypeDescription
configAoqAudioPlaybackConfigAudio 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.
Device 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)
ParameterTypeDescription
fadeMsintFade-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)
ParameterTypeDescription
fadeMsintFade-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)
ParameterTypeDescription
trackTypeAoqTrackTypeType of the track to interrupt
fadeMsintFade-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)
ParameterTypeDescription
enablebooleantrue 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.
Switching 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)
ParameterTypeDescription
configAoqAudioCodecConfigAudio encoding configuration. Set trackType to AoqTrackTypeAudio.
Return value: 0 on success; non-zero on failure (an AoqErrorCode value, such as AoqECParamInvalid for invalid parameters).
codecType 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)
ParameterTypeDescription
configAoqAudioCodecConfigAudio decoding configuration. Set trackType to AoqTrackTypeAudio.
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
sampleRate 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)
ParameterTypeDescription
fileIdStringApplication-defined file identifier used for subsequent control
configAoqAudioFileMixConfigAudio file playback configuration
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
Playback 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)
ParameterTypeDescription
fileIdStringFile 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)
ParameterTypeDescription
fileIdStringFile 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)
ParameterTypeDescription
fileIdStringFile 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)
ParameterTypeDescription
fileIdStringFile 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)
ParameterTypeDescription
fileIdStringFile 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)
ParameterTypeDescription
fileIdStringFile identifier
positionMillislongTarget 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)
ParameterTypeDescription
fileIdStringFile identifier
typeAoqAudioStreamDirectionVolume direction. AoqAudioStreamPublish controls streaming; AoqAudioStreamPlayout controls playback.
volumeintVolume. 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)
ParameterTypeDescription
fileIdStringFile identifier
typeAoqAudioStreamDirectionVolume 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)
ParameterTypeDescription
streamIdStringApplication-defined external stream identifier
configAoqAudioExternalStreamConfigExternal 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)
ParameterTypeDescription
streamIdStringExternal stream identifier
dataAoqAudioFrameDataPCM 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)
ParameterTypeDescription
streamIdStringExternal stream identifier
typeAoqAudioStreamDirectionVolume direction
volumeintVolume. 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)
ParameterTypeDescription
streamIdStringExternal stream identifier
typeAoqAudioStreamDirectionVolume 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)
ParameterTypeDescription
streamIdStringExternal stream identifier
fadeoutMsintFade-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).
If 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)
ParameterTypeDescription
streamIdStringExternal 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)
ParameterTypeDescription
listenerAoqAudioFrameListenerAudio frame listener. Pass null to remove it.
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
Use 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)
ParameterTypeDescription
enabledbooleantrue enables callbacks; false disables them.
audioSourceAoqAudioSourceAudio source position: capture, after 3A processing, publishing, or playback
configAoqAudioObserverConfigCallback 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)
ParameterTypeDescription
configAoqAudioVolumeIndicationConfigVolume indication configuration. interval<=0 disables callbacks.
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
Call 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)
ParameterTypeDescription
configAoqVideoCaptureConfigVideo capture configuration.
Return value: 0 on success; non-zero on failure (an AoqErrorCode value, such as AoqECVideoDeviceCameraAuthFailed when camera permission has not been granted).
On 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)
ParameterTypeDescription
directionAoqCameraDirectionTarget camera direction: AoqCameraDirectionFront for the front camera and AoqCameraDirectionBack for the rear camera.
Return value: 0 on success; < 0 on failure (an AoqErrorCode value).
This 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)
ParameterTypeDescription
trackTypeAoqTrackTypeTrack type
canvasAoqVideoCanvasVideo 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)
ParameterTypeDescription
trackTypeAoqTrackTypeTrack type
canvasAoqVideoCanvasVideo 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.
The 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)
ParameterTypeDescription
configAoqVideoCodecConfigVideo encoding configuration.
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
Before 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)
ParameterTypeDescription
configAoqVideoCodecConfigVideo decoding configuration.
Return value: 0 on success; non-zero on failure. If config.trackType is AoqTrackTypeScreen, returns AoqECUnSupport and does not apply the configuration.
The 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)
ParameterTypeDescription
trackTypeAoqTrackTypeTrack type. For AoqTrackTypeVideo, call startVideoCapture(isExternal=true) first. For AoqTrackTypeScreen, call startScreenCapture(isExternal=true) first.
frameAoqVideoFrameExternal 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)
ParameterTypeDescription
trackTypeAoqTrackTypeTrack type
frameAoqVideoEncodedFrameExternal encoded video frame.
Return value: 0 on success; AoqECVideoExternalEncoderNotEnabled(212) if external encoding is not enabled for the track; < 0 on failure.
frame.timeStamp is passed through unchanged. The SDK does not fill it in. The caller must ensure that timestamps increase monotonically.
pushExternalVideoCapturedFrame 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)
ParameterTypeDescription
trackTypeAoqTrackTypeTrack type. Supports AoqTrackTypeAudio/AoqTrackTypeVideo/AoqTrackTypeScreen.
enablebooleantrue enables sending; false disables sending.
Return value: 0 indicates a successful call. A value less than 0 indicates failure and corresponds to AoqErrorCode.
After 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)
ParameterTypeDescription
listenerAoqVideoFrameListenerVideo frame listener. Pass null to remove it.
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
Use 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)
ParameterTypeDescription
enabledbooleantrue enables callbacks; false disables them.
videoSourceAoqVideoSourceVideo source position: after capture, before encoding, or after remote decoding
configAoqVideoObserverConfigCallback 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.
Callbacks 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)
ParameterTypeDescription
msgAoqDataMsgData message
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
The 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)
ParameterTypeDescription
codeintError code corresponding to an AoqErrorCode enum value
messageStringError 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)
ParameterTypeDescription
codeintWarning code corresponding to an AoqWarningCode enum value
messageStringWarning description
Return value: None (void).

onConnectionStatusChange

Connection state change callback. State transitions: Disconnected → Connecting → Connected/Failed → Disconnected.
public void onConnectionStatusChange(@NonNull AoqClientEngine.AoqConnectionStatus status)
ParameterTypeDescription
statusAoqConnectionStatusCurrent connection state
Return value: None (void).
Enable 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)
ParameterTypeDescription
statsAoqStatsStatistics 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)
ParameterTypeDescription
stateAoqAudioDeviceStateAudio 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)
ParameterTypeDescription
routeTypeintCurrent 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)
ParameterTypeDescription
interruptbooleantrue 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)
ParameterTypeDescription
stateAoqScreenCaptureStateScreen capture state, including state (state code) and reason (error cause).
Return value: None (void).
Started 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)
ParameterTypeDescription
stateAoqVideoDeviceStateVideo 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)
ParameterTypeDescription
audioFocusintAndroid 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)
ParameterTypeDescription
stateAoqAudioFileStateAudio 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)
ParameterTypeDescription
volumeAoqAudioVolumeLocal 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)
ParameterTypeDescription
msgAoqDataMsgData 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) {}
}
MethodWhen triggeredParameter
onCapturedAudioFrameWhen a raw audio frame is capturedframe: AoqAudioFrameData
onProcessCapturedAudioFrameAudio frame after 3A processingframe: AoqAudioFrameData
onPublishAudioFrameAudio frame before publishingtrackType: track type; frame: AoqAudioFrameData
onPlaybackAudioFrameRemote audio frame before playbackframe: 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)
ParameterTypeDescription
frameAoqAudioFrameDataCaptured audio frame data
Return value: None (void).
frame.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)
ParameterTypeDescription
frameAoqAudioFrameDataAudio frame data after 3A processing
Return value: None (void).
frame.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)
ParameterTypeDescription
trackTypeAoqTrackTypeTrack type
frameAoqAudioFrameDataAudio frame data before publishing
Return value: None (void).
frame.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)
ParameterTypeDescription
frameAoqAudioFrameDataRemote audio frame data before playback
Return value: None (void).
frame.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; }
}
MethodWhen triggeredParameter
onCapturedVideoFrameWhen a raw video frame is captured (before preprocessing)trackType: track type; frame: AoqVideoFrameData
onPreEncodeVideoFrameVideo frame before encoding (after preprocessing)trackType: track type; frame: AoqVideoFrameData
onRemoteVideoFrameRemote video frame after decoding and before renderingtrackType: 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.
Callbacks 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)
ParameterTypeDescription
trackTypeAoqTrackTypeTrack type (Video/Screen)
frameAoqVideoFrameDataCaptured 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.
Callbacks 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)
ParameterTypeDescription
trackTypeAoqTrackTypeTrack type (Video/Screen)
frameAoqVideoFrameDataVideo 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.
Callbacks 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)
ParameterTypeDescription
trackTypeAoqTrackTypeTrack type (Video/Screen)
frameAoqVideoFrameDataDecoded 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.
Callbacks 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.
FieldTypeDefault valueDescription
routeIndexint-1Route index
endpointString""Relay server domain name or IP address
portint0Relay server UDP port
tcpPortint0Relay server TCP port

AoqTrackParam

Track properties.
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeAudioTrack type
trackModeAoqTrackModeAoqTrackModeSegmentStreaming or non-streaming mode. Applies only to downstream audio.

AoqTrackParam.trackMode

FieldTypeDefaultDescription
trackModeAoqTrackModeAoqTrackModeSegmentApplies only to downstream audio.
AoqCreateConfig

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

maxEncodedVideoFrameBytesint190 × 1024Maximum encoded frame size in bytes. Applies only to the SDK internal JPEG encoder.
enableDropOversizedVideoFramebooleanfalseFor the SDK internal JPEG encoder, whether to drop a frame that remains oversized at the lowest quality.
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

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

AoqNetworkStats

Field

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.
FieldTypeDescription
audioPublishStatsAoqAudioPublishStats arrayAudio publishing statistics array (@Nullable)
videoPublishStatsAoqVideoPublishStats arrayVideo publishing statistics array (@Nullable)
dataMsgPublishStatsAoqDataMsgPublishStats arrayData message publishing statistics array (@Nullable)
audioSubscribeStatsAoqAudioSubscribeStats arrayAudio subscription statistics array (@Nullable)
videoSubscribeStatsAoqVideoSubscribeStats arrayVideo subscription statistics array (@Nullable)
dataMsgSubscribeStatsAoqDataMsgSubscribeStats arrayData message subscription statistics array (@Nullable)
networkStatsAoqNetworkStatsNetwork statistics (@Nullable)

AoqAudioPublishStats

Audio publishing statistics.
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeAudioTrack type
bitrateint0Bitrate in bps
byteslong0Total bytes sent
encodeVolumeint0Publishing encoding volume

AoqVideoPublishStats

Video publishing statistics.
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeVideoTrack type
bitrateint0Bitrate in bps
byteslong0Total bytes sent
encodeFpsint0Encoding frame rate

AoqDataMsgPublishStats

Data message publishing statistics.
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeDataTrack type
bitrateint0Bitrate in bps
byteslong0Total bytes sent

AoqAudioSubscribeStats

Audio subscription statistics.
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeAudioTrack type
bitrateint0Bitrate in bps
byteslong0Total bytes received
playVolumeint0Playback volume

AoqVideoSubscribeStats

Video subscription statistics.
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeVideoTrack type
bitrateint0Bitrate in bps
byteslong0Total bytes received
decodeFpsint0Decoding frame rate
renderFpsint0Rendering frame rate

AoqDataMsgSubscribeStats

Data message subscription statistics.
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeDataTrack type
bitrateint0Bitrate in bps
byteslong0Total bytes received

Enumerations

AoqTrackMode

ValueNumberDescription
AoqTrackModeSegment0Segment mode: delivers data in semantic segments, such as sentences. Applies only to downstream audio.
AoqTrackModeStream1Stream mode: delivers data continuously. Applies only to downstream audio.
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

AoqECScreen300General screen sharing error
AoqECScreenAuthFailed310Screen sharing permission denied
AoqECScreenStartFailed311Failed 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

AoqTrackTypeScreen3Screen sharing track. Uplink only.
AoqEncoderType

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

AoqConnectionStatus

Enum value

Value

Description

AoqConnectionStatusDisconnected

0

Disconnected

AoqConnectionStatusConnecting

1

Connecting

AoqConnectionStatusConnected

2

Connected

AoqConnectionStatusFailed

3

Connection failed

AoqMirrorMode

Mirror mode.
Enum valueValueDescription
AoqMirrorModeDisabled0Mirroring disabled
AoqMirrorModeEnabled1Mirroring enabled

AoqOrientationMode

Video orientation.
Enum valueValueDescription
AoqOrientationModeAuto0Automatic
AoqOrientationModePortrait1Portrait
AoqOrientationModeLandscape2Landscape

Audio types

AoqAudioCaptureConfig

Field

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)

AoqAudioPlaybackConfig

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)

AoqAudioCodecConfig

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 valueValueDescription
AoqAudioDeviceNone0No state
AoqAudioDeviceRecordStarting1Capture starting
AoqAudioDeviceRecordStarted2Capture started
AoqAudioDeviceRecordStopping3Capture stopping
AoqAudioDeviceRecordStopped4Capture stopped
AoqAudioDeviceRecordFail5Capture failed
AoqAudioDevicePlayStarting6Playback starting
AoqAudioDevicePlayStarted7Playback started
AoqAudioDevicePlayStopping8Playback stopping
AoqAudioDevicePlayStopped9Playback stopped
AoqAudioDevicePlayFail10Playback failed

AoqAudioDeviceState

Audio device capture and playback state.
FieldTypeDefault valueDescription
stateAoqAudioDeviceStateCodeAoqAudioDeviceNoneDevice operation state
reasonint0Error reason code (see AoqErrorCode)

AoqAudioDeviceRouteType

Audio device route types.
Enum valueValueDescription
AoqAudioDeviceRouteDefault0Default route
AoqAudioDeviceRouteHeadset1Headset with microphone
AoqAudioDeviceRouteEarpiece2Earpiece
AoqAudioDeviceRouteHeadsetNoMic3Headset without microphone
AoqAudioDeviceRouteSpeakerPhone4Speaker
AoqAudioDeviceRouteUsb5USB audio device
AoqAudioDeviceRouteBluetooth6Bluetooth SCO mode
AoqAudioDeviceRouteBluetoothA2dp7Bluetooth A2DP mode

Audio file types

AoqAudioFileMixConfig

Audio file playback configuration.
FieldTypeDefault valueDescription
fileNameString""File name including its path. Must not be empty.
cyclesint-1Loop count. -1 loops indefinitely.
startPosMslong0Initial playback position in milliseconds
publishVolumeint100Publishing volume. Valid values: 0-100.
playoutVolumeint100Playback volume. Valid values: 0-100.

AoqAudioFileStateCode

Audio file playback state codes.
Enum valueValueDescription
AoqAudioFileNone0No state
AoqAudioFileStarted1Playback started
AoqAudioFileStopped2Playback stopped
AoqAudioFilePaused3Playback paused
AoqAudioFileResumed4Playback resumed
AoqAudioFileEnded5Playback ended
AoqAudioFileBuffering6Playback buffering
AoqAudioFileBufferingEnd7Buffering ended
AoqAudioFileFailed8Playback failed

AoqAudioFileErrorCode

Audio file playback error codes.
Enum valueValueDescription
AoqAudioFileNoError0No error
AoqAudioFileOpenFailed1Failed to open file
AoqAudioFileDecodeFailed2Failed to decode file

AoqAudioFileState

Audio file state.
FieldTypeDefault valueDescription
fileIdString""File identifier
stateCodeAoqAudioFileStateCodeAoqAudioFileNoneFile playback state code
errorCodeAoqAudioFileErrorCodeAoqAudioFileNoErrorFile error code

External audio stream and volume types

AoqAudioExternalStreamToggle

External audio stream toggle states.
Enum valueValueDescription
AoqAudioExternalStreamToggleNormal0Normal state
AoqAudioExternalStreamTogglePause1Paused state

AoqAudioFrameData

External audio frame data.
FieldTypeDefault valueDescription
dataPtrbyte arraynullRaw PCM audio data (@Nullable)
dataSizeint0PCM data size in bytes
numOfSamplesint0Number of samples per channel
bytesPerSampleint0Bytes per sample
numOfChannelsint0Number of channels
samplesPerSecint0Samples per second (sample rate)
pushSequenceint0PCM input round
timeStamplong0Timestamp
autoGenMutebooleanfalseValid in data callbacks. true indicates SDK-generated silence.

AoqAudioSource

Audio frame callback data sources.
Enum valueValueDescription
AoqAudioSourceCaptured0Captured audio data
AoqAudioSourceProcessCaptured1Audio data after 3A processing
AoqAudioSourcePublish2Published audio data
AoqAudioSourcePlayback3Playback audio data

AoqAudioObserverMode

Audio frame callback modes.
Enum valueValueDescription
AoqAudioObserverModeReadOnly0Read-only mode
AoqAudioObserverModeReadWrite1Read-write mode

AoqAudioObserverConfig

Audio frame callback configuration.
FieldTypeDefault valueDescription
sampleRateint48000Callback audio sample rate in Hz
channelsint1Callback audio channel count
modeAoqAudioObserverModeAoqAudioObserverModeReadOnlyRead-write mode

AoqAudioVolumeIndicationConfig

FieldTypeDefaultDescription
reportSpeechbooleanfalseWhether to detect speech.
intervalint0Callback interval in milliseconds. Values of 0 or less disable callbacks; values between 0 and 10 use 10.
smoothint3Smoothing factor, from 0 to 10. Higher values produce smoother results.

AoqAudioVolume

FieldTypeDefaultDescription
isSpeechbooleanfalseWhether speech is detected.
volumeint0Smoothed instantaneous volume, from 0 to 255.

Video types

AoqRenderMode

Rendering modes.
Enum valueValueDescription
AoqRenderModeAuto0Automatic mode
AoqRenderModeStretch1Stretch mode
AoqRenderModeFill2Fill mode
AoqRenderModeCrop3Crop mode

AoqVideoCanvas

Video rendering canvas.
FieldTypeDefault valueDescription
viewViewnullAndroid View used for rendering (@Nullable)
renderModeAoqRenderModeAoqRenderModeAutoRendering mode

AoqCameraDirection

Camera direction.
Enum valueValueDescription
AoqCameraDirectionFront0Front camera
AoqCameraDirectionBack1Rear camera

AoqScreenCaptureConfig

FieldTypeDefaultDescription
isExternalbooleanfalseWhether the application supplies raw screen frames.
mediaProjectionIntentIntentnullPass an existing MediaProjection permission intent, or null to let the SDK request permission. Ignored for external capture.
notificationFactoryAoqScreenShareNotificationFactorynullForeground service notification factory. Null uses the default notification. Ignored for external capture.
AoqVideoCaptureConfig

Field

Type

Default

Description

width

int

1280

Capture width (pixels); ignored when isExternal=true

height

int

720

Capture height (pixels); ignored when isExternal=true

fps

int

15

Capture frame rate; ignored when isExternal=true

isExternal

boolean

false

External capture mode; when true, the camera is not opened

cameraDirection

AoqCameraDirection

Front

Camera direction; ignored when isExternal=true

AoqVideoCodecConfig

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 pushExternalVideoEncodedFrame to deliver pre-encoded data

AoqVideoPixelFormat

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.
FieldTypeDefault valueDescription
formatAoqVideoPixelFormatAoqVideoPixelFormatUnknownPixel format
widthint0Video width in pixels
heightint0Video height in pixels
databyte arraynullPacked-format data (NV12/NV21/BGRA/RGBA) (@Nullable)
dataYbyte arraynullI420 Y plane data (@Nullable)
dataUbyte arraynullI420 U plane data (@Nullable)
dataVbyte arraynullI420 V plane data (@Nullable)
strideYint0Y plane stride
strideUint0U plane stride
strideVint0V plane stride
textureIdint0Texture ID (valid for TEXTURE_OES/TEXTURE_2D)
transformMatrixfloat arraynull4×4 row-major texture transformation matrix (@Nullable)
eglContextEGLContextnullShared EGL context (@Nullable)
timeStamplong0Timestamp in milliseconds. If 0, the SDK fills it in using the local clock.

AoqVideoCodecType

Codec type for externally encoded frames.
Enum valueValueDescription
AoqVideoCodecTypeJPEG0JPEG encoding

AoqVideoEncodedFrame

Externally encoded video frame. The application encodes the frame; the SDK packages and sends it without re-encoding.
FieldTypeDefault valueDescription
codecAoqVideoCodecTypeAoqVideoCodecTypeJPEGEncoding format
databyte arraynullEncoded data (@Nullable)
widthint0Width in pixels
heightint0Height in pixels
timeStamplong0Timestamp in milliseconds. If 0, the SDK fills it in using the local clock.

AoqVideoDeviceStateCode

Video device capture state codes.
Enum valueValueDescription
AoqVideoDeviceNone0No state
AoqVideoDeviceCaptureStarting1Capture starting
AoqVideoDeviceCaptureStarted2Capture started
AoqVideoDeviceCaptureStopping3Capture stopping
AoqVideoDeviceCaptureStopped4Capture stopped
AoqVideoDeviceCaptureFail5Capture failed

AoqVideoDeviceState

Video device capture state.
FieldTypeDefault valueDescription
stateAoqVideoDeviceStateCodeAoqVideoDeviceNoneDevice capture state
reasonint0Error reason code (see AoqErrorCode)
AoqAudioExternalStreamConfig

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

AoqAudioStreamDirection

Enum value

Value

Description

AoqAudioStreamPublish

0

Publish stream (send)

AoqAudioStreamPlayout

1

Playout stream (receive)

AoqScreenCaptureStateCode

ValueNumberDescription
AoqScreenCaptureNone0None
AoqScreenCaptureStarting1Starting
AoqScreenCaptureStarted2Input ready; does not indicate transmission
AoqScreenCaptureStopping3Stopping
AoqScreenCaptureStopped4Stopped
AoqScreenCaptureFail5Start or runtime failure

AoqScreenCaptureState

FieldTypeDefaultDescription
stateAoqScreenCaptureStateCodeAoqScreenCaptureNoneScreen capture state.
reasonint00 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 valueValueDescription
AoqVideoSourceCaptured0Video data after capture (before preprocessing)
AoqVideoSourcePreEncode1Video data before encoding (after preprocessing)
AoqVideoSourceRemote2Remote video data after decoding and before rendering

AoqVideoObserverMode

Video frame callback modes.
Enum valueValueDescription
AoqVideoObserverModeReadOnly0Read-only mode
AoqVideoObserverModeReadWrite1Read-write mode

AoqVideoObserverAlignment

Video output width alignment.
Enum valueValueDescription
AoqVideoObserverAlignmentDefault0Default alignment
AoqVideoObserverAlignmentEven1Even alignment
AoqVideoObserverAlignment424-byte alignment
AoqVideoObserverAlignment838-byte alignment
AoqVideoObserverAlignment16416-byte alignment

AoqVideoObserverConfig

Video frame callback configuration.
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeVideoVideo track to observe. Only Video and Screen are supported.
formatAoqVideoPixelFormatAoqVideoPixelFormatI420Desired callback pixel format
alignmentAoqVideoObserverAlignmentAoqVideoObserverAlignmentDefaultWidth alignment policy
modeAoqVideoObserverModeAoqVideoObserverModeReadOnlyRead/write mode. Only I420 supports read-write access.
mirrorAppliedbooleanfalseWhether 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.
FieldTypeDefault valueDescription
formatAoqVideoPixelFormatAoqVideoPixelFormatUnknownPixel format
widthint0Width in pixels
heightint0Height in pixels
dataByteBuffernullPacked-format data (NV12/NV21/BGRA/RGBA). The direct ByteBuffer references native memory (@Nullable).
dataYByteBuffernullI420 Y plane (@Nullable)
dataUByteBuffernullI420 U plane (@Nullable)
dataVByteBuffernullI420 V plane (@Nullable)
strideYint0Y plane stride
strideUint0U plane stride
strideVint0V plane stride
textureIdint0Texture ID (valid for TEXTURE_OES/TEXTURE_2D)
transformMatrixfloat arraynull4×4 row-major texture transformation matrix (valid for TEXTURE_OES/TEXTURE_2D) (@Nullable)
timeStamplong0Timestamp in milliseconds

Data message types

AoqDataMsg

Field

Type

Default

Description

data

byte[]

new byte[0]

Message data (byte array)

Text Generation
Image Generation
Video Generation
World models
Audio
  • Audio generation
Text Embedding
Decision Model
TokenPlan
Model Production