AOQ Client SDK iOS API reference
AOQ Client SDK iOS API reference, covering engine lifecycle, audio/video device management, codec configuration, media stream control, audio file playback, external audio streams, real-time messaging, frame callbacks, delegate protocols, and data types and enumerations.
NoteThe AOQ SDK provides generic video APIs. Qwen-Audio-Realtime does not support video input or output. For the media capabilities of other models, see their access documentation.
API index
Engine lifecycle
| API | Description |
|---|---|
| createEngine | Create an engine instance (singleton) |
| destroy | Destroy the engine instance |
| getVersion | Get the SDK version |
| connect | Connect to the Relay server |
| disconnect | Disconnect from the server |
Audio device management
| API | Description |
|---|---|
| startAudioCapture | Open the audio capture device (microphone) |
| stopAudioCapture | Close the audio capture device |
| muteAudioCapture | Mute or unmute audio capture |
| startAudioPlayer | Start audio rendering (remote audio playback) |
| stopAudioPlayer | Stop audio rendering |
| pauseAudioPlayer | Pause audio rendering, with optional fade-out |
| resumeAudioPlayer | Resume audio rendering, with optional fade-in |
| interruptAudioPlayer | Interrupt the current audio session |
| enableSpeakerphone | Switch audio output between the speaker and earpiece |
| isSpeakerphoneEnabled | Check whether audio output uses the speaker |
| setAudioSessionRestriction | Set AVAudioSession control permissions (iOS only) |
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 |
| switchCamera | Switch between front and rear cameras |
| setLocalView | Set or remove the local video rendering window |
| setRemoteView | Set or remove the remote video rendering window |
Video encoding and external input
| API | Description |
|---|---|
| setVideoEncoderConfig | Set video encoding parameters |
| setVideoDecoderConfig | Set video decoding parameters |
| pushExternalVideoCapturedFrame | Push externally captured video frames |
| pushExternalVideoEncodedFrame | Push externally encoded video frames |
Screen capture
| API | Description |
|---|---|
| startScreenCapture | Start screen capture (Broadcast Upload Extension) |
| 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 callbacks
| API | Description |
|---|---|
| onError | Engine error callback |
| onWarning | Engine warning callback |
| onConnectionStatusChange | Connection status change callback |
| onStats | Engine statistics callback |
| onAudioDeviceStateChanged | Audio device operation status change callback |
| onAudioDeviceRouteChanged | Audio output route change callback |
| onAudioDeviceInterrupted | Audio device interruption callback |
| 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 |
| onScreenCaptureStateChanged | Screen capture status change callback (@optional) |
AoqAudioFrameDelegate callbacks
| API | Description |
|---|---|
| onCapturedAudioFrame | Called when a raw audio frame is captured. The frame contains unprocessed PCM data. |
| onProcessCapturedAudioFrame | Called for an audio frame after 3A processing, such as echo cancellation and noise suppression. |
| onPublishAudioFrame | Called for an audio frame before publishing, immediately before encoding and transmission. |
| onPlaybackAudioFrame | Called for a remote audio frame before playback, after decoding and mixing. |
AoqVideoFrameDelegate callbacks
| API | Description |
|---|---|
| onCapturedVideoFrame | Called when a raw video frame is captured, before preprocessing. |
| onPreEncodeVideoFrame | Called for a video frame after preprocessing and before encoding. |
| onRemoteVideoFrame | Called for a remote video frame after decoding and before rendering. |
API details
Engine lifecycle
createEngine:delegate:
Creates the engine instance. The SDK holds a global singleton; repeated calls return the existing instance.
+ (instancetype _Nonnull)createEngine:(AoqCreateConfig * _Nonnull)config
delegate:(id<AoqEngineDelegate> _Nonnull)delegate;
| Parameter | Type | Description |
|---|---|---|
| config | AoqCreateConfig * | Engine creation configuration |
| delegate | id<AoqEngineDelegate> | Engine event delegate |
Return value: An AoqClientEngine instance. Never nil.
destroy
Destroys the engine instance and releases all resources. Call createEngine: again before using the SDK after destruction.
+ (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:.
+ (NSString * _Nonnull)getVersion;
Parameters: None.
Return value: A version string, such as "1.3.0".
connect:
Connects to the Relay server. The AppServer sends the connection parameters to the client. This call returns immediately. The actual connection result is reported through the onConnectionStatusChange: callback.
NoteIn the generic SDK API documentation, the AppServer allocates connection parameters through /api/v1/allocate. For a specific model, see Qwen-Omni-Realtime AOQ access, Qwen-Audio-Realtime AOQ access, or Qwen-LiveTranslate-Realtime AOQ access.
- (int)connect:(AoqConnectConfig * _Nonnull)config;
| Parameter | Type | Description |
|---|---|---|
| config | AoqConnectConfig * | Connection configuration, including Token, SID, Relay endpoints, and publishing/subscription tracks |
Return value: 0 indicates that the call has been dispatched for asynchronous execution. A nonzero value indicates parameter validation failure and corresponds to AoqErrorCode.
NoteThe Screen track supports upstream transmission only; downstream subscription is not implemented. Do not include AoqTrackTypeScreen in config.subscribeTracks. Otherwise, AoqECUnSupport is returned and no connection is initiated. Do not enable sending with enableSendMediaStream:enable:YES 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:.
- (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:data:), set isExternal to YES. In this mode, the microphone is not opened.
- (int)startAudioCapture:(AoqAudioCaptureConfig * _Nonnull)config;
| Parameter | Type | Description |
|---|---|---|
| config | AoqAudioCaptureConfig * | Audio capture configuration |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode. For example, AoqECAudioDeviceRecordingAuthFailed indicates that recording permission has not been granted.
NoteConfigure NSMicrophoneUsageDescription in Info.plist and obtain recording permission. Device state changes are reported through onAudioDeviceStateChanged:.
stopAudioCapture
Closes the audio capture device and stops local audio capture.
- (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.
- (int)muteAudioCapture:(BOOL)mute;
| Parameter | Type | Description |
|---|---|---|
| mute | BOOL | YES mutes capture; NO unmutes it. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteThis method takes effect only after startAudioCapture: is called.
startAudioPlayer:
Starts audio rendering and plays remote audio through the speaker or earpiece. For external rendering (playing PCM yourself), set isExternal to YES.
- (int)startAudioPlayer:(AoqAudioPlaybackConfig * _Nonnull)config;
| Parameter | Type | Description |
|---|---|---|
| config | AoqAudioPlaybackConfig * | Audio playback configuration |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode. For example, AoqECAudioDevicePlayoutOccupied indicates that the playback device is occupied.
NoteDevice state changes are reported through onAudioDeviceStateChanged:. Output route changes are reported through onAudioDeviceRouteChanged:.
stopAudioPlayer
Stops audio rendering and closes the playback device.
- (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.
- (int)pauseAudioPlayer:(NSInteger)fadeMs;
| Parameter | Type | Description |
|---|---|---|
| fadeMs | NSInteger | Fade-out duration in milliseconds. 0 pauses playback immediately. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
resumeAudioPlayer:
Resumes audio rendering with optional fade-in. Call this method after pauseAudioPlayer:.
- (int)resumeAudioPlayer:(NSInteger)fadeMs;
| Parameter | Type | Description |
|---|---|---|
| fadeMs | NSInteger | Fade-in duration in milliseconds. 0 resumes playback immediately. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
interruptAudioPlayer:fadeMs:
Interrupts the current audio conversation and clears the playback buffer. This is commonly used when a user interrupts AI speech in a conversation.
- (int)interruptAudioPlayer:(AoqTrackType)trackType fadeMs:(NSInteger)fadeMs;
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Type of the track to interrupt |
| fadeMs | NSInteger | Fade-out duration in milliseconds. 0 interrupts playback immediately. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
enableSpeakerphone:
Switches audio output to the speaker or earpiece. Takes effect only after startAudioPlayer:.
- (int)enableSpeakerphone:(BOOL)enable;
| Parameter | Type | Description |
|---|---|---|
| enable | BOOL | YES switches to the speaker; NO switches to the earpiece. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode. For example, AoqECAudioDeviceEarpieceRequiresVoipMode indicates that the earpiece requires VoIP mode.
NoteSwitching to the earpiece requires AoqAudioPlaybackConfig.isVoipMode=YES. Route changes are reported through onAudioDeviceRouteChanged:.
isSpeakerphoneEnabled
Checks whether audio is currently output through the speaker.
- (BOOL)isSpeakerphoneEnabled;
Parameters: None.
Return value: YES indicates speaker output. NO indicates the earpiece or another route.
setAudioSessionRestriction:
Sets the SDK's AVAudioSession control permissions (iOS only). Limits SDK control when the application manages AVAudioSession itself.
- (int)setAudioSessionRestriction:(int)restriction;
| Parameter | Type | Description |
|---|---|---|
| restriction | int | AVAudioSession permission bitmask corresponding to AoqAudioSessionRestriction. Multiple flags can be combined using bitwise OR. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteBy default, the SDK fully manages AVAudioSession. Use this method to constrain SDK behavior if the application needs to manage the category or activation state itself.
Audio encoding configuration
setAudioEncoderConfig:
Configures audio encoding for publishing. Configuration changes take effect immediately.
- (int)setAudioEncoderConfig:(AoqAudioCodecConfig * _Nonnull)config;
| Parameter | Type | Description |
|---|---|---|
| config | AoqAudioCodecConfig * | Audio encoding configuration. Set trackType to AoqTrackTypeAudio. |
Return value: 0 on success; non-zero on failure (an AoqErrorCode value, such as AoqECParamInvalid for invalid parameters).
NotecodecType specifies the encoding format (Opus by default). sampleRate and channel must match the capture settings. bitrate applies only to lossy codecs such as Opus.
setAudioDecoderConfig:
Configures audio decoding for subscribed audio. The settings must match the remote encoding settings.
- (int)setAudioDecoderConfig:(AoqAudioCodecConfig * _Nonnull)config;
| Parameter | Type | Description |
|---|---|---|
| config | AoqAudioCodecConfig * | Audio decoding configuration. Set trackType to AoqTrackTypeAudio. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NotesampleRate must match the output sample rate of the remote encoder. A mismatch may cause decoding errors or audio quality issues.
Audio file playback
startAudioFile:config:
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.
- (int)startAudioFile:(NSString * _Nonnull)fileId config:(AoqAudioFileMixConfig * _Nonnull)config;
| Parameter | Type | Description |
|---|---|---|
| fileId | NSString * | Application-defined file identifier used for subsequent control |
| config | AoqAudioFileMixConfig * | Audio file playback configuration |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NotePlayback state changes are reported through onAudioFileState:. Repeated calls with the same fileId replace the previous playback.
stopAudioFile:
Stops audio file playback.
- (int)stopAudioFile:(NSString * _Nonnull)fileId;
| Parameter | Type | Description |
|---|---|---|
| fileId | NSString * | File identifier, matching the value passed to startAudioFile:config: |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
pauseAudioFile:
Pauses audio file playback.
- (int)pauseAudioFile:(NSString * _Nonnull)fileId;
| Parameter | Type | Description |
|---|---|---|
| fileId | NSString * | File identifier |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
resumeAudioFile:
Resumes audio file playback. Call this method after pauseAudioFile:.
- (int)resumeAudioFile:(NSString * _Nonnull)fileId;
| Parameter | Type | Description |
|---|---|---|
| fileId | NSString * | File identifier |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
getAudioFileDuration:
Gets the total duration of an audio file.
- (long long)getAudioFileDuration:(NSString * _Nonnull)fileId;
| Parameter | Type | Description |
|---|---|---|
| fileId | NSString * | File identifier |
Return value: The total duration in milliseconds. Returns 0 if the file is not loaded or does not exist.
getAudioFileCurrentPosition:
Gets the current playback position of an audio file.
- (long long)getAudioFileCurrentPosition:(NSString * _Nonnull)fileId;
| Parameter | Type | Description |
|---|---|---|
| fileId | NSString * | File identifier |
Return value: The current playback position in milliseconds. Returns 0 if the file is not loaded or does not exist.
setAudioFilePositionMillis:positionMillis:
Sets the playback position of an audio file (seek).
- (int)setAudioFilePositionMillis:(NSString * _Nonnull)fileId positionMillis:(long long)positionMillis;
| Parameter | Type | Description |
|---|---|---|
| fileId | NSString * | File identifier |
| positionMillis | long long | Target playback position in milliseconds |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
setAudioFileVolume:type:volume:
Sets the audio file volume. Streaming and local playback volumes can be controlled separately.
- (int)setAudioFileVolume:(NSString * _Nonnull)fileId type:(AoqAudioStreamDirection)type volume:(NSInteger)volume;
| Parameter | Type | Description |
|---|---|---|
| fileId | NSString * | File identifier |
| type | AoqAudioStreamDirection | Volume direction. AoqAudioStreamPublish controls streaming; AoqAudioStreamPlayout controls playback. |
| volume | NSInteger | Volume. Valid values: 0-100. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
getAudioFileVolume:type:
Gets the current audio file volume.
- (int)getAudioFileVolume:(NSString * _Nonnull)fileId type:(AoqAudioStreamDirection)type;
| Parameter | Type | Description |
|---|---|---|
| fileId | NSString * | File identifier |
| type | AoqAudioStreamDirection | Volume direction |
Return value: The current volume (0-100). Returns 0 if the file does not exist.
External audio streams
addAudioExternalStream:config:
Adds an external audio stream. Multiple independent streams can be created and distinguished by streamId.
- (int)addAudioExternalStream:(NSString * _Nonnull)streamId config:(AoqAudioExternalStreamConfig * _Nonnull)config;
| Parameter | Type | Description |
|---|---|---|
| streamId | NSString * | Application-defined external stream identifier |
| config | AoqAudioExternalStreamConfig * | External audio stream configuration |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
pushAudioExternalStreamData:data:
Feeds external PCM audio data into the specified stream.
- (int)pushAudioExternalStreamData:(NSString * _Nonnull)streamId data:(AoqAudioFrameData * _Nonnull)data;
| Parameter | Type | Description |
|---|---|---|
| streamId | NSString * | External stream identifier |
| data | AoqAudioFrameData * | PCM audio frame data |
Return value: 0 indicates success. A nonzero value indicates failure. AoqECAudioExternalBufferFull(110) is returned when the buffer is full.
NoteMemory referenced by data.dataPtr 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:config:.
setAudioExternalStreamVolume:type:volume:
Sets the external audio stream volume. Streaming and local playback volumes can be controlled separately.
- (int)setAudioExternalStreamVolume:(NSString * _Nonnull)streamId type:(AoqAudioStreamDirection)type volume:(NSInteger)volume;
| Parameter | Type | Description |
|---|---|---|
| streamId | NSString * | External stream identifier |
| type | AoqAudioStreamDirection | Volume direction |
| volume | NSInteger | Volume. Valid values: 0-100. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
getAudioExternalStreamVolume:type:
Gets the current external audio stream volume.
- (int)getAudioExternalStreamVolume:(NSString * _Nonnull)streamId type:(AoqAudioStreamDirection)type;
| Parameter | Type | Description |
|---|---|---|
| streamId | NSString * | External stream identifier |
| type | AoqAudioStreamDirection | Volume direction |
Return value: The current volume (0-100). Returns 0 if the stream does not exist.
clearAudioExternalStreamBuffer:fadeoutMs:
Clears the external audio stream buffer with optional fade-out. Commonly used to interrupt current playback.
- (void)clearAudioExternalStreamBuffer:(NSString * _Nonnull)streamId fadeoutMs:(NSInteger)fadeoutMs;
| Parameter | Type | Description |
|---|---|---|
| streamId | NSString * | External stream identifier |
| fadeoutMs | NSInteger | Fade-out duration in milliseconds. -1 uses the default value, 0 clears the buffer immediately, and a value greater than 0 retains the specified duration for fade-out. |
Return value: None (void).
removeAudioExternalStream:
Removes an external audio stream and releases its resources.
- (int)removeAudioExternalStream:(NSString * _Nonnull)streamId;
| Parameter | Type | Description |
|---|---|---|
| streamId | NSString * | External stream identifier |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
Audio frame callbacks
setAudioFrameObserver:
Sets the audio frame delegate. Pass delegate=nil to remove it.
- (int)setAudioFrameObserver:(id<AoqAudioFrameDelegate> _Nullable)delegate;
| Parameter | Type | Description |
|---|---|---|
| delegate | id<AoqAudioFrameDelegate> | Audio frame delegate protocol. Pass nil to remove it. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteSet the delegate with this method first, then call enableAudioFrameObserver:audioSource:config: to enable callbacks at the required positions.
enableAudioFrameObserver:audioSource:config:
Enables or disables audio frame callbacks at the specified position.
- (int)enableAudioFrameObserver:(BOOL)enabled audioSource:(AoqAudioSource)audioSource config:(AoqAudioObserverConfig * _Nonnull)config;
| Parameter | Type | Description |
|---|---|---|
| enabled | BOOL | YES enables callbacks; NO disables them. |
| audioSource | AoqAudioSource | Audio source position: capture, after 3A processing, publishing, or playback |
| config | AoqAudioObserverConfig * | Callback configuration |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteCallbacks run on internal SDK threads. Do not perform time-consuming operations or blocking calls in them. dataPtr 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.
- (int)enableLocalAudioVolumeIndication:(AoqAudioVolumeIndicationConfig * _Nonnull)config;
| Parameter | Type | Description |
|---|---|---|
| config | AoqAudioVolumeIndicationConfig * | Volume indication configuration. interval<=0 disables callbacks. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteCall this method after startAudioCapture: to obtain volume data. Values of interval>0 and <10 are treated as 10.
Video device management
startVideoCapture:
Opens the video capture device (camera). Captured video is sent over AoqTrackTypeVideo. For external video input (pushExternalVideoCapturedFrame:frame:), set isExternal to YES; the camera is not opened in this mode.
- (int)startVideoCapture:(AoqVideoCaptureConfig * _Nonnull)config;
| Parameter | Type | Description |
|---|---|---|
| config | AoqVideoCaptureConfig * | Video capture configuration. |
Return value: 0 on success; non-zero on failure (an AoqErrorCode value, such as AoqECVideoDeviceCameraAuthFailed when camera permission has not been granted).
NoteConfigure NSCameraUsageDescription in Info.plist and obtain camera permission. Device state changes are reported through onVideoDeviceStateChanged:.
stopVideoCapture
Closes the video capture device and stops local video capture.
- (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=NO).
- (int)switchCamera:(AoqCameraDirection)direction;
| Parameter | Type | Description |
|---|---|---|
| direction | AoqCameraDirection | Target camera direction: AoqCameraDirectionFront for the front camera and AoqCameraDirectionBack for the rear camera. |
Return value: 0 on success; < 0 on failure (an AoqErrorCode value).
NoteThis method has no effect in external capture mode (isExternal=YES).
setLocalView:canvas:
Sets or removes the local video rendering view. Pass canvas=nil or canvas.view=nil to unbind rendering.
- (int)setLocalView:(AoqTrackType)trackType canvas:(AoqVideoCanvas * _Nullable)canvas;
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type. Set to AoqTrackTypeVideo for local preview. |
| canvas | AoqVideoCanvas * | Video rendering canvas. Pass nil to unbind it. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
setRemoteView:canvas:
Sets or removes the remote video rendering view. Pass canvas=nil or canvas.view=nil to unbind it.
- (int)setRemoteView:(AoqTrackType)trackType canvas:(AoqVideoCanvas * _Nullable)canvas;
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type |
| canvas | AoqVideoCanvas * | Video rendering canvas. Pass nil to unbind it. |
Return value: 0 on success; non-zero on failure. If trackType is AoqTrackTypeScreen, returns AoqECUnSupport and does not bind the view.
NoteThe Screen track currently supports publishing only and has no remote video to render. Do not set trackType to AoqTrackTypeScreen.
Video encoding and external input
setVideoEncoderConfig:
Configures video encoding for publishing, routed by config.trackType. If isExternal=YES, pushExternalVideoEncodedFrame:frame: sends encoded frames directly without re-encoding by the SDK.
- (int)setVideoEncoderConfig:(AoqVideoCodecConfig * _Nonnull)config;
| Parameter | Type | Description |
|---|---|---|
| config | AoqVideoCodecConfig * | Video encoding configuration. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteBefore using pushExternalVideoEncodedFrame:, call this method with isExternal=YES. This mode bypasses the capture pipeline and does not require startVideoCapture:/startScreenCapture:. When using pushExternalVideoCapturedFrame:, keep isExternal=NO so that the SDK encodes the frames.
setVideoDecoderConfig:
Configures video decoding for subscribed video, routed by config.trackType. Only trackType/codecType/width/height/fps/bitrate apply to decoding. The other fields apply only to encoding.
- (int)setVideoDecoderConfig:(AoqVideoCodecConfig * _Nonnull)config;
| Parameter | Type | Description |
|---|---|---|
| config | AoqVideoCodecConfig * | Video decoding configuration. |
Return value: 0 on success; non-zero on failure. If config.trackType is AoqTrackTypeScreen, returns AoqECUnSupport and does not apply the configuration.
NoteThe Screen track currently supports publishing only, not subscribing. Do not set config.trackType to AoqTrackTypeScreen.
pushExternalVideoCapturedFrame:frame:
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.
- (int)pushExternalVideoCapturedFrame:(AoqTrackType)trackType frame:(AoqVideoFrame * _Nonnull)frame;
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type. For AoqTrackTypeVideo, call startVideoCapture:(isExternal=YES) first. For AoqTrackTypeScreen, call startScreenCapture:(isExternal=YES) first. |
| frame | AoqVideoFrame * | External video frame data. |
Return value: 0 on success; AoqECVideoExternalCaptureNotEnabled(211) if external capture is not enabled for the track; AoqECVideoExternalBufferFull(210) if the buffer is full; < 0 on other failures.
NoteIf frame.timeStamp<=0, the SDK fills it in using the local clock. The CVPixelBuffer zero-copy path is supported (format=AoqVideoPixelFormatCVPixelBuffer).
pushExternalVideoEncodedFrame:frame:
Pushes external encoded video frames. The SDK packetizes and sends them without re-encoding. Frames are consumed only after setVideoEncoderConfig:(isExternal=YES) is called for the corresponding trackType. startVideoCapture:/startScreenCapture: is not required.
- (int)pushExternalVideoEncodedFrame:(AoqTrackType)trackType frame:(AoqVideoEncodedFrame * _Nonnull)frame;
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type. Supports AoqTrackTypeVideo / AoqTrackTypeScreen. |
| frame | AoqVideoEncodedFrame * | External encoded video frame. |
Return value: 0 on success; AoqECVideoExternalEncoderNotEnabled(212) if external encoding is not enabled for the track; < 0 on failure.
Noteframe.timeStamp is passed through unchanged. The SDK does not fill it in. The caller must ensure that timestamps increase monotonically.
Screen capture
- (int)startScreenCapture:(AoqScreenCaptureConfig * _Nonnull)config;
- (int)stopScreenCapture;
config specifies screen capture settings. Screen content is sent on the AoqTrackTypeScreen track.
For start, 0 means that the request is accepted; onScreenCaptureStateChanged reports the result asynchronously. A nonzero return rejects the request synchronously without a duplicate failure event. Stop returns 0 on success or a nonzero value on failure, and reports the stopped state through this callback.
With isExternal=NO, capture uses a Broadcast Upload Extension. Integrate and configure AoqScreenShare.framework and display the system broadcast picker. On timeout, the onScreenCaptureStateChanged: callback reports failure with AoqECScreenStartFailed. You do not need to wait for Started before enabling transmission.
For external raw frames, set isExternal=YES. This does not enable the Extension receiving channel. Supply raw Screen frames through pushExternalVideoCapturedFrame for SDK encoding. For external encoded frames, configure the Screen track for external encoding with setVideoEncoderConfig, then call pushExternalVideoEncodedFrame; startScreenCapture is not required.
Media stream transmission control
enableSendMediaStream:enable:
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.
- (int)enableSendMediaStream:(AoqTrackType)trackType enable:(BOOL)enable;
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type. Supports AoqTrackTypeAudio/AoqTrackTypeVideo/AoqTrackTypeScreen. |
| enable | BOOL | YES enables sending; NO disables sending. |
Return value: 0 indicates a successful call. A value less than 0 indicates failure and corresponds to AoqErrorCode.
NoteAfter initialization, call enableSendMediaStream:enable:NO first. Enable sending after onConnectionStatusChange: reports Connected to avoid losing data before the connection is established.
Video frame callbacks
setVideoFrameObserver:
Sets the video frame delegate. Pass delegate=nil to remove it.
- (int)setVideoFrameObserver:(id<AoqVideoFrameDelegate> _Nullable)delegate;
| Parameter | Type | Description |
|---|---|---|
| delegate | id<AoqVideoFrameDelegate> | Video frame delegate protocol. Pass nil to remove it. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteSet the delegate with this method first, then call enableVideoFrameObserver:videoSource:config: to enable callbacks at the required positions.
enableVideoFrameObserver:videoSource:config:
Enables or disables video frame callbacks at the specified position.
- (int)enableVideoFrameObserver:(BOOL)enabled videoSource:(AoqVideoSource)videoSource config:(AoqVideoObserverConfig * _Nonnull)config;
| Parameter | Type | Description |
|---|---|---|
| enabled | BOOL | YES enables callbacks; NO disables them. |
| videoSource | AoqVideoSource | Video source position: after capture, before encoding, or after remote decoding |
| config | AoqVideoObserverConfig * | Callback configuration. Use config.trackType to observe the Video or Screen track. |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteCallbacks run on internal SDK threads. Do not perform time-consuming operations in them. Only I420/CVPixelBuffer supports read-write mode (mode=ReadWrite); other formats are read-only.
Real-time messages
sendDataMsg:
Sends a real-time data message to the remote end. Call this method after connect: succeeds and enableSendMediaStream:(Data, YES) is called.
- (int)sendDataMsg:(AoqDataMsg * _Nonnull)msg;
| Parameter | Type | Description |
|---|---|---|
| msg | AoqDataMsg * | Data message |
Return value: 0 indicates success. A nonzero value indicates failure and corresponds to AoqErrorCode.
NoteThe remote end receives the message through onDataMsg:. Message size is subject to internal SDK limits. Split oversized messages into smaller parts before sending.
AoqEngineDelegate callbacks
onError:message:
Engine error callback. Triggered when an unrecoverable error occurs.
- (void)onError:(NSInteger)code message:(NSString * _Nonnull)message;
| Parameter | Type | Description |
|---|---|---|
| code | NSInteger | Error code corresponding to an AoqErrorCode enum value |
| message | NSString * | Error description |
Return value: None (void).
onWarning:message:
Engine warning callback. Triggered by recoverable exceptions that do not prevent the SDK from continuing to run.
- (void)onWarning:(NSInteger)code message:(NSString * _Nonnull)message;
| Parameter | Type | Description |
|---|---|---|
| code | NSInteger | Warning code corresponding to an AoqWarningCode enum value |
| message | NSString * | Warning description |
Return value: None (void).
onConnectionStatusChange:
Connection state change callback. State transitions: Disconnected → Connecting → Connected/Failed → Disconnected.
- (void)onConnectionStatusChange:(AoqConnectionStatus)status;
| Parameter | Type | Description |
|---|---|---|
| status | AoqConnectionStatus | Current connection state |
Return value: None (void).
NoteEnable media sending with enableSendMediaStream:enable:YES 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.
- (void)onStats:(AoqStats * _Nonnull)stats;
| Parameter | Type | Description |
|---|---|---|
| stats | AoqStats * | Statistics for audio/video/data message publishing and subscription, and network statistics |
Return value: None (void).
onAudioDeviceStateChanged:
Callback for audio device capture/playback state changes.
- (void)onAudioDeviceStateChanged:(AoqAudioDeviceState * _Nonnull)state;
| Parameter | Type | Description |
|---|---|---|
| state | AoqAudioDeviceState * | Audio device state, including state (state code) and reason (error reason) |
Return value: None (void).
onAudioDeviceRouteChanged:
Callback for audio output route changes.
- (void)onAudioDeviceRouteChanged:(NSInteger)routeType;
| Parameter | Type | Description |
|---|---|---|
| routeType | NSInteger | Current audio output route, corresponding to an AoqAudioDeviceRouteType enum value |
Return value: None (void).
onAudioDeviceInterrupted:
Audio device interruption callback. Triggered by system interruptions, such as incoming calls or another app taking audio focus.
- (void)onAudioDeviceInterrupted:(BOOL)interrupt;
| Parameter | Type | Description |
|---|---|---|
| interrupt | BOOL | YES indicates interruption; NO indicates recovery from interruption. |
Return value: None (void).
onAudioFileState:
Audio file playback state callback.
- (void)onAudioFileState:(AoqAudioFileState * _Nonnull)state;
| Parameter | Type | Description |
|---|---|---|
| state | AoqAudioFileState * | Audio file playback state, including fileId, stateCode, and errorCode |
Return value: None (void).
onLocalAudioVolumeIndication:
Reports the locally captured audio volume. Triggered only after volume indications are enabled through enableLocalAudioVolumeIndication:.
- (void)onLocalAudioVolumeIndication:(AoqAudioVolume * _Nonnull)volume;
| Parameter | Type | Description |
|---|---|---|
| volume | AoqAudioVolume * | Local volume information, including isSpeech (whether speech is detected) and volume (smoothed instantaneous volume [0-255]). |
Return value: None (void).
onScreenCaptureStateChanged: is @optional. All other AoqEngineDelegate callbacks are @required.
onVideoDeviceStateChanged:
Callback for video device capture state changes.
- (void)onVideoDeviceStateChanged:(AoqVideoDeviceState * _Nonnull)state;
| Parameter | Type | Description |
|---|---|---|
| state | AoqVideoDeviceState * | Video device state, including state (state code) and reason (error reason) |
Return value: None (void).
onDataMsg:
Callback for received real-time data messages.
- (void)onDataMsg:(AoqDataMsg * _Nonnull)msg;
| Parameter | Type | Description |
|---|---|---|
| msg | AoqDataMsg * | Data message |
Return value: None (void).
NoteCallbacks run on internal SDK threads. Do not perform time-consuming operations in them. NSData is valid only during the callback. Make a copy for asynchronous use.
onScreenCaptureStateChanged
Reports screen capture state changes (@optional) using AoqScreenCaptureStateCode and the unified AoqErrorCode. Notifications are delivered in order on the main thread. Screen capture failures are not also reported through onError:.
- (void)onScreenCaptureStateChanged:(AoqScreenCaptureState * _Nonnull)state;
| Parameter | Type | Description |
|---|---|---|
| state | AoqScreenCaptureState * | Screen capture state, including state (state code) and reason (error cause). |
Return value: None (void).
NoteStarted indicates that capture or external input is ready, not that media has been sent. Fail and Stopped are terminal states after cleanup.
AoqAudioFrameDelegate callbacks
Audio frame delegate protocol. All methods are @optional; implement them as needed.
@protocol AoqAudioFrameDelegate <NSObject>
@optional
- (void)onCapturedAudioFrame:(AoqAudioFrameData * _Nonnull)frame;
- (void)onProcessCapturedAudioFrame:(AoqAudioFrameData * _Nonnull)frame;
- (void)onPublishAudioFrame:(AoqTrackType)trackType frame:(AoqAudioFrameData * _Nonnull)frame;
- (void)onPlaybackAudioFrame:(AoqAudioFrameData * _Nonnull)frame;
@end
| Method | When triggered | Parameter |
|---|---|---|
| onCapturedAudioFrame: | When a raw audio frame is captured | frame: AoqAudioFrameData * |
| onProcessCapturedAudioFrame: | Audio frame after 3A processing | frame: AoqAudioFrameData * |
| onPublishAudioFrame:frame: | Audio frame before publishing | trackType: track type; frame: AoqAudioFrameData * |
| onPlaybackAudioFrame: | Remote audio frame before playback | frame: AoqAudioFrameData * |
Return value: None (void).
NoteCallbacks are triggered only after enableAudioFrameObserver:audioSource:config: enables the corresponding AoqAudioSource. dataPtr is valid only during the callback.
onCapturedAudioFrame
Called when a raw audio frame is captured. The frame contains unprocessed PCM data.
- (void)onCapturedAudioFrame:(AoqAudioFrameData *)frame;
| Parameter | Type | Description |
|---|---|---|
| frame | AoqAudioFrameData * | Captured audio frame data |
Return value: None (void).
Noteframe.dataPtr references SDK-managed memory and is valid only during the callback. Copy the data before using it asynchronously.
onProcessCapturedAudioFrame
Called for an audio frame after 3A processing, such as echo cancellation and noise suppression.
- (void)onProcessCapturedAudioFrame:(AoqAudioFrameData *)frame;
| Parameter | Type | Description |
|---|---|---|
| frame | AoqAudioFrameData * | Audio frame data after 3A processing |
Return value: None (void).
Noteframe.dataPtr references SDK-managed memory and is valid only during the callback. Copy the data before using it asynchronously.
onPublishAudioFrame
Called for an audio frame before publishing, immediately before encoding and transmission.
- (void)onPublishAudioFrame:(AoqTrackType)trackType frame:(AoqAudioFrameData *)frame;
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type |
| frame | AoqAudioFrameData * | Audio frame data before publishing |
Return value: None (void).
Noteframe.dataPtr references SDK-managed memory and is valid only during the callback. Copy the data before using it asynchronously.
onPlaybackAudioFrame
Called for a remote audio frame before playback, after decoding and mixing.
- (void)onPlaybackAudioFrame:(AoqAudioFrameData *)frame;
| Parameter | Type | Description |
|---|---|---|
| frame | AoqAudioFrameData * | Remote audio frame data before playback |
Return value: None (void).
Noteframe.dataPtr references SDK-managed memory and is valid only during the callback. Copy the data before using it asynchronously.
AoqVideoFrameDelegate callbacks
Video frame delegate protocol. All methods are @optional. Returning NO indicates no data modification. Each of the three callbacks includes trackType to distinguish Video and Screen tracks.
@protocol AoqVideoFrameDelegate <NSObject>
@optional
- (BOOL)onCapturedVideoFrame:(AoqTrackType)trackType frame:(AoqVideoFrame * _Nonnull)frame;
- (BOOL)onPreEncodeVideoFrame:(AoqTrackType)trackType frame:(AoqVideoFrame * _Nonnull)frame;
- (BOOL)onRemoteVideoFrame:(AoqTrackType)trackType frame:(AoqVideoFrame * _Nonnull)frame;
@end
| Method | When triggered | Parameter |
|---|---|---|
| onCapturedVideoFrame:frame: | When a raw video frame is captured (before preprocessing) | trackType: track type; frame: AoqVideoFrame * |
| onPreEncodeVideoFrame:frame: | Video frame before encoding (after preprocessing) | trackType: track type; frame: AoqVideoFrame * |
| onRemoteVideoFrame:frame: | Remote video frame after decoding and before rendering | trackType: track type; frame: AoqVideoFrame * |
Return value: BOOL. YES indicates that the data was modified and must be written back to the SDK (supported only for I420/CVPixelBuffer). NO indicates no modification.
NoteCallbacks are triggered only after enableVideoFrameObserver:videoSource:config: enables the corresponding AoqVideoSource. NSData/pixelBuffer in frame references internal SDK memory and is valid only during the callback. Make a copy for asynchronous use.
onCapturedVideoFrame
Called when a raw video frame is captured, before preprocessing.
- (BOOL)onCapturedVideoFrame:(AoqTrackType)trackType frame:(AoqVideoFrame *)frame;
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type (Video/Screen) |
| frame | AoqVideoFrame * | Captured video frame data |
Return value: BOOL. YES indicates that modified data must be written back to the SDK (supported only for I420/CVPixelBuffer). NO indicates no modification.
NoteCallbacks are triggered only after enableVideoFrameObserver:videoSource:config: enables the corresponding AoqVideoSource. NSData/pixelBuffer in frame references internal SDK memory and is valid only during the callback. Make a copy for asynchronous use.
onPreEncodeVideoFrame
Called for a video frame after preprocessing and before encoding.
- (BOOL)onPreEncodeVideoFrame:(AoqTrackType)trackType frame:(AoqVideoFrame *)frame;
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type (Video/Screen) |
| frame | AoqVideoFrame * | Video frame data before encoding |
Return value: BOOL. YES indicates that modified data must be written back to the SDK (supported only for I420/CVPixelBuffer). NO indicates no modification.
NoteCallbacks are triggered only after enableVideoFrameObserver:videoSource:config: enables the corresponding AoqVideoSource. NSData/pixelBuffer in frame references internal SDK memory and is valid only during the callback. Make a copy for asynchronous use.
onRemoteVideoFrame
Called for a remote video frame after decoding and before rendering.
- (BOOL)onRemoteVideoFrame:(AoqTrackType)trackType frame:(AoqVideoFrame *)frame;
| Parameter | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type (Video/Screen) |
| frame | AoqVideoFrame * | Decoded remote video frame data |
Return value: BOOL. YES indicates that modified data must be written back to the SDK (supported only for I420/CVPixelBuffer). NO indicates no modification.
NoteCallbacks are triggered only after enableVideoFrameObserver:videoSource:config: enables the corresponding AoqVideoSource. NSData/pixelBuffer in frame references internal SDK memory and is valid only during the callback. Make a copy for asynchronous use.
Data types and enumerations
Common types
AoqConnectConfig
subscribeTracks must not include AoqTrackTypeScreen; otherwise, connect returns AoqECUnSupport without starting a connection. setRemoteView also returns AoqECUnSupport for Screen.
Field | Type | Description |
|---|---|---|
token | NSString * | Authentication token |
sid | NSString * | Session ID |
certFingerprint | NSString * | Server certificate fingerprint |
relayEndpoints | NSArray<AoqRelayEndpoint *> * | List of Relay endpoints |
workspaceIdHash | NSString * | Workspace ID hash |
publishTracks | NSArray<AoqTrackParam *> * | Local tracks to publish |
subscribeTracks | NSArray<AoqTrackParam *> * | Remote tracks to subscribe to |
AoqRelayEndpoint
Relay endpoint.
| Field | Type | Default value | Description |
|---|---|---|---|
| routeIndex | NSInteger | -1 | Route index |
| endpoint | NSString * | "" | Server address (domain name or IP address) |
| port | NSInteger | 0 | Server UDP port |
| tcpPort | NSInteger | 0 | TCP fallback port. 0 uses the SDK default port, 443. |
AoqTrackParam.trackMode
| Field | Type | Default | Description |
|---|---|---|---|
| trackMode | AoqTrackMode | AoqTrackModeSegment | Applies only to downstream audio. |
AoqCreateConfig (fields added in v1.3.0)
| Field | Type | Default | Description |
|---|---|---|---|
| maxEncodedVideoFrameBytes | NSInteger | 190 × 1024 | Maximum encoded frame size in bytes. Applies only to the SDK internal JPEG encoder. |
| enableDropOversizedVideoFrame | BOOL | NO | For the SDK internal JPEG encoder, whether to drop a frame that remains oversized at the lowest quality. |
AoqTrackParam
Track properties.
| Field | Type | Default value | Description |
|---|---|---|---|
| trackType | AoqTrackType | AoqTrackTypeAudio | Track type |
| trackMode | AoqTrackMode | AoqTrackModeSegment | Streaming or non-streaming mode. Applies only to downstream audio. |
Enumerations
AoqTrackMode
| Value | Number | Description |
|---|---|---|
| AoqTrackModeSegment | 0 | Segment mode: delivers data in semantic segments, such as sentences. Applies only to downstream audio. |
| AoqTrackModeStream | 1 | Stream mode: delivers data continuously. Applies only to downstream audio. |
AoqErrorCode
Enum value | Value | Description |
|---|---|---|
AoqECOK | 0 | Success |
AoqECParamInvalid | 1 | Invalid parameter |
AoqECStateInvalid | 2 | Invalid state |
AoqECUnSupport | 3 | Unsupported operation |
AoqECAudio | 100 | Audio generic error |
AoqECAudioExternalBufferFull | 110 | External audio buffer full |
AoqECAudioDevice | 120 | Audio device generic error |
AoqECAudioDeviceRecordingAuthFailed | 121 | Recording permission not granted |
AoqECAudioDeviceRecordingOccupied | 122 | Recording device in use |
AoqECAudioDeviceRecordingBackgroundStart | 123 | Failed to start recording in background |
AoqECAudioDeviceRecordingStartFail | 124 | Recording start failed |
AoqECAudioDevicePlayoutOccupied | 125 | Playback device in use |
AoqECAudioDevicePlayoutBackgroundStart | 126 | Failed to start playback in background |
AoqECAudioDevicePlayoutStartFail | 127 | Playback start failed |
AoqECAudioDeviceEarpieceRequiresVoipMode | 128 | Earpiece requires VoIP mode |
AoqECVideo | 200 | Video generic error |
AoqECVideoExternalBufferFull | 210 | External video buffer full |
AoqECVideoExternalCaptureNotEnabled | 211 | External video capture not enabled |
AoqECVideoExternalEncoderNotEnabled | 212 | External video encoder not enabled |
AoqECVideoDevice | 220 | Video device generic error |
AoqECVideoDeviceCameraOpenFail | 221 | Camera open failed |
AoqECVideoDeviceCameraAuthFailed | 222 | Camera permission not granted |
AoqECVideoDeviceCameraOccupied | 223 | Camera in use |
AoqECVideoDeviceCameraRunningError | 224 | Camera runtime error |
AoqECVideoCodec | 230 | Video codec generic error |
AoqECVideoCodecEncoderInitFail | 231 | Video encoder initialization failed |
AoqECVideoRender | 240 | Video rendering generic error |
AoqECVideoRenderCreateFail | 241 | Video renderer creation failed |
AoqECVideoRenderDrawError | 242 | Video rendering draw error |
| AoqECScreen | 300 | General screen sharing error |
| AoqECScreenAuthFailed | 310 | Screen sharing permission denied |
| AoqECScreenStartFailed | 311 | Failed to start screen sharing |
AoqTrackType
Enum value | Value | Description |
|---|---|---|
AoqTrackTypeAudio | 0 | Audio track |
AoqTrackTypeVideo | 1 | Video track |
AoqTrackTypeData | 2 | Data messaging track |
| AoqTrackTypeScreen | 3 | Screen sharing track. Uplink only. |
AoqWarningCode
Warning codes.
| Enum value | Value | Description |
|---|---|---|
| AoqWCOK | 0 | No warning |
| AoqWCAudio | 100 | General audio warning |
| AoqWCAudioHowling | 101 | Audio howling detected |
| AoqWCAudioDevice | 120 | General audio device warning |
| AoqWCAudioDeviceMicEnumerateError | 121 | Microphone enumeration error |
| AoqWCAudioDeviceMicStartTimeout | 122 | Microphone startup timeout |
| AoqWCAudioDeviceRecordingError | 123 | Recording error |
| AoqWCAudioDeviceSpeakerEnumerateError | 124 | Speaker enumeration error |
| AoqWCAudioDeviceSpeakerStartTimeout | 125 | Speaker startup timeout |
| AoqWCAudioDevicePlayoutError | 126 | Playback error |
| AoqWCVideo | 200 | General video warning |
| AoqWCVideoCameraEnumerateError | 201 | Camera enumeration error |
| AoqWCVideoEncoderSwitched | 202 | Video encoder switched |
| AoqWCVideoRenderDowngrade | 203 | Video rendering downgraded |
AoqEncoderType
Track media formats.
| Enum value | Value | Description |
|---|---|---|
| AoqEncoderTypeUnknown | 0 | Unknown format |
| AoqEncoderTypeAudioPCM | 1 | PCM audio |
| AoqEncoderTypeAudioOpus | 2 | Opus audio |
| AoqEncoderTypeVideoH264 | 3 | H.264 video |
| AoqEncoderTypeVideoJpeg | 4 | JPEG video |
| AoqEncoderTypeDataText | 5 | Text data |
AoqConnectionStatus
Engine connection states.
| Enum value | Value | Description |
|---|---|---|
| AoqConnectionStatusDisconnected | 0 | Disconnected |
| AoqConnectionStatusConnecting | 1 | Connecting |
| AoqConnectionStatusConnected | 2 | Connected |
| AoqConnectionStatusFailed | 3 | Connection failed |
AoqMirrorMode
Mirror mode.
| Enum value | Value | Description |
|---|---|---|
| AoqMirrorModeDisabled | 0 | Mirroring disabled |
| AoqMirrorModeEnabled | 1 | Mirroring enabled |
AoqOrientationMode
Video orientation.
| Enum value | Value | Description |
|---|---|---|
| AoqOrientationModeAuto | 0 | Automatic |
| AoqOrientationModePortrait | 1 | Portrait |
| AoqOrientationModeLandscape | 2 | Landscape |
Audio types
AoqAudioPlaybackConfig
Field | Type | Default | Description |
|---|---|---|---|
isVoipMode | BOOL | NO | YES: enable VoIP mode (hardware AEC); applies to mobile |
isDefaultSpeaker | BOOL | YES | YES: default to speaker; NO: earpiece |
isExternal | BOOL | NO | YES: external audio output |
channel | NSInteger | 1 | Channel count: 1 or 2 |
AoqAudioCaptureConfig
Audio capture configuration.
| Field | Type | Default value | Description |
|---|---|---|---|
| isExternal | BOOL | NO | Whether to use external capture |
| isVoipMode | BOOL | NO | Whether to enable VoIP mode (hardware AEC). Effective on mobile devices. |
| channel | NSInteger | 1 | Channel count. Supports 1/2. |
AoqAudioCodecConfig
Audio codec configuration shared by setAudioEncoderConfig: and setAudioDecoderConfig:.
| Field | Type | Default value | Description |
|---|---|---|---|
| trackType | AoqTrackType | AoqTrackTypeAudio | Track type |
| codecType | AoqEncoderType | AoqEncoderTypeAudioOpus | Encoding format |
| sampleRate | NSInteger | 48000 | Sample rate in Hz |
| channel | NSInteger | 1 | Number of channels |
| bitrate | NSInteger | 32000 | Bitrate in bps |
AoqAudioSessionRestriction
AVAudioSession permission bitmask (NS_OPTIONS; flags can be combined with bitwise OR). Used by setAudioSessionRestriction:.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioSessionNone | 0 | No restrictions (the SDK fully manages AVAudioSession) |
| AoqAudioSessionSetCategory | 1 | Restricts the SDK from setting the category |
| AoqAudioSessionConfigureSession | 2 | Restricts the SDK from configuring the session |
| AoqAudioSessionDeactivateSession | 4 | Restricts the SDK from deactivating the session |
| AoqAudioSessionActivateSession | 8 | Restricts the SDK from activating the session |
AoqAudioDeviceStateCode
Audio device capture and playback state codes.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioDeviceNone | 0 | No state |
| AoqAudioDeviceRecordStarting | 1 | Capture starting |
| AoqAudioDeviceRecordStarted | 2 | Capture started |
| AoqAudioDeviceRecordStopping | 3 | Capture stopping |
| AoqAudioDeviceRecordStopped | 4 | Capture stopped |
| AoqAudioDeviceRecordFail | 5 | Capture failed |
| AoqAudioDevicePlayStarting | 6 | Playback starting |
| AoqAudioDevicePlayStarted | 7 | Playback started |
| AoqAudioDevicePlayStopping | 8 | Playback stopping |
| AoqAudioDevicePlayStopped | 9 | Playback stopped |
| AoqAudioDevicePlayFail | 10 | Playback failed |
AoqAudioDeviceState
Audio device capture and playback state.
| Field | Type | Default value | Description |
|---|---|---|---|
| state | AoqAudioDeviceStateCode | AoqAudioDeviceNone | Device operation state |
| reason | NSInteger | 0 | Error reason code (see AoqErrorCode) |
AoqAudioDeviceRouteType
Audio device route types.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioDeviceRouteDefault | 0 | Default route |
| AoqAudioDeviceRouteHeadset | 1 | Headset with microphone |
| AoqAudioDeviceRouteEarpiece | 2 | Earpiece |
| AoqAudioDeviceRouteHeadsetNoMic | 3 | Headset without microphone |
| AoqAudioDeviceRouteSpeakerPhone | 4 | Speaker |
| AoqAudioDeviceRouteUsb | 5 | USB audio device |
| AoqAudioDeviceRouteBluetooth | 6 | Bluetooth SCO mode |
| AoqAudioDeviceRouteBluetoothA2dp | 7 | Bluetooth A2DP mode |
Audio file types
AoqAudioFileMixConfig
Audio file playback configuration.
| Field | Type | Default value | Description |
|---|---|---|---|
| fileName | NSString * | "" | File name including its path. Must not be empty. |
| cycles | NSInteger | -1 | Loop count. -1 loops indefinitely. |
| startPosMs | NSInteger | 0 | Initial playback position in milliseconds |
| publishVolume | NSInteger | 100 | Publishing volume. Valid values: 0-100. |
| playoutVolume | NSInteger | 100 | Playback volume. Valid values: 0-100. |
AoqAudioFileStateCode
Audio file playback state codes.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioFileNone | 0 | No state |
| AoqAudioFileStarted | 1 | Playback started |
| AoqAudioFileStopped | 2 | Playback stopped |
| AoqAudioFilePaused | 3 | Playback paused |
| AoqAudioFileResumed | 4 | Playback resumed |
| AoqAudioFileEnded | 5 | Playback ended |
| AoqAudioFileBuffering | 6 | Playback buffering |
| AoqAudioFileBufferingEnd | 7 | Buffering ended |
| AoqAudioFileFailed | 8 | Playback failed |
AoqAudioFileErrorCode
Audio file playback error codes.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioFileNoError | 0 | No error |
| AoqAudioFileOpenFailed | 1 | Failed to open file |
| AoqAudioFileDecodeFailed | 2 | Failed to decode file |
AoqAudioFileState
Audio file state.
| Field | Type | Default value | Description |
|---|---|---|---|
| fileId | NSString * | "" | File identifier |
| stateCode | AoqAudioFileStateCode | AoqAudioFileNone | File playback state code |
| errorCode | AoqAudioFileErrorCode | AoqAudioFileNoError | File error code |
External audio stream and volume types
AoqAudioVolume
| Field | Type | Default | Description |
|---|---|---|---|
| isSpeech | BOOL | NO | Whether speech is detected. |
| volume | NSInteger | 0 | Smoothed instantaneous volume, from 0 to 255. |
AoqAudioVolumeIndicationConfig
| 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. |
AoqAudioStreamDirection
Audio stream directions.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioStreamPublish | 0 | Publishing stream |
| AoqAudioStreamPlayout | 1 | Playback stream |
AoqAudioExternalStreamToggle
External audio stream toggle states.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioExternalStreamToggleNormal | 0 | Normal state |
| AoqAudioExternalStreamTogglePause | 1 | Paused state |
AoqAudioExternalStreamConfig
External audio stream configuration.
| Field | Type | Default value | Description |
|---|---|---|---|
| trackType | AoqTrackType | AoqTrackTypeAudio | Audio track type |
| codecType | AoqEncoderType | AoqEncoderTypeAudioPCM | Audio stream format |
| channels | NSInteger | 1 | Number of channels |
| sampleRate | NSInteger | 48000 | Sample rate in Hz |
| playoutVolume | NSInteger | 100 | Playback volume (0-100) |
| publishVolume | NSInteger | 100 | Publishing volume (0-100) |
| maxBufferDuration | NSInteger | 1000 | Maximum buffer duration in milliseconds |
| enable3A | BOOL | NO | Whether to apply 3A processing to input PCM |
AoqAudioFrameData
External audio frame data.
| Field | Type | Default value | Description |
|---|---|---|---|
| dataPtr | void * | NULL | Pointer to raw PCM audio data (@Nullable) |
| dataSize | NSInteger | 0 | PCM data size in bytes |
| numOfSamples | NSInteger | 0 | Number of samples per channel |
| bytesPerSample | NSInteger | 0 | Bytes per sample |
| numOfChannels | NSInteger | 0 | Number of channels |
| samplesPerSec | NSInteger | 0 | Samples per second (sample rate) |
| pushSequence | int32_t | 0 | PCM input round |
| timeStamp | int64_t | 0 | Timestamp |
| autoGenMute | BOOL | NO | Valid in data callbacks. YES indicates SDK-generated silence. |
AoqAudioSource
Audio frame callback data sources.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioSourceCaptured | 0 | Captured audio data |
| AoqAudioSourceProcessCaptured | 1 | Audio data after 3A processing |
| AoqAudioSourcePublish | 2 | Published audio data |
| AoqAudioSourcePlayback | 3 | Playback audio data |
AoqAudioObserverMode
Audio frame callback modes.
| Enum value | Value | Description |
|---|---|---|
| AoqAudioObserverModeReadOnly | 0 | Read-only mode |
| AoqAudioObserverModeReadWrite | 1 | Read-write mode |
AoqAudioObserverConfig
Audio frame callback configuration.
| Field | Type | Default value | Description |
|---|---|---|---|
| sampleRate | NSInteger | 48000 | Callback audio sample rate in Hz |
| channels | NSInteger | 1 | Callback audio channel count |
| mode | AoqAudioObserverMode | AoqAudioObserverModeReadOnly | Read-write mode |
Video types
AoqScreenCaptureState
| Field | Type | Default | Description |
|---|---|---|---|
| state | AoqScreenCaptureStateCode | AoqScreenCaptureNone | Screen capture state. |
| reason | NSInteger | 0 | 0 for normal states; an AoqErrorCode on failure. |
AoqScreenCaptureStateCode
| Value | Number | Description |
|---|---|---|
| AoqScreenCaptureNone | 0 | None |
| AoqScreenCaptureStarting | 1 | Starting |
| AoqScreenCaptureStarted | 2 | Input ready; does not indicate transmission |
| AoqScreenCaptureStopping | 3 | Stopping |
| AoqScreenCaptureStopped | 4 | Stopped |
| AoqScreenCaptureFail | 5 | Start or runtime failure |
AoqScreenCaptureConfig
| Field | Type | Default | Description |
|---|---|---|---|
| isExternal | BOOL | NO | Whether the application supplies raw screen frames. |
| appGroup | NSString * | nil | Optional AppGroup ID shared by the app and Broadcast Extension. If nil, settings are delivered through the socket handshake and neither target needs the App Groups capability. Ignored for external capture. |
AoqVideoCodecConfig
| Field | Type | Default | Description |
|---|---|---|---|
| trackType | AoqTrackType | AoqTrackTypeVideo | Track type |
| codecType | AoqEncoderType | AoqEncoderTypeVideoH264 | Codec |
| width | NSInteger | 540 | Width in pixels |
| height | NSInteger | 960 | Height in pixels |
| fps | NSInteger | 5 | Frame rate |
| bitrate | NSInteger | 500000 | Bitrate in bps |
| minBitrate | NSInteger | 128000 | Minimum bitrate in bps |
| keyframeInterval | NSInteger | 2 | Keyframe interval in seconds |
| mirrorMode | AoqMirrorMode | AoqMirrorModeDisabled | Mirror mode |
| orientationMode | AoqOrientationMode | AoqOrientationModeAuto | Orientation mode |
| isExternal | BOOL | NO | Whether the application supplies encoded frames. |
AoqRenderMode
Rendering modes.
| Enum value | Value | Description |
|---|---|---|
| AoqRenderModeAuto | 0 | Automatic mode |
| AoqRenderModeStretch | 1 | Stretch mode. The image is distorted when aspect ratios differ. |
| AoqRenderModeFill | 2 | Letterbox mode. Black bars are added above and below or on the sides when aspect ratios differ. |
| AoqRenderModeCrop | 3 | Crop mode. Width or height is cropped when aspect ratios differ, removing part of the image. |
AoqVideoCanvas
Video rendering canvas.
| Field | Type | Default value | Description |
|---|---|---|---|
| view | UIView * | nil | Display view. Pass nil to remove the rendering binding (@Nullable). |
| renderMode | AoqRenderMode | AoqRenderModeAuto | Rendering mode |
AoqCameraDirection
Camera direction.
| Enum value | Value | Description |
|---|---|---|
| AoqCameraDirectionFront | 0 | Front camera |
| AoqCameraDirectionBack | 1 | Rear camera (effective on mobile devices) |
AoqVideoCaptureConfig
Video capture configuration.
| Field | Type | Default value | Description |
|---|---|---|---|
| width | NSInteger | 1280 | Capture width in pixels. Ignored when isExternal=YES. |
| height | NSInteger | 720 | Capture height in pixels. Ignored when isExternal=YES. |
| fps | NSInteger | 15 | Capture frame rate. Ignored when isExternal=YES (timing is determined by frame input). |
| isExternal | BOOL | NO | Whether to use external capture. When YES, the camera is not opened; supply frames through pushExternalVideoCapturedFrame:. |
| cameraDirection | AoqCameraDirection | AoqCameraDirectionFront | Camera direction. Ignored when isExternal=YES. |
AoqVideoPixelFormat
Video pixel formats.
| Enum value | Value | Description |
|---|---|---|
| AoqVideoPixelFormatUnknown | 0 | Unknown format |
| AoqVideoPixelFormatI420 | 1 | I420 (YUV planar format) |
| AoqVideoPixelFormatNV12 | 2 | NV12 (YUV semi-planar format) |
| AoqVideoPixelFormatNV21 | 3 | NV21 (YUV semi-planar format) |
| AoqVideoPixelFormatBGRA | 4 | BGRA (32-bit) |
| AoqVideoPixelFormatRGBA | 5 | RGBA (32-bit) |
| AoqVideoPixelFormatCVPixelBuffer | 6 | Apple zero-copy path. Set pixelBuffer to a CVPixelBufferRef. |
NoteiOS does not support TextureOES/Texture2D. Its zero-copy path uses CVPixelBuffer.
AoqVideoFrame
External video data, also used in video frame callbacks (AoqVideoFrameDelegate).
| Field | Type | Default value | Description |
|---|---|---|---|
| format | AoqVideoPixelFormat | AoqVideoPixelFormatUnknown | Pixel format |
| width | NSInteger | 0 | Width in pixels |
| height | NSInteger | 0 | Height in pixels |
| data | NSData * | nil | Packed-format data (NV12/NV21/BGRA/RGBA) (@Nullable) |
| dataY | NSData * | nil | I420 Y plane data (@Nullable) |
| dataU | NSData * | nil | I420 U plane data (@Nullable) |
| dataV | NSData * | nil | I420 V plane data (@Nullable) |
| strideY | NSInteger | 0 | Y plane stride |
| strideU | NSInteger | 0 | U plane stride |
| strideV | NSInteger | 0 | V plane stride |
| pixelBuffer | CVPixelBufferRef | NULL | Apple zero-copy buffer. Used when format=AoqVideoPixelFormatCVPixelBuffer (@Nullable). |
| timeStamp | int64_t | 0 | Timestamp in milliseconds. If 0, the SDK fills it in using the local clock. |
NoteiOS has no textureId/transformMatrix/eglContext fields. Use pixelBuffer for zero-copy access.
AoqVideoCodecType
Codec type for externally encoded frames.
| Enum value | Value | Description |
|---|---|---|
| AoqVideoCodecTypeJPEG | 0 | JPEG encoding |
AoqVideoEncodedFrame
Externally encoded video frame. The application encodes the frame; the SDK packages and sends it without re-encoding.
| Field | Type | Default value | Description |
|---|---|---|---|
| codec | AoqVideoCodecType | AoqVideoCodecTypeJPEG | Encoding format |
| data | NSData * | Non-empty | Encoded data |
| width | NSInteger | 0 | Width in pixels |
| height | NSInteger | 0 | Height in pixels |
| timeStamp | int64_t | 0 | Timestamp in milliseconds. If 0, the SDK fills it in using the local clock. |
AoqVideoDeviceStateCode
Video device capture state codes.
| Enum value | Value | Description |
|---|---|---|
| AoqVideoDeviceNone | 0 | No state |
| AoqVideoDeviceCaptureStarting | 1 | Camera starting |
| AoqVideoDeviceCaptureStarted | 2 | Camera started |
| AoqVideoDeviceCaptureStopping | 3 | Camera stopping |
| AoqVideoDeviceCaptureStopped | 4 | Camera stopped |
| AoqVideoDeviceCaptureFail | 5 | Camera startup failed |
AoqVideoDeviceState
Video device capture state.
| Field | Type | Default value | Description |
|---|---|---|---|
| state | AoqVideoDeviceStateCode | AoqVideoDeviceNone | Device capture state |
| reason | NSInteger | 0 | Error reason code (see AoqErrorCode) |
Video frame callback types
AoqVideoSource
Video frame callback data sources (pipeline positions).
| Enum value | Value | Description |
|---|---|---|
| AoqVideoSourceCaptured | 0 | Video data after capture (before preprocessing) |
| AoqVideoSourcePreEncode | 1 | Video data before encoding (after preprocessing) |
| AoqVideoSourceRemote | 2 | Remote video data after decoding and before rendering |
AoqVideoObserverMode
Video frame callback modes.
| Enum value | Value | Description |
|---|---|---|
| AoqVideoObserverModeReadOnly | 0 | Read-only mode |
| AoqVideoObserverModeReadWrite | 1 | Read-write mode |
AoqVideoObserverAlignment
Video output width alignment.
| Enum value | Value | Description |
|---|---|---|
| AoqVideoObserverAlignmentDefault | 0 | Default alignment |
| AoqVideoObserverAlignmentEven | 1 | Even alignment |
| AoqVideoObserverAlignment4 | 2 | 4-byte alignment |
| AoqVideoObserverAlignment8 | 3 | 8-byte alignment |
| AoqVideoObserverAlignment16 | 4 | 16-byte alignment |
AoqVideoObserverConfig
Video frame callback configuration.
| Field | Type | Default value | Description |
|---|---|---|---|
| trackType | AoqTrackType | AoqTrackTypeVideo | Video track to observe. Only Video and Screen are supported. |
| format | AoqVideoPixelFormat | AoqVideoPixelFormatI420 | Desired callback pixel format |
| alignment | AoqVideoObserverAlignment | AoqVideoObserverAlignmentDefault | Width alignment policy |
| mode | AoqVideoObserverMode | AoqVideoObserverModeReadOnly | Read/write mode. Only I420/CVPixelBuffer supports read-write access. |
| mirrorApplied | BOOL | NO | Whether to mirror callback data |
Data message types
AoqDataMsg
Real-time message data structure.
| Field | Type | Default value | Description |
|---|---|---|---|
| data | NSData * | Empty NSData | Message data referencing memory owned by the caller |
Statistics types
AoqStats
Field | Type | Description |
|---|---|---|
audioPublishStats | NSArray<AoqAudioPublishStats *> * | Audio publish statistics |
videoPublishStats | NSArray<AoqVideoPublishStats *> * | Video publish statistics |
dataMsgPublishStats | NSArray<AoqDataMsgPublishStats *> * | Data message publish statistics |
audioSubscribeStats | NSArray<AoqAudioSubscribeStats *> * | Audio subscribe statistics |
videoSubscribeStats | NSArray<AoqVideoSubscribeStats *> * | Video subscribe statistics |
dataMsgSubscribeStats | NSArray<AoqDataMsgSubscribeStats *> * | Data message subscribe statistics |
networkStats | AoqNetworkStats * | Network statistics |
AoqNetworkStats
Field | Type | Description |
|---|---|---|
sendBitrate | NSUInteger | Send bitrate (bps) |
sendBytes | NSUInteger | Cumulative bytes sent |
recvBitrate | NSUInteger | Receive bitrate (bps) |
recvBytes | NSUInteger | Cumulative bytes received |
loss | NSUInteger | Packet loss rate |
rtt | NSUInteger | Round-trip time (ms) |
AoqAudioPublishStats
Audio publishing statistics.
| Field | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type |
| bitrate | NSUInteger | Bitrate in bps |
| bytes | NSUInteger | Total bytes sent |
| encodeVolume | NSUInteger | Publishing encoding volume |
AoqVideoPublishStats
Video publishing statistics.
| Field | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type |
| bitrate | NSUInteger | Bitrate in bps |
| bytes | NSUInteger | Total bytes sent |
| encodeFps | NSUInteger | Encoding frame rate |
AoqAudioSubscribeStats
Audio subscription statistics.
| Field | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type |
| bitrate | NSUInteger | Bitrate in bps |
| bytes | NSUInteger | Total bytes received |
| playVolume | NSUInteger | Playback volume |
AoqVideoSubscribeStats
Video subscription statistics.
| Field | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type |
| bitrate | NSUInteger | Bitrate in bps |
| bytes | NSUInteger | Total bytes received |
| decodeFps | NSUInteger | Decoding frame rate |
| renderFps | NSUInteger | Rendering frame rate |
AoqDataMsgPublishStats
Data message publishing statistics.
| Field | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type |
| bitrate | NSUInteger | Bitrate in bps |
| bytes | NSUInteger | Total bytes sent |
AoqDataMsgSubscribeStats
Data message subscription statistics.
| Field | Type | Description |
|---|---|---|
| trackType | AoqTrackType | Track type |
| bitrate | NSUInteger | Bitrate in bps |
| bytes | NSUInteger | Total bytes received |