channel.channel.
For process-level shared events (audio routing, network speed test, app performance), implement RTCEngineDelegate.
The same
userId may appear in multiple channels at once. When querying user data in a callback, use the channel instance passed as the first parameter (such as [channel findMemberWithUserId:userId]); don’t reuse indexes across channels.Connection callbacks
engineChannelOnReconnecting:()
- (void)engineChannelOnReconnecting:(RTCEngineChannel *)channel
Called when reconnection starts.
Triggered when the channel’s connection drops and reconnection begins. If an error occurs, the SDK fires the engineChannel:onDisconnected:errCode:errMsg:() callback.
Parameters
engineChannelOnReconnected:()
- (void)engineChannelOnReconnected:(RTCEngineChannel *)channel
Called when reconnection succeeds.
Triggered after the connection is restored.
Parameters
engineChannel:onDisconnected:errCode:errMsg:()
- (void)engineChannel:(RTCEngineChannel *)channel onDisconnected:(RTCLeaveReason)reason errCode:(RTCEngineError)errCode errMsg:(nullable NSString *)errMsg
Called when the connection drops or you leave the channel involuntarily.
When the reason is RTCLeaveReasonError, the SDK has hit an unrecoverable error, such as a failure to join the channel. You need to get a new token before joining the channel again. For error codes, see the error code table.
When the reason is anything other than RTCLeaveReasonError, you left the channel involuntarily. For the specific reasons, see RTCLeaveReason.
Parameters
Local user callbacks
engineChannel:onJoinSucceed:()
- (void)engineChannel:(RTCEngineChannel *)channel onJoinSucceed:(NSString *)userId
Called when joining the channel succeeds.
You receive this callback after calling the channel instance’s joinChannelWithToken:() to join the channel. If an error occurs, the SDK fires the engineChannel:onDisconnected:errCode:errMsg:() callback.
Parameters
engineChannel:onUserUpdate:()
- (void)engineChannel:(RTCEngineChannel *)channel onUserUpdate:(NSString *)userId
Called when the local user’s data is updated.
You receive this callback after the server modifies the current user’s data, notifying you that the current user’s data in this channel has changed.
Parameters
Channel callbacks
engineChannel:onChannelUpdate:()
- (void)engineChannel:(RTCEngineChannel *)channel onChannelUpdate:(NSString *)props
Called when the channel is updated.
You receive this callback after your app calls a server API to change the channel info.
Parameters
User callbacks
engineChannel:onRemoteUserJoinChannel:()
- (void)engineChannel:(RTCEngineChannel *)channel onRemoteUserJoinChannel:(NSString *)userId
Called when a user joins the channel, including the current user.
The engineChannel:onRemoteUserJoinChannel: and engineChannel:onRemoteUserLeaveChannel:reason: callbacks are only for maintaining the channel’s “user list”. Receiving them doesn’t mean there’s video. Use streamTracks in the user info to check whether the user is publishing and to get the track numbers.
Parameters
engineChannel:onRemoteUserUpdate:()
- (void)engineChannel:(RTCEngineChannel *)channel onRemoteUserUpdate:(NSString *)userId
Called when a user’s data in the current channel is updated.
Parameters
engineChannel:onRemoteUserLeaveChannel:reason:()
- (void)engineChannel:(RTCEngineChannel *)channel onRemoteUserLeaveChannel:(NSString *)userId reason:(RTCLeaveReason)reason
Called when a user leaves the channel, including the current user.
This callback is the counterpart of engineChannel:onRemoteUserJoinChannel:.
Parameters
engineChannel:onRemoteStreamTrackChange:streamTrackModel:changeType:()
- (void)engineChannel:(RTCEngineChannel *)channel onRemoteStreamTrackChange:(NSString *)userId streamTrackModel:(RTCEngineStreamTrackModel *)streamTrackModel changeType:(RTCChangeType)changeType
Called when a user’s stream track data in the current channel changes.
Parameters
Message callbacks
engineChannel:onCustomMessage:action:userId:sessionId:nickname:()
- (void)engineChannel:(RTCEngineChannel *)channel onCustomMessage:(NSString *)content action:(NSString *)action userId:(nullable NSString *)userId sessionId:(nullable NSString *)sessionId nickname:(nullable NSString *)nickname
Called when a custom message arrives.
When your app’s business features trigger an event through the server, the SDK notifies you through this callback.
Parameters
Audio callbacks
engineChannel:onAudioCapture:channels:stamp:dataSize:pcmData:()
- (void)engineChannel:(RTCEngineChannel *)channel onAudioCapture:(int)samplerate channels:(int)channels stamp:(unsigned int)stamp dataSize:(int)dataSize pcmData:(void *)pcmData
Called with captured audio data.
The SDK delivers the raw microphone PCM data through this callback after capturing it. You can use it for local recording, audio analysis, and similar scenarios.
Note: This callback fires on the audio capture thread. Don’t do time-consuming work in it, and don’t hold on to the pcmData pointer; copy the data yourself if you need to keep it.
Parameters
engineChannel:onAudioCaptureResampled:channels:stamp:resampledData:()
- (void)engineChannel:(RTCEngineChannel *)channel onAudioCaptureResampled:(int)samplerate channels:(int)channels stamp:(unsigned int)stamp resampledData:(NSData *)resampledData
Called with resampled captured audio data.
Unlike engineChannel:onAudioCapture:channels:stamp:dataSize:pcmData:(), the data has already been converted to the SDK’s internal sample rate and is delivered as NSData, so you don’t need to manage the memory yourself.
Note: This callback also fires on the audio capture thread. Don’t do time-consuming work in it.
Parameters
engineChannel:onRemoteMemberAudioStatus:()
- (void)engineChannel:(RTCEngineChannel *)channel onRemoteMemberAudioStatus:(NSArray<RTCStreamAudioModel *> *)audioArray
Called with remote users’ audio status.
Reports the audio status of users in the channel, including the audio decibel value, power, and more. You can use this callback to collect audio data for voice activation.
Parameters
engineChannel:onServiceEnabledSpeak:()
- (void)engineChannel:(RTCEngineChannel *)channel onServiceEnabledSpeak:(BOOL)enabled
Called when the service allows or disallows speaking.
Parameters
Media streaming callbacks
engineChannelOnStreamMediaDidConnectSucceed:()
- (void)engineChannelOnStreamMediaDidConnectSucceed:(RTCEngineChannel *)channel
Called when the media streaming connection succeeds.
The SDK notifies you through this method when the channel’s media streaming connects for the first time.
Parameters
engineChannel:onStreamChangedVendorName:()
- (void)engineChannel:(RTCEngineChannel *)channel onStreamChangedVendorName:(NSString *)vendorName
Called when the media streaming platform changes.
When the media streaming platform used by the current channel switches, the SDK uses this callback to tell you the name of the platform now in effect.
Parameters
engineChannel:onDownBitrateAdaptiveUserId:state:()
- (void)engineChannel:(RTCEngineChannel *)channel onDownBitrateAdaptiveUserId:(NSString *)userId state:(RTCDownBitrateAdaptiveState)state
Called with the downlink adaptive bitrate state.
Parameters
engineChannel:onUploadBitrateAdaptiveState:()
- (void)engineChannel:(RTCEngineChannel *)channel onUploadBitrateAdaptiveState:(RTCUploadBitrateAdaptiveState)state
Called with the uplink adaptive bitrate state.
Parameters
engineChannel:onDownLossLevelChangeState:()
- (void)engineChannel:(RTCEngineChannel *)channel onDownLossLevelChangeState:(RTCDownLossLevelState)state
Called when the downlink average packet loss level changes.
Parameters
engineChannel:onDownLossRateAverage:()
- (void)engineChannel:(RTCEngineChannel *)channel onDownLossRateAverage:(CGFloat)average
Called with the downlink average packet loss rate.
Parameters
engineChannel:onSendStreamModel:()
- (void)engineChannel:(RTCEngineChannel *)channel onSendStreamModel:(RTCStreamSendModel *)sendModel
Called with media streaming send status data.
You receive this callback at a fixed interval. It describes the current send status, such as latency and packet loss rate.
Parameters
engineChannel:onReceiveStreamModel:()
- (void)engineChannel:(RTCEngineChannel *)channel onReceiveStreamModel:(NSArray <RTCStreamReceiveModel *> *)receiveArray
Called with media streaming receive status data.
You receive this callback at a fixed interval. It describes the current receive status, such as latency and packet loss rate.
Parameters
engineChannel:onSendQualitySample:()
- (void)engineChannel:(RTCEngineChannel *)channel onSendQualitySample:(RTCStreamQualitySampleModel *)sample
Called with a server-side uplink quality sample.
Available since SeaStart SFU 26.4. The server delivers it over the Signal DataChannel. It includes server-only metrics such as score, level, and mos, and complements the local engineChannel:onSendStreamModel:.
Parameters
engineChannel:onReceiveQualitySample:()
- (void)engineChannel:(RTCEngineChannel *)channel onReceiveQualitySample:(RTCStreamQualitySampleModel *)sample
Called with a server-side downlink quality sample.
Available since SeaStart SFU 26.4. The server delivers it over the Signal DataChannel as an aggregate sample for the whole downlink, complementing the per-stream view of engineChannel:onReceiveStreamModel:.
Parameters
engineChannel:onReceiveStreamStatusChange:trackId:status:()
- (void)engineChannel:(RTCEngineChannel *)channel onReceiveStreamStatusChange:(NSString *)userId trackId:(RTCTrackIdentifierFlags)trackId status:(BOOL)status
Called when the receive status of a remote stream changes.
After you subscribe to a user’s remote video stream, you receive this callback if no video from that user arrives for a while. You also receive it when the video stream recovers.
Parameters
engineChannel:onReceiveRetweetStreamStatusChange:status:()
- (void)engineChannel:(RTCEngineChannel *)channel onReceiveRetweetStreamStatusChange:(NSString *)streamName status:(BOOL)status
Called when the receive status of a re-streamed stream changes.
After you subscribe to a remote re-streamed stream, you receive this callback if no video from it arrives for a while. Re-streamed streams aren’t reported as remote user video data; their receive status is reported separately through this callback.
Parameters
Screen sharing callbacks
engineChannel:onScreenRecordStatus:()
- (void)engineChannel:(RTCEngineChannel *)channel onScreenRecordStatus:(RTCScreenRecordStatus)status
Called with the screen sharing status.
After you call the channel instance’s publishScreenRecord:() to start screen sharing, the SDK uses this callback to notify the host app of the current screen sharing status.
Parameters