AliRtcEngine interface

更新时间:
复制 MD 格式

This topic describes the AliRtcEngine interface for the iOS and Mac SDKs.

API reference

For more information about all APIs, see AliRtcEngine.

Contents

Basic APIs

APIDescriptionMinimum supported version
setH5CompatibleModeSets the H5 compatibility mode.1.1
getH5CompatibleModeChecks whether H5 compatibility mode is set.1.1
sharedInstanceCreates an AliRtcEngine instance.1.17
destroyReleases the SDK instance.1.1
uploadLogUploads logs.1.1
setLogDirPathSets the path to save the SDK log file.1.17
setLogLevelSets the log level.1.17

Channel APIs

APIDescriptionMinimum supported version
joinChannelJoins a channel.1.1
leaveChannelLeave the channel.1.1
switchChannelSwitches to another channel.2.1
isInCallChecks whether the user is in a channel.1.1
setChannelProfileSets the channel mode.1.15
createChannelWithDelegateCreates an AliRtcEngine sub-channel instance.2.1
destroyChannelDestroys the sub-channel created by createChannelWithDelegate.2.1

Publishing APIs

APIDescriptionMinimum supported version
publishLocalVideoStreamSets whether to publish the video stream.2.1
isLocalVideoStreamPublishedQueries whether the video stream is allowed to be published.1.1
isScreenSharePublishedQueries whether the screen stream is allowed to be published.1.1
publishLocalAudioStreamSets whether to publish the audio stream.2.1
isLocalAudioStreamPublishedQueries whether the audio stream is allowed to be published.1.1
publishLocalDualStreamSets whether to publish the secondary video stream.2.1
isDualStreamPublishedQueries whether the secondary video stream is allowed to be published.2.1

Subscription APIs

APIDescriptionMinimum supported version
setRemoteVideoStreamTypeSets the subscribed camera stream type to high-quality or low-quality.2.1
setRemoteDefaultVideoStreamTypeSets the default subscribed camera stream type to high-quality or low-quality.2.1
setDefaultSubscribeAllRemoteAudioStreamsSets whether to subscribe to audio streams by default.2.1
subscribeAllRemoteAudioStreamsStops or resumes receiving all remote audio streams.2.1
subscribeRemoteAudioStreamStops or resumes receiving the audio stream of a specific remote user.2.1
setDefaultSubscribeAllRemoteVideoStreamsSets whether to subscribe to video streams by default.2.1
subscribeAllRemoteVideoStreamsStops or resumes receiving all remote video streams.2.1
subscribeRemoteVideoStreamStops or resumes receiving the video stream of a specific remote user.2.1

Video APIs

APIDescriptionMinimum supported version
setScreenShareEncoderConfigurationSets the screen sharing encoding properties.2.1
setLocalViewConfigSets the rendering window and parameters for the local preview.1.1
setCameraCapturerConfigurationSets the preferred camera capture settings.2.1
enableLocalVideoDisables or re-enables local video capture.2.1
muteLocalCameraStops or resumes sending local video data.1.1
muteAllRemoteVideoRenderingStops or resumes rendering all remote videos (iOS only).2.1
setRemoteViewConfigSets the rendering window and parameters for a remote video.1.1
isCameraOnChecks whether the camera is on.1.1
stopRecordStops recording.1.17
startRecordStarts recording (non-layout recording).1.17
setBeautyEffectSets whether to enable basic retouching.1.17.9
setVideoEncoderConfigurationSets the video encoding properties.2.1
addVideoWatermarkAdds a watermark.2.1
clearVideoWatermarkRemoves the watermark from the specified data stream.2.1
snapshotVideoTakes a snapshot.2.1
switchCameraSwitches between the front and rear cameras (iOS only).1.1
getCurrentCameraDirectionGets the current camera direction. The front camera is used by default (iOS only).1.1
setCameraZoomSets the camera zoom factor (iOS only).1.1
setCameraFlashSets whether to turn on the camera flash (iOS only).1.14
isCameraFocusPointSupportedChecks whether the camera supports manual focus (iOS only).1.14
isCameraExposurePointSupportedChecks whether the camera supports setting an exposure area (iOS only).1.14
setCameraFocusPointSets the manual focus for the camera (iOS only).1.14
setCameraExposurePointSets the camera exposure point (iOS only).1.14
isCameraAutoFocusFaceModeSupportedChecks whether the camera supports face-based auto focus (iOS only).2.1
setCameraAutoFocusFaceModeEnabledSets face-based auto focus for the camera (iOS only).2.1
getVideoCaptureDataActively obtains captured data.2.4
getVideoPreEncoderDataActively obtains pre-encoding data.2.4
getVideoRenderDataActively obtains stream pulling data.2.4

Video Sharing APIs

APIDescriptionMinimum supported version
startScreenShareStarts screen sharing (iOS only).2.1
startScreenShareWithDesktopIdStarts screen sharing based on the desktop ID (Mac only).2.1
startScreenShareWithWindowIdStarts screen sharing based on the window ID (Mac only).2.1
getScreenShareSourceInfoWithTypeGets the screen sharing source information (Mac only).2.1
updateScreenShareConfigUpdates the screen sharing configuration (Mac only).2.1
stopScreenShareStops screen sharing.2.1

Audio APIs

APIDescriptionMinimum supported version
setAudioOnlyModeSets the mode to audio-only or audio and video.1.1
isAudioOnlyQueries whether the current mode is audio-only.1.1
muteLocalMicStops or resumes sending local audio data.1.1
muteRemoteAudioPlayingStops or resumes playing a remote audio stream.1.1
muteAllRemoteAudioPlayingStops or resumes playing all remote audio streams.1.16.2
startAudioCaptureStarts audio capture.1.11
stopAudioCaptureStops audio capture.1.11
startAudioPlayerStarts the audio playback device.1.11
stopAudioPlayerStops audio playback.1.11
setRemoteAudioVolumeSets the playback volume of a specified remote user.2.1
enableSpeakerphoneSets the audio output to the earpiece or speaker (iOS only).2.1
isEnableSpeakerphoneGets the current audio output device, earpiece or speaker (iOS only).2.1
setRecordingVolumeSets the recording volume.1.16.2
setPlayoutVolumeSets the playback volume.1.16.2
setRecordingDeviceVolumeSets the audio capture device volume (Mac only).2.1
getRecordingDeviceVolumeGets the audio capture device volume (Mac only).2.1
setPlayoutDeviceVolumeSets the audio playback device volume (Mac only).2.1
getPlayoutDeviceVolumeGets the audio playback device volume (Mac only).2.1
setExternalAudioRenderVolumeSets the playback volume of the external audio input (Mac only).2.1
getExternalAudioRenderVolumeGets the playback volume of the external audio input (Mac only).2.1
enableAudioVolumeIndicationSets the volume callback frequency and smoothing coefficient.1.17.9
setAudioProfileSets the audio profile.2.1
setAudioSessionOperationRestrictionSets the SDK's control permission over AVAudioSession (iOS only).2.1
setDeviceVolumeTypeSets the SDK device volume type (iOS only).2.1
enableAudioDTXEnables local audio traffic shaping (voice).2.1
enableAudioAMDEnables local audio traffic shaping (microphone).2.1
setAudioEffectVoiceChangerModeSets the voice changer effect mode.2.1
setAudioEffectPitchValueSets the pitch-shifting parameter.2.1
setAudioEffectReverbModeSets the reverb effect mode.2.1
setAudioEffectReverbParamTypeSets the reverb effect type and specific parameters.2.1
enableEarBackEnables in-ear monitoring (iOS only).1.15
setEarBackVolumeSets the in-ear monitoring volume (iOS only).1.15
setRecordingDeviceMuteMutes the audio capture device (macOS only).2.4
getRecordingDeviceMuteGets the mute status of the audio capture device (Mac only).2.4
setPlaybackDeviceMuteMutes the audio playback device (Mac only).2.4
getPlaybackDeviceMuteGets the mute status of the audio playback device (Mac only).2.4

Accompaniment and Sound Effects

APIDescriptionMinimum supported version
startAudioAccompanyWithFileStarts audio mixing.1.15
stopAudioAccompanyStops audio mixing.1.15
setAudioAccompanyVolumeSets the audio mixing volume.1.15
setAudioAccompanyPublishVolumeSets the volume of the mixed audio for stream ingest.1.15
getAudioAccompanyPublishVolumeGets the volume of the mixed audio for stream ingest.1.15
setAudioAccompanyPlayoutVolumeSets the local playback volume of the mixed audio.1.15
getAudioAccompanyPlayoutVolumeGets the local playback volume of the mixed audio.1.15
pauseAudioAccompanyPauses audio mixing.1.15
resumeAudioAccompanyResumes audio mixing.1.15
getAudioAccompanyDurationGets the duration of the audio mixing file.1.17.30
getAudioAccompanyCurrentPositionGets the playback progress of the music file.1.17.30
setAudioAccompanyPositionSets the playback position of the audio file.1.17.30
preloadAudioEffectWithSoundIdPreloads a sound effect file.1.15
unloadAudioEffectWithSoundIdUnloads a preloaded sound effect file.1.15
playAudioEffectWithSoundIdStarts playing a sound effect.1.15
stopAudioEffectWithSoundIdStops playing a sound effect.1.15
stopAllAudioEffectsStops playing all sound effects.1.15
setAudioEffectPublishVolumeWithSoundIdSets the stream ingest volume for a sound effect.1.15
getAudioEffectPublishVolumeWithSoundIdGets the stream ingest volume for a sound effect.1.15
setAudioEffectPlayoutVolumeWithSoundIdSets the local playback volume for a sound effect.1.15
getAudioEffectPlayoutVolumeWithSoundIdGets the local playback volume for a sound effect.1.15
setAllAudioEffectsPublishVolumeSets the local playback volume for all sound effects.1.15
setAllAudioEffectsPlayoutVolumeSets the stream ingest volume for all sound effects.1.15
pauseAudioEffectWithSoundIdPauses a sound effect.1.15
pauseAllAudioEffectsPauses all sound effects.1.15
resumeAudioEffectWithSoundIdResumes playing a sound effect.1.15
resumeAllAudioEffectsResumes playing all sound effects.1.15

Media Engine APIs

APIDescriptionMinimum supported version
registerVideoSampleObserverRegisters video data outputs.1.17
unRegisterVideoSampleObserverUnregisters the video data output.1.17
registerLocalVideoTextureRegisters an observer for local camera stream video OpenGL texture data (iOS only).1.15
unregisterLocalVideoTextureUnregisters the observer for local camera stream video OpenGL texture data (iOS only).1.15
subscribeAudioDataSubscribes to audio data output.1.17
unSubscribeAudioDataUnsubscribes from audio data output.1.17
setSubscribeAudioNumChannelSets the number of output audio channels (not supported for pre-mixing data).2.1
setSubscribeAudioSampleRateSets the output audio sample rate (not supported for pre-mixing data).2.1
setExternalVideoSourceEnables an external video input source.2.1
pushExternalVideoFrameInputs video data.2.1
setExternalAudioSourceSets whether to enable an external audio input source.1.17.9
pushExternalAudioFrameRawDataInputs audio data.1.17.9
setExternalAudioVolumeSets the audio mixing volume.1.17.9
getExternalAudioVolumeGets the audio mixing volume.1.17.9
setMixedWithMicSets whether to mix with the audio captured by the microphone.1.17.9
setExteranlAudioRenderSets whether to enable playback of external audio input.1.17.9
pushExternalAudioRenderRawDataInputs external audio playback data.1.17.9

Live Stream Bypass APIs

APIDescriptionMinimum supported version
startPublishLiveStreamWithURLStarts bypass live streaming.2.4
updatePublishLiveStreamWithURLUpdates bypass live streaming parameters.2.4
stopPublishLiveStreamWithURLStops bypass live streaming.2.1
GetPublishLiveStreamStateWithURLGets the bypass live streaming status.2.4

Cross-channel Co-hosting APIs

APIDescriptionMinimum supported version
startChannelRelayStarts cross-channel co-hosting.2.1
updateChannelRelayUpdates cross-channel co-hosting.2.1
stopChannelRelayStops cross-channel co-hosting.2.1
enableBackgroundExchangeEnables or disables the virtual background replacement feature (Mac only).2.4
enableBackgroundBlurEnables or disables the virtual background blur feature (Mac only).2.4

Preview APIs

APIDescriptionMinimum supported version
startPreviewStarts the local preview.1.1
stopPreviewStops the local preview.1.1

Remote User Query APIs

APIDescriptionMinimum supported version
getOnlineRemoteUsersGets the list of online remote users.1.1
getUserInfoQueries remote user information.1.1
isUserOnlineQueries whether a user is online.1.1

Device Management APIs (Mac only)

APIDescriptionMinimum supported version
getAudioCapturesGets the list of recording devices in the system.1.1
getCurrentAudioCaptureGets the name of the recording device in use.1.1
getCurrentAudioCaptureIDGets the ID of the recording device in use.1.16.2
setCurrentAudioCaptureSets the recording device by name.1.1
setCurrentAudioCaptureWithIDSets the recording device by ID.1.16.2
getAudioRenderersGets the list of speakers in the system.1.1
getCurrentAudioRendererGets the name of the speaker in use.1.1
getCurrentAudioRendererIDGets the ID of the speaker in use.1.16.2
setCurrentAudioRendererSets the speaker by name.1.1
setCurrentAudioRendererWithIDSets the speaker by ID.1.16.2
getCameraListGets the camera list.1.1
getCurrentCameraGets the name of the camera in use.1.1
getCurrentCameraIDGets the ID of the camera in use.1.16.2
setCurrentCameraSets the camera by name.1.1
setCurrentCameraWithIDSets the camera by ID.1.16.2
startTestAudioRecordWithNameStarts testing the audio capture device.1.16.2
stopTestAudioRecordStops testing the audio capture device.1.16.2
startTestAudioPlayoutWithNameStarts testing the audio playback device.1.16.2
stopTestAudioPlayoutStops testing the audio playback device.1.16.2

Video Layout Recording APIs (Mac only)

APIDescriptionMinimum supported version
startRecordStarts recording.2.1
pauseRecordPauses recording.2.1
resumeRecordResumes recording.2.1
UpdateRecordLayoutUpdates recording information.2.1
addRecordTemplateAdds a recording template.2.1

Other APIs

APIDescriptionMinimum supported version
getSDKVersionGets the SDK version number.1.1
getErrorDescriptionGets the description of an error code.2.1
setClientRoleSets the user role.1.16
getCurrentClientRoleGets the user role (iOS only).1.17.19
getClientRoleGets the user role (Mac only).1.17.19
startLastmileDetectStarts the network quality probe.1.16.2
stopLastmileDetectStops the network quality probe.1.16.2
postFeedbackWithUidFeedback on SDK issues.1.17.12
sendMediaExtensionMsgSends media extension messages.1.17.1
startIntelligentDenoiseStarts intelligent noise reduction.2.1
stopIntelligentDenoiseStops intelligent noise reduction.2.1
refreshAuthInfoRefreshes the authentication information.1.17.41
getCurrentConnectionStatusGets the current network connection status.2.1
enableDelegateMainQueueSpecifies whether to dispatch callbacks to the main thread (iOS only).2.1
setDelegateQueueSpecifies the thread queue for callbacks (iOS only).2.1
showDebugViewShows the dashboard.2.4

API details

  • setH5CompatibleMode: Sets whether to enable H5 compatibility.
    + (void)setH5CompatibleMode:(BOOL)comp;
    Parameters
    NameTypeDescription
    compBOOLSpecifies whether to enable H5 compatibility. `YES`: H5 compatibility is enabled. `NO`: H5 compatibility is disabled. The default value is `NO`.
    Important The current version does not support changing the H5 compatibility mode after an AliRtcEngine instance is created. You must call this method before you create the instance.
  • getH5CompatibleMode: Checks whether H5 compatibility mode is set.
    + (BOOL)getH5CompatibleMode;
    Return value

    `YES`: H5 compatibility is enabled. `NO`: H5 compatibility is disabled.

  • sharedInstance: Creates an AliRtcEngine instance.
    + (instancetype _Nonnull )sharedInstance:(id<AliRtcEngineDelegate>_Nullable)delegate extras:(NSString *_Nullable)extras;
    Parameters
    NameTypeDescription
    delegateid<AliRtcEngineDelegate>_NullableThe delegate for listening to callbacks.
    extrasNSString *_NullableConfigures special SDK features using JSON configurations. For more information, see extras feature description. If no special features are needed, you can pass an empty string: "".
    Important Only one primary instance can exist at a time.
  • destroy: Releases the SDK instance.
    + (void)destroy;
    Important Call this method after all operations are complete.
  • uploadLog: Uploads logs. By default, logs are automatically uploaded after a user leaves a session.
    + (void)uploadLog;
  • setLogDirPath: Sets the path to save the SDK log file.
    + (int)setLogDirPath:(NSString *_Nullable)logDirPath;
    Parameters
    NameTypeDescription
    logDirPathNSString *_NullableThe absolute path to save the log file. The default path for iOS is Library/Caches/Ali_RTC_Log. The default path for Mac is /Users/xxx/Documents/Ali_RTC_Log.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Important Call this method before you call any other SDK methods to prevent log loss. The application must ensure that the specified directory exists and is writable.
  • setLogLevel: Sets the log level.
    - (void)setLogLevel:(AliRtcLogLevel)logLevel;
    Parameters
    NameTypeDescription
    logLevelAliRtcLogLevelThe log level. The default value is AliRtcLogLevelInfo.
  • joinChannel: Joins a channel.
    - (int)joinChannel:(AliRtcAuthInfo *_Nonnull)authInfo name:(NSString *_Nullable)userName onResult:(void(^_Nullable)(NSInteger errCode,NSString * _Nonnull channel,NSInteger elapsed))onResult;
    Parameters
    NameTypeDescription
    authInfoAliRtcAuthInfoThe authentication information.
    userNameStringThe display name of the user, not the user ID.
    onResultvoid(^_Nullable)(NSInteger errCode,NSString * _Nonnull channel,NSInteger elapsed)This callback is invoked when the method call is complete.
    Note After you successfully join a channel, you must call leaveChannel to leave the current channel before joining another one. If you fail to join a channel and need to retry, you do not need to call leaveChannel first.
  • leaveChannel: Leaves a channel.
    - (int)leaveChannel;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note
    • For versions 1.15 and later, the engine can only be destroyed using the destroy method.
    • For versions earlier than 1.15, the AliRtcEngine instance is destroyed when you leave a channel. To perform operations such as joining a channel again, you must re-initialize the AliRtcEngine instance by calling `getInstance`.
    • If you are not in a channel, calling leaveChannel does not affect the instance, but it sends a notification message to other users in the channel.
  • switchChannel: Switches to another channel.
    - (int)switchChannel:(AliRtcAuthInfo *_Nonnull)authInfo;
    Parameters
    NameTypeDescription
    authInfoAliRtcAuthInfoThe authentication information.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    • If the ERR_SDK_INVALID_STATE error is returned, check if the channel mode or role is incorrect, or if you are not currently in a channel.
    • If `ERR_INVALID_ARGUMENTS` is returned, check whether the authentication information is valid, or whether you are trying to join the same channel.
    • `ERR_INNER` indicates an internal SDK state error.
    Note
    • This method can be used only by a viewer (`AliRtcClientRolelive`) in interactive live streaming mode (`AliRtcInteractivelive`).
    • This is an asynchronous method. After you successfully switch channels by calling this method, the SDK first triggers the onLeaveChannelResult callback for leaving the original channel, and then triggers the `onJoinChannelResult` callback for joining the new channel.
  • isInCall: Checks whether the user is in a channel.
    - (BOOL)isInCall;
    Return value

    `YES`: The user is in a channel. `NO`: The user is not in a channel.

  • setChannelProfile: Sets the channel mode.
    - (int)setChannelProfile:(AliRtcChannelProfile)profile;
    Parameters
    NameTypeDescription
    profileAliRtcChannelProfileThe channel type. The default value is AliRtcCommunication.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note You can call this method only before you join a channel. You cannot change the channel mode during a session. You can change it after you leave the channel.
  • createChannelWithDelegate: Creates an AliRtcEngine sub-channel instance.
    - (AliRtcEngine *_Nullable)createChannelWithDelegate:(id<AliRtcEngineDelegate>_Nonnull)delegate extras:(NSString *_Nullable)extras;
    Parameters
    NameTypeDescription
    delegateid<AliRtcEngineDelegate>_NonnullThe delegate of the returned SDK instance object.
    extrasNSString *_NullableConfigures special SDK features using JSON configurations. For more information, see extras feature description. If no special features are needed, you can pass an empty string: @"".
    Return value

    Returns a sub-channel instance on success, or `nil` on failure.

  • destroyChannel: Destroys the sub-channel created by createChannelWithDelegate.
    - (void)destroyChannel;
  • publishLocalVideoStream: Sets whether to publish the camera stream.
    - (int)publishLocalVideoStream:(BOOL)enable;
    Parameters
    NameTypeDescription
    enableboolean`YES`: sends the video. `NO`: stops sending the video. The default value is `YES`.
  • isLocalVideoStreamPublished: Checks whether the camera stream is published.
    - (BOOL)isLocalVideoStreamPublished;
    Return value

    `YES`: The camera stream is published. `NO`: The camera stream is not published.

  • isScreenSharePublished: Checks whether the screen stream is published.
    - (BOOL)isScreenSharePublished;
    Return value

    `YES`: The screen stream is published. `NO`: The screen stream is not published.

  • publishLocalAudioStream: Sets whether to publish the audio stream.
    - (int)publishLocalAudioStream:(BOOL)enable;
    Parameters
    NameTypeDescription
    enableboolean`YES`: sends the local audio stream. `NO`: stops the stream ingest. The default value is `YES`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • isLocalAudioStreamPublished: Checks whether the audio stream is published.
    - (BOOL)isLocalAudioStreamPublished;
    Return value

    YES allows pushing, and NO disallows pushing.

  • publishLocalDualStream: Sets whether to publish the secondary video stream.
    - (int)publishLocalDualStream:(BOOL)enable;
    Parameters
    NameTypeDescription
    enableBOOL`YES`: publishes the secondary stream. `NO`: does not publish the secondary stream. The default value is `NO`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • isDualStreamPublished: Checks whether the secondary video stream is published.
    - (BOOL)isDualStreamPublished;
    Return value

    YES allows pushing. NO disallows pushing.

  • setRemoteVideoStreamType: Sets the subscribed camera stream type to high-quality or low-quality.
    - (int)setRemoteVideoStreamType:(NSString *_Nonnull)uid type:(AliRtcVideoStreamType)streamType;
    Parameters
    NameTypeDescription
    uidNSString *_NonnullThe remote user ID.
    streamTypeAliRtcVideoStreamTypeThe camera stream type. The default value is AliRtcVideoStreamTypeHigh (high-quality stream).
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setRemoteDefaultVideoStreamType: Sets the default subscribed camera stream type to high-quality or low-quality.
    - (int)setRemoteDefaultVideoStreamType:(AliRtcVideoStreamType)streamType;
    Parameters
    NameTypeDescription
    streamTypeAliRtcVideoStreamTypeThe camera stream type. The default value is AliRtcVideoStreamTypeHigh (high-quality stream).
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setDefaultSubscribeAllRemoteAudioStreams: Sets whether to subscribe to audio streams by default.
    - (int)setDefaultSubscribeAllRemoteAudioStreams:(BOOL)sub;
    Parameters
    NameTypeDescription
    subBOOL`YES`: receives user audio streams. `NO`: stops receiving user audio streams. The default value is `YES`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Important
    • You can call this method before or after you join a channel. If you call `setDefaultSubscribeAllRemoteAudioStreams:NO` after you join a channel, you will not receive audio streams from users who join the channel after the setting is applied.
    • After you stop receiving audio streams, if you want to resume, call subscribeRemoteAudioStream:uid sub:YES and specify the UID of the remote user.
    • To resume receiving audio streams from multiple users, you must call subscribeRemoteAudioStream multiple times. `setDefaultSubscribeAllRemoteAudioStreams:YES` only resumes receiving audio streams from users who join the channel later.
  • subscribeAllRemoteAudioStreams: Stops or resumes receiving all remote audio streams.
    - (int)subscribeAllRemoteAudioStreams:(BOOL)sub;
    Parameters
    NameTypeDescription
    subBOOL`YES`: receives audio streams from all users. `NO`: stops receiving audio streams from all users. The default value is `YES`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note This method acts as a master switch for subscribing to remote audio streams. If you set this parameter to `NO`, you will unsubscribe from all remote audio streams in the current session. You will also not subscribe to new users who join later, even if setDefaultSubscribeAllRemoteAudioStreams:YES is set.
  • subscribeRemoteAudioStream: Stops or resumes receiving the audio stream of a specific remote user.
    - (int)subscribeRemoteAudioStream:(NSString *_Nonnull)uid sub:(BOOL)sub;
    Parameters
    NameTypeDescription
    uidNSString *_NonnullThe remote user ID.
    subBOOL`YES`: receives the audio stream of the specified user. `NO`: stops receiving the audio stream of the specified user. The default value is `YES`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note If you have previously called subscribeAllRemoteAudioStreams:NO to stop receiving all remote audio, you must call subscribeAllRemoteAudioStreams:YES before calling this method. The subscribeAllRemoteAudioStreams method provides global control, while the subscribeRemoteAudioStream method provides fine-grained control.
  • setDefaultSubscribeAllRemoteVideoStreams: Sets whether to subscribe to video streams by default.
    - (int)setDefaultSubscribeAllRemoteVideoStreams:(BOOL)sub;
    Parameters
    NameTypeDescription
    subboolean`YES`: receives user video streams. `NO`: does not receive user video streams. The default value is `YES`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note
    • You can call this method before or after you join a channel. If you call `setDefaultSubscribeAllRemoteVideoStreams:NO` after you join a channel, you will not receive video streams from users who join the channel after the setting is applied.
    • After you stop receiving video streams, if you want to resume, call subscribeRemoteVideoStream:uid track:track sub:YES and specify the UID of the remote user.
    • To resume receiving video streams from multiple users, you must call subscribeRemoteVideoStream multiple times. `setDefaultSubscribeAllRemoteVideoStreams:YES` only resumes receiving video streams from users who join the channel later.
  • subscribeAllRemoteVideoStreams: Stops or resumes receiving all remote video streams.
    - (int)subscribeAllRemoteVideoStreams:(BOOL)sub;
    Parameters
    NameTypeDescription
    subBOOL`YES`: receives video streams from all users. `NO`: stops receiving video streams from all users. The default value is `YES`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note This method acts as a master switch for subscribing to remote video streams. If you set this parameter to `NO`, you will unsubscribe from all remote video streams in the current session. You will also not subscribe to new users who join later, even if setDefaultSubscribeAllRemoteVideoStreams:YES is set.
  • subscribeRemoteVideoStream: Stops or resumes receiving the video stream of a specific remote user.
    - (int)subscribeRemoteVideoStream:(NSString *_Nonnull)uid track:(AliRtcVideoTrack)track sub:(BOOL)sub;
    Parameters
    NameTypeDescription
    uidNSString *_NonnullThe remote user ID.
    trackAliRtcVideoTrackThe video stream type.
    subBOOL`YES`: receives the video stream of the specified user. `NO`: stops receiving the video stream of the specified user. The default value is `YES`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note
  • setScreenShareEncoderConfiguration: Sets the encoding properties for screen sharing.
    - (void)setScreenShareEncoderConfiguration:(AliRtcScreenShareEncoderConfiguration* _Nonnull)config;
    Parameters
    NameTypeDescription
    configAliRtcScreenShareEncoderConfiguration* _NonnullThe predefined screen sharing encoding properties. Default values:
    • dimensions: [0,0]
    • frameRate: 5
    • bitrate: 0
    • rotation: 0
  • setLocalViewConfig: Sets the rendering window and parameters for the local preview.
    - (int)setLocalViewConfig:(AliVideoCanvas *_Nullable)viewConfig forTrack:(AliRtcVideoTrack)track;
    Parameters
    NameTypeDescription
    viewConfigAliVideoCanvas *_NullableThe rendering parameters, including the rendering window and rendering mode.
    trackAliRtcVideoTrackThe video track type.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note
    • You can switch windows before and after you call joinChannel. If `canvas` or `AliVideoCanvas::view` is `nil`, rendering stops.
    • To reset the render mode during playback, keep the other member variables in the `canvas` object unchanged and modify only the `renderMode` member variable.
    • To reset the mirror mode during playback, keep the other member variables in the `canvas` object unchanged and modify only the `mirrorMode` member variable.
  • setCameraCapturerConfiguration: Sets the preferred camera capture settings.
    - (int)setCameraCapturerConfiguration:(AliRtcCameraCapturerConfiguration* _Nonnull)config;
    Parameters
    NameTypeDescription
    configAliRtcCameraCapturerConfiguration* _NonnullThe preferred camera capture settings. Default values:
    • preference: 0
    • cameraDirection: 0
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • enableLocalVideo: Disables or re-enables local video capture.
    - (int)enableLocalVideo:(BOOL)enable;
    Parameters
    NameTypeDescription
    enableBOOL`YES`: resumes normal operation. `NO`: stops video capture. The default value is `YES`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • muteLocalCamera: Stops or resumes sending local video data.
    - (int)muteLocalCamera:(BOOL)mute forTrack:(AliRtcVideoTrack)track;
    Parameters
    NameTypeDescription
    muteBOOL`YES`: sends black frames instead of video data. `NO`: resumes normal operation. The default value is `NO`.
    trackAliRtcVideoTrackThe video track type whose publishing state needs to be changed.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note This method controls only whether to send black frames on the specified video stream. It does not stop video capture or data sending. To turn off video capture, use the enableLocalVideo method. To stop sending video data, use the publishLocalVideoStream method.
  • muteAllRemoteVideoRendering: Stops or resumes rendering all remote videos (iOS only).
    - (int)muteAllRemoteVideoRendering:(BOOL)mute;
    Parameters
    NameTypeDescription
    muteBOOL`YES`: stops rendering. `NO`: resumes rendering. The default value is `NO`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note Stream pulling and decoding are not affected. You can call this method before or after you call joinChannel.
  • setRemoteViewConfig: Sets the rendering window and parameters for a remote video.
    - (int)setRemoteViewConfig:(AliVideoCanvas *_Nullable)canvas uid:(NSString *_Nonnull)uid forTrack:(AliRtcVideoTrack)track;
    Parameters
    NameTypeDescription
    canvasAliVideoCanvas *_NullableThe rendering parameters, including the rendering window and rendering mode.
    uidNSString *_NonnullThe user ID.
    trackAliRtcVideoTrackThe video track type to set.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note
    • You can switch windows before and after you call joinChannel. If `canvas` or `view` is `nil`, rendering of the corresponding stream stops.
    • To reset the render mode during playback, keep the other member variables in the `canvas` object unchanged and modify only the `renderMode` member variable.
    • To reset the mirror mode during playback, keep the other member variables in the `canvas` object unchanged and modify only the `mirrorMode` member variable.
  • isCameraOn: Checks whether the camera is on.
    - (BOOL)isCameraOn;
    Return value

    `YES`: The camera is on. `NO`: The camera is not on.

  • stopRecord: Stops recording.
    - (void)stopRecord;
  • startRecord: Starts recording (non-layout recording).
    - (BOOL)startRecord:(AliRtcRecordType)recordType recordFormat:(AliRtcRecordFormat)recordFormat filePath:(NSString*_Nonnull)filePath audioConfig:(AliRtcRecordAudioConfig*_Nullable)audioConfig videoConfig:(AliRtcRecordVideoConfig*_Nullable)videoConfig;
    Parameters
    NameTypeDescription
    recordTypeAliRtcRecordTypeThe record type.
    recordFormatAliRtcRecordFormatThe record format.
    filePathNSString*_NonnullThe file path.
    audioConfigAliRtcRecordAudioConfig*_NullableThe audio recording settings.
    videoConfigAliRtcRecordVideoConfig*_NullableThe video settings. Mobile devices do not support video recording.
    Return value

    `YES` indicates that the method call is successful. `NO` indicates that the call failed.

  • setBeautyEffect: Enables or disables basic retouching. This feature currently supports only whitening and smoothing.
    - (int)setBeautyEffect:(BOOL)enable config:(AliRtcBeautyConfig *_Nullable)config;
    Parameters
    NameTypeDescription
    enableBOOL`YES`: enables the feature. `NO`: disables the feature. The default value is `NO`.
    configAliRtcBeautyConfig *_NullableThe basic retouching parameters.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setVideoEncoderConfiguration: Sets the video encoding properties.
    - (void)setVideoEncoderConfiguration:(AliRtcVideoEncoderConfiguration* _Nonnull)config;
    Parameters
    NameTypeDescription
    configAliRtcVideoEncoderConfiguration* _NonnullThe predefined encoding properties. Default values:
    • dimensions: [640,480]
    • frameRate: 15
    • bitrate: 0
    • mirrorMode: 0
    • orientationMode: 0
    • rotation: 0
  • addVideoWatermark: Adds a watermark.
    - (int)addVideoWatermark:(AliRtcVideoTrack)track image:(NSString*_Nonnull)imageUrl config:(AliRtcWatermarkConfig *_Nullable)config;
    Parameters
    NameTypeDescription
    trackAliRtcVideoTrackThe data stream type.
    imageUrlNSString*_NonnullThe path of the watermark image.
    configAliRtcWatermarkConfig *_NullableThe watermark configuration.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • clearVideoWatermark: Removes the watermark from the specified data stream.
    - (int)clearVideoWatermark:(AliRtcVideoTrack)track;
    Parameters
    NameTypeDescription
    trackAliRtcVideoTrackThe data stream type.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • snapshotVideo: Takes a snapshot. The result is returned through the OnSnapshotComplete callback.
    - (int)snapshotVideo:(NSString*_Nullable)userId type:(AliRtcVideoTrack)type;
    Parameters
    NameTypeDescription
    userIdNSString*_NullableThe user ID. If empty, it refers to the local user.
    trackTypeAliRtcVideoTrackThe stream type.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • switchCamera: Switches between the front and rear cameras. The front camera is used by default (iOS only).
    - (int)switchCamera;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • getCurrentCameraDirection: Retrieves the current camera direction. The front camera is used by default (iOS only).
    - (AliRtcCameraDirection)getCurrentCameraDirection;
    Return value

    Returns the camera direction enumeration value.

  • setCameraZoom: Sets the camera zoom factor (iOS only).
    - (int)setCameraZoom:(float)zoom;
    Parameters
    NameTypeDescription
    zoomfloatThe zoom level. The default value is 1.0.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setCameraFlash: Turns the camera flash on or off (iOS only).
    - (int)setCameraFlash:(BOOL)flash;
    Parameters
    NameTypeDescription
    flashBOOL`YES`: turns on the flash. `NO`: turns off the flash. The default value is `NO`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • isCameraFocusPointSupported: Checks whether the camera supports manual focus (iOS only).
    - (BOOL)isCameraFocusPointSupported;
    Return value

    `YES`: supported. `NO`: not supported.

  • isCameraExposurePointSupported: Checks whether the camera supports setting an exposure area (iOS only).
    - (BOOL)isCameraExposurePointSupported;
    Return value

    `YES`: supported. `NO`: not supported.

  • setCameraFocusPoint: Sets the manual focus for the camera (iOS only).
    - (int)setCameraFocusPoint:(CGPoint)point;
    Parameters
    NameTypeDescription
    pointCGPointThe coordinates of the focus point.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setCameraExposurePoint: Sets the camera exposure point (iOS only).
    - (int)setCameraExposurePoint:(CGPoint)point;
    Parameters
    NameTypeDescription
    pointCGPointThe coordinates of the exposure point.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • isCameraAutoFocusFaceModeSupported: Checks whether the camera supports face-based auto focus (iOS only).
    - (BOOL)isCameraAutoFocusFaceModeSupported;
    Return value

    `YES`: supported. `NO`: not supported.

  • setCameraAutoFocusFaceModeEnabled: Enables or disables face-based auto focus for the camera (iOS only).
    - (BOOL)setCameraAutoFocusFaceModeEnabled:(BOOL)enable;
    Parameters
    NameTypeDescription
    enableBOOL`YES`: enables face-based auto focus. `NO`: disables face-based auto focus. The default value is `NO`.
    Return value

    `YES` indicates that the method call is successful. `NO` indicates that the call failed.

  • startScreenShare: Starts screen sharing (iOS only).
    - (int)startScreenShare;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • stopScreenShare: Stops screen sharing.
    - (int)stopScreenShare;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setAudioOnlyMode: Sets the mode to audio-only or audio and video.
    - (int)setAudioOnlyMode:(BOOL)audioOnly;
    Parameters
    NameTypeDescription
    audioOnlyBOOL`YES`: only audio is ingested and pulled. `NO`: both audio and video are supported. The default value is `NO`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • isAudioOnly: Checks whether the current mode is audio-only.
    - (BOOL)isAudioOnly;
    Return value

    `YES`: audio-only mode. `NO`: audio and video mode.

  • muteLocalMic: Stops or resumes sending local audio data.
    - (int)muteLocalMic:(BOOL)mute mode:(AliRtcMuteLocalAudioMode)mode;
    Parameters
    NameTypeDescription
    muteBOOL`YES`: sends empty frames instead of local audio. `NO`: resumes normal operation. The default value is `NO`.
    modeAliRtcMuteLocalAudioModeThe mute mode. The default is microphone mute mode.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note Muting sends only silent audio frames. The capture and encoding modules continue to work.
  • muteRemoteAudioPlaying: Stops or resumes playing a remote audio stream.
    - (int)muteRemoteAudioPlaying:(NSString *_Nonnull)uid mute:(BOOL)mute;
    Parameters
    NameTypeDescription
    uidNSString *_NonnullThe user ID.
    muteBOOL`YES`: stops playback. `NO`: resumes playback. The default value is `NO`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • muteAllRemoteAudioPlaying: Stops or resumes playing all remote audio streams.
    - (int)muteAllRemoteAudioPlaying:(BOOL)mute;
    Parameters
    NameTypeDescription
    muteBOOL`YES`: stops playback. `NO`: resumes playback. The default value is `NO`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note Stream pulling and decoding are not affected. You can call this method before or after you call joinChannel.
  • startAudioCapture: Starts audio capture.
    - (void)startAudioCapture;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note This method lets you start audio capture in advance. If you do not call this method, the SDK starts audio capture at the appropriate time.
  • stopAudioCapture: Stops audio capture.
    - (void)stopAudioCapture;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note This method stops audio capture and is the counterpart to `startAudioCapture`.
  • startAudioPlayer: Starts the audio playback device.
    - (void)startAudioPlayer;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note This method lets you start audio playback in advance. If you do not call this method, the SDK starts audio playback at the appropriate time.
  • stopAudioPlayer: Stops audio playback.
    - (void)stopAudioPlayer;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note This method stops audio playback and is the counterpart to `startAudioPlayer`.
  • setRemoteAudioVolume: Sets the playback volume of a specified remote user.
    - (int)setRemoteAudioVolume:(NSString *_Nonnull)uid volume:(NSInteger)volume;
    Parameters
    NameTypeDescription
    uidNSString *_NonnullThe user ID.
    volumeNSIntegerThe playback volume. The range is [0, 100]. 0 means mute, and 100 means original volume. The default value is 100.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • enableSpeakerphone: Sets the audio output to the earpiece or speaker (iOS only).
    - (int)enableSpeakerphone:(BOOL)enable;
    Parameters
    NameTypeDescription
    enableBOOL`YES`: speaker mode. `NO`: earpiece mode. The default value is `YES`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • isEnableSpeakerphone: Checks whether the audio output device is the speaker or the earpiece (iOS only).
    - (BOOL)isEnableSpeakerphone;
    Return value

    `YES`: speaker mode. `NO`: earpiece mode.

  • setRecordingVolume: Sets the recording volume.
    - (int)setRecordingVolume:(NSInteger)volume;
    Parameters
    NameTypeDescription
    volumeNSIntegerThe range is [0, 400]. 0 means mute. The default value is 100. A value greater than 100 increases the volume, and a value less than 100 decreases the volume.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setPlayoutVolume: Sets the playback volume.
    - (int)setPlayoutVolume:(NSInteger)volume;
    Parameters
    NameTypeDescription
    volumeNSIntegerThe range is [0, 400]. 0 means mute. The default value is 100. A value greater than 100 increases the volume, and a value less than 100 decreases the volume.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • enableAudioVolumeIndication: Sets the volume callback frequency and smoothing coefficient.
    - (int)enableAudioVolumeIndication:(NSInteger)interval smooth:(NSInteger)smooth reportVad:(NSInteger)reportVad;
    Parameters
    NameTypeDescription
    intervalNSIntegerThe time interval in milliseconds. The minimum value is 10 ms. We recommend setting it to 300-500 ms. A value less than or equal to 0 disables the volume and speaker detection features.
    smoothNSIntegerThe smoothing coefficient. The range is [0, 9]. A larger value provides more smoothing but less real-time performance. We recommend setting it to 3.
    reportVadNSIntegerThe speaker detection switch. Valid values:
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setAudioProfile: Sets the audio profile.
    - (int)setAudioProfile:(AliRtcAudioProfile)audio_profile audio_scene:(AliRtcAudioScenario)audio_scene;
    Parameters
    NameTypeDescription
    audio_profileAliRtcAudioProfileThe audio capture or encoding mode parameter. The default value is AliEngineBasicQualityMode.
    audio_sceneAliRtcAudioScenarioThe audio scenario mode parameter. The default value is AliEngineSceneDefaultMode.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setAudioSessionOperationRestriction: Sets the SDK's control permission over AVAudioSession (iOS only).
    - (int)setAudioSessionOperationRestriction:(AliRtcAudioSessionOperationRestriction)restriction;
    Parameters
    NameTypeDescription
    restrictionAliRtcAudioSessionOperationRestrictionThe control permission. The default value is AliAudioSessionOperationRestrictionNone.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setDeviceVolumeType: Sets the SDK device volume type (iOS only).
    - (int)setDeviceVolumeType:(AliRtcDeviceVolumeType)type;
    Parameters
    NameTypeDescription
    typeAliRtcDeviceVolumeTypeThe volume type. The default value is AliRtcDeviceVolumeTypeAuto.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • enableAudioDTX: Enables local audio traffic shaping (voice).
    - (int)enableAudioDTX:(BOOL)enable;
    Parameters
    NameTypeDescription
    enableBOOL`YES`: enables the feature. `NO`: disables the feature. The default value is `NO`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note This method is effective when called before stream ingest. Enabling voice activity detection can reduce the number of bytes sent when no voice is detected, which saves user traffic.
  • enableAudioAMD: Enables local audio traffic shaping (microphone).
    - (int)enableAudioAMD:(BOOL)enable;
    Parameters
    NameTypeDescription
    enableBOOL`YES`: enables the feature. `NO`: disables the feature. The default value is `NO`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note This method is effective when called before stream ingest. Enabling voice activity detection can stop the sending of audio packets when the microphone is muted or turned off.
  • setAudioEffectVoiceChangerMode: Sets the voice changer effect mode.
    - (int)setAudioEffectVoiceChangerMode:(AliRtcAudioEffectVoiceChangerMode)mode;
    Parameters
    NameTypeDescription
    modeAliRtcAudioEffectVoiceChangerModeThe mode value. The default value is AliRtcSdk_AudioEffect_Voice_Changer_OFF.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setAudioEffectPitchValue: Sets the pitch-shifting parameter.
    - (int)setAudioEffectPitchValue:(double)value;
    Parameters
    NameTypeDescription
    valuedoubleThe range is [0.5, 2.0]. The default value is 1.0, which means no pitch change.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setAudioEffectReverbMode: Sets the reverb effect mode.
    - (int)setAudioEffectReverbMode:(AliRtcAudioEffectReverbMode)mode;
    Parameters
    NameTypeDescription
    modeAliRtcAudioEffectReverbModeThe sound effect mode. The default value is AliRtcAudioEffectReverb_Off.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setAudioEffectReverbParamType: Sets the reverb effect type and specific parameters.
    - (int)setAudioEffectReverbParamType:(AliRtcAudioEffectReverbParamType)type value:(float)value;
    Parameters
    NameTypeDescription
    typeAliRtcAudioEffectReverbParamTypeThe reverb effect mode.
    valuefloatThe specific parameter value.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • startAudioAccompanyWithFile: Starts audio mixing.
    - (int)startAudioAccompanyWithFile:(NSString *_Nonnull)filePath onlyLocalPlay:(BOOL)onlyLocalPlay replaceMic:(BOOL)replaceMic loopCycles:(NSInteger)loopCycles;
    Parameters
    NameTypeDescription
    filePathNSString *_NonnullThe path of the audio mixing file.
    onlyLocalPlayBOOLSpecifies whether to play locally only.
    replaceMicBOOLSpecifies whether to replace the microphone.
    loopCyclesNSIntegerThe number of loops (can be -1 or a positive integer).
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • stopAudioAccompany: Stops audio mixing.
    - (int)stopAudioAccompany;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setAudioAccompanyVolume: Sets the audio mixing volume. This method is effective only after you call startAudioAccompanyWithFile.
    - (int)setAudioAccompanyVolume:(NSInteger)volume;
    Parameters
    NameTypeDescription
    volumeNSIntegerThe audio mixing volume. The range is [0, 100]. The default value is 50.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setAudioAccompanyPublishVolume: Sets the stream ingest volume of the mixed audio. This method is effective only after you call startAudioAccompanyWithFile.
    - (int)setAudioAccompanyPublishVolume:(NSInteger)volume;
    Parameters
    NameTypeDescription
    volumeNSIntegerThe audio mixing volume. The range is [0, 100]. The default value is 50.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • getAudioAccompanyPublishVolume: Retrieves the stream ingest volume of the mixed audio.
    - (int)getAudioAccompanyPublishVolume;
    Return value

    Returns the stream ingest volume of the mixed audio. A value from 0 to 100 indicates success. Other values are error codes.

  • setAudioAccompanyPlayoutVolume: Sets the local playback volume of the mixed audio. This method is effective only after you call startAudioAccompanyWithFile.
    - (int)setAudioAccompanyPlayoutVolume:(NSInteger)volume;
    Parameters
    NameTypeDescription
    volumeNSIntegerThe audio mixing volume. The range is [0, 100]. The default value is 50.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • getAudioAccompanyPlayoutVolume: Retrieves the local playback volume of the mixed audio.
    - (int)getAudioAccompanyPlayoutVolume;
    Return value

    Returns the local playback volume of the mixed audio. A value from 0 to 100 indicates success. Other values are error codes.

  • pauseAudioAccompany: Pauses audio mixing.
    public abstract int pauseAudioAccompany();
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • resumeAudioAccompany: Resumes audio mixing.
    - (int)pauseAudioAccompany;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • getAudioAccompanyDuration: Retrieves the duration of the audio mixing file.
    - (int)getAudioAccompanyDuration;
    Return value

    Returns the duration of the audio mixing file in milliseconds. A value less than 0 is an error code.

  • getAudioAccompanyCurrentPosition: Retrieves the playback progress of the music file.
    - (int)getAudioAccompanyCurrentPosition;
    Return value

    Returns the playback progress of the music file in milliseconds. A value less than 0 is an error code.

  • setAudioAccompanyPosition: Sets the playback position of the audio file.
    - (int)setAudioAccompanyPosition:(int)pos;
    Parameters
    NameTypeDescription
    posintThe progress bar position in milliseconds.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • preloadAudioEffectWithSoundId: Preloads a sound effect file.
    - (int)preloadAudioEffectWithSoundId:(NSInteger)soundId filePath:(NSString *_Nonnull)filePath;
    Parameters
    NameTypeDescription
    soundIdNSIntegerThe ID assigned to the sound effect file by the user.
    filePathNSString *_NonnullThe path of the sound effect file.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • unloadAudioEffectWithSoundId: Unloads a preloaded sound effect file.
    - (int)unloadAudioEffectWithSoundId:(NSInteger)soundId;
    Parameters
    NameTypeDescription
    soundIdNSIntegerThe ID assigned to the sound effect file by the user.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • playAudioEffectWithSoundId: Starts playing a sound effect.
    - (int)playAudioEffectWithSoundId:(NSInteger)soundId filePath:(NSString *_Nonnull)filePath cycles:(NSInteger)cycles publish:(BOOL)publish;
    Parameters
    NameTypeDescription
    soundIdNSIntegerThe ID assigned to the sound effect file by the user.
    filePathNSString *_NonnullThe path of the sound effect file.
    cyclesNSIntegerThe number of loops (can be -1 or a positive integer).
    publishBOOLSpecifies whether to publish.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • stopAudioEffectWithSoundId: Stops playing a sound effect.
    - (int)stopAudioEffectWithSoundId:(NSInteger)soundId;
    Parameters
    NameTypeDescription
    soundIdNSIntegerThe ID assigned to the sound effect file by the user.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • stopAllAudioEffects: Stops playing all sound effects.
    - (int)stopAllAudioEffects;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setAudioEffectPublishVolumeWithSoundId: Sets the stream ingest volume for a sound effect.
    - (int)setAudioEffectPublishVolumeWithSoundId:(NSInteger)soundId volume:(NSInteger)volume;
    Parameters
    NameTypeDescription
    soundIdNSIntegerThe ID assigned to the sound effect file by the user.
    volumeNSIntegerThe audio mixing volume. The range is [0, 100]. The default value is 50.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • getAudioEffectPublishVolumeWithSoundId: Retrieves the stream ingest volume for a sound effect.
    - (int)getAudioEffectPublishVolumeWithSoundId:(NSInteger)soundId;
    Parameters
    NameTypeDescription
    soundIdNSIntegerThe ID assigned to the sound effect file by the user.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setAudioEffectPlayoutVolumeWithSoundId: Sets the local playback volume for a sound effect.
    - (int)setAudioEffectPlayoutVolumeWithSoundId:(NSInteger)soundId volume:(NSInteger)volume;
    Parameters
    NameTypeDescription
    soundIdNSIntegerThe ID assigned to the sound effect file by the user.
    volumeNSIntegerThe audio mixing volume. The range is [0, 100]. The default value is 50.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • getAudioEffectPlayoutVolumeWithSoundId: Retrieves the local playback volume for a sound effect.
    - (int)getAudioEffectPlayoutVolumeWithSoundId:(NSInteger)soundId;
    Parameters
    NameTypeDescription
    soundIdNSIntegerThe ID assigned to the sound effect file by the user.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setAllAudioEffectsPublishVolume: Sets the stream ingest volume for all sound effects.
    - (int)setAllAudioEffectsPublishVolume:(NSInteger)volume;
    Parameters
    NameTypeDescription
    volumeNSIntegerThe audio mixing volume. The range is [0, 100]. The default value is 50.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setAllAudioEffectsPlayoutVolume: Sets the local playback volume for all sound effects.
    - (int)setAllAudioEffectsPlayoutVolume:(NSInteger)volume;
    Parameters
    NameTypeDescription
    volumeNSIntegerThe audio mixing volume. The range is [0, 100]. The default value is 50.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • pauseAudioEffectWithSoundId: Pauses a sound effect.
    - (int)pauseAudioEffectWithSoundId:(NSInteger)soundId;
    Parameters
    NameTypeDescription
    soundIdNSIntegerThe ID assigned to the sound effect file by the user.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • pauseAllAudioEffects: Pauses all sound effects.
    - (int)pauseAllAudioEffects;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • resumeAudioEffectWithSoundId: Resumes playing a sound effect.
    - (int)resumeAudioEffectWithSoundId:(NSInteger)soundId;
    Parameters
    NameTypeDescription
    soundIdNSIntegerThe ID assigned to the sound effect file by the user.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • resumeAllAudioEffects: Resumes playing all sound effects.
    - (int)resumeAllAudioEffects;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • enableEarBack: Enables in-ear monitoring (iOS only).
    - (int)enableEarBack:(BOOL)enable;
    Parameters
    NameTypeDescription
    enableBOOL`YES`: enables in-ear monitoring. `NO`: disables in-ear monitoring. The default value is `NO`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setEarBackVolume: Sets the in-ear monitoring volume (iOS only).
    - (int)setEarBackVolume:(NSInteger)volume;
    Parameters
    NameTypeDescription
    volumeNSIntegerThe range is [0, 100]. The default value is 100.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • registerVideoSampleObserver: Registers a video data observer.
    - (void)registerVideoSampleObserver;
  • unRegisterVideoSampleObserver: Unregisters the video data observer.
    - (void)unregisterVideoSampleObserver;
  • registerLocalVideoTexture: Registers an observer for local camera stream video OpenGL texture data (iOS only).
    - (void)registerLocalVideoTexture;
  • unregisterLocalVideoTexture: Unregisters the observer for local camera stream video OpenGL texture data (iOS only).
    - (void)unregisterLocalVideoTexture;
  • subscribeAudioData: Subscribes to audio data output.
    - (void)subscribeAudioData:(AliRtcAudioSource)audioSource;
    Parameters
    NameTypeDescription
    audioSourceAliRtcAudioSourceThe data type.
  • unSubscribeAudioData: Unsubscribes from audio data output.
    - (void)unSubscribeAudioData:(AliRtcAudioSource)audioSource;
    Parameters
    NameTypeDescription
    audioSourceAliRtcAudioSourceThe data type.
  • setSubscribeAudioNumChannel: Sets the number of output audio channels (not supported for pre-mixing data).
    - (void)setSubscribeAudioNumChannel:(AliRtcAudioNumChannel)audioNumChannel;
    Parameters
    NameTypeDescription
    audioNumChannelAliRtcAudioNumChannelThe number of sound channels. The default is mono.
  • setSubscribeAudioSampleRate: Sets the output audio sample rate (not supported for pre-mixing data).
    - (void)setSubscribeAudioSampleRate:(AliRtcAudioSampleRate)audioSampleRate;
    Parameters
    NameTypeDescription
    audioSampleRateAliRtcAudioSampleRateThe sample rate. The default is 44.1 kHz.
  • setExternalVideoSource: Enables an external video input source.
    - (int)setExternalVideoSource:(BOOL)enable sourceType:(AliRtcVideoSource)type renderMode:(AliRtcRenderMode)renderMode;
    Parameters
    NameTypeDescription
    enableBOOL`YES`: enables the feature. `NO`: disables the feature.
    typeAliRtcVideoSourceThe stream type.
    renderModeAliRtcRenderModeThe rendering mode.
  • pushExternalVideoFrame: Inputs video data.
    - (int)pushExternalVideoFrame:(AliRtcVideoDataSample *_Nonnull)frame sourceType:(AliRtcVideoSource)type;
    Parameters
    NameTypeDescription
    frameAliRtcVideoDataSample *_NonnullThe frame data.
    typeAliRtcVideoSourceThe stream type.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setExternalAudioSource: Sets whether to enable an external audio input source.
    - (int)setExternalAudioSource:(BOOL)enable withSampleRate:(NSUInteger)sampleRate channelsPerFrame:(NSUInteger)channelsPerFrame;
    Parameters
    NameTypeDescription
    enableBOOL`YES`: enables the feature. `NO`: disables the feature. The default value is `NO`.
    sampleRateNSUIntegerThe sample rate, such as 16000 Hz or 48000 Hz.
    channelsPerFrameNSUIntegerThe number of sound channels, such as 1 or 2.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • pushExternalAudioFrameRawData: Inputs audio data.
    - (int)pushExternalAudioFrameRawData:(void *_Nonnull)data samples:(NSUInteger)samples timestamp:(NSTimeInterval)timestamp;
    Parameters
    NameTypeDescription
    datavoid *_NonnullThe audio data. We recommend not exceeding 40 ms of data.
    samplesNSUIntegerThe sample rate, such as 16 kHz or 48 kHz.
    timestampNSTimeIntervalThe timestamp.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setExternalAudioVolume: Sets the audio mixing volume.
    - (int)setExternalAudioVolume:(int)vol;
    Parameters
    NameTypeDescription
    volintThe audio mixing volume. The range is [1, 100]. The default value is 50.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • getExternalAudioVolume: Retrieves the audio mixing volume.
    - (int)getExternalAudioVolume;
    Return value

    Returns the current audio mixing volume.

  • setMixedWithMic: Sets whether to mix with the audio captured by the microphone.
    - (int)setMixedWithMic:(BOOL)mixed;
    Parameters
    NameTypeDescription
    mixedBOOL`YES`: mixes the audio. `NO`: completely replaces the microphone-captured data. The default value is `NO`.
    Return value

    Retrieves the current audio mixing volume.

  • setExteranlAudioRender: Sets whether to enable playback of external audio input.
    - (int)setExteranlAudioRender:(BOOL)enable sampleRate:(NSUInteger)sampleRate channelsPerFrame:(NSUInteger)channelsPerFrame;
    Parameters
    NameTypeDescription
    enableBOOL`YES`: enables the feature. `NO`: disables the feature. The default value is `NO`.
    sampleRateNSUIntegerThe sample rate, such as 16 kHz or 48 kHz.
    channelsPerFrameNSUIntegerThe number of sound channels, such as 1 or 2.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • pushExternalAudioRenderRawData: Inputs external audio playback data.
    - (int)pushExternalAudioRenderRawData:(const void* _Nullable)audioSamples sampleLength:(NSUInteger)sampleLength sampleRate:(NSUInteger)sampleRate channelsPerFrame:(NSUInteger)channelsPerFrame timestamp:(long long)timestamp;
    Parameters
    NameTypeDescription
    audioSamplesconstvoid* _NullableThe audio data.
    sampleLengthNSUIntegerThe length of the audio data.
    sampleRateNSUIntegerThe audio sample rate.
    channelsPerFrameNSUIntegerThe number of audio channels.
    timestamplong longThe timestamp.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • startPublishLiveStreamWithURL: Starts bypass live streaming.
    - (int)startPublishLiveStreamWithURL:(NSString *_Nonnull)streamURL liveTranscoding:(AliRtcLiveTranscodingParam *_Nonnull)trancoding;
    Parameters
    NameTypeDescription
    streamUrlNSString *The ingest URL.
    transcodingAliRtcLiveTranscodingParam *The parameters required for stream ingest.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • updatePublishLiveStreamWithURL: Updates bypass live streaming parameters.
    - (int)updatePublishLiveStreamWithURL:(NSString *_Nonnull)streamURL liveTranscoding:(AliRtcLiveTranscodingParam *_Nonnull)trancoding;
    Parameters
    NameTypeDescription
    streamUrlNSString *The ingest URL.
    transcodingAliRtcLiveTranscodingParam *The parameters required for stream ingest.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • stopPublishLiveStreamWithURL: Stops bypass live streaming.
    - (int)stopPublishLiveStreamWithURL:(NSString *_Nonnull)streamURL;
    Parameters
    NameTypeDescription
    streamUrlNSString *_NonnullThe ingest URL.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • startChannelRelay: Starts cross-channel co-hosting.
    - (int)startChannelRelay:(AliRtcChannelRelayConfiguration *_Nonnull)configuration;
    Parameters
    NameTypeDescription
    configurationAliRtcChannelRelayConfiguration *_NonnullThe configuration information.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • updateChannelRelay: Updates cross-channel co-hosting.
    - (int)updateChannelRelay:(AliRtcChannelRelayConfiguration *_Nonnull)configuration;
    Parameters
    NameTypeDescription
    configurationAliRtcChannelRelayConfiguration *_NonnullThe configuration information.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • stopChannelRelay: Stops cross-channel co-hosting.
    - (int)stopChannelRelay;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • startPreview: Starts the local preview. This method automatically turns on the camera.
    - (int)startPreview;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note If no view is set, the preview cannot be started. You can start the preview before you call joinChannel.
  • stopPreview: Stops the local preview.
    - (int)stopPreview;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note `leaveChannel` automatically stops the local preview and turns off the camera. If the camera stream is being published, the camera is not turned off.
  • getOnlineRemoteUsers: Retrieves the list of online remote users.
    - (NSArray<NSString *> *_Nullable)getOnlineRemoteUsers;
    Return value

    Returns a list of user IDs.

  • getUserInfo: Queries remote user information.
    - (NSDictionary *_Nullable)getUserInfo:(NSString *_Nonnull)uid;
    Parameters
    NameTypeDescription
    uidNSString *_NonnullThe ID of the target user to query.
    Return value

    Returns a dictionary. The keys are described as follows:

    KeyMeaning
    userIDThe ID of the remote user.
    displayNameThe name of the remote user.
    sessionIDThe session ID of the remote user.
    isOnlineWhether the remote user is online.
    isCameraMirrorWhether the remote user has enabled camera stream mirroring.
    isScreenMirrorWhether the remote user has enabled screen stream mirroring.
    muteAudioPlayingWhether the local user has muted this remote user.
    preferCameraMasterWhether the remote user has prioritized the high-quality stream.
    hasCameraViewWhether the local user has set a view for this remote user's camera stream.
    hasScreenViewWhether the local user has set a view for this remote user's screen stream.
    hasAudioWhether the remote user has published an audio stream.
    hasCameraMasterWhether the remote user has published a high-quality camera stream.
    hasCameraSlaveWhether the remote user has published a low-quality camera stream.
    hasScreenSharingWhether the remote user has published a screen stream.
    requestAudioWhether the local user has requested this remote user's audio stream.
    requestCameraMasterWhether the local user has requested this remote user's high-quality camera stream.
    requestCameraSlaveWhether the local user has requested this remote user's low-quality camera stream.
    requestScreenSharingWhether the local user has requested this remote user's screen stream.
    subScribedAudioWhether the local user has pulled this remote user's audio stream.
    subScribedCameraMasterWhether the local user has pulled this remote user's high-quality camera stream.
    subScribedCamearSlaveWhether the local user has pulled this remote user's low-quality camera stream.
    subScribedScreenSharingWhether the local user has pulled this remote user's screen stream.
  • isUserOnline: Queries whether a user is online.
    - (BOOL)isUserOnline:(NSString *_Nonnull)uid;
    Parameters
    NameTypeDescription
    uidNSString *_NonnullThe user ID. A unique identifier assigned by the app server.
    Return value

    `YES`: online. `NO`: offline.

  • getSdkVersion: Retrieves the SDK version number.
    + (NSString *_Nonnull)getSdkVersion;
    Return value

    Returns the SDK version number.

  • getErrorDescription: Retrieves the description of an error code.
    + (NSString *_Nullable)getErrorDescription:(NSInteger)errCode;
    Parameters
    NameTypeDescription
    errorCodeNSIntegerThe error code.
    Return value

    Returns the description string of the error code.

  • setClientRole: Sets the user role.
    - (int)setClientRole:(AliRtcClientRole)role;
    Parameters
    NameTypeDescription
    roleAliRtcClientRoleThe user role type. The default value is AliRtcClientRolelive (viewer role). This is effective only in non-communication modes.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • getCurrentClientRole: Retrieves the user role (iOS only).
    - (AliRtcClientRole)getCurrentClientRole;
    Return value

    Returns the current user role.

  • startLastmileDetect: Starts the network quality probe.
    - (int)startLastmileDetect;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note Call this method before you call joinChannel. The probe result is returned in the onLastmileDetectResultWithQuality callback.
  • stopLastmileDetect: Stops the network quality probe.
    - (int)stopLastmileDetect;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • postFeedbackWithUid: Provides SDK feedback.
    - (void)postFeedbackWithUid:(NSString *_Nullable)uid channleId:(NSString *_Nullable)channelId description:(NSString *_Nonnull)description type:(AliRtcFeedbackType)type timeStamp:(NSTimeInterval)timeStamp;
    Parameters
    NameTypeDescription
    uidNSString *_NullableThe current UID (can be empty).
    channelIdNSString *_NullableThe current channel ID (can be empty).
    descriptionNSString *_NullableThe problem description (supports Chinese and English, cannot be empty).
    typeAliRtcFeedbackTypeThe problem type.
    timeStampNSTimeIntervalThe timestamp when the problem occurred (Unix timestamp, can be an approximate time, does not need to be precise, can also be 0).
  • sendMediaExtensionMsg: Sends media extension messages.
    - (int)sendMediaExtensionMsg:(NSData *_Nonnull)data repeatCount:(int)repeatCount;
    Parameters
    NameTypeDescription
    dataNSData *_NonnullThe extension message.
    repeatCountintThe number of repetitions.
    Return value
    • 0: Success.
    • -1: No stream is being published.
    • -2: Invalid parameter.
    • -3: The message is sent too frequently. We recommend that you try again later.
  • startIntelligentDenoise: Starts intelligent noise reduction.
    - (int)startIntelligentDenoise;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note
    • This method can be used to enable the intelligent noise reduction feature during a call.
    • This feature is disabled by default. Enabling it may increase power consumption. Intelligent noise reduction is suitable for voice-centric scenarios, such as meetings and education, but not for scenarios with background music.
  • stopIntelligentDenoise: Stops intelligent noise reduction.
    - (void)stopIntelligentDenoise;
    Note This method can be used to disable the intelligent noise reduction feature during a call.
  • refreshAuthInfo: Refreshes the authentication information.
    - (int)refreshAuthInfo:(AliRtcAuthInfo *_Nonnull)authInfo;
    Parameters
    NameTypeDescription
    authInfoAliRtcAuthInfo *_NonnullThe authentication information.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • getCurrentConnectionStatus: Retrieves the current network connection status.
    - (AliRtcConnectionStatus)getCurrentConnectionStatus;
    Return value

    Returns the current network connection status. For more information about the status, see AliRtcConnectionStatus.

  • enableDelegateMainQueue: Specifies whether to dispatch callbacks to the main thread (iOS only).
    - (int)enableDelegateMainQueue:(BOOL)enable;
    Parameters
    NameTypeDescription
    enableBOOL`YES`: dispatches callbacks to the main thread queue. `NO`: does not dispatch callbacks to the main thread queue. The default value is `YES`.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • setDelegateQueue: Specifies the thread queue for callbacks (iOS only).
    - (int)setDelegateQueue:(NSOperationQueue *_Nullable)queue;
    Parameters
    NameTypeDescription
    queueNSOperationQueue *_NullableThe callback queue. The default is the main thread queue.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

    Note
    • If you call enableDelegateMainQueue:YES, this method setting is invalid, and callbacks are dispatched to the main thread.
    • If you call enableDelegateMainQueue:NO, you can use this method to specify the callback thread. If you do not set a thread, the SDK's default subthread is used.
  • startScreenShareWithDesktopId: Starts screen sharing based on the desktop ID (Mac only).
    - (int)startScreenShareWithDesktopId:(int)desktopId config:(AliRtcScreenShareConfig * _Nonnull)config;
    Parameters
    NameTypeDescription
    desktopIdintThe desktop ID, which can be obtained by calling the getScreenShareSourceInfoWithType method.
    configAliRtcScreenShareConfig * _NonnullThe screen sharing configuration.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • startScreenShareWithWindowId: Starts screen sharing based on the window ID (Mac only).
    - (int)startScreenShareWithWindowId:(int)windowId config:(AliRtcScreenShareConfig * _Nonnull)config;
    Parameters
    NameTypeDescription
    windowIdintThe window ID, which can be obtained by calling the getScreenShareSourceInfoWithType method.
    configAliRtcScreenShareConfig * _NonnullThe screen sharing configuration.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • getScreenShareSourceInfoWithType: Retrieves the screen sharing source information (Mac only).
    - (NSArray<AliRtcScreenSourceInfo *> * _Nullable)getScreenShareSourceInfoWithType:(AliRtcScreenShareType)type;
    Parameters
    NameTypeDescription
    typeAliRtcScreenShareTypeThe screen sharing type.
    Return value

    Returns a list of AliRtcScreenSourceInfo objects that contain the screen sharing source information.

  • updateScreenShareConfig: Updates the screen sharing configuration (Mac only).
    - (int)updateScreenShareConfig:(AliRtcScreenShareConfig * _Nonnull)config;
    Parameters
    NameTypeDescription
    configAliRtcScreenShareConfig * _NonnullThe screen sharing configuration.
    Return value

    Returns a list of screen sharing source information objects (AliRtcScreenSourceInfo).

  • setRecordingDeviceVolume: Sets the audio capture device volume (Mac only).
    - (int)setRecordingDeviceVolume:(NSInteger)volume;
    Parameters
    NameTypeDescription
    volumeNSIntegerThe volume range is [0, 100]. The default value is the current microphone volume.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • getRecordingDeviceVolume: Retrieves the audio capture device volume (Mac only).
    - (int)getRecordingDeviceVolume;
    Return value

    Returns the audio capture device volume. The value ranges from 0 to 100. A value of -1 indicates that the method call failed.

  • setPlayoutDeviceVolume: Sets the audio playback device volume (Mac only).
    - (int)setPlayoutDeviceVolume:(NSInteger)volume;
    Parameters
    NameTypeDescription
    volumeNSIntegerThe volume range is [0, 100]. The default value is the current speaker volume.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • getPlayoutDeviceVolume: Retrieves the audio playback device volume (Mac only).
    - (int)getPlayoutDeviceVolume;
    Return value

    Returns the audio playback device volume. The value ranges from 0 to 100. A value of -1 indicates that the method call failed.

  • setExternalAudioRenderVolume: Sets the playback volume of the external audio input (Mac only).
    - (int)setExternalAudioRenderVolume:(int)vol;
    Parameters
    NameTypeDescription
    volintThe volume range is [0, 100]. The default value is 50.
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • getExternalAudioRenderVolume: Retrieves the playback volume of the external audio input (Mac only).
    - (int)getExternalAudioRenderVolume;
    Return value

    Returns the audio playback volume. The value ranges from 0 to 100.

  • getAudioCaptures: Retrieves a list of the recording devices in the system (Mac only).
    - (NSArray<AliRtcDeviceInfo *> *_Nullable)getAudioCaptures;
  • getCurrentAudioCapture: Retrieves the name of the recording device in use (Mac only).
    - (NSString *_Nullable)getCurrentAudioCapture;
  • getCurrentAudioCaptureID: Retrieves the ID of the recording device in use (Mac only).
    - (NSString *_Nullable)getCurrentAudioCaptureID;
  • setCurrentAudioCapture: Sets the recording device by name (Mac only).
    - (void)setCurrentAudioCapture:(NSString *_Nonnull)capture;
    Parameters
    NameTypeDescription
    captureNSString *_NonnullThe name of the recording device to set.
  • setCurrentAudioCaptureWithID: Sets the recording device by ID (Mac only).
    - (void)setCurrentAudioCaptureWithID:(NSString *_Nonnull)captureID;
    Parameters
    NameTypeDescription
    captureIDNSString *_NonnullThe ID of the recording device to set.
  • getAudioRenderers: Retrieves a list of the speakers in the system (Mac only).
    - (NSArray<AliRtcDeviceInfo *> *_Nullable)getAudioRenderers;
  • getCurrentAudioRenderer: Retrieves the name of the speaker in use (Mac only).
    - (NSString *_Nullable)getCurrentAudioRenderer;
  • getCurrentAudioRendererID: Retrieves the ID of the speaker in use (Mac only).
    - (NSString *_Nullable)getCurrentAudioRendererID;
  • setCurrentAudioRenderer: Sets the speaker by name (Mac only).
    - (void)setCurrentAudioRenderer:(NSString *_Nonnull)renderer;
    Parameters
    NameTypeDescription
    rendererNSString *_NonnullThe name of the speaker device to set.
  • setCurrentAudioRendererWithID: Sets the speaker by ID (Mac only).
    - (void)setCurrentAudioRendererWithID:(NSString *_Nonnull)rendererID;
    Parameters
    NameTypeDescription
    rendererIDNSString *_NonnullThe ID of the speaker device to set.
  • getCameraList: Retrieves the camera list (Mac only).
    - (NSArray<AliRtcDeviceInfo *> *_Nullable)getCameraList;
  • getCurrentCamera: Retrieves the name of the camera in use (Mac only).
    - (NSString *_Nullable)getCurrentCamera;
  • getCurrentCameraID: Retrieves the ID of the camera in use (Mac only).
    - (NSString *_Nullable)getCurrentCameraID;
  • setCurrentCamera: Sets the camera by name (Mac only).
    - (void)setCurrentCamera:(NSString *_Nonnull)camera;
    Parameters
    NameTypeDescription
    cameraNSString *_NonnullThe name of the camera device to set.
  • setCurrentCameraWithID: Sets the camera by ID (Mac only).
    - (void)setCurrentCameraWithID:(NSString *_Nonnull)cameraID;
    Parameters
    NameTypeDescription
    cameraIDNSString *_NonnullThe ID of the camera device to set.
  • startTestAudioRecordWithName: Starts testing the audio capture device (Mac only).
    - (int)startTestAudioRecordWithName:(NSString *_Nonnull)deviceName;
    Parameters
    NameTypeDescription
    deviceNameNSString *_NonnullThe audio capture device name.
  • stopTestAudioRecord: Stops testing the audio capture device (Mac only).
    - (int)stopTestAudioRecord;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • startTestAudioPlayoutWithName: Starts testing the audio playback device (Mac only).
    - (int)startTestAudioPlayoutWithName:(NSString *_Nonnull)deviceName filePath:(NSString *_Nonnull)filePath loopCycles:(NSInteger)loopCycles;
    Parameters
    NameTypeDescription
    deviceNameNSString *_NonnullThe audio playback device name.
    filePathNSString *_NonnullThe audio file path.
    loopCyclesNSIntegerThe number of times to repeat playback. -1 means loop playback.
  • stopTestAudioPlayout: Stops testing the audio playback device (Mac only).
    - (int)stopTestAudioPlayout;
    Return value

    A value of 0 indicates that the method call is successful. Other values indicate that the call failed.

  • startRecord: Starts recording (Mac only).
    - (BOOL)startRecord:(NSString*_Nonnull)filePath recordLayout:(AliRtcRecordVideoLayout*_Nonnull)recordLayout;
    Parameters
    NameTypeDescription
    filePathNSString*_NonnullThe file path.
    recordLayoutAliRtcRecordVideoLayout*_NonnullThe video window layout settings.
    Return value

    `YES` indicates that the method call is successful. `NO` indicates that the call failed.

  • pauseRecord: Pauses recording (Mac only).
    - (BOOL)pauseRecord;
    Return value

    `YES` indicates that the method call is successful. `NO` indicates that the call failed.

  • resumeRecord: Resumes recording (Mac only).
    - (BOOL)resumeRecord;
    Return value

    `YES` indicates that the method call is successful. `NO` indicates that the call failed.

  • UpdateRecordLayout: Updates recording information (Mac only).
    - (BOOL)UpdateRecordLayout:(AliRtcRecordVideoLayout*_Nonnull)layout;
    Parameters
    NameTypeDescription
    layoutAliRtcRecordVideoLayout*_NonnullThe video window layout settings.
    Return value

    `YES` indicates that the method call is successful. `NO` indicates that the call failed.

  • addRecordTemplate: Adds a recording template (Mac only).
    - (BOOL)addRecordTemplate:(AliRtcRecordTemplate*_Nonnull)recordTemplate;
    Parameters
    NameTypeDescription
    recordTemplateAliRtcRecordTemplate*_NonnullThe recording template.
    Return value

    `YES` indicates that the method call is successful. `NO` indicates that the call failed.

  • getClientRole: Retrieves the user role (Mac only).
    - (AliRtcClientRole)getClientRole;
    Return value

    Returns the current user role.

  • showDebugView: Displays the dashboard.
    - (int)showDebugView:(UITextView * _Nonnull)view showType:(AliRtcShowDebugViewType)showType userId:(NSString * _Nullable)userId;
    Parameters
    ParameterTypeDescription
    viewUITextView *The view to display externally.
    showTypeAliRtcShowDebugViewTypeThe display type. Valid values:
    • 0 (default): Do not show.
    • 1: Audio.
    • 2: Video.
    • 3: Network.
    • 4: All.
    Note For non-public data, you can set a special value.
    userIdNSString *The corresponding user data.
    Return value

    A value of 0 indicates that the method call is successful. A non-zero value indicates that the call failed.

  • getVideoCaptureData: Retrieves captured video data.
    - (BOOL)getVideoCaptureData:(AliRtcVideoTrack)videoTrack videoSample:(AliRtcVideoDataSample**)p_sample;
    Parameters
    ParameterTypeDescription
    videoTrackAliRtcVideoTrackThe video stream type.
    p_sampleAliRtcVideoDataSample **The video sample.
    Return value

    `YES` indicates that the method call is successful. `NO` indicates that the call failed.

  • getVideoPreEncoderData: Retrieves pre-encoding video data.
    - (BOOL)getVideoPreEncoderData:(AliRtcVideoTrack)videoTrack videoSample:(AliRtcVideoDataSample**)p_sample;
    Parameters
    ParameterTypeDescription
    videoTrackAliRtcVideoTrackThe video stream type.
    p_sampleAliRtcVideoDataSample **The video sample.
    Return value

    `YES` indicates that the method call is successful. `NO` indicates that the call failed.

  • getVideoRenderData: Retrieves stream pulling data.
    - (BOOL)getVideoRenderData:(NSString*)uid videoTrack:(AliRtcVideoTrack)videoTrack videoSample:(AliRtcVideoDataSample**)p_sample;
    Parameters
    ParameterTypeDescription
    uidNSString *The remote user ID.
    videoTrackAliRtcVideoTrackThe video stream type.
    p_sampleAliRtcVideoDataSample **The video sample.
    Return value

    `YES` indicates that the method call is successful. `NO` indicates that the call failed.

  • GetPublishLiveStreamStateWithURL: Retrieves the bypass live streaming status.
    - (AliRtcLiveTranscodingState)GetPublishLiveStreamStateWithURL:(NSString *_Nonnull)streamURL;
    Parameters
    ParameterTypeDescription
    streamURL NSString * The ingest URL.
    Return value

    Returns the bypass live streaming status.

  • setRecordingDeviceMute: Mutes the audio capture device (Mac only).
    - (int)setRecordingDeviceMute:(BOOL)mute;
    Parameters
    ParameterTypeDescription
    mute BOOLSpecifies whether to mute the device. Valid values:
    • TRUE: Mutes the device.
    • FALSE: The device is unmuted.
    Return value

    A value of 0 indicates that the method call is successful. A non-zero value indicates that the call failed.

  • getRecordingDeviceMute: Retrieves the mute status of the audio capture device (Mac only).
    - (BOOL)getRecordingDeviceMute;
    Return value

    `YES` indicates that the method call is successful. `NO` indicates that the call failed.

  • setPlaybackDeviceMute: Mutes the audio playback device (Mac only).
    - (int)setPlaybackDeviceMute:(BOOL)mute;
    Parameters
    ParameterTypeDescription
    muteBOOLSpecifies whether to mute the device. Valid values:
    • TRUE: Mutes the device.
    • FALSE: The device is unmuted.
    Return value

    A value of 0 indicates that the method call is successful. A non-zero value indicates that the call failed.

  • getPlaybackDeviceMute: Retrieves the mute status of the audio playback device (Mac only).
    - (BOOL)getPlaybackDeviceMute;
    Return value

    `YES` indicates that the method call is successful. `NO` indicates that the call failed.

  • enableBackgroundExchange: Enables or disables the virtual background replacement feature (Mac only).
    - (int)enableBackgroundExchange:(BOOL)enable imagePath:(NSString *_Nonnull)path scalMode:(AliRtcBokehScaleModel)mode;
    Parameters
    ParameterTypeDescription
    enableBOOLSpecifies whether to enable the background replacement feature. Valid values:
    • YES: Enable.
    • NO: Disable.
    pathNSStringThe local image path. Supports JPG and PNG formats.
    modeAliRtcBokehScaleModelThe background image scaling mode. Valid values:
    • AliRtcBokehScaleModelCrop: Proportional clipping.
    • AliRtcBokehScaleModelFill: Fill with black bars.
    Return value

    A value of 0 indicates that the method call is successful. A non-zero value indicates that the call failed.

  • enableBackgroundBlur: Enables or disables the virtual background blur feature (Mac only).
    - (int)enableBackgroundBlur:(BOOL)enable blurDegree:(uint32_t)blurDegree;
    Parameters
    ParameterTypeDescription
    enableBOOLSpecifies whether to enable the background blur feature. Valid values:
    • YES: Enable.
    • NO: Disable.
    blurDegreeuint32_tThe degree of blur. The range is [0, 100].
    Return value

    A value of 0 indicates that the method call is successful. A non-zero value indicates that the call failed.