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.
API index
Engine lifecycle
|
API |
Description |
|
createEngine:delegate: |
Create the engine instance (singleton) |
|
destroy |
Destroy the engine instance |
|
getVersion |
Get the SDK version string |
|
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 playback (play remote audio) |
|
stopAudioPlayer |
Stop audio playback |
|
pauseAudioPlayer: |
Pause audio playback with optional fade-out |
|
resumeAudioPlayer: |
Resume audio playback with optional fade-in |
|
interruptAudioPlayer:fadeMs: |
Interrupt the current audio call turn |
|
enableSpeakerphone: |
Switch audio output between speaker and earpiece |
|
isSpeakerphoneEnabled |
Query whether the speaker is currently active |
|
setAudioSessionRestriction: |
Set AVAudioSession control permissions |
Audio codec configuration
|
API |
Description |
|
setAudioEncoderConfig: |
Set audio encoding parameters |
|
setAudioDecoderConfig: |
Set audio decoding parameters |
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:canvas: |
Set or remove the local video rendering view |
|
setRemoteView:canvas: |
Set or remove the remote video rendering view |
Video encoding and external input
|
API |
Description |
|
setVideoEncoderConfig: |
Set video encoding parameters |
|
pushExternalVideoCapturedFrame:frame: |
Push an externally captured raw video frame |
|
pushExternalVideoEncodedFrame:frame: |
Push an externally encoded video frame |
Media stream control
|
API |
Description |
|
enableSendMediaStream:enable: |
Enable or disable local media stream sending |
Audio file playback
|
API |
Description |
|
startAudioFile:config: |
Start streaming 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 |
|
setAudioFilePositionMillis:positionMillis: |
Seek to a position in the audio file |
|
setAudioFileVolume:type:volume: |
Set the audio file volume |
|
getAudioFileVolume:type: |
Get the current audio file volume |
External audio streams
|
API |
Description |
|
addAudioExternalStream:config: |
Add an external audio stream |
|
removeAudioExternalStream: |
Remove an external audio stream |
|
pushAudioExternalStreamData:data: |
Push external PCM audio data |
|
setAudioExternalStreamVolume:type:volume: |
Set the volume for an external audio stream |
|
getAudioExternalStreamVolume:type: |
Get the volume for an external audio stream |
|
clearAudioExternalStreamBuffer:fadeoutMs: |
Clear the buffer for an external audio stream |
Real-time messaging
|
API |
Description |
|
sendDataMsg: |
Send a real-time data message |
Audio frame callbacks
|
API |
Description |
|
setAudioFrameObserver: |
Set the audio frame data callback delegate |
|
enableAudioFrameObserver:audioSource:config: |
Enable or disable audio frame callbacks at a specified point |
Video frame callbacks
|
API |
Description |
|
setVideoFrameObserver: |
Set the video frame data callback delegate |
|
enableVideoFrameObserver:videoSource:config: |
Enable or disable video frame callbacks at a specified point |
AoqEngineDelegate callbacks
|
Callback |
Description |
|
onError:message: |
Engine error callback |
|
onWarning:message: |
Engine warning callback |
|
onConnectionStatusChange: |
Connection state change callback |
|
onStats: |
Statistics callback |
|
onAudioDeviceStateChanged: |
Audio device state change callback |
|
onAudioDeviceRouteChanged: |
Audio output route change callback |
|
onAudioDeviceInterrupted: |
Audio device interruption callback |
|
onVideoDeviceStateChanged: |
Video device state change callback |
|
onAudioFileState: |
Audio file playback state callback |
|
onDataMsg: |
Real-time data message received callback |
|
AoqAudioFrameDelegate |
Audio frame data listener protocol |
|
AoqVideoFrameDelegate |
Video frame data listener protocol |
API details
Engine lifecycle
createEngine:delegate:
Create the engine instance. The SDK holds the engine as a global singleton.
+ (instancetype _Nonnull)createEngine:(AoqCreateConfig * _Nonnull)config
delegate:(id<AoqEngineDelegate> _Nonnull)delegate;
destroy
+ (int)destroy;
getVersion
+ (NSString * _Nonnull)getVersion;
connect:
- (int)connect:(AoqConnectConfig * _Nonnull)config;
disconnect
- (int)disconnect;
Audio device management
- (int)startAudioCapture:(AoqAudioCaptureConfig * _Nonnull)config;
- (int)stopAudioCapture;
- (int)muteAudioCapture:(BOOL)mute;
- (int)startAudioPlayer:(AoqAudioPlaybackConfig * _Nonnull)config;
- (int)stopAudioPlayer;
- (int)pauseAudioPlayer:(NSInteger)fadeMs;
- (int)resumeAudioPlayer:(NSInteger)fadeMs;
- (int)interruptAudioPlayer:(AoqTrackType)trackType fadeMs:(NSInteger)fadeMs;
- (int)enableSpeakerphone:(BOOL)enable;
- (BOOL)isSpeakerphoneEnabled;
- (int)setAudioSessionRestriction:(int)restriction;
Audio codec configuration
- (int)setAudioEncoderConfig:(AoqAudioCodecConfig * _Nonnull)config;
- (int)setAudioDecoderConfig:(AoqAudioCodecConfig * _Nonnull)config;
Video device management
- (int)startVideoCapture:(AoqVideoCaptureConfig * _Nonnull)config;
- (int)stopVideoCapture;
- (int)switchCamera:(AoqCameraDirection)direction;
- (int)setLocalView:(AoqTrackType)trackType canvas:(AoqVideoCanvas * _Nullable)canvas;
- (int)setRemoteView:(AoqTrackType)trackType canvas:(AoqVideoCanvas * _Nullable)canvas;
Pass AoqTrackTypeVideo as the trackType parameter for setLocalView and setRemoteView.
Video encoding and external input
- (int)setVideoEncoderConfig:(AoqVideoCodecConfig * _Nonnull)config;
- (int)pushExternalVideoCapturedFrame:(AoqTrackType)trackType frame:(AoqVideoFrame * _Nonnull)frame;
- (int)pushExternalVideoEncodedFrame:(AoqTrackType)trackType frame:(AoqVideoEncodedFrame * _Nonnull)frame;
Pass AoqTrackTypeVideo as the trackType parameter.
Media stream control
- (int)enableSendMediaStream:(AoqTrackType)trackType enable:(BOOL)enable;
trackType accepts AoqTrackTypeAudio or AoqTrackTypeVideo.
Audio file playback
- (int)startAudioFile:(NSString * _Nonnull)fileId config:(AoqAudioFileMixConfig * _Nonnull)config;
- (int)stopAudioFile:(NSString * _Nonnull)fileId;
- (int)pauseAudioFile:(NSString * _Nonnull)fileId;
- (int)resumeAudioFile:(NSString * _Nonnull)fileId;
- (long long)getAudioFileDuration:(NSString * _Nonnull)fileId;
- (long long)getAudioFileCurrentPosition:(NSString * _Nonnull)fileId;
- (int)setAudioFilePositionMillis:(NSString * _Nonnull)fileId positionMillis:(long long)positionMillis;
- (int)setAudioFileVolume:(NSString * _Nonnull)fileId type:(AoqAudioStreamDirection)type volume:(NSInteger)volume;
- (int)getAudioFileVolume:(NSString * _Nonnull)fileId type:(AoqAudioStreamDirection)type;
External audio streams
- (int)addAudioExternalStream:(NSString * _Nonnull)streamId config:(AoqAudioExternalStreamConfig * _Nonnull)config;
- (int)pushAudioExternalStreamData:(NSString * _Nonnull)streamId data:(AoqAudioFrameData * _Nonnull)data;
- (int)setAudioExternalStreamVolume:(NSString * _Nonnull)streamId type:(AoqAudioStreamDirection)type volume:(NSInteger)volume;
- (int)getAudioExternalStreamVolume:(NSString * _Nonnull)streamId type:(AoqAudioStreamDirection)type;
- (void)clearAudioExternalStreamBuffer:(NSString * _Nonnull)streamId fadeoutMs:(NSInteger)fadeoutMs;
- (int)removeAudioExternalStream:(NSString * _Nonnull)streamId;
Real-time messaging
- (int)sendDataMsg:(AoqDataMsg * _Nonnull)msg;
Audio frame callbacks
- (int)setAudioFrameObserver:(id<AoqAudioFrameDelegate> _Nullable)delegate;
- (int)enableAudioFrameObserver:(BOOL)enabled audioSource:(AoqAudioSource)audioSource config:(AoqAudioObserverConfig * _Nonnull)config;
Video frame callbacks
- (int)setVideoFrameObserver:(id<AoqVideoFrameDelegate> _Nullable)delegate;
- (int)enableVideoFrameObserver:(BOOL)enabled videoSource:(AoqVideoSource)videoSource config:(AoqVideoObserverConfig * _Nonnull)config;
AoqEngineDelegate callbacks
All callback methods are @required.
- (void)onError:(NSInteger)code message:(NSString * _Nonnull)message;
- (void)onWarning:(NSInteger)code message:(NSString * _Nonnull)message;
- (void)onConnectionStatusChange:(AoqConnectionStatus)status;
- (void)onStats:(AoqStats * _Nonnull)stats;
- (void)onAudioDeviceStateChanged:(AoqAudioDeviceState * _Nonnull)state;
- (void)onAudioDeviceRouteChanged:(NSInteger)routeType;
- (void)onAudioDeviceInterrupted:(BOOL)interrupt;
- (void)onAudioFileState:(AoqAudioFileState * _Nonnull)state;
- (void)onVideoDeviceStateChanged:(AoqVideoDeviceState * _Nonnull)state;
- (void)onDataMsg:(AoqDataMsg * _Nonnull)msg;
AoqAudioFrameDelegate (@optional)
- (void)onCapturedAudioFrame:(AoqAudioFrameData * _Nonnull)frame;
- (void)onProcessCapturedAudioFrame:(AoqAudioFrameData * _Nonnull)frame;
- (void)onPublishAudioFrame:(AoqTrackType)trackType frame:(AoqAudioFrameData * _Nonnull)frame;
- (void)onPlaybackAudioFrame:(AoqAudioFrameData * _Nonnull)frame;
AoqVideoFrameDelegate (@optional)
- (BOOL)onCapturedVideoFrame:(AoqVideoFrame * _Nonnull)frame;
- (BOOL)onPreEncodeVideoFrame:(AoqTrackType)trackType frame:(AoqVideoFrame * _Nonnull)frame;
- (BOOL)onRemoteVideoFrame:(AoqTrackType)trackType frame:(AoqVideoFrame * _Nonnull)frame;
Data types and enumerations
AoqErrorCode
|
Enum value |
Value |
Description |
|
AoqErrorCodeOK |
0 |
Success |
|
AoqErrorCodeParamInvalid |
1 |
Invalid parameter |
|
AoqErrorCodeStateInvalid |
2 |
Invalid state |
|
AoqErrorCodeUnSupport |
3 |
Unsupported operation |
|
AoqErrorCodeAudio |
100 |
Audio generic error |
|
AoqErrorCodeAudioExternalBufferFull |
110 |
External audio buffer full |
|
AoqErrorCodeAudioDevice |
120 |
Audio device generic error |
|
AoqErrorCodeAudioDeviceRecordingAuthFailed |
121 |
Recording permission not granted |
|
AoqErrorCodeAudioDeviceRecordingOccupied |
122 |
Recording device in use |
|
AoqErrorCodeAudioDeviceRecordingBackgroundStart |
123 |
Failed to start recording in background |
|
AoqErrorCodeAudioDeviceRecordingStartFail |
124 |
Recording start failed |
|
AoqErrorCodeAudioDevicePlayoutOccupied |
125 |
Playback device in use |
|
AoqErrorCodeAudioDevicePlayoutBackgroundStart |
126 |
Failed to start playback in background |
|
AoqErrorCodeAudioDevicePlayoutStartFail |
127 |
Playback start failed |
|
AoqErrorCodeAudioDeviceEarpieceRequiresVoipMode |
128 |
Earpiece requires VoIP mode |
|
AoqErrorCodeVideo |
200 |
Video generic error |
|
AoqErrorCodeVideoExternalBufferFull |
210 |
External video buffer full |
|
AoqErrorCodeVideoExternalCaptureNotEnabled |
211 |
External video capture not enabled |
|
AoqErrorCodeVideoExternalEncoderNotEnabled |
212 |
External video encoder not enabled |
|
AoqErrorCodeVideoDevice |
220 |
Video device generic error |
|
AoqErrorCodeVideoDeviceCameraOpenFail |
221 |
Camera open failed |
|
AoqErrorCodeVideoDeviceCameraAuthFailed |
222 |
Camera permission not granted |
|
AoqErrorCodeVideoDeviceCameraOccupied |
223 |
Camera in use |
|
AoqErrorCodeVideoDeviceCameraRunningError |
224 |
Camera runtime error |
|
AoqErrorCodeVideoCodec |
230 |
Video codec generic error |
|
AoqErrorCodeVideoCodecEncoderInitFail |
231 |
Video encoder initialization failed |
|
AoqErrorCodeVideoRender |
240 |
Video rendering generic error |
|
AoqErrorCodeVideoRenderCreateFail |
241 |
Video renderer creation failed |
|
AoqErrorCodeVideoRenderDrawError |
242 |
Video rendering draw error |
AoqTrackType
|
Enum value |
Value |
Description |
|
AoqTrackTypeAudio |
0 |
Audio track |
|
AoqTrackTypeVideo |
1 |
Video track |
|
AoqTrackTypeData |
2 |
Data messaging track |
AoqConnectConfig
|
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 |
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 |
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
trackType / bitrate / bytes / encodeVolume
AoqVideoPublishStats
trackType / bitrate / bytes / encodeFps
AoqAudioSubscribeStats
trackType / bitrate / bytes / playVolume
AoqVideoSubscribeStats
trackType / bitrate / bytes / decodeFps / renderFps
AoqDataMsgPublishStats / AoqDataMsgSubscribeStats
trackType / bitrate / bytes
Key differences from the Android SDK
|
Difference |
iOS |
Android |
|
Callback pattern |
|
Abstract class listener |
|
AVAudioSession control |
|
No equivalent |
|
Audio focus callback |
None (uses |
|
|
Video pixel format |
Supports CVPixelBuffer zero-copy |
Supports TextureOES / Texture2D |
|
Video rendering view |
UIView |
SurfaceView / TextureView |
|
Bluetooth mode config |
No |
|
|
Video frame callback write-back |
I420 / CVPixelBuffer |
I420 |