After reading this topic, you can learn more about the callback and listener interfaces of iOS SDK and Mac SDK.

Contents

API Description Supported earliest version
onJoinChannelResult Add channel result callback. 2.1
onLeaveChannelResult Leave the channel result callback. 2.1
onAudioPublishStateChanged Audio stream ingest change callback. 2.1
onVideoPublishStateChanged The callback for the video stream ingest change. 2.1
onDualStreamPublishStateChanged Secondary stream ingest stream change callback. 2.1
onScreenSharePublishStateChanged Screen sharing stream ingest change callback. 2.1
onScreenSharePublishStateChangedWithInfo Screen sharing stream ingest change callback (Mac only). 2.1
onRemoteUserOnLineNotify The callback when the remote user goes online. 2.1
onRemoteUserOffLineNotify The callback when the remote user goes offline. 2.1
onRemoteTrackAvailableNotify Callback when the flow of the remote user changes. 2.1
onAudioSubscribeStateChanged The callback for audio subscription changes. 2.1
onVideoSubscribeStateChanged The callback for the change of the camera stream subscription. 2.1
onScreenShareSubscribeStateChanged Callback for change of screen sharing stream subscription. 2.1
onSubscribeStreamTypeChanged The callback for the change of the size stream subscription. 2.1
onNetworkQualityChanged Callback when the network quality changes. 2.1
onConnectionStatusChange Callback for network connection status change. 2.1
onOccurWarning If a warning occurs in the engine, the App is notified by this callback. 2.1
onOccurError If an error occurs in the engine, the App is notified through this callback. 2.1
onFirstAudioPacketSentWithTimecost The first audio packet data is sent. 2.1
onFirstVideoPacketSentWithVideoTrack The first video packet data is sent. 2.1
onFirstAudioPacketReceivedWithUid The first audio packet data is received. 2.1
onFirstVideoPacketReceivedWithUid The first video packet data is received. 2.1
onFirstRemoteAudioDecodedWithUid The callback for the first frame of the decoded remote audio. 2.1
onFirstRemoteVideoFrameDrawn Callback when the first video frame of the remote user is displayed. 2.1
onFirstLocalVideoFrameDrawn The callback when the preview starts displaying the first frame of video. 2.1
onAudioSampleCallback The callback for the subscribed audio data. 2.1
onPlaybackAudioFrameBeforeMixing Callback for the specified user's audio data before mixing. 2.1
onAudioDeviceRecordLevel Audio capture device test callback (Mac only). 1.16.2
onAudioDevicePlayoutLevel Audio playback device test callback (Mac only). 1.16.2
onAudioDevicePlayoutEnd The audio playback device test ends (the audio file is played) (Mac only). 1.16.2
onAudioDeviceStateChanged Audio device status changes (Mac only). 2.1
onAudioVolumeCallback Callbacks for the audio volume, voice status, and UID of the subscription. 2.1
onActiveSpeaker The callback of the person currently speaking. 2.1
onGetVideoFormatPreference The callback for the video data output format. 2.1
onCaptureVideoSample The callback for the locally collected video data of the subscription. 2.1
onPreEncodeVideoSample The callback of the video data before the local encoding of the subscription. 2.1
onRemoteVideoSample The callback of the subscribed remote video data. 2.1
onUserAudioMuted User muteAudio notifications. 2.1
onUserVideoMuted User muteVideo notifications. 2.1
onUserVideoEnabled Disable or re-enable notifications for local video collection. 2.1
onUserAudioInterruptedBegin User audio is interrupted notification (in general, user calls and other audio preemption scenarios). 2.1
onUserAudioInterruptedEnded User audio interruption end notification (corresponding to the onUserAudioInterruptedBegin ). 2.1
onUserWillResignActive The callback for the remote user application to retreat to the background. 2.1
onUserWillBecomeActive The callback for the remote user application to return to the foreground. 2.1
onTextureCreate Subscribe to the local video Texture creation callback (iOS only). 2.1
onTextureUpdate Subscribe to local video Texture drawing callbacks (iOS only). 2.1
onTextureDestory Subscribe to the local video Texture destruction callback (iOS only). 2.1
onAudioPlayingStateChanged The callback for the playback status of the local accompaniment. 1.16.2
onRemoteAudioAccompanyStarted Remote user accompaniment playback start callback. 2.1
onRemoteAudioAccompanyFinished The callback for the end of playback of the remote user accompaniment. 2.1
onAudioEffectFinished The callback for the end of local sound playback. 2.1
onMediaRecordEvent The file recording callback event. 2.1
onRtcLocalVideoStats Local video statistics (triggered once in 2s). 2.1
onRtcRemoteVideoStats Remote video statistics (triggered once in 2s). 2.1
onRtcLocalAudioStats Local audio statistics (triggered once in 2s). 2.1
onRtcRemoteAudioStats Remote audio statistics (triggered once in 2s). 2.1
onMediaExtensionMsgReceived The callback for receiving the media extension information. 2.1
onDownlinkMessageNotify Downstream message channel (receiving messages) (iOS only). 2.1
onUplinkMessageResponse The result is returned after the upstream message is sent. 2.1
onAudioRouteChanged Callback for voice route changes (iOS only). 2.1
onSnapshotComplete Screenshot callback. 2.1
onPublishLiveStreamStateChanged Callback for bypass ingest status change. 2.4
onPublishTaskStateChanged The callback for the status change of the bypass task. 2.4
onChannelRelayStateChanged Cross-channel retweet status changes. 2.1
onChannelRelayEvent Cross-channel retweet event callback. 2.1
onGetVideoObservedFramePosition Video data output location. 2.1
onUpdateRoleNotifyWithOldRole Callback when the user role changes. 1.16
onConnectionLost The network disconnect callback. 1.14
onTryToReconnect Attempt network reconnection callback. 1.14
onConnectionRecovery Callback for successful network reconnection. 1.14
onBye Callback when the server is kicked out or the channel is closed. 1.1
onPerformanceLow The callback for insufficient performance of the current device. 1.16
onPerformanceRecovery The callback for performance recovery of the current device. 1.16
onLastmileDetectResultWithQuality The network quality probe callback. 1.16.2
onRtcStats Real-time data callback (triggered once in 2 seconds). 1.17
onGetIfUserFetchObserverData Specifies whether the video output data is obtained by the user. 2.4
onGetVideoAlignment The alignment of video data output. 2.4
onGetObserverDataMirrorApplied Indicates whether the video output data needs to be mirrored. 2.4
onGetSmoothRenderingEnabled Specifies whether to output the stream video data smoothly. 2.4
onRemoteVideoChanged Remote video stream change callback. 2.4

Details

  • onJoinChannelResult: Add channel result callback (this callback is equivalent to calling the block operation of the joinChannel interface, that is, to handle events after adding a channel, select one of them).
    - (void)onJoinChannelResult:(int)result channel:(NSString *_Nonnull)channel elapsed:(int) elapsed;
    Parameter Type Description
    result int The result of adding a channel. 0 is returned if it is successful and an error code is returned if it fails.
    channel NSString *_Nonnull The ID of the added channel.
    elapsed int The duration of joining the channel.
  • onLeaveChannelResult: Leave the channel result callback. This callback is returned after you call the leaveChannel operation. If you call the destroy directly after you call the leaveChannel operation, you will not receive this callback.
    - (void)onLeaveChannelResult:(int)result stats:(AliRtcStats)stats;
    Parameter Type Description
    result int If you leave the channel, 0 is returned for success and an error code is returned for failure.
    stats AliRtcStats Statistics summary of the sessions in this channel.
  • onAudioPublishStateChanged: audio stream ingest change callback.
    - (void)onAudioPublishStateChanged:(AliRtcPublishState)oldState newState:(AliRtcPublishState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState channel:(NSString *_Nonnull)channel;
    Parameter Type Description
    oldState AliRtcPublishState The previous stream ingest status.
    newState AliRtcPublishState The current stream ingest status.
    elapseSinceLastState NSInteger The interval at which the status changes. Unit: milliseconds.
    channel NSString *_Nonnull The ID of the current channel.
  • onVideoPublishStateChanged: the callback for video stream ingest change.
    - (void)onVideoPublishStateChanged:(AliRtcPublishState)oldState newState:(AliRtcPublishState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState channel:(NSString *_Nonnull)channel;
    Parameter Type Description
    oldState AliRtcPublishState The previous stream ingest status.
    newState AliRtcPublishState The current stream ingest status.
    elapseSinceLastState NSInteger The interval at which the status changes. Unit: milliseconds.
    channel NSString *_Nonnull The ID of the current channel.
  • onDualStreamPublishStateChanged: the callback for secondary stream ingest changes.
    - (void)onDualStreamPublishStateChanged:(AliRtcPublishState)oldState newState:(AliRtcPublishState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState channel:(NSString *_Nonnull)channel;
    Parameter Type Description
    oldState AliRtcPublishState The previous stream ingest status.
    newState AliRtcPublishState The current stream ingest status.
    elapseSinceLastState NSInteger The interval at which the status changes. Unit: milliseconds.
    channel NSString *_Nonnull The ID of the current channel.
  • onScreenSharePublishStateChanged: Screen sharing stream ingest change callback.
    - (void)onScreenSharePublishStateChanged:(AliRtcPublishState)oldState newState:(AliRtcPublishState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState channel:(NSString *_Nonnull)channel;
    Parameter Type Description
    oldState AliRtcPublishState The previous stream ingest status.
    newState AliRtcPublishState The current stream ingest status.
    elapseSinceLastState NSInteger The interval at which the status changes. Unit: milliseconds.
    channel NSString *_Nonnull The ID of the current channel.
  • onRemoteUserOnLineNotify: the callback when the remote user goes online.
    - (void)onRemoteUserOnLineNotify:(NSString *_Nonnull)uid elapsed:(int)elapsed;
    Parameter Type Description
    uid NSString *_Nonnull The unique identifier that the user ID is assigned from the App server.
    elapsed int The duration when the user joins the channel.
  • onRemoteUserOffLineNotify: the callback when the remote user goes offline.
    - (void)onRemoteUserOffLineNotify:(NSString *_Nonnull)uid offlineReason:(AliRtcUserOfflineReason)reason;
    Parameter Type Description
    uid NSString *_Nonnull The unique identifier that the user ID is assigned from the App server.
    reason AliRtcUserOfflineReason The reason why the user is offline.
  • onRemoteTrackAvailableNotify: callback when the flow of the remote user changes.
    - (void)onRemoteTrackAvailableNotify:(NSString *_Nonnull)uid audioTrack:(AliRtcAudioTrack)audioTrack videoTrack:(AliRtcVideoTrack)videoTrack;
    Parameter Type Description
    uid NSString *_Nonnull The unique identifier that the user ID is assigned from the App server.
    audioTrack AliRtcAudioTrack The audio stream after the remote user changes.
    videoTrack AliRtcVideoTrack The video stream after the remote user changes.
  • onAudioSubscribeStateChanged: the callback for audio subscription changes.
    - (void)onAudioSubscribeStateChanged:(NSString *_Nonnull)uid oldState:(AliRtcSubscribeState)oldState newState:(AliRtcSubscribeState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState channel:(NSString *_Nonnull)channel;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the user whose subscription status changes.
    oldState AliRtcSubscribeState The previous subscription status.
    newState AliRtcSubscribeState The current subscription status.
    elapseSinceLastState NSInteger The interval at which the status changes. Unit: milliseconds.
    channel NSString *_Nonnull The ID of the current channel.
  • onVideoSubscribeStateChanged: the callback for the change of the camera stream subscription.
    - (void)onVideoSubscribeStateChanged:(NSString *_Nonnull)uid oldState:(AliRtcSubscribeState)oldState newState:(AliRtcSubscribeState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState channel:(NSString *_Nonnull)channel;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the user whose subscription status changes.
    oldState AliRtcSubscribeState The previous subscription status.
    newState AliRtcSubscribeState The current subscription status.
    elapseSinceLastState NSInteger The interval at which the status changes. Unit: milliseconds.
    channel NSString *_Nonnull The ID of the current channel.
  • onScreenShareSubscribeStateChanged: Screen sharing stream subscription status change callback.
    - (void)onScreenShareSubscribeStateChanged:(NSString *_Nonnull)uid oldState:(AliRtcSubscribeState)oldState newState:(AliRtcSubscribeState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState channel:(NSString *_Nonnull)channel;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the user whose subscription status changes.
    oldState AliRtcSubscribeState The previous subscription status.
    newState AliRtcSubscribeState The current subscription status.
    elapseSinceLastState NSInteger The interval at which the status changes. Unit: milliseconds.
    channel NSString *_Nonnull The ID of the current channel.
  • onSubscribeStreamTypeChanged: the callback for the change of the size stream subscription.
    - (void)onSubscribeStreamTypeChanged:(NSString *_Nonnull)uid oldStreamType:(AliRtcVideoStreamType)oldStreamType newStreamType:(AliRtcVideoStreamType)newStreamType elapseSinceLastState:(NSInteger)elapseSinceLastState channel:(NSString *_Nonnull)channel;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the user whose subscription status changes.
    oldState AliRtcVideoStreamType The previous subscription status.
    newState AliRtcVideoStreamType The current subscription status.
    elapseSinceLastState NSInteger The interval at which the status changes. Unit: milliseconds.
    channel NSString *_Nonnull The ID of the current channel.
  • onNetworkQualityChanged: callback when the network quality changes.
    - (void)onNetworkQualityChanged:(NSString *_Nonnull)uidupNetworkQuality:(AliRtcNetworkQuality)upQualitydownNetworkQuality:(AliRtcNetworkQuality)downQuality;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the user whose network quality has changed. If the user ID is empty, it means local, and others means remote.
    upQuality AliRtcNetworkQuality Upstream network quality.
    downQuality AliRtcNetworkQuality The downstream network quality.
  • onConnectionStatusChange: the callback for the network connection status change.
    - (void)onConnectionStatusChange:(AliRtcConnectionStatus)status reason:(AliRtcConnectionStatusChangeReason)reason;
    Parameter Type Description
    status AliRtcConnectionStatus The current status value.
    reason AliRtcConnectionStatusChangeReason The specific cause of the change in state.
  • onOccurWarning: If a warning occurs in the engine, the App is notified by using this callback.
    - (void)onOccurWarning:(int)warn message:(NSString *_Nonnull)message;
    Parameter Type Description
    warn int The code of the warning.
    message NSString *_Nonnull The description of the warning.
  • onOccurError: If an error occurs in the engine, the app is notified by this callback.
    - (void)onOccurError:(int)errormessage:(NSString *_Nonnull)message;
    Parameter Type Description
    error int The error code returned.
    message NSString *_Nonnull The description of the error.
  • onFirstAudioPacketSentWithTimecost: The first audio packet data is sent.
    - (void)onFirstAudioPacketSentWithTimecost:(int)timeCost;
    Parameter Type Description
    timeCost int The time consumed to send.
  • onFirstVideoPacketSentWithVideoTrack: The first video packet data is sent.
    - (void)onFirstVideoPacketSentWithVideoTrack:(AliRtcVideoTrack)videoTracktimeCost:(int)timeCost;
    Parameter Type Description
    videoTrack AliRtcVideoTrack The type of the successfully sent video stream.
    timeCost int The time consumed to send.
  • onFirstAudioPacketReceivedWithUid: The first audio packet data is received.
    - (void)onFirstAudioPacketReceivedWithUid:(NSString *_Nonnull)uidtimeCost:(int)timeCost;
    Parameter Type Description
    uid NSString *_Nonnull Unique identifier assigned from the App server.
    timeCost int Acceptance duration.
  • onFirstVideoPacketReceivedWithUid: The first video packet data is received.
    - (void)onFirstVideoPacketReceivedWithUid:(NSString *_Nonnull)uidvideoTrack:(AliRtcVideoTrack)videoTracktimeCost:(int)timeCost;
    Parameter Type Description
    uid NSString *_Nonnull Unique identifier assigned from the App server.
    videoTrack AliRtcVideoTrack The type of the received video stream.
    timeCost int Acceptance duration.
  • onFirstRemoteAudioDecodedWithUid: The callback for the first frame of the decoded remote audio.
    - (void)onFirstRemoteAudioDecodedWithUid:(NSString *_Nonnull)uid elapsed:(int)elapsed;
    Parameter Type Description
    uid NSString *_Nonnull Unique identifier assigned from the App server.
    elapsed int The delay from when the local user joins the channel until this callback is triggered. Unit: milliseconds.
  • onFirstRemoteVideoFrameDrawn: the callback when the first video frame of the remote user is displayed.
    - (void)onFirstRemoteVideoFrameDrawn:(NSString *_Nonnull)uid videoTrack:(AliRtcVideoTrack)videoTrack width:(int)width height:(int)height elapsed:(int)elapsed;
    Parameter Type Description
    uid NSString *_Nonnull Unique identifier assigned from the App server.
    videoTrack AliRtcVideoTrack Screen Stream or Camera Stream.
    width int The width of the video.
    height int The height of the video.
    elapsed int The total duration.
  • onFirstLocalVideoFrameDrawn: The callback when the preview starts displaying the first frame of video.
    - (void)onFirstLocalVideoFrameDrawn:(int)width height:(int)height elapsed:(int)elapsed;
    Parameter Type Description
    width int The width of the video.
    height int The height of the video.
    elapsed int The total duration.
  • onAudioSampleCallback: the callback of the subscribed audio data.
    - (void)onAudioSampleCallback:(AliRtcAudioSource)audioSource audioSample:(AliRtcAudioDataSample *_Nonnull)audioSample;
    Parameter Type Description
    audioSource AliRtcAudioSource The type of the bare audio data source.
    audioSample AliRtcAudioDataSample *_Nonnull The bare audio data.
  • onPlaybackAudioFrameBeforeMixing: the callback for the audio data of the specified user before mixing.
    - (void)onPlaybackAudioFrameBeforeMixing:(NSString *_Nonnull)uid audioSample:(AliRtcAudioDataSample *_Nonnull)audioSample;
    Parameter Type Description
    uid NSString *_Nonnull Specifies the user ID before mixing.
    audioSample AliRtcAudioDataSample *_Nonnull The bare audio data.
  • onAudioVolumeCallback: the callback for the audio volume, voice status, and UID of the subscription.
    - (void)onAudioVolumeCallback:(NSArray <AliRtcUserVolumeInfo *> *_Nullable)array totalVolume:(int)totalVolume;
    Parameter Type Description
    array NSArray <AliRtcUserVolumeInfo *> *_Nullable Indicates the callback user volume information array, including the user UID, voice status, and volume. A UID of 0 indicates the local speaker.
    totalVolume int The total volume after mixing, in the range of [0,255]. In the callback of the local user, totalVolume is the volume after the local user mixes. In the callback of the remote user, totalVolume is the total volume after all speakers mixes.
  • onActiveSpeaker: The callback of the person who is currently speaking.
    - (void)onActiveSpeaker:(NSString *_Nonnull)uid;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the person who is currently speaking.
  • onGetVideoFormatPreference: the callback for the video data output format.
    - (AliRtcVideoFormat)onGetVideoFormatPreference;
    Return result

    Returns the expected output video data format. By default, AliRtcYUV420 is returned. You need to trigger a callback after the registerVideoSampleObserver is registered.

  • onCaptureVideoSample: the callback for subscribed locally collected video data.
    - (BOOL)onCaptureVideoSample:(AliRtcVideoSource)videoSource videoSample:(AliRtcVideoDataSample *_Nonnull)videoSample;
    Parameter Type Description
    videoSource AliRtcVideoSource The type of the bare video data source.
    videoSample AliRtcVideoDataSample *_Nonnull The bare video data.
    Return result

    If true is returned, the SDK needs to be written back (valid only for I420 and CVPixelBuffer). If false is returned, the SDK does not need to be written back.

  • onPreEncodeVideoSample: the callback of the pre-encoded video data of the subscription.
    - (BOOL)onPreEncodeVideoSample:(AliRtcVideoSource)videoSource videoSample:(AliRtcVideoDataSample *_Nonnull)videoSample;
    Parameter Type Description
    videoSource AliRtcVideoSource The type of the bare video data source.
    videoSample AliRtcVideoDataSample *_Nonnull The bare video data.
    Return result

    If true is returned, the SDK needs to be written back (valid only for I420 and CVPixelBuffer). If false is returned, the SDK does not need to be written back.

  • onRemoteVideoSample: the callback for subscribed remote video data.
    - (BOOL)onRemoteVideoSample:(NSString *_Nonnull)uid videoSource:(AliRtcVideoSource)videoSource videoSample:(AliRtcVideoDataSample *_Nonnull)videoSample;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the remote user who subscribed to the.
    videoSource AliRtcVideoSource The type of the bare video data source.
    videoSample AliRtcVideoDataSample *_Nonnull The bare video data.
    Return result

    If true is returned, the SDK needs to be written back (valid only for I420 and CVPixelBuffer). If false is returned, the SDK does not need to be written back.

  • onUserAudioMuted: user muteAudio notifications.
    - (void)onUserAudioMuted:(NSString *_Nonnull)uid audioMuted:(BOOL)isMute;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the user who executed muteAudio.
    isMute BOOL YES indicates mute, and NO indicates unmute.
  • onUserVideoMuted: user muteVideo notifications.
    - (void)onUserVideoMuted:(NSString *_Nonnull)uid videoMuted:(BOOL)isMute;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the user who executed the muteVideo.
    isMute BOOL YES indicates ingest black frames, and NO indicates normal ingest.
  • onUserVideoEnabled: Disable or re-enable notifications for local video collection.
    - (void)onUserVideoEnabled:(NSString *_Nullable)uid videoEnabled:(BOOL)isEnable;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the user who executed the EnableLocalVideo.
    isMute BOOL YES indicates that camera stream collection is turned on, and NO indicates that camera stream collection is turned off.
  • onUserAudioInterruptedBegin: user audio interruption notification (general user call and other audio preemption scenarios).
    - (void)onUserAudioInterruptedBegin:(NSString *_Nonnull)uid;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the user whose audio was interrupted.
  • onUserAudioInterruptedEnded: user audio interruption end notification (corresponding to the onUserAudioInterruptedBegin ).
    - (void)onUserAudioInterruptedEnded:(NSString *_Nonnull)uid;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the user whose audio interruption ended.
  • onUserWillResignActive: the callback for remote user applications to retreat to the background.
    - (void)onUserWillResignActive:(NSString *_Nonnull)uid;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the user whose application retreated to the background.
  • onUserWillBecomeActive: The callback that the remote user application returns to the foreground.
    - (void)onUserWillBecomeActive:(NSString *_Nonnull)uid;
    Parameter Type Description
    uid NSString *_Nonnull The application returns the user ID of the foreground.
  • onTextureCreate: Subscribe to local video Texture creation callback (iOS only).
    - (void)onTextureCreate:(void *_Nullable)context;
    Parameter Type Description
    context void *_Nullable Texture context.
  • onTextureUpdate: Subscribe to Local Video Texture Draw Callback (iOS only).
    - (int)onTextureUpdate:(int)textureId width:(int)width height:(int)height videoSample:(AliRtcVideoDataSample *_Nonnull)videoSample;
    Parameter Type Description
    textureId int The ID of the video texture.
    width int The width of the remote videos.
    height int The height of the remote videos.
    videoSample AliRtcVideoDataSample *_Nonnull The bare video data.
    Return result

    Returns the video texture ID.

  • onTextureDestory: Subscribe to Local Video Texture Destruction Callback (iOS only).
    - (void)onTextureDestory;
  • onAudioPlayingStateChanged: the callback for the playback status of the local accompaniment.
    - (void)onAudioPlayingStateChanged:(AliRtcAudioPlayingStateCode)playState errorCode:(AliRtcAudioPlayingErrorCode)errorCode;
    Parameter Type Description
    playState AliRtcAudioPlayingStateCode The current playback status.
    errorCode AliRtcAudioPlayingErrorCode The error code for playback.
  • onRemoteAudioAccompanyStarted: The remote user accompaniment playback start callback.
    - (void)onRemoteAudioAccompanyStarted:(NSString *_Nonnull)uid;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the remote user at which the accompaniment playback starts.
  • onRemoteAudioAccompanyFinished: the callback for the end of playback of the remote user accompaniment.
    - (void)onRemoteAudioAccompanyFinished:(NSString *_Nonnull)uid;
    Parameter Type Description
    uid NSString *_Nonnull The ID of the remote user whose accompaniment playback ends.
  • onAudioEffectFinished: the callback for the end of local sound playback.
    - (void)onAudioEffectFinished:(int)soundId;
    Parameter Type Description
    soundId int The ID of the sound effect that was played.
  • onMediaRecordEvent: file recording callback events.
    - (void)onMediaRecordEvent:(int)event filePath:(NSString *_Nullable)filePath;
    Parameter Type Description
    event int The recording event. Valid values:
    • 0: The recording starts.
    • 1: The recording ends.
    • 2: Failed to open the file.
    • 3: Failed to write the file.
    filePath NSString *_Nullable The path of the recording file.
  • onRtcLocalVideoStats: local video statistics (triggered once in 2s).
    - (void)onRtcLocalVideoStats:(AliRtcLocalVideoStats *_Nonnull)localVideoStats;
    Parameter Type Description
    localVideoStats AliRtcLocalVideoStats *_Nonnull The statistics on local videos.
  • onRtcRemoteVideoStats: remote video statistics (triggered once in 2s).
    - (void)onRtcRemoteVideoStats:(AliRtcRemoteVideoStats *_Nonnull)remoteVideoStats;
    Parameter Type Description
    remoteVideoStats AliRtcRemoteVideoStats *_Nonnull The statistics on remote videos.
  • onRtcLocalAudioStats: local audio statistics (triggered once in 2s).
    - (void)onRtcLocalAudioStats:(AliRtcLocalAudioStats *_Nonnull)localAudioStats;
    Parameter Type Description
    localAudioStats AliRtcLocalAudioStats *_Nonnull Local audio statistics (triggered once in 2s).
  • onRtcRemoteAudioStats: remote audio statistics (triggered once in 2s).
    - (void)onRtcRemoteAudioStats:(AliRtcRemoteAudioStats *_Nonnull)remoteAudioStats;
    Parameter Type Description
    remoteAudioStats AliRtcRemoteAudioStats *_Nonnull The statistics on remote audio.
  • onMediaExtensionMsgReceived: The callback for media extension information is received.
    - (void)onMediaExtensionMsgReceived:(NSString *_Nonnull)uid message:(NSData *_Nonnull)data;
    Parameter Type Description
    uid NSString *_Nonnull The UID of the remote user.
    data NSData *_Nonnull Media extension information.
  • onDownlinkMessageNotify: downstream message channel (receiving messages) (iOS only).
    - (void)onDownlinkMessageNotify:(AliRtcMessage *_Nonnull)messageInfo;
    Parameter Type Description
    messageInfo AliRtcMessage *_Nonnull The message information.
  • onUplinkMessageResponse: The result is returned after an upstream message is sent.
    - (void)onUplinkMessageResponse:(AliRtcMessageResponse *_Nonnull)resultInfo;
    Parameter Type Description
    resultInfo AliRtcMessageResponse *_Nonnull The message information.
  • onAudioRouteChanged: callback for voice route changes (iOS only).
    - (void)onAudioRouteChanged:(AliRtcAudioRouteType)routing;
    Parameter Type Description
    routing AliRtcAudioRouteType The voice route currently in use.
  • onSnapshotComplete: screenshot callback.
    - (void)onSnapshotComplete:(NSString*_Nullable)uid videoTrack:(AliRtcVideoTrack)videoTrack image:(UIImage* _Nullable)image success:(BOOL)success;
    Parameter Type Description
    uid NSString*_Nullable The UID of the remote user.
    videoTrack AliRtcVideoTrack The video stream type of the screenshot.
    image UIImage* _Nullable The image of the snapshot data itself.
    success BOOL Indicates whether the screenshot was successful.
  • onPublishLiveStreamStateChanged: callback for bypass ingest status change.
    - (void)onPublishLiveStreamStateChanged:(NSString *_Nonnull)streamURL state:(AliRtcLiveTranscodingState)state errCode:(AliRtcTrascodingLiveStreamErrorCode)errCode;
    Parameter Type Description
    streamURL NSString * The URL of the stream.
    state AliRtcLiveTranscodingState The status of the O&M events.
    errCode AliRtcTrascodingLiveStreamErrorCode The error code returned.
  • onPublishTaskStateChanged: callback for the status change of the bypass task.
    - (void)onPublishTaskStateChanged:(NSString *_Nonnull)streamURL state:(AliRtcTrascodingLiveTaskStatus)state;
    Parameter Type Description
    streamURL NSString * The URL of the stream.
    state AliRtcTrascodingLiveTaskStatus The status of the O&M events.
  • onChannelRelayStateChanged: Cross-channel retweet status changes.
    - (void)onChannelRelayStateChanged:(int)state code:(int)code message:(NSString *_Nullable)message;
    Parameter Type Description
    state int The current state of the state. For more information, see AliRtcChannelRelayState.
    code int The error code returned.
    message NSString *_Nullable The error message returned.
  • onChannelRelayEvent: callback for cross-channel retweet events.
    - (void)onChannelRelayEvent:(int)event;
    Parameter Type Description
    event int The event. For more information, see AliRtcChannelRelayState.
  • onGetVideoObservedFramePosition: the video data output location.
    - (NSInteger)onGetVideoObservedFramePosition;
    Return result

    Returns the desired video output position. For more information, see AliRtcVideoObserPosition.

    Note After the registerVideoSampleObserver is registered, a callback is triggered. The application can return the desired output video content. The corresponding data will be obtained from the onCaptureVideoSample, onPreEncodeVideoSample, and onRemoteVideoSample. By default, all types of AliRtcVideoObserPosition data, namely, AliRtcPositionPostCapture, AliRtcPositionPreRender, and AliRtcPositionPreEncoder, are returned.
  • onUpdateRoleNotifyWithOldRole: callback when the user role changes (this callback is triggered when the setClientRole method is called to switch the role successfully).
    - (void)onUpdateRoleNotifyWithOldRole:(AliRtcClientRole)oldRole newRole:(AliRtcClientRole)newRole;
    Parameter Type Description
    oldRole AliRtcClientRole The type of the role before the change.
    newRole AliRtcClientRole The role type after the change.
  • onConnectionLost: network disconnection callback. The Mac environment supports this callback since version 1.15.
    - (void)onConnectionLost;
  • onTryToReconnect: Attempt the network reconnection callback. The Mac environment supports this callback since version 1.15.
    - (void)onTryToReconnect;
  • onConnectionRecovery: The callback for successful network reconnection. The Mac environment supports this callback since version 1.15.
    - (void)onConnectionRecovery;
  • onBye: callback when the server is kicked out or the channel is closed.
    - (void)onBye:(int)code;
    Parameter Type Description
    code int The type of the message. Valid values:
    • 1: kicked out by the server.
    • 2: The channel is closed.
    • 3: The same user ID is logged on to another end and kicked out by the server.
  • onPerformanceLow: the callback for insufficient performance of the current device.
    - (void)onPerformanceLow;
  • onPerformanceRecovery: the callback for performance recovery of the current device.
    - (void)onPerformanceRecovery;
  • onLastmileDetectResultWithQuality: network quality detection callback.
    - (void)onLastmileDetectResultWithQuality:(AliRtcNetworkQuality)networkQuality;
    Parameter Type Description
    networkQuality AliRtcNetworkQuality Network quality.
  • onRtcStats: real-time data callback (triggered once in 2 seconds).
    - (void)onRtcStats:(AliRtcStats)stats;
    Parameter Type Description
    stats AliRtcStats Data callback.
  • onScreenSharePublishStateChangedWithInfo: Screen sharing stream change callback (Mac only).
    - (void)onScreenSharePublishStateChangedWithInfo:(AliRtcPublishState)oldState newState:(AliRtcPublishState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState channel:(NSString *_Nonnull)channel info:(AliRtcScreenShareInfo* _Nonnull)screenShareInfo;
    Parameter Type Description
    oldState AliRtcPublishState The previous stream ingest status.
    newState AliRtcPublishState The current stream ingest status.
    elapseSinceLastState NSInteger The interval at which the status changes. Unit: milliseconds.
    channel NSString *_Nonnull The ID of the current channel.
    screenShareInfo AliRtcScreenShareInfo* _Nonnull This screen shares streaming configuration information.
  • onAudioDeviceRecordLevel: Audio capture device test callback (Mac only).
    - (void)onAudioDeviceRecordLevel:(int)level;
    Parameter Type Description
    level int The audio collection device volume value.
  • onAudioDevicePlayoutLevel: Audio playback device test callback (Mac only).
    - (void)onAudioDevicePlayoutLevel:(int) level;
    Parameter Type Description
    level int The volume value of the audio playback device.
  • onAudioDevicePlayoutEnd: The audio playback device test ends (the audio file is played) (Mac only).
    - (void)onAudioDevicePlayoutEnd;
  • onAudioDeviceStateChanged: Audio device status changes (Mac only).
    - (void)onAudioDeviceStateChanged:(AliRtcDeviceInfo *_Nonnull)deviceInfo deviceType:(AliRtcExternalDeviceType)deviceType deviceState:(AliRtcExternalDeviceState)deviceState;
    Parameter Type Description
    deviceInfo AliRtcDeviceInfo *_Nonnull The information about the external device.
    deviceType AliRtcExternalDeviceType The type of the external device.
    deviceState AliRtcExternalDeviceState The status of the external device.
  • onGetIfUserFetchObserverData: whether the video output data is obtained by the user.
    - (BOOL)onGetIfUserFetchObserverData;
    Return result

    YES indicates that the video output data is obtained by the user. NO indicates that the video output data is obtained by the SDK callback. The default value is NO.

  • onGetVideoAlignment: the video data output alignment.
    - (AliRtcVideoObserAlignment)onGetVideoAlignment;
    Return result

    The data alignment type of the returned bare data callback. Default value: AliRtcAlignmentDefault.

  • onGetObserverDataMirrorApplied: whether the video output data needs to be mirrored.
    - (BOOL)onGetObserverDataMirrorApplied;
    Return result

    YES indicates that the video output data needs to be mirrored. NO indicates that the video output data does not need to be mirrored. Default value: NO.

  • onGetSmoothRenderingEnabled: indicates whether the pull-stream video data is output smoothly.
    - (BOOL)onGetSmoothRenderingEnabled;
    Return result

    YES indicates smooth output of pull-stream video data. NO indicates direct output of pull-stream video data. Default value: NO.

    Note If and only when the onGetIfUserFetchObserverData returns NO, the smooth output of the pull-stream video data takes effect.
  • onRemoteVideoChanged: remote video stream change callback.
    - (void)onRemoteVideoChanged:(NSString *_Nonnull)uid trackType:(AliRtcVideoTrack)trackType state:(AliRtcVideoState)state reason:(AliRtcVideoReason)reason;
    Parameter Type Description
    uId NSString * The ID of the user.
    trackType AliRtcVideoTrack The type of the video stream.
    state AliRtcVideoState The status of the video stream changes.
    reason AliRtcVideoReason The reason why the status of the video stream is changed.