AOQ Client SDK Linux Python API reference
This topic describes the Python APIs, callbacks, and data types of AOQ Client SDK for Linux.
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.
The Linux platform provides APIs through the aoq_client_sdk Python module. All callbacks are triggered on native threads, and you must ensure thread safety yourself.
API index
Engine lifecycle
| API | Description |
|---|---|
| create_engine | Create an engine instance (singleton) |
| destroy | Destroy the engine instance |
| get_version | Get the SDK version |
| connect | Connect to the Relay server |
| disconnect | Disconnect from the server |
Audio device management
| API | Description |
|---|---|
| start_audio_capture | Open the audio capture device (microphone) |
| stop_audio_capture | Close the audio capture device |
| mute_audio_capture | Mute or unmute audio capture |
| start_audio_player | Start audio rendering (remote audio playback) |
| stop_audio_player | Stop audio rendering |
| pause_audio_player | Pause audio rendering, with optional fade-out |
| resume_audio_player | Resume audio rendering, with optional fade-in |
| interrupt_audio_player | Interrupt the current audio session |
Audio encoding configuration
| API | Description |
|---|---|
| set_audio_encoder_config | Set audio encoding parameters |
| set_audio_decoder_config | Set audio decoding parameters |
Video device management
| API | Description |
|---|---|
| start_video_capture | Open the video capture device (camera) |
| stop_video_capture | Close the video capture device |
| set_local_view | Set or remove the local video rendering window |
| set_remote_view | Set or remove the remote video rendering window |
Video codec configuration and external input
| API | Description |
|---|---|
| set_video_encoder_config | Set video encoding parameters |
| set_video_decoder_config | Set video decoding parameters |
| push_external_video_frame | Push externally captured video frames |
| push_external_video_encoded_frame | Push externally encoded video frames |
Media stream transmission control
| API | Description |
|---|---|
| enable_send_media_stream | Enable or disable local media stream transmission |
Audio file playback
| API | Description |
|---|---|
| start_audio_file | Start playing and publishing a local audio file |
| stop_audio_file | Stop audio file playback |
| pause_audio_file | Pause audio file playback |
| resume_audio_file | Resume audio file playback |
| get_audio_file_duration | Get the total duration of the audio file |
| get_audio_file_current_position | Get the current playback position of the audio file |
| set_audio_file_position_millis | Seek to a position in the audio file |
| set_audio_file_volume | Set the audio file volume |
| get_audio_file_volume | Get the current audio file volume |
External audio streams
| API | Description |
|---|---|
| add_audio_external_stream | Add an external audio stream |
| remove_audio_external_stream | Remove an external audio stream |
| push_audio_external_stream_data | Push external PCM audio data |
| set_audio_external_stream_volume | Set the external audio stream volume |
| get_audio_external_stream_volume | Get the external audio stream volume |
| clear_audio_external_stream_buffer | Clear the external audio stream buffer |
Real-time messages
| API | Description |
|---|---|
| send_data_msg | Send a real-time data message |
Audio frame callbacks
| API | Description |
|---|---|
| set_audio_frame_observer | Set the audio frame callback listener |
| enable_audio_frame_observer | Enable or disable audio frame callbacks at a specified stage |
Video frame callbacks
| API | Description |
|---|---|
| set_video_frame_observer | Set the video frame callback listener |
| enable_video_frame_observer | Enable or disable video frame callbacks at a specified stage |
Callback interfaces
| API | Description |
|---|---|
| on_error | Engine error callback |
| on_connection_status_change | Connection status change callback |
| on_data_msg | Received real-time data message callback |
IAudioFrameObserver callbacks
| API | Description |
|---|---|
| on_captured_audio_frame | Called when a raw audio frame is captured. The frame contains unprocessed PCM data. |
| on_process_captured_audio_frame | Called for an audio frame after 3A (AEC/AGC/ANS) processing. |
| on_publish_audio_frame | Called for an audio frame before publishing, immediately before encoding and transmission. |
| on_playback_audio_frame | Called for a decoded remote audio frame before playback. |
IVideoFrameObserver callbacks
| API | Description |
|---|---|
| on_captured_video_frame | Called when a raw video frame is captured. The frame has not yet been preprocessed. |
| on_pre_encode_video_frame | Called for a raw video frame after preprocessing and before encoding. |
| on_remote_video_frame | Called for a raw remote video frame after decoding and before rendering. |
Utility functions
| API | Description |
|---|---|
| load_library | Specify and load the native shared library manually |
API details
Engine lifecycle
create_engine
Creates the engine instance (class method). The SDK holds the engine as a global singleton, so calling this method again returns the existing instance. After destroy, you must call create_engine again before you can continue to use the engine.
@classmethod
def create_engine(cls, config: AoqCreateConfig, listener: AoqEngineEventListener) -> "AoqClientEngine"
Parameters | Type | Description |
|---|---|---|
config | AoqCreateConfig | Engine creation configuration |
listener | AoqEngineEventListener | Engine event callback listener |
Returns: The AoqClientEngine engine instance. If the creation fails, a RuntimeError is thrown.
destroy
Destroys the engine instance (class method) and releases all resources.
@classmethod
def destroy(cls) -> int
Returns: 0 on success; non-zero on failure.
get_version
Gets the current SDK version (static method).
@staticmethod
def get_version() -> str
Returns: The version string, such as "1.0.0".
connect
Connects to the relay server. The application server obtains temporary AOQ connection parameters based on the protocol in use and sends them to the client. For more information, see Token authentication.
def connect(self, config: AoqConnectConfig) -> int
Parameters | Type | Description |
|---|---|---|
config | AoqConnectConfig | Connection configuration, which includes the token, SID, and the list of relay access points |
Returns: 0 indicates that the call is dispatched and runs asynchronously; non-zero indicates that parameter validation failed.
disconnect
Disconnects from the server and releases the resources associated with the connection.
def disconnect(self) -> int
Returns: 0 indicates that the call is dispatched and runs asynchronously; non-zero indicates a failure.
Audio device management
start_audio_capture
def start_audio_capture(self, config: AoqAudioCaptureConfig) -> int
On Linux, this method is an empty implementation. It returns 0 but does not open a sound card or microphone. Provide audio input through an external audio stream.
stop_audio_capture
def stop_audio_capture(self) -> int
This method has no actual effect because the Linux build does not set the audio capture device state.
mute_audio_capture
def mute_audio_capture(self, mute: bool) -> int
The Linux build does not support microphone capture. This method cannot control an actual audio capture device.
start_audio_player
def start_audio_player(self, config: AoqAudioPlaybackConfig) -> int
On Linux, this method is an empty implementation. It returns 0 but does not open a sound card or speaker. Obtain audio output through an audio frame callback and play it yourself.
stop_audio_player / pause_audio_player / resume_audio_player
def stop_audio_player(self) -> int
def pause_audio_player(self, fade_ms: int = 0) -> int
def resume_audio_player(self, fade_ms: int = 0) -> int
The Linux build does not support speaker playback, so these methods cannot control an actual audio playback device. fade_ms specifies the fade-out or fade-in duration in milliseconds. 0 indicates immediate execution.
interrupt_audio_player
def interrupt_audio_player(self, track_type: int, fade_ms: int = 0) -> int
Interrupts the current audio session.
Audio encoding configuration
def set_audio_encoder_config(self, config: AoqAudioCodecConfig) -> int
def set_audio_decoder_config(self, config: AoqAudioCodecConfig) -> int
Video device management
def start_video_capture(self, config: AoqVideoCaptureConfig) -> int
def stop_video_capture(self) -> int
def set_local_view(self, track_type: int, canvas: Optional[AoqVideoCanvas]) -> int
def set_remote_view(self, track_type: int, canvas: Optional[AoqVideoCanvas]) -> int
The Linux build does not support camera capture and has no video rendering backend. When you call start_video_capture, set is_external to True and provide frames by calling push_external_video_frame. set_local_view, set_remote_view, and AoqVideoCanvas.view have no actual effect on Linux. To preview video, obtain frames through a video frame callback and render them yourself.
Video codec configuration and external input
set_video_decoder_config
def set_video_decoder_config(self, config: AoqVideoCodecConfig) -> int
config specifies video decoding settings. Only the following fields take effect: track_type, codec_type, width, height, fps, bitrate. Other fields apply only to encoding.
Call before connect to propose codec settings for subscriptions.
Returns 0 on success or a nonzero value on failure.
def set_video_encoder_config(self, config: AoqVideoCodecConfig) -> int
def set_video_decoder_config(self, config: AoqVideoCodecConfig) -> int
def push_external_video_frame(self, frame: AoqVideoFrame, track_type: AoqTrackType = AoqTrackType.VIDEO) -> int
def push_external_video_encoded_frame(self, track_type: AoqTrackType, frame: AoqVideoEncodedFrame) -> int
Note
- For set_video_decoder_config, only the track_type/codec_type/width/height/fps/bitrate fields take effect.
- push_external_video_frame is consumed only after start_video_capture(is_external=True). For packed formats (NV12/NV21/BGRA/RGBA), fill
frame.data; for the three I420 planes, fillframe.data_y/u/vand the corresponding stride. If the buffer is full, it returns AoqErrorCode.VIDEO_EXTERNAL_BUFFER_FULL(210). - push_external_video_encoded_frame requires set_video_encoder_config(is_external=True, codec_type=VIDEO_JPEG) to have been called. Otherwise, it returns AoqErrorCode.VIDEO_EXTERNAL_ENCODER_NOT_ENABLED(212). It uses the bypass path without re-encoding and does not require start_video_capture.
Media stream transmission control
def enable_send_media_stream(self, track_type: AoqTrackType, enable: bool) -> int
After initialization, disable sending separately for each required track by calling enable_send_media_stream(AoqTrackType.AUDIO, False) and enable_send_media_stream(AoqTrackType.VIDEO, False) as needed. After on_connection_status_change(CONNECTED) is received, enable each track in a separate call.
Audio file playback
def start_audio_file(self, file_id: str, config: AoqAudioFileMixConfig) -> int
def stop_audio_file(self, file_id: str) -> int
def pause_audio_file(self, file_id: str) -> int
def resume_audio_file(self, file_id: str) -> int
def get_audio_file_duration(self, file_id: str) -> int
def get_audio_file_current_position(self, file_id: str) -> int
def set_audio_file_position_millis(self, file_id: str, position_ms: int) -> int
def set_audio_file_volume(self, file_id: str, type_: AoqAudioStreamDirection, volume: int) -> int
def get_audio_file_volume(self, file_id: str, type_: AoqAudioStreamDirection) -> int
External audio streams
def add_audio_external_stream(self, stream_id: str, config: AoqAudioExternalStreamConfig) -> int
def remove_audio_external_stream(self, stream_id: str) -> int
def push_audio_external_stream_data(self, stream_id: str, data: AoqAudioFrameData) -> int
def set_audio_external_stream_volume(self, stream_id: str, type_: AoqAudioStreamDirection, volume: int) -> int
def get_audio_external_stream_volume(self, stream_id: str, type_: AoqAudioStreamDirection) -> int
def clear_audio_external_stream_buffer(self, stream_id: str, fadeout_ms: int = -1) -> None
NoteWhen the buffer is full, push_audio_external_stream_data returns AoqErrorCode.AUDIO_EXTERNAL_BUFFER_FULL(110). We recommend that you wait about 20 ms and then retry the same frame.
Real-time messages
def send_data_msg(self, msg: AoqDataMsg) -> int
Audio frame callbacks
def set_audio_frame_observer(self, observer: Optional[IAudioFrameObserver]) -> int
def enable_audio_frame_observer(self, enabled: bool, audio_source: AoqAudioSource, config: AoqAudioObserverConfig) -> int
Pass None to set_audio_frame_observer to unregister the observer.
Video frame callbacks
def set_video_frame_observer(self, observer: Optional[IVideoFrameObserver]) -> int
def enable_video_frame_observer(self, enabled: bool, video_source: AoqVideoSource, config: AoqVideoObserverConfig) -> int
Pass None to set_video_frame_observer to unregister the observer.
Callback interfaces
AoqEngineEventListener
Base class for engine event callbacks. All methods are optional overrides with default empty implementations. Callbacks are triggered on native threads, and you must ensure thread safety yourself.
class AoqEngineEventListener:
def on_error(self, code: int, message: str) -> None: ...
def on_connection_status_change(self, status: AoqConnectionStatus) -> None: ...
def on_data_msg(self, msg: AoqDataMsg) -> None: ...
on_error
def on_error(self, code: int, message: str) -> None
Engine error callback. code corresponds to an AoqErrorCode enum value.
on_connection_status_change
def on_connection_status_change(self, status: AoqConnectionStatus) -> None
Connection status change callback. State transitions: DISCONNECTED -> CONNECTING -> CONNECTED/FAILED -> DISCONNECTED.
on_data_msg
def on_data_msg(self, msg: AoqDataMsg) -> None
Callback for a received real-time data message.
IAudioFrameObserver callbacks
Base class for audio frame data listeners. All methods are optional overrides with default empty implementations.
class IAudioFrameObserver:
def on_captured_audio_frame(self, data: AoqAudioFrameData) -> None: ...
def on_process_captured_audio_frame(self, data: AoqAudioFrameData) -> None: ...
def on_publish_audio_frame(self, track_type: AoqTrackType, data: AoqAudioFrameData) -> None: ...
def on_playback_audio_frame(self, data: AoqAudioFrameData) -> None: ...
The callback is triggered on the native audio thread. Do not perform any time-consuming operations in it. AoqAudioFrameData.data is already a bytes copy and can be safely used asynchronously.
on_captured_audio_frame
Called when a raw audio frame is captured. The frame contains unprocessed PCM data.
def on_captured_audio_frame(self, data: AoqAudioFrameData) -> None: ...
| Parameter | Type | Description |
|---|---|---|
| data | AoqAudioFrameData | Captured audio frame data |
Return value: None.
NoteFrame data is already copied into bytes and can safely be used asynchronously.
on_process_captured_audio_frame
Called for an audio frame after 3A (AEC/AGC/ANS) processing.
def on_process_captured_audio_frame(self, data: AoqAudioFrameData) -> None: ...
| Parameter | Type | Description |
|---|---|---|
| data | AoqAudioFrameData | Audio frame data after 3A processing |
Return value: None.
NoteFrame data is already copied into bytes and can safely be used asynchronously.
on_publish_audio_frame
Called for an audio frame before publishing, immediately before encoding and transmission.
def on_publish_audio_frame(self, track_type: AoqTrackType, data: AoqAudioFrameData) -> None: ...
| Parameter | Type | Description |
|---|---|---|
| track_type | AoqTrackType | Audio track type |
| data | AoqAudioFrameData | Audio frame data before publishing |
Return value: None.
NoteFrame data is already copied into bytes and can safely be used asynchronously. This callback supports read-only access only.
on_playback_audio_frame
Called for a decoded remote audio frame before playback.
def on_playback_audio_frame(self, data: AoqAudioFrameData) -> None: ...
| Parameter | Type | Description |
|---|---|---|
| data | AoqAudioFrameData | Remote audio frame data before playback |
Return value: None.
NoteFrame data is already copied into bytes and can safely be used asynchronously.
IVideoFrameObserver callbacks
Base class for video frame data listeners. All methods are optional overrides and return False by default.
class IVideoFrameObserver:
def on_captured_video_frame(self, track_type: AoqTrackType, frame: AoqVideoFrame) -> bool: ...
def on_pre_encode_video_frame(self, track_type: AoqTrackType, frame: AoqVideoFrame) -> bool: ...
def on_remote_video_frame(self, track_type: AoqTrackType, frame: AoqVideoFrame) -> bool: ...
The callback is triggered on the native video thread. Do not perform any time-consuming operations in it. The pixel data in the frame is already a bytes copy. The Python layer currently uses copy semantics and does not support writing modifications back, so we recommend that you always return False.
on_captured_video_frame
Called when a raw video frame is captured. The frame has not yet been preprocessed.
def on_captured_video_frame(self, track_type: AoqTrackType, frame: AoqVideoFrame) -> bool: ...
| Parameter | Type | Description |
|---|---|---|
| track_type | AoqTrackType | Frame track (Video / Screen) |
| frame | AoqVideoFrame | Captured video frame data |
Return value: True requests that modified data be written back to the SDK (I420 only). False indicates read-only access. The current Python layer uses copy semantics; always returning False is recommended.
NoteFrame data is already copied into bytes and can safely be used asynchronously.
on_pre_encode_video_frame
Called for a raw video frame after preprocessing and before encoding.
def on_pre_encode_video_frame(self, track_type: AoqTrackType, frame: AoqVideoFrame) -> bool: ...
| Parameter | Type | Description |
|---|---|---|
| track_type | AoqTrackType | Frame track (Video / Screen) |
| frame | AoqVideoFrame | Video frame data before encoding |
Return value: True requests that modified data be written back to the SDK (I420 only). False indicates read-only access. The current Python layer uses copy semantics; always returning False is recommended.
NoteFrame data is already copied into bytes and can safely be used asynchronously.
on_remote_video_frame
Called for a raw remote video frame after decoding and before rendering.
def on_remote_video_frame(self, track_type: AoqTrackType, frame: AoqVideoFrame) -> bool: ...
| Parameter | Type | Description |
|---|---|---|
| track_type | AoqTrackType | Frame track (Video / Screen) |
| frame | AoqVideoFrame | Decoded remote video frame data |
Return value: True requests that modified data be written back to the SDK (I420 only). False indicates read-only access. The current Python layer uses copy semantics; always returning False is recommended.
NoteFrame data is already copied into bytes and can safely be used asynchronously.
Utility functions
load_library
def load_library(path: Optional[str] = None) -> ctypes.CDLL
Loads the native shared library. You usually do not need to call this method manually, because the library is loaded automatically when you first use the engine. If path is empty, libAoqClientSdk.so is searched for in the following order: the AOQ_CLIENT_SDK_LIB environment variable, the directory of the module, the lib directory at the same level, and the default system paths. If the loading fails, an OSError is thrown. A typical cause is that a dependent library is not in LD_LIBRARY_PATH.
Data types and enumerations
All data types are Python dataclasses. You can construct them directly and assign values to the fields.
Common types
AoqCreateConfig
Field | Type | Default value | Description |
|---|---|---|---|
work_dir | str | "" | SDK working directory |
enable_dump_audio | bool | False | Specifies whether to enable audio dump (for debugging) |
extras | str | "" | Extended parameter string |
| max_encoded_video_frame_bytes | int | 190 × 1024 | Maximum encoded frame size in bytes. Applies only to the SDK internal JPEG encoder. |
| enable_drop_oversized_video_frame | bool | False | For the SDK internal JPEG encoder, whether to drop a frame that remains oversized at the lowest quality. |
AoqConnectConfig
Field | Type | Default value | Description |
|---|---|---|---|
token | str | "" | Connection authentication token |
sid | str | "" | Session ID |
certificate | str | "" | Server certificate fingerprint |
relay_endpoints | List[AoqRelayEndpoint] | None | List of relay access points |
workspace_id_hash | str | "" | Workspace ID hash |
publish_tracks | List[AoqTrackParam] | None | List of local published tracks |
subscribe_tracks | List[AoqTrackParam] | None | List of local subscribed tracks |
AoqRelayEndpoint
Field | Type | Default value | Description |
|---|---|---|---|
endpoint | str | "" | Domain name or IP address of the relay server |
port | int | 0 | Port of the relay server |
route_index | int | -1 | Path index. If it is less than 0, the SDK automatically fills it in based on the array subscript. |
| tcp_port | int | 0 | TCP fallback port. A value of 0 uses the SDK default port, 443. |
AoqTrackParam
Field | Type | Default value | Description |
|---|---|---|---|
track_type | AoqTrackType | AoqTrackType.AUDIO | Track type |
AoqDataMsg
Field | Type | Default value | Description |
|---|---|---|---|
data | bytes | b"" | Message data (a byte string) |
Enumerations
AoqErrorCode
Enum value | Value | Description |
|---|---|---|
OK | 0 | Success |
PARAM_INVALID | 1 | Invalid parameter |
STATE_INVALID | 2 | Invalid state |
AUDIO | 100 | Generic audio error |
AUDIO_EXTERNAL_BUFFER_FULL | 110 | External audio buffer is full |
AUDIO_DEVICE | 120 | Generic audio device error |
AUDIO_DEVICE_RECORDING_AUTH_FAILED | 121 | Recording permission not granted |
AUDIO_DEVICE_RECORDING_OCCUPIED | 122 | Recording device is in use |
AUDIO_DEVICE_RECORDING_START_FAIL | 124 | Failed to start recording |
AUDIO_DEVICE_PLAYOUT_OCCUPIED | 125 | Playback device is in use |
AUDIO_DEVICE_PLAYOUT_START_FAIL | 127 | Failed to start playback |
VIDEO | 200 | Generic video error |
VIDEO_EXTERNAL_BUFFER_FULL | 210 | External video buffer is full |
AoqWarningCode
Warning codes.
| Enum value | Value | Description |
|---|---|---|
| OK | 0 | No warning |
| AUDIO | 100 | General audio warning |
| AUDIO_HOWLING | 101 | Audio howling detected |
| AUDIO_DEVICE | 120 | General audio device warning |
| AUDIO_DEVICE_MIC_ENUMERATE_ERROR | 121 | Microphone enumeration error |
| AUDIO_DEVICE_MIC_START_TIMEOUT | 122 | Microphone startup timeout |
| AUDIO_DEVICE_RECORDING_ERROR | 123 | Recording error |
| AUDIO_DEVICE_SPEAKER_ENUMERATE_ERROR | 124 | Speaker enumeration error |
| AUDIO_DEVICE_SPEAKER_START_TIMEOUT | 125 | Speaker startup timeout |
| AUDIO_DEVICE_PLAYOUT_ERROR | 126 | Playback error |
| VIDEO | 200 | General video warning |
| VIDEO_CAMERA_ENUMERATE_ERROR | 201 | Camera enumeration error |
| VIDEO_ENCODER_SWITCHED | 202 | Video encoder switched |
| VIDEO_RENDER_DOWNGRADE | 203 | Video rendering downgraded |
NoteThe AoqEngineEventListener base class does not declare on_warning, but the C bridge dynamically forwards warnings through getattr(listener, "on_warning"). Implement this method on your listener to receive warnings.
AoqConnectionStatus
Enum value | Value | Description |
|---|---|---|
DISCONNECTED | 0 | Disconnected |
CONNECTING | 1 | Connecting |
CONNECTED | 2 | Connected |
FAILED | 3 | Connection failed |
AoqTrackType
Enum value | Value | Description |
|---|---|---|
AUDIO | 0 | Audio track |
VIDEO | 1 | Video track |
DATA | 2 | Data message track |
AoqEncoderType
Enum value | Value | Description |
|---|---|---|
UNKNOWN | 0 | Unknown format |
AUDIO_PCM | 1 | Audio PCM |
AUDIO_OPUS | 2 | Audio Opus |
VIDEO_H264 | 3 | Video H.264 |
VIDEO_JPEG | 4 | Video JPEG |
DATA_TEXT | 5 | Message text |
AoqMirrorMode
Enum value | Value | Description |
|---|---|---|
DISABLED | 0 | Disable mirroring |
ENABLED | 1 | Enable mirroring |
AoqOrientationMode
Enum value | Value | Description |
|---|---|---|
AUTO | 0 | Auto-fit |
PORTRAIT | 1 | Portrait |
LANDSCAPE | 2 | Landscape |
AoqRenderMode
Enum value | Value | Description |
|---|---|---|
AUTO | 0 | Adaptive mode |
STRETCH | 1 | Stretch mode |
FILL | 2 | Fill mode |
CROP | 3 | Crop mode |
AoqVideoPixelFormat
Enum value | Value | Description |
|---|---|---|
UNKNOWN | 0 | Unknown format |
I420 | 1 | I420 (YUV planar format) |
NV12 | 2 | NV12 (YUV semi-planar format) |
NV21 | 3 | NV21 (YUV semi-planar format) |
BGRA | 4 | BGRA (32-bit) |
RGBA | 5 | RGBA (32-bit) |
| CV_PIXEL_BUFFER | 6 | Apple zero-copy path. Not used on Linux. |
AoqCameraDirection
Enum value | Value | Description |
|---|---|---|
FRONT | 0 | Front camera (platform-generic enum value; camera capture is not supported on Linux) |
BACK | 1 | Rear camera (platform-generic enum value; camera capture is not supported on Linux) |
Audio types
AoqAudioCaptureConfig
Field | Type | Default value | Description |
|---|---|---|---|
is_external | bool | False | Specifies whether to use external capture mode |
channel | int | 1 | Number of channels (mono by default) |
AoqAudioPlaybackConfig
Field | Type | Default value | Description |
|---|---|---|---|
is_external | bool | False | Specifies whether to use external playback mode |
channel | int | 1 | Number of channels (mono by default) |
AoqAudioCodecConfig
Field | Type | Default value | Description |
|---|---|---|---|
track_type | AoqTrackType | AUDIO | Track type |
codec_type | AoqEncoderType | AUDIO_OPUS | Codec format |
sample_rate | int | 48000 | Sample rate, in Hz |
channel | int | 1 | Number of channels |
bitrate | int | 32000 | Bitrate, in bit/s |
AoqAudioFileMixConfig
Field | Type | Default value | Description |
|---|---|---|---|
file_name | str | "" | File name (including the path). It cannot be empty. |
cycles | int | -1 | Number of loops. -1 indicates unlimited looping. |
start_pos_ms | int | 0 | Start playback position, in milliseconds |
publish_volume | int | 100 | Publishing volume. Valid values: 0 to 100. |
playout_volume | int | 100 | Playback volume. Valid values: 0 to 100. |
AoqAudioExternalStreamConfig
Field | Type | Default value | Description |
|---|---|---|---|
track_type | AoqTrackType | AUDIO | Audio track type |
codec_type | AoqEncoderType | AUDIO_PCM | Audio stream format |
channels | int | 1 | Number of channels |
sample_rate | int | 48000 | Sample rate, in Hz |
playout_volume | int | 100 | Playback volume. Valid values: 0 to 100. |
publish_volume | int | 100 | Publishing volume. Valid values: 0 to 100. |
max_buffer_duration | int | 1000 | Maximum buffer duration, in milliseconds |
enable_3a | bool | False | Specifies whether to apply 3A processing to the input PCM |
AoqAudioFrameData
Raw audio data, which is used for external input or observer callbacks.
Field | Type | Default value | Description |
|---|---|---|---|
data | bytes | b"" | Raw audio PCM data (a bytes copy in callbacks) |
num_of_samples | int | 0 | Number of samples (per channel) |
bytes_per_sample | int | 0 | Bytes per sample |
num_of_channels | int | 0 | Number of channels |
samples_per_sec | int | 0 | Number of samples per second (sample rate) |
push_sequence | int | 0 | PCM input round |
time_stamp | int | 0 | Timestamp |
auto_gen_mute | bool | False | True indicates silent data generated by the SDK |
AoqAudioObserverConfig
Field | Type | Default value | Description |
|---|---|---|---|
sample_rate | int | 48000 | Sample rate of the callback audio, in Hz |
channels | int | 1 | Number of audio channels in the callback |
mode | AoqAudioObserverMode | READ_ONLY | Read-write mode |
AoqAudioStreamDirection
Enum value | Value | Description |
|---|---|---|
PUBLISH | 0 | Publishing stream |
PLAYOUT | 1 | Playback stream (subscribing stream) |
AoqAudioExternalStreamToggle
Enum value | Value | Description |
|---|---|---|
NORMAL | 0 | Normal state |
PAUSE | 1 | Paused state |
AoqAudioSource
Enum value | Value | Description |
|---|---|---|
CAPTURED | 0 | Captured audio data |
PROCESS_CAPTURED | 1 | Audio data after 3A processing |
PUBLISH | 2 | Audio data to be published |
PLAYBACK | 3 | Audio data to be played |
AoqAudioObserverMode
Enum value | Value | Description |
|---|---|---|
READ_ONLY | 0 | Read-only mode |
READ_WRITE | 1 | Read-write mode |
Video types
AoqVideoCaptureConfig
Field | Type | Default value | Description |
|---|---|---|---|
width | int | 1280 | Capture width, in pixels. This parameter is ineffective when is_external=True. |
height | int | 720 | Capture height, in pixels. This parameter is ineffective when is_external=True. |
fps | int | 15 | Capture frame rate. This parameter is ineffective when is_external=True. |
is_external | bool | False | Specifies whether to use external capture. Linux supports only True. After you call start_video_capture, provide frames by calling push_external_video_frame. |
camera_direction | AoqCameraDirection | FRONT | Camera direction for mobile platforms. Linux has no corresponding capability. Keep the value FRONT. |
AoqVideoCodecConfig
Video codec parameters, which are shared by encoding and decoding. For decoding, only track_type/codec_type/width/height/fps/bitrate take effect, and the other fields are used only for encoding.
Field | Type | Default value | Description |
|---|---|---|---|
| is_external | bool | False | External encoding mode. When True, the caller pushes encoded frames and the SDK does not capture or encode video (applies only to encoding). |
track_type | AoqTrackType | VIDEO | Track type |
codec_type | AoqEncoderType | VIDEO_H264 | Codec format |
width | int | 540 | Encoding width, in pixels |
height | int | 960 | Encoding height, in pixels |
fps | int | 5 | Encoding frame rate |
bitrate | int | 500000 | Target bitrate, in bit/s |
min_bitrate | int | 128000 | Minimum bitrate, in bit/s |
keyframe_interval | int | 2 | Keyframe interval, in seconds |
mirror_mode | AoqMirrorMode | DISABLED | Mirror mode |
orientation_mode | AoqOrientationMode | AUTO | Video orientation mode |
AoqVideoCanvas
Field | Type | Default value | Description |
|---|---|---|---|
view | int | 0 | Rendering window handle. Linux has no rendering backend, so this field has no actual effect. Keep the value 0. |
render_mode | AoqRenderMode | AUTO | Rendering mode. Linux has no rendering backend, so this field has no actual effect. |
AoqVideoFrame
External video frame or video frame callback data. When you use a packed format (NV12/NV21/BGRA/RGBA), fill in data. When you use the three I420 planes, fill in data_y/u/v and the corresponding stride. The two methods are mutually exclusive.
Field | Type | Default value | Description |
|---|---|---|---|
format | AoqVideoPixelFormat | UNKNOWN | Pixel format |
width | int | 0 | Video width, in pixels |
height | int | 0 | Video height, in pixels |
data | bytes | b"" | Packed-format data (NV12/NV21/BGRA/RGBA) |
data_y | bytes | b"" | I420 Y plane data |
data_u | bytes | b"" | I420 U plane data |
data_v | bytes | b"" | I420 V plane data |
stride_y | int | 0 | Stride of the Y plane |
stride_u | int | 0 | Stride of the U plane |
stride_v | int | 0 | Stride of the V plane |
time_stamp | int | 0 | Timestamp, in milliseconds. If it is 0, the SDK fills it in with the local clock. |
| native_pixel_buffer | int | 0 | Apple zero-copy handle. Keep this field at 0 on Linux. |
AoqVideoEncodedFrame
An externally encoded video frame, such as a JPEG frame.
Field | Type | Default value | Description |
|---|---|---|---|
codec | AoqEncoderType | VIDEO_JPEG | Codec format |
data | bytes | b"" | Encoded data |
width | int | 0 | Width, in pixels |
height | int | 0 | Height, in pixels |
time_stamp | int | 0 | Timestamp, in milliseconds. If it is 0, the SDK fills it in with the local clock. |
AoqVideoObserverConfig
Field | Type | Default value | Description |
|---|---|---|---|
format | AoqVideoPixelFormat | I420 | Expected pixel format of the callback data |
alignment | AoqVideoObserverAlignment | DEFAULT | Width alignment policy |
mode | AoqVideoObserverMode | READ_ONLY | Read-write mode |
mirror_applied | bool | False | Specifies whether to mirror the callback data |
AoqVideoSource
Enum value | Value | Description |
|---|---|---|
CAPTURED | 0 | Captured video data before preprocessing |
PRE_ENCODE | 1 | Video data before encoding, after preprocessing |
REMOTE | 2 | Remote video data after decoding and before rendering |
AoqVideoObserverMode
Enum value | Value | Description |
|---|---|---|
READ_ONLY | 0 | Read-only mode |
READ_WRITE | 1 | Read-write mode |
AoqVideoObserverAlignment
Enum value | Value | Description |
|---|---|---|
DEFAULT | 0 | Default alignment |
EVEN | 1 | Even-number alignment |
ALIGN_4 | 2 | 4-byte alignment |
ALIGN_8 | 3 | 8-byte alignment |
ALIGN_16 | 4 | 16-byte alignment |