AOQ Client SDK macOS API reference
This topic describes the Objective-C APIs, callbacks, and data types of AOQ Client SDK for macOS.
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 SDK holds the engine instance as a global singleton, provides APIs through the AoqClientEngine class, and reports asynchronous events through the AoqEngineDelegate protocol.
API index
Engine lifecycle
| API | Description |
|---|---|
| createEngine | Create an engine instance (singleton) |
| destroy | Destroy the engine instance |
| getVersion | Get the SDK version |
| connect | Connect to the Relay server |
| disconnect | Disconnect from the server |
Audio device management
| API | Description |
|---|---|
| startAudioCapture | Open the audio capture device (microphone) |
| stopAudioCapture | Close the audio capture device |
| muteAudioCapture | Mute or unmute audio capture |
| startAudioPlayer | Start audio rendering (remote audio playback) |
| stopAudioPlayer | Stop audio rendering |
| pauseAudioPlayer | Pause audio rendering, with optional fade-out |
| resumeAudioPlayer | Resume audio rendering, with optional fade-in |
| interruptAudioPlayer | Interrupt the current audio session |
Audio encoding configuration
| API | Description |
|---|---|
| setAudioEncoderConfig | Set audio encoding parameters |
| setAudioDecoderConfig | Set audio decoding parameters |
Audio file playback
| API | Description |
|---|---|
| startAudioFile | Start playing and publishing a local audio file |
| stopAudioFile | Stop audio file playback |
| pauseAudioFile | Pause audio file playback |
| resumeAudioFile | Resume audio file playback |
| getAudioFileDuration | Get the total duration of the audio file |
| getAudioFileCurrentPosition | Get the current playback position of the audio file |
| setAudioFilePositionMillis | Seek to a position in the audio file |
| setAudioFileVolume | Set the audio file volume |
| getAudioFileVolume | Get the current audio file volume |
External audio streams
| API | Description |
|---|---|
| addAudioExternalStream | Add an external audio stream |
| pushAudioExternalStreamData | Push external PCM audio data |
| setAudioExternalStreamVolume | Set the external audio stream volume |
| getAudioExternalStreamVolume | Get the external audio stream volume |
| clearAudioExternalStreamBuffer | Clear the external audio stream buffer |
| removeAudioExternalStream | Remove an external audio stream |
Audio frame callbacks
| API | Description |
|---|---|
| setAudioFrameObserver | Set the audio frame callback delegate |
| enableAudioFrameObserver | Enable or disable audio frame callbacks at a specified stage |
Local audio volume indication
| API | Description |
|---|---|
| enableLocalAudioVolumeIndication | Enable or disable local capture volume indication |
Video device management
| API | Description |
|---|---|
| startVideoCapture | Open the video capture device (camera) |
| stopVideoCapture | Close the video capture device |
| setLocalView | Set or remove the local video rendering window |
| setRemoteView | Set or remove the remote video rendering window |
Video encoding and external input
| API | Description |
|---|---|
| setVideoEncoderConfig | Set video encoding parameters |
| setVideoDecoderConfig | Set video decoding parameters |
| pushExternalVideoCapturedFrame | Push externally captured video frames |
| pushExternalVideoEncodedFrame | Push externally encoded video frames |
Screen capture
| API | Description |
|---|---|
| getScreenSourceList | Get the list of screen capture sources (Mac desktop only) |
| startScreenCapture | Start screen capture |
| stopScreenCapture | Stop screen capture |
Media stream transmission control
| API | Description |
|---|---|
| enableSendMediaStream | Enable or disable local media stream transmission |
Video frame callbacks
| API | Description |
|---|---|
| setVideoFrameObserver | Set the video frame callback delegate |
| enableVideoFrameObserver | Enable or disable video frame callbacks at a specified stage |
Real-time messages
| API | Description |
|---|---|
| sendDataMsg | Send a real-time data message |
AoqEngineDelegate
| API | Description |
|---|---|
| onError | Engine error callback |
| onWarning | Engine warning callback |
| onConnectionStatusChange | Connection status change callback |
| onStats | Engine statistics callback |
| onAudioDeviceStateChanged | Audio device operation status change callback |
| onAudioDeviceRouteChanged | Audio output route change callback |
| onAudioFileState | Audio file playback status callback |
| onLocalAudioVolumeIndication | Local capture volume indication callback |
| onVideoDeviceStateChanged | Video device operation status change callback |
| onDataMsg | Received real-time data message callback |
AoqAudioFrameDelegate
| API | Description |
|---|---|
| onCapturedAudioFrame | Called when a raw audio frame is captured. The frame contains unprocessed PCM data. |
| onProcessCapturedAudioFrame | Called for an audio frame after 3A processing, such as echo cancellation and noise suppression. |
| onPublishAudioFrame | Called for an audio frame before publishing, immediately before encoding and transmission. |
| onPlaybackAudioFrame | Called for a remote audio frame before playback, after decoding and mixing. |
AoqVideoFrameDelegate
| API | Description |
|---|---|
| onCapturedVideoFrame | Called when a raw video frame is captured, before preprocessing. trackType distinguishes Video and Screen tracks. |
| onPreEncodeVideoFrame | Called for a video frame after preprocessing and before encoding. |
| onRemoteVideoFrame | Called for a remote video frame after decoding and before rendering. |
API details
Engine lifecycle
createEngine:delegate:
Creates the engine instance. The SDK holds the engine as a global singleton, so calling this method again returns the existing instance.
+ (instancetype _Nonnull)createEngine:(AoqCreateConfig * _Nonnull)config
delegate:(id<AoqEngineDelegate> _Nonnull)delegate;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Engine creation configuration. For more information, see |
|
| Engine event callback delegate. For more information, see |
Returns: The engine instance. nil is never returned.
destroy
Destroys the engine instance. After the engine is destroyed, you must call createEngine:delegate: again before you can continue to use it.
+ (int)destroy;
Returns: 0 on success; non-zero on failure.
getVersion
Gets the SDK version.
+ (NSString * _Nonnull)getVersion;
Returns: The version string.
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.
- (int)connect:(AoqConnectConfig * _Nonnull)config;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Connection authentication configuration. For more information, see |
Returns: 0 indicates that the call is dispatched and runs asynchronously; non-zero indicates that parameter validation failed.
disconnect
Disconnects from the server.
- (int)disconnect;
Returns: 0 indicates that the call is dispatched and runs asynchronously; non-zero indicates a failure.
Audio device management
startAudioCapture:
Opens the audio capture device (microphone).
- (int)startAudioCapture:(AoqAudioCaptureConfig * _Nonnull)config;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio capture configuration. For more information, see |
Returns: 0 on success; non-zero on failure.
stopAudioCapture
Closes the audio capture device.
- (int)stopAudioCapture;
Returns: 0 on success; non-zero on failure.
muteAudioCapture:
Mutes or unmutes audio capture.
- (int)muteAudioCapture:(BOOL)mute;
Parameters
Parameters | Type | Description |
|---|---|---|
|
|
|
Returns: 0 on success; non-zero on failure.
startAudioPlayer:
Starts audio rendering to play remote audio.
- (int)startAudioPlayer:(AoqAudioPlaybackConfig * _Nonnull)config;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio playback configuration. For more information, see |
Returns: 0 on success; non-zero on failure.
stopAudioPlayer
Stops audio rendering.
- (int)stopAudioPlayer;
Returns: 0 on success; non-zero on failure.
pauseAudioPlayer:
Pauses audio rendering, with fade-out supported.
- (int)pauseAudioPlayer:(NSInteger)fadeMs;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Fade-out duration, in milliseconds. 0 indicates immediate pause. |
Returns: 0 on success; non-zero on failure.
resumeAudioPlayer:
Resumes audio rendering, with fade-in supported.
- (int)resumeAudioPlayer:(NSInteger)fadeMs;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Fade-in duration, in milliseconds. 0 indicates immediate resumption. |
Returns: 0 on success; non-zero on failure.
interruptAudioPlayer:fadeMs:
Interrupts the current audio session and stops the audio that is currently playing.
- (int)interruptAudioPlayer:(AoqTrackType)trackType fadeMs:(NSInteger)fadeMs;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Track type. For more information, see |
|
| Fade-out duration, in milliseconds. 0 indicates immediate interruption. |
Returns: 0 on success; non-zero on failure.
Audio encoding configuration
setAudioEncoderConfig:
Sets audio encoding parameters.
- (int)setAudioEncoderConfig:(AoqAudioCodecConfig * _Nonnull)config;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio codec configuration. For more information, see |
Returns: 0 on success; non-zero on failure.
setAudioDecoderConfig:
Sets audio decoding parameters.
- (int)setAudioDecoderConfig:(AoqAudioCodecConfig * _Nonnull)config;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio codec configuration. For more information, see |
Returns: 0 on success; non-zero on failure.
Audio file playback
startAudioFile:config:
Starts playing a local audio file to the publishing stream.
- (int)startAudioFile:(NSString * _Nonnull)fileId
config:(AoqAudioFileMixConfig * _Nonnull)config;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio file ID. The business layer must ensure that it is unique. |
|
| Audio file mixing configuration. For more information, see |
Returns: 0 on success; non-zero on failure.
stopAudioFile:
Stops audio file playback.
- (int)stopAudioFile:(NSString * _Nonnull)fileId;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio file ID |
Returns: 0 on success; non-zero on failure.
pauseAudioFile:
Pauses audio file playback.
- (int)pauseAudioFile:(NSString * _Nonnull)fileId;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio file ID |
Returns: 0 on success; non-zero on failure.
resumeAudioFile:
Resumes audio file playback.
- (int)resumeAudioFile:(NSString * _Nonnull)fileId;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio file ID |
Returns: 0 on success; non-zero on failure.
getAudioFileDuration:
Gets the total duration of the audio file.
- (long long)getAudioFileDuration:(NSString * _Nonnull)fileId;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio file ID |
Returns: A value greater than or equal to 0 indicates the duration of the audio file, in milliseconds; a value less than 0 indicates a failure.
getAudioFileCurrentPosition:
Gets the current playback position of the audio file.
- (long long)getAudioFileCurrentPosition:(NSString * _Nonnull)fileId;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio file ID |
Returns: A value greater than or equal to 0 indicates the current playback position, in milliseconds; a value less than 0 indicates a failure.
setAudioFilePositionMillis:positionMillis:
Sets the playback position of the audio file (seek).
- (int)setAudioFilePositionMillis:(NSString * _Nonnull)fileId
positionMillis:(long long)positionMillis;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio file ID |
|
| Playback position, in milliseconds |
Returns: 0 on success; non-zero on failure.
setAudioFileVolume:type:volume:
Sets the volume of the audio file.
- (int)setAudioFileVolume:(NSString * _Nonnull)fileId
type:(AoqAudioStreamDirection)type
volume:(NSInteger)volume;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio file ID |
|
| Audio stream direction. For more information, see |
|
| Volume value. Valid values: 0 to 100. |
Returns: 0 on success; non-zero on failure.
getAudioFileVolume:type:
Gets the current volume of the audio file.
- (int)getAudioFileVolume:(NSString * _Nonnull)fileId
type:(AoqAudioStreamDirection)type;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio file ID |
|
| Audio stream direction. For more information, see |
Returns: A value from 0 to 100 indicates the volume; a value less than 0 indicates a failure.
External audio streams
addAudioExternalStream:config:
Adds an external audio stream.
- (int)addAudioExternalStream:(NSString * _Nonnull)streamId
config:(AoqAudioExternalStreamConfig * _Nonnull)config;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| External audio stream ID. The business layer must ensure that it is unique. |
|
| External audio stream configuration. For more information, see |
Returns: 0 on success; non-zero on failure.
pushAudioExternalStreamData:data:
Feeds external audio PCM data. If AoqECAudioExternalBufferFull (110) is returned, the SDK buffer is full, and we recommend that you wait about 20 ms and then send the current data frame again.
- (int)pushAudioExternalStreamData:(NSString * _Nonnull)streamId
data:(AoqAudioFrameData * _Nonnull)data;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| External audio stream ID |
|
| Raw external audio data. For more information, see |
Returns: 0 on success; non-zero on failure.
NoteBest practice: In real-time capture scenarios, push 10 ms of data at a time and push whenever data is available. When the data comes from a file, push 40 ms of data at a time at 30 ms intervals, and handle the AoqECAudioExternalBufferFull return value.
setAudioExternalStreamVolume:type:volume:
Sets the volume of an external audio stream.
- (int)setAudioExternalStreamVolume:(NSString * _Nonnull)streamId
type:(AoqAudioStreamDirection)type
volume:(NSInteger)volume;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| External audio stream ID |
|
| External audio stream type. For more information, see |
|
| Volume value. Valid values: 0 to 100. |
Returns: 0 on success; non-zero on failure.
getAudioExternalStreamVolume:type:
Gets the volume of an external audio stream.
- (int)getAudioExternalStreamVolume:(NSString * _Nonnull)streamId
type:(AoqAudioStreamDirection)type;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| External audio stream ID |
|
| External audio stream type. For more information, see |
Returns: A value from 0 to 100 indicates the volume; a value less than 0 indicates a failure.
clearAudioExternalStreamBuffer:fadeoutMs:
Clears the buffer of an external audio stream.
- (void)clearAudioExternalStreamBuffer:(NSString * _Nonnull)streamId
fadeoutMs:(NSInteger)fadeoutMs;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| External audio stream ID |
|
| Fade-out duration. -1 uses the SDK's default fade-out, 0 clears everything without a fade-out, and a value greater than 0 keeps a fade-out of the specified number of milliseconds. |
Returns: None.
removeAudioExternalStream:
Removes an external audio stream.
- (int)removeAudioExternalStream:(NSString * _Nonnull)streamId;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| External audio stream ID |
Returns: 0 on success; non-zero on failure.
Audio frame callbacks
setAudioFrameObserver:
Sets the audio frame data callback delegate. Pass nil to stop callbacks. After you set the delegate, call enableAudioFrameObserver:audioSource:config: to enable the callback for the corresponding data source.
- (int)setAudioFrameObserver:(id<AoqAudioFrameDelegate> _Nullable)delegate;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio frame callback delegate. For more information, see |
Returns: 0 on success; non-zero on failure.
enableAudioFrameObserver:audioSource:config:
Enables or disables the audio frame callback at a specified position.
- (int)enableAudioFrameObserver:(BOOL)enabled
audioSource:(AoqAudioSource)audioSource
config:(AoqAudioObserverConfig * _Nonnull)config;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Specifies whether to allow data callbacks |
|
| Type of the raw audio data source. For more information, see |
|
| Callback parameter settings. For more information, see |
Returns: 0 on success; non-zero on failure.
Local audio volume indication
enableLocalAudioVolumeIndication:
Enables or disables local capture volume indication. After it is enabled, the onLocalAudioVolumeIndication: callback is triggered at the interval specified by config.interval. If config.interval <= 0, the callback is disabled. You must call this method after startAudioCapture: to obtain volume data.
- (int)enableLocalAudioVolumeIndication:(AoqAudioVolumeIndicationConfig * _Nonnull)config;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Volume indication configuration. For more information, see |
Returns: 0 on success; non-zero on failure.
Video device management
startVideoCapture:
Opens the video capture device (camera). When isExternal=YES is configured, the camera is not opened, and frames are fed by pushExternalVideoCapturedFrame:frame:.
- (int)startVideoCapture:(AoqVideoCaptureConfig * _Nonnull)config;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Video capture configuration. For more information, see |
Returns: 0 on success; non-zero on failure.
stopVideoCapture
Closes the video capture device.
- (int)stopVideoCapture;
Returns: 0 on success; non-zero on failure.
setLocalView:canvas:
Sets or removes the local video rendering window. If you pass nil for canvas or canvas.view is nil, the binding is removed.
- (int)setLocalView:(AoqTrackType)trackType canvas:(AoqVideoCanvas * _Nullable)canvas;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Video track. Pass |
|
| Rendering canvas. For more information, see |
Returns: 0 on success; non-zero on failure.
setRemoteView:canvas:
Sets or removes the remote video rendering window. If you pass nil for canvas or canvas.view is nil, the binding is removed.
- (int)setRemoteView:(AoqTrackType)trackType canvas:(AoqVideoCanvas * _Nullable)canvas;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Video track. Pass |
|
| Rendering canvas. For more information, see |
Returns: 0 on success; non-zero on failure.
Video encoding and external input
setVideoEncoderConfig:
Sets video encoding parameters and routes them based on config.trackType.
- (int)setVideoEncoderConfig:(AoqVideoCodecConfig * _Nonnull)config;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Video codec configuration. For more information, see |
Returns: 0 on success; non-zero on failure.
setVideoDecoderConfig:
Sets video decoding parameters (a codec proposal on the subscribing side, which must be called before connect:). The call is routed based on config.trackType.
- (int)setVideoDecoderConfig:(AoqVideoCodecConfig * _Nonnull)config;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Video codec configuration. For more information, see |
Returns: 0 on success; non-zero on failure.
pushExternalVideoCapturedFrame:frame:
Pushes an external video frame. You must first call startVideoCapture: and configure isExternal=YES. If external video capture is not started or the format is not supported, AoqECParamInvalid is returned.
- (int)pushExternalVideoCapturedFrame:(AoqTrackType)trackType
frame:(AoqVideoFrame * _Nonnull)frame;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Routing target. Pass |
|
| External video frame data. For more information, see |
Returns: 0 on success; AoqECVideoExternalBufferFull (210) indicates that the buffer is full; a value less than 0 indicates another error.
pushExternalVideoEncodedFrame:frame:
Pushes an externally encoded video frame directly, bypassing the encoder. You must first call setVideoEncoderConfig: and configure isExternal=YES. Only JPEG is currently supported.
- (int)pushExternalVideoEncodedFrame:(AoqTrackType)trackType
frame:(AoqVideoEncodedFrame * _Nonnull)frame;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Routing target. Pass |
|
| Externally encoded frame data. For more information, see |
Returns: 0 on success; non-zero on failure.
Screen capture
- (int)startScreenCapture:(AoqScreenCaptureConfig * _Nonnull)config;
- (int)stopScreenCapture;
config specifies screen capture settings. Screen content is sent on the AoqTrackTypeScreen track.
Returns 0 on success or a nonzero value on failure. These methods return synchronously and do not provide an onScreenCaptureStateChanged callback.
Call getScreenSourceList to enumerate screens and windows, then pass the selected sourceId and sourceType in the capture configuration.
For external raw frames, set isExternal=YES 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.
getScreenSourceList
- (AoqScreenSourceList * _Nullable)getScreenSourceList;
Returns a screen source list, or nil on failure.
Media stream transmission control
enableSendMediaStream:enable:
Enables or disables sending of a local media stream. We recommend that you disable sending after initialization and enable it only after the onConnectionStatusChange: callback reports AoqConnectionStatusConnected.
- (int)enableSendMediaStream:(AoqTrackType)trackType enable:(BOOL)enable;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Routing target. |
|
|
|
Returns: 0 indicates that the call is dispatched and runs asynchronously; non-zero indicates a failure.
Video frame callbacks
setVideoFrameObserver:
Sets the video frame data callback delegate. Pass nil to stop callbacks. After you set the delegate, call enableVideoFrameObserver:videoSource:config: to enable the callback for the corresponding data source.
- (int)setVideoFrameObserver:(id<AoqVideoFrameDelegate> _Nullable)delegate;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Video frame callback delegate. For more information, see |
Returns: 0 on success; non-zero on failure.
enableVideoFrameObserver:videoSource:config:
Enables or disables the video frame callback at a specified position.
- (int)enableVideoFrameObserver:(BOOL)enabled
videoSource:(AoqVideoSource)videoSource
config:(AoqVideoObserverConfig * _Nonnull)config;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Specifies whether to enable data callbacks at a position |
|
| Data source of the video frame callback (position in the pipeline). For more information, see |
|
| Callback parameter settings. For more information, see |
Returns: 0 on success; non-zero on failure.
Real-time messages
sendDataMsg:
Sends a real-time data message.
- (int)sendDataMsg:(AoqDataMsg * _Nonnull)msg;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Message content. For more information, see |
Returns: 0 on success; non-zero on failure.
AoqEngineDelegate
AoqEngineDelegate is the unified entry point for all asynchronous event notifications from the SDK. It is passed in when you call createEngine:delegate:. All callback methods are @required. State transitions: Disconnected → Connecting → Connected/Failed → Disconnected.
onError:message:
Engine error callback.
- (void)onError:(NSInteger)code message:(NSString * _Nonnull)message;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Error code. For more information, see |
|
| Error description |
onWarning:message:
Engine warning callback.
- (void)onWarning:(NSInteger)code message:(NSString * _Nonnull)message;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Warning code. For more information, see |
|
| Warning description |
onConnectionStatusChange:
Engine connection status change callback.
- (void)onConnectionStatusChange:(AoqConnectionStatus)status;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Connection status. For more information, see |
onStats:
Engine statistics callback.
- (void)onStats:(AoqStats * _Nonnull)stats;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Statistics data. For more information, see |
onAudioDeviceStateChanged:
Callback for audio device capture and playback operation status changes.
- (void)onAudioDeviceStateChanged:(AoqAudioDeviceState * _Nonnull)state;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Audio device state. For more information, see |
onAudioDeviceRouteChanged:
Audio output route change callback.
- (void)onAudioDeviceRouteChanged:(NSInteger)routeType;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Route type. For the valid values, see |
onAudioFileState:
Callback for audio file playback status.
- (void)onAudioFileState:(AoqAudioFileState * _Nonnull)state;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| File playback state. For more information, see |
onLocalAudioVolumeIndication:
Local capture volume indication callback. To enable it, call enableLocalAudioVolumeIndication:.
- (void)onLocalAudioVolumeIndication:(AoqAudioVolume * _Nonnull)volume;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Local volume information. For more information, see |
onVideoDeviceStateChanged:
Callback for video device capture operation status changes.
- (void)onVideoDeviceStateChanged:(AoqVideoDeviceState * _Nonnull)state;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Video device state. For more information, see |
onDataMsg:
Callback for a received real-time data message.
- (void)onDataMsg:(AoqDataMsg * _Nonnull)msg;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Data message. For more information, see |
AoqAudioFrameDelegate
Protocol for audio frame data callbacks. All methods are @optional. Do not perform any time-consuming operations in the callbacks. Otherwise, audio anomalies may occur.
onCapturedAudioFrame:
Callback for raw captured data. To enable it, call enableAudioFrameObserver: and set audioSource = AoqAudioSourceCaptured. You can set the sample rate and the number of channels, and read-write mode is supported.
- (void)onCapturedAudioFrame:(AoqAudioFrameData * _Nonnull)frame;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Raw captured audio data. For more information, see |
onProcessCapturedAudioFrame:
Callback for data after 3A processing. To enable it, call enableAudioFrameObserver: and set audioSource = AoqAudioSourceProcessCaptured. You can set the sample rate and the number of channels, and read-write mode is supported.
- (void)onProcessCapturedAudioFrame:(AoqAudioFrameData * _Nonnull)frame;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Raw audio data after 3A processing. For more information, see |
onPublishAudioFrame:frame:
Callback for publishing data. To enable it, call enableAudioFrameObserver: and set audioSource = AoqAudioSourcePublish. You can set the sample rate and the number of channels, and only read-only mode is supported.
- (void)onPublishAudioFrame:(AoqTrackType)trackType
frame:(AoqAudioFrameData * _Nonnull)frame;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Track type. For more information, see |
|
| Raw audio data to be published. For more information, see |
onPlaybackAudioFrame:
Callback for playback data. To enable it, call enableAudioFrameObserver: and set audioSource = AoqAudioSourcePlayback. You can set the sample rate and the number of channels, and read-write mode is supported.
- (void)onPlaybackAudioFrame:(AoqAudioFrameData * _Nonnull)frame;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Raw audio data for playback. For more information, see |
AoqVideoFrameDelegate
Protocol for video frame data callbacks. All methods are @optional. Do not perform any time-consuming operations in the callbacks. Otherwise, video stuttering may occur. A return value of YES indicates that the data is modified and must be written back to the SDK. Writing back takes effect only for I420 and CVPixelBuffer. A return value of NO indicates read-only. The data in frame is valid only during the callback. To use it asynchronously, copy it yourself.
onCapturedVideoFrame:
Callback for local raw data after capture, before preprocessing. To enable it, call enableVideoFrameObserver: and set videoSource = AoqVideoSourceCaptured.
- (BOOL)onCapturedVideoFrame:(AoqTrackType)trackType frame:(AoqVideoFrame * _Nonnull)frame;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Captured video frame data. For more information, see |
| trackType | AoqTrackType | Video track type: Video or Screen. |
Returns: YES indicates that the data is modified and must be written back to the SDK; NO indicates read-only.
onPreEncodeVideoFrame:frame:
Callback for local raw data before encoding, after preprocessing. To enable it, call enableVideoFrameObserver: and set videoSource = AoqVideoSourcePreEncode.
- (BOOL)onPreEncodeVideoFrame:(AoqTrackType)trackType
frame:(AoqVideoFrame * _Nonnull)frame;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Video track type. For more information, see |
|
| Video frame data before encoding. For more information, see |
Returns: YES indicates that the data is modified and must be written back to the SDK; NO indicates read-only.
onRemoteVideoFrame:frame:
Callback for remote raw data after decoding and before rendering. To enable it, call enableVideoFrameObserver: and set videoSource = AoqVideoSourceRemote.
- (BOOL)onRemoteVideoFrame:(AoqTrackType)trackType
frame:(AoqVideoFrame * _Nonnull)frame;
Parameters
Parameters | Type | Description |
|---|---|---|
|
| Video track type. For more information, see |
|
| Remote video frame data. For more information, see |
Returns: YES indicates that the data is modified and must be written back to the SDK; NO indicates read-only.
Data types and enumerations
Common types
AoqCreateConfig
Engine creation configuration.
Field | Type | Default value | Description |
|---|---|---|---|
|
|
| SDK working directory |
|
|
| Specifies whether to enable raw audio data dump (for debugging) |
|
|
| Extended parameters |
| maxEncodedVideoFrameBytes | NSInteger | 190 × 1024 | Maximum encoded frame size in bytes. Applies only to the SDK internal JPEG encoder. A value of 0 disables the limit. |
| enableDropOversizedVideoFrame | BOOL | NO | For the SDK internal JPEG encoder, whether to drop a frame that remains oversized at the lowest quality. |
AoqConnectConfig
Configuration for connecting to the relay server.
Field | Type | Description |
|---|---|---|
|
| Connection authentication token |
|
| Session ID |
|
| Server certificate fingerprint |
|
| List of relay access points |
|
| Workspace hash ID |
|
| Array of local publishing track attributes |
|
| Array of local subscribing track attributes |
AoqRelayEndpoint
A relay access point.
Field | Type | Default value | Description |
|---|---|---|---|
|
|
| Path index |
|
|
| Server address (domain name or IP address) |
|
|
| Server port |
| tcpPort | NSInteger | 0 | TCP fallback port. A value of 0 uses the SDK default port, 443. |
AoqTrackParam
The track attribute.
Field | Type | Default value | Description |
|---|---|---|---|
|
|
| Track type |
|
|
| Streaming or non-streaming mode. Effective only for the audio downlink. |
AoqDataMsg
Data structure of a real-time message.
Field | Type | Description |
|---|---|---|
|
| Message content. It points to memory held by the caller. |
Statistics types
AoqStats
Engine statistics.
Field | Type | Description |
|---|---|---|
|
| Array of publishing statistics for audio |
|
| Array of publishing statistics for video |
|
| Array of publishing statistics for data messages |
|
| Array of subscribing statistics for audio |
|
| Array of subscribing statistics for video |
|
| Array of subscribing statistics for data messages |
|
| Network statistics |
AoqNetworkStats
Network statistics.
Field | Type | Description |
|---|---|---|
|
| Send bitrate, in bit/s |
|
| Cumulative bytes sent |
|
| Receive bitrate, in bit/s |
|
| Cumulative bytes received |
|
| Packet loss rate, from 0 to 100 |
|
| Round-trip latency, in ms |
AoqAudioPublishStats
Publishing statistics for audio.
Field | Type | Description |
|---|---|---|
|
| Track type |
|
| Bitrate, in bit/s |
|
| Cumulative bytes |
|
| Encoding volume of the publishing stream |
AoqVideoPublishStats
Publishing statistics for video.
Field | Type | Description |
|---|---|---|
|
| Track type |
|
| Bitrate, in bit/s |
|
| Cumulative bytes |
|
| Encoding frame rate |
AoqDataMsgPublishStats
Publishing statistics for data messages.
Field | Type | Description |
|---|---|---|
|
| Track type |
|
| Bitrate, in bit/s |
|
| Cumulative bytes |
AoqAudioSubscribeStats
Subscribing statistics for audio.
Field | Type | Description |
|---|---|---|
|
| Track type |
|
| Bitrate, in bit/s |
|
| Cumulative bytes |
|
| Playback volume |
AoqVideoSubscribeStats
Subscribing statistics for video.
Field | Type | Description |
|---|---|---|
|
| Track type |
|
| Bitrate, in bit/s |
|
| Cumulative bytes |
|
| Decoding frame rate |
|
| Rendering frame rate |
AoqDataMsgSubscribeStats
Subscribing statistics for data messages.
Field | Type | Description |
|---|---|---|
|
| Track type |
|
| Bitrate, in bit/s |
|
| Cumulative bytes |
Enumerations
AoqErrorCode
Error code enumeration.
Enum value | Value | Description |
|---|---|---|
| 0 | Success |
| 1 | Invalid parameter |
| 2 | Invalid state |
| 3 | The API is not supported |
| 100 | Generic audio error |
| 110 | External audio buffer is full |
| 120 | Generic audio device error |
| 121 | Recording permission not granted |
| 122 | Recording device is in use |
| 123 | Start recording in the background |
| 124 | Failed to start recording |
| 125 | Playback device is in use |
| 126 | Start playback in the background |
| 127 | Failed to start playback |
| 200 | Generic video error |
| 210 | External video buffer is full |
| 211 | External video capture is not enabled |
| 212 | External video encoding is not enabled |
| 220 | Generic video device error |
| 221 | Failed to open the camera |
| 222 | Camera permission not granted |
| 223 | Camera is in use |
| 224 | Camera runtime error |
| 230 | Generic video codec error |
| 231 | Failed to initialize the encoder |
| 240 | Generic video rendering error |
| 241 | Failed to create the rendering view |
| 242 | Rendering drawing error |
AoqWarningCode
Warning code enumeration.
Enum value | Value | Description |
|---|---|---|
| 0 | No warning |
| 100 | Generic audio warning |
| 101 | Audio howling detected |
| 120 | Generic audio device warning |
| 121 | Microphone enumeration error |
| 122 | Microphone startup timed out |
| 123 | Recording error |
| 124 | Speaker enumeration error |
| 125 | Speaker startup timed out |
| 126 | Playback error |
| 200 | Generic video warning |
| 201 | Camera enumeration error |
| 202 | Video encoder switched |
| 203 | Video rendering downgraded |
AoqTrackType
Track type.
Enum value | Value | Description |
|---|---|---|
| 0 | Audio track |
| 1 | Video track |
| 2 | Data message track |
| AoqTrackTypeScreen | 3 | Screen sharing track. Supports uplink. |
AoqEncoderType
Encoder type.
Enum value | Value | Description |
|---|---|---|
| 0 | Unknown format |
| 1 | Audio PCM |
| 2 | Audio Opus |
| 3 | Video H.264 |
| 4 | Video JPEG |
| 5 | Message text |
AoqTrackMode
Streaming or non-streaming mode. Effective only for the audio downlink.
Enum value | Value | Description |
|---|---|---|
| 0 | Segmented: data is packaged and delivered in semantic segments, such as a sentence. |
| 1 | Streaming: data is delivered continuously. |
AoqConnectionStatus
Engine connection status.
Enum value | Value | Description |
|---|---|---|
| 0 | Disconnected |
| 1 | Connecting |
| 2 | Connected |
| 3 | Connection failed |
Audio types
AoqAudioCaptureConfig
Audio capture configuration.
Field | Type | Default value | Description |
|---|---|---|---|
|
|
| Specifies whether to use external capture |
|
|
| Number of audio capture channels. 1 and 2 are supported. |
AoqAudioPlaybackConfig
Audio playback configuration.
Field | Type | Default value | Description |
|---|---|---|---|
|
|
| Specifies whether to use external playback |
|
|
| Number of audio playback channels. 1 and 2 are supported. |
AoqAudioCodecConfig
Audio codec configuration.
Field | Type | Default value | Description |
|---|---|---|---|
|
|
| Track type |
|
|
| Codec format |
|
|
| Sample rate, in Hz |
|
|
| Number of channels |
|
|
| Bitrate, in bit/s |
AoqAudioDeviceStateCode
Audio device state code.
Enum value | Value | Description |
|---|---|---|
| 0 | No state |
| 1 | Capture starting |
| 2 | Capture started |
| 3 | Capture stopping |
| 4 | Capture stopped |
| 5 | Capture failed |
| 6 | Playback starting |
| 7 | Playback started |
| 8 | Playback stopping |
| 9 | Playback stopped |
| 10 | Playback failed |
AoqAudioDeviceState
Audio device state.
Field | Type | Description |
|---|---|---|
|
| Status code |
|
| Error code ( |
AoqAudioDeviceRouteType
Audio device route type.
Enum value | Value | Description |
|---|---|---|
| 0 | Default |
| 1 | Headphones |
| 2 | Receiver |
| 3 | Headphones without a microphone |
| 4 | Built-in speaker |
| 5 | USB |
| 6 | Bluetooth |
| 7 | Bluetooth A2DP |
Audio file types
AoqAudioFileMixConfig
Configuration for playing an audio file to the publishing stream.
Field | Type | Default value | Description |
|---|---|---|---|
|
| - | File name (including the path). Required. |
|
|
| Number of loops. -1 indicates unlimited looping. |
|
|
| Start playback position, in ms |
|
|
| Publishing volume. Valid values: 0 to 100. |
|
|
| Playback volume. Valid values: 0 to 100. |
AoqAudioFileStateCode
Audio file state code.
Enum value | Value | Description |
|---|---|---|
| 0 | No state |
| 1 | Started |
| 2 | Stopped |
| 3 | Paused |
| 4 | Resumed |
| 5 | Playback completed |
| 6 | Buffering |
| 7 | Buffering ended |
| 8 | Playback failed |
AoqAudioFileErrorCode
Audio file playback error code.
Enum value | Value | Description |
|---|---|---|
| 0 | No error |
| 1 | Failed to open the file |
| 2 | Failed to decode the file |
AoqAudioFileState
Audio file state.
Field | Type | Description |
|---|---|---|
|
| File ID |
|
| Status code |
|
| Error code |
External audio stream and volume types
AoqAudioStreamDirection
Direction of an external audio stream.
Enum value | Value | Description |
|---|---|---|
| 0 | Publishing audio |
| 1 | Playback audio |
AoqAudioExternalStreamToggle
External audio stream switching state.
Enum value | Value | Description |
|---|---|---|
| 0 | Recovered |
| 1 | Paused |
AoqAudioExternalStreamConfig
External audio stream configuration.
Field | Type | Default value | Description |
|---|---|---|---|
|
|
| Audio track type |
|
|
| Audio stream format. PCM is supported. |
|
|
| Number of channels |
|
|
| Sample rate, in Hz |
|
|
| Playback volume. Valid values: 0 to 100. |
|
|
| Publishing volume. Valid values: 0 to 100. |
|
|
| Maximum buffer duration, in ms |
|
|
| Specifies whether to apply 3A processing to the input PCM |
AoqAudioFrameData
External audio data.
Field | Type | Description |
|---|---|---|
|
| Pointer to the raw audio PCM data |
|
| Number of bytes of the PCM data |
|
| Number of samples (per channel) |
|
| Bytes per sample |
|
| Number of channels |
|
| Number of samples per second |
|
| PCM input round |
|
| Timestamp |
|
| Valid in data callbacks. |
AoqAudioSource
Data source of the audio frame callback.
Enum value | Value | Description |
|---|---|---|
| 0 | Captured audio data |
| 1 | Audio data after 3A processing |
| 2 | Audio data to be published (requires a successful Connect) |
| 3 | Audio data to be played |
AoqAudioObserverMode
Audio frame callback mode.
Enum value | Value | Description |
|---|---|---|
| 0 | Read-only |
| 1 | Read-write |
AoqAudioObserverConfig
Audio frame callback configuration.
Field | Type | Default value | Description |
|---|---|---|---|
|
|
| Sample rate of the callback audio |
|
|
| Number of audio channels in the callback |
|
|
| Read-write mode |
AoqAudioVolumeIndicationConfig
Local volume indication configuration.
| Field | Type | Default | Description |
|---|---|---|---|
| reportSpeech | BOOL | NO | Whether to detect speech. |
| interval | NSInteger | 0 | Callback interval in milliseconds. Values of 0 or less disable callbacks; values between 0 and 10 use 10. |
| smooth | NSInteger | 3 | Smoothing factor, from 0 to 10. Higher values produce smoother results. |
AoqAudioVolume
Local volume information.
| Field | Type | Default | Description |
|---|---|---|---|
| isSpeech | BOOL | NO | Whether speech is detected. |
| volume | NSInteger | 0 | Smoothed instantaneous volume, from 0 to 255. |
Video types
AoqVideoCaptureConfig
Video capture configuration.
Field | Type | Default value | Description |
|---|---|---|---|
|
|
| Capture width, in pixels. This parameter is ineffective when |
|
|
| Capture height, in pixels. This parameter is ineffective when |
|
|
| Capture frame rate. This parameter is ineffective when |
|
|
| Specifies whether to use external capture. If it is |
AoqVideoCanvas
Data structure for video rendering.
Field | Type | Default value | Description |
|---|---|---|---|
|
|
| Display view. Pass nil to remove the rendering binding. |
|
|
| Rendering mode |
The caller must ensure that the lifecycle of view outlasts the period during which it is set by setLocalView: / setRemoteView:.
AoqRenderMode
Rendering display mode.
Enum value | Value | Description |
|---|---|---|
| 0 | Auto mode |
| 1 | Stretch-to-fill mode. When the aspect ratios do not match, the image is stretched to the target ratio and becomes distorted. |
| 2 | Letterbox mode. When the aspect ratios do not match, black bars are added to the top and bottom or the left and right. |
| 3 | Crop mode. When the aspect ratios do not match, the width or height is cropped and part of the image is lost. |
AoqRenderView
The rendering view control, which inherits from NSView and can be used as AoqVideoCanvas.view.
Attribute | Type | Description |
|---|---|---|
|
| Display view used internally by the engine |
|
| Rendering width |
|
| Rendering height |
|
| Specifies whether to enable Metal rendering |
|
| Event delegate of the rendering view |
AoqRenderViewDelegate
The event delegate protocol of the rendering view.
- (void)onRenderViewSizeChanged:(AoqRenderView * _Nonnull)view;
Callback | Description |
|---|---|
| Callback for rendering view size changes |
AoqVideoPixelFormat
Video pixel format.
Enum value | Value | Description |
|---|---|---|
| 0 | Unknown format |
| 1 | I420 |
| 2 | NV12 |
| 3 | NV21 |
| 4 | BGRA |
| 5 | RGBA |
| 6 | Zero-copy path. Set the |
AoqVideoFrame
External video data.
Field | Type | Description |
|---|---|---|
|
| Pixel format |
|
| Width, in pixels |
|
| Height, in pixels |
|
| Packed-format data (NV12/NV21/BGRA/RGBA) |
|
| Data of the three I420 planes |
|
| Stride of the three I420 planes |
|
| Zero-copy, which is used when |
|
| Timestamp, in ms. If it is 0, the SDK fills it in with the local clock. |
AoqVideoCodecType
The codec type of the externally encoded frame.
Enum value | Value | Description |
|---|---|---|
| 0 | JPEG |
AoqVideoEncodedFrame
An externally encoded video frame. The caller performs the encoding, and the SDK packages and sends the frame directly without re-encoding.
Field | Type | Description |
|---|---|---|
|
| Codec format |
|
| Encoded data |
|
| Width, in pixels |
|
| Height, in pixels |
|
| Timestamp, in ms. If it is 0, the SDK fills it in with the local clock. |
AoqVideoCodecConfig
Video codec parameters, which are shared by encoding and decoding. For decoding, only trackType / codecType / width / height / fps / bitrate take effect and participate in negotiation as a subscription proposal, whereas the other fields are used only for encoding.
Field | Type | Default value | Description |
|---|---|---|---|
|
|
| External encoding mode. When it is |
|
|
| Track type |
|
|
| Codec format |
|
|
| Resolution width |
|
|
| Resolution height |
|
|
| Frame rate |
|
|
| Initial bitrate, in bit/s |
|
|
| Minimum bitrate, in bit/s |
|
|
| Keyframe interval, in seconds |
|
|
| Mirror mode |
|
|
| Orientation mode |
AoqMirrorMode
Mirror mode.
Enum value | Value | Description |
|---|---|---|
| 0 | Disable mirroring |
| 1 | Enable mirroring |
AoqOrientationMode
Orientation mode.
Enum value | Value | Description |
|---|---|---|
| 0 | Auto |
| 1 | Portrait |
| 2 | Landscape |
AoqVideoDeviceStateCode
Video device state code.
Enum value | Value | Description |
|---|---|---|
| 0 | No state |
| 1 | Camera starting |
| 2 | Camera started |
| 3 | Camera stopping |
| 4 | Camera stopped |
| 5 | Failed to start the camera |
AoqVideoDeviceState
Video device state.
Field | Type | Description |
|---|---|---|
|
| Status code |
|
| Error code ( |
AoqVideoSource
Data source of the video frame callback (position in the pipeline).
Enum value | Value | Description |
|---|---|---|
| 0 | Captured video data before preprocessing |
| 1 | Video data before encoding, after preprocessing |
| 2 | Remote video data after decoding and before rendering |
AoqVideoObserverMode
Video frame callback mode.
Enum value | Value | Description |
|---|---|---|
| 0 | Read-only |
| 1 | Read-write |
AoqVideoObserverAlignment
Width alignment method for video output.
Enum value | Value | Description |
|---|---|---|
| 0 | Default |
| 1 | Even-number alignment |
| 2 | 4-byte alignment |
| 3 | 8-byte alignment |
| 4 | 16-byte alignment |
AoqVideoObserverConfig
Video frame callback configuration.
Field | Type | Default value | Description |
|---|---|---|---|
|
|
| Expected pixel format of the callback data |
|
|
| Width alignment policy |
|
|
| Read-write mode. ReadWrite is supported only for I420 / CVPixelBuffer. |
|
|
| Specifies whether to mirror the callback data |
| trackType | AoqTrackType | AoqTrackTypeVideo | Video track to observe. Supports Video and Screen only. |
Screen capture types
AoqScreenShareSourceType
| Value | Number | Description |
|---|---|---|
| AoqScreenShareSourceTypeDesktop | 0 | Entire desktop |
| AoqScreenShareSourceTypeWindow | 1 | A specific window |
AoqScreenSourceInfo
| Field | Type | Default | Description |
|---|---|---|---|
| sourceType | AoqScreenShareSourceType | Desktop | Source type |
| sourceId | int64_t | 0 | Source ID |
| sourceName | NSString * | — | Source name |
| sourceIsSelf | BOOL | — | Whether the window belongs to the current process |
AoqScreenSourceList
| Field | Type | Description |
|---|---|---|
| sourceList | NSArray<AoqScreenSourceInfo *> * | Array of screen sources |
AoqScreenCaptureConfig
| Field | Type | Default | Description |
|---|---|---|---|
| isExternal | BOOL | NO | Whether the application supplies raw screen frames. |
| sourceId | int64_t | 0 | Screen source ID. |
| sourceType | AoqScreenShareSourceType | AoqScreenShareSourceTypeWindow | Screen source type. |