AgoraRtcChannelDelegate Protocol Reference

Conforms to NSObject
Declared in AgoraRtcChannel.h

Overview

The AgoraRtcChannelDelegate class.

Since v3.0.0.

– rtcChannel:didOccurWarning:

Reports a warning during SDK runtime.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didOccurWarning:(AgoraWarningCode)warningCode

Parameters

rtcChannel

AgoraRtcChannel

warningCode

Warning code: AgoraWarningCode

Discussion

In most cases, the app can ignore the warning reported by the SDK because the SDK can usually fix the issue and resume running.

For instance, the SDK may report an AgoraWarningCodeOpenChannelTimeout(106) warning upon disconnection from the server and attempts to reconnect.

See AgoraWarningCode.

Declared In

AgoraRtcChannel.h

– rtcChannel:didOccurError:

Reports an error during SDK runtime.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didOccurError:(AgoraErrorCode)errorCode

Parameters

rtcChannel

AgoraRtcChannel

errorCode

Error code: AgoraErrorCode

Discussion

In most cases, the SDK cannot fix the issue and resume running. The SDK requires the app to take action or informs the user about the issue.

For example, the SDK reports an AgoraErrorCodeStartCall = 1002 error when failing to initialize a call. The app informs the user that the call initialization failed and invokes the leaveChannel method to leave the channel.

See AgoraErrorCode.

Declared In

AgoraRtcChannel.h

– rtcChannelDidJoinChannel:withUid:elapsed:

Occurs when the local user joins a specified channel.

- (void)rtcChannelDidJoinChannel:(AgoraRtcChannel *_Nonnull)rtcChannel withUid:(NSUInteger)uid elapsed:(NSInteger)elapsed

Parameters

rtcChannel

AgoraRtcChannel

uid

User ID. If the uid is specified in the joinChannelByToken method, the specified user ID is returned. If the user ID is not specified when the joinChannelByToken method is called, the server automatically assigns a uid.

elapsed

Time elapsed (ms) from the user calling the joinChannelByToken method until the SDK triggers this callback.

Declared In

AgoraRtcChannel.h

– rtcChannelDidRejoinChannel:withUid:elapsed:

Occurs when the local user rejoins a channel.

- (void)rtcChannelDidRejoinChannel:(AgoraRtcChannel *_Nonnull)rtcChannel withUid:(NSUInteger)uid elapsed:(NSInteger)elapsed

Parameters

rtcChannel

AgoraRtcChannel

uid

User ID. If the uid is specified in the joinChannelByToken method, the specified user ID is returned. If the user ID is not specified when the joinChannelByToken method is called, the server automatically assigns a uid.

elapsed

Time elapsed (ms) from the user calling joinChannelByToken until the SDK triggers this callback.

Discussion

If the client loses connection with the server because of network problems, the SDK automatically attempts to reconnect and then triggers this callback upon reconnection, indicating that the user rejoins the channel with the assigned channel ID and user ID.

Declared In

AgoraRtcChannel.h

– rtcChannelDidLeaveChannel:withStats:

Occurs when the local user leaves a channel.

- (void)rtcChannelDidLeaveChannel:(AgoraRtcChannel *_Nonnull)rtcChannel withStats:(AgoraChannelStats *_Nonnull)stats

Parameters

rtcChannel

AgoraRtcChannel

stats

Statistics of the call: AgoraChannelStats.

Discussion

When the app calls the leaveChannel method, this callback notifies the app that a user leaves a channel.

With this callback, the app gets information, such as the call duration and the statistics.

Declared In

AgoraRtcChannel.h

– rtcChannel:didClientRoleChangeFailed:currentRole:

Occurs when the user role switch fails in the interactive live streaming.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didClientRoleChangeFailed:(AgoraClientRoleChangeFailedReason)reason currentRole:(AgoraClientRole)currentRole

Parameters

rtcChannel

AgoraRtcChannel

reason

The reason for the user role switch failure. See AgoraClientRoleChangeFailedReason.

currentRole

The current user role. See AgoraClientRole.

Availability

v3.7.0

In the LiveBroadcasting channel profile, when the local user calls setClientRole to switch their user role after joining the channel but the switch fails, the SDK triggers this callback to report the reason for the failure and the current user role.

Declared In

AgoraRtcChannel.h

– rtcChannel:didClientRoleChanged:newRole:

Occurs when the user role switches successfully in the interactive live streaming.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didClientRoleChanged:(AgoraClientRole)oldRole newRole:(AgoraClientRole)newRole

Parameters

rtcChannel

AgoraRtcChannel

oldRole

Role that the user switches from: AgoraClientRole.

newRole

Role that the user switches to: AgoraClientRole.

Discussion

In the LiveBroadcasting channel profile, when the local user successfully calls setClientRole to switch their user role after joining the channel, for example, from a host to an audience member or vice versa, the SDK triggers this callback to report the user role before and after the switch.

Declared In

AgoraRtcChannel.h

– rtcChannel:didJoinedOfUid:elapsed:

Occurs when a remote user or host joins a channel.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didJoinedOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed

Parameters

rtcChannel

AgoraRtcChannel

uid

ID of the user or host who joins the channel. If the uid is specified in the joinChannelByToken method, the specified user ID is returned. If the uid is not specified in the joinChannelByToken method, the Agora server automatically assigns a uid.

elapsed

Time elapsed (ms) from the local user calling the joinChannelByToken method until the SDK triggers this callback.

Discussion

  • Communication profile: This callback notifies the app that another user joins the channel. If other users are already in the channel, the SDK also reports to the app on the existing users.
  • Interactive live streaming profile: This callback notifies the app that a host joins the channel. If other hosts are already in the channel, the SDK also reports to the app on the existing hosts. Agora recommends limiting the number of hosts to 17.

The SDK triggers this callback under one of the following circumstances: - A remote user/host joins the channel by calling the joinChannelByToken method. - A remote user switches the user role to the host by calling the setClientRole method after joining the channel. - A remote user/host rejoins the channel after a network interruption.

Note

Interactive live streaming profile:

  • The host receives this callback when another host joins the channel.
  • The audience in the channel receives this callback when a new host joins the channel.
  • When a web application joins the channel, the SDK triggers this callback as long as the web application publishes streams.

Declared In

AgoraRtcChannel.h

– rtcChannel:didOfflineOfUid:reason:

Occurs when a remote user (Communication)/host (Live Broadcast) leaves a channel.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didOfflineOfUid:(NSUInteger)uid reason:(AgoraUserOfflineReason)reason

Parameters

rtcChannel

AgoraRtcChannel

uid

ID of the user or host who leaves a channel or goes offline.

reason

Reason why the user goes offline, see AgoraUserOfflineReason.

Discussion

There are two reasons for users to be offline:

  • Leave a channel: When the user/host leaves a channel, the user/host sends a goodbye message. When the message is received, the SDK assumes that the user/host leaves a channel.
  • Drop offline: When no data packet of the user or host is received for a certain period of time (20 seconds for the Communication profile, and more for the interactive live streaming profile), the SDK assumes that the user/host drops offline. Unreliable network connections may lead to false detections, so Agora recommends using the Agora RTM SDK for more reliable offline detection.

Declared In

AgoraRtcChannel.h

– rtcChannel:connectionChangedToState:reason:

Occurs when the network connection state changes.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel connectionChangedToState:(AgoraConnectionStateType)state reason:(AgoraConnectionChangedReason)reason

Parameters

rtcChannel

AgoraRtcChannel

state

The current network connection state, see AgoraConnectionStateType.

reason

The reason of the connection state change, see AgoraConnectionChangedReason.

Discussion

The SDK triggers this callback to report on the current network connection state when it changes, and the reason of the change.

Declared In

AgoraRtcChannel.h

– rtcChannel:didProxyConnected:proxyType:localProxyIp:elapsed:

Reports the proxy connection state.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didProxyConnected:(NSUInteger)uid proxyType:(AgoraProxyType)proxyType localProxyIp:(NSString *_Nonnull)localProxyIp elapsed:(NSInteger)elapsed

Parameters

rtcChannel

AgoraRtcChannel

uid

The user ID.

proxyType

The proxy type connected. See AgoraProxyType.

localProxyIp

Reserved for future use.

elapsed

The time elapsed (ms) from the user calling joinChannel until this callback is triggered.

Availability

v3.6.2

You can use this callback to listen for the state of the SDK connecting to a proxy. For example, when a user calls setCloudProxy and joins a channel successfully, the SDK triggers this callback to report the user ID, the proxy type connected, and the time elapsed from the user calling joinChannelByToken until this callback is triggered.

Declared In

AgoraRtcChannel.h

– rtcChannelDidLost:

Occurs when the SDK cannot reconnect to Agora’s edge server 10 seconds after its connection to the server is interrupted.

- (void)rtcChannelDidLost:(AgoraRtcChannel *_Nonnull)rtcChannel

Parameters

rtcChannel

AgoraRtcChannel

Discussion

The SDK triggers this callback when it cannot connect to the server 10 seconds after calling the joinChannelByToken method, regardless of whether it is in the channel or not.

If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora’s edge server, the SDK stops rejoining the channel.

Declared In

AgoraRtcChannel.h

– rtcChannel:tokenPrivilegeWillExpire:

Occurs when the token expires in 30 seconds.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel tokenPrivilegeWillExpire:(NSString *_Nonnull)token

Parameters

rtcChannel

AgoraRtcChannel

token

The token that expires in 30 seconds.

Discussion

The user becomes offline if the token used in the joinChannelByToken method expires. The SDK triggers this callback 30 seconds before the token expires to remind the app to get a new token. Upon receiving this callback, generate a new token on the server and call the renewToken method to pass the new token to the SDK.

Declared In

AgoraRtcChannel.h

– rtcChannelRequestToken:

Occurs when the token expires.

- (void)rtcChannelRequestToken:(AgoraRtcChannel *_Nonnull)rtcChannel

Parameters

rtcChannel

AgoraRtcChannel

Discussion

After a token is specified by calling the joinChannelByToken method, if the SDK losses connection to the Agora server due to network issues, the token may expire after a certain period of time and a new token may be required to reconnect to the server.

Once you receive this callback, generate a new token on your app server, and call renewToken to pass the new token to the SDK.

Declared In

AgoraRtcChannel.h

– rtcChannel:activeSpeaker:

Occurs when the most active remote speaker is detected.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel activeSpeaker:(NSUInteger)speakerUid

Parameters

rtcChannel

AgoraRtcChannel

speakerUid

The user ID of the most active remote speaker.

Discussion

After a successful call of enableAudioVolumeIndication, the SDK continuously detects which remote user has the loudest volume. During the current period, the remote user, who is detected as the loudest for the most times, is the most active user.

When the number of users is more than or equal to two and an active speaker exists, the SDK triggers this callback and reports the uid of the most active speaker.

  • If the most active speaker is always the same user, the SDK triggers this callback only once.
  • If the most active speaker changes to another user, the SDK triggers this callback again and reports the uid of the new active speaker.

Declared In

AgoraRtcChannel.h

– rtcChannel:videoSizeChangedOfUid:size:rotation:

Occurs when the video size or rotation of a specific remote user changes.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel videoSizeChangedOfUid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation

Parameters

rtcChannel

AgoraRtcChannel

uid

User ID of the remote user or local user (0) whose video size or rotation changes.

size

New video size.

rotation

New rotation of the video. The value ranges between 0 and 360.

Declared In

AgoraRtcChannel.h

– rtcChannel:remoteVideoStateChangedOfUid:state:reason:elapsed:

Occurs when the remote video state changes.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel remoteVideoStateChangedOfUid:(NSUInteger)uid state:(AgoraVideoRemoteState)state reason:(AgoraVideoRemoteStateReason)reason elapsed:(NSInteger)elapsed

Parameters

rtcChannel

AgoraRtcChannel

uid

ID of the remote user whose video state changes.

state

The state of the remote video. See AgoraVideoRemoteState.

reason

The reason of the remote video state change. See AgoraVideoRemoteStateReason.

elapsed

The time elapsed (ms) from the local user calling the joinChannelByToken method until the SDK triggers this callback.

Declared In

AgoraRtcChannel.h

– rtcChannel:superResolutionEnabledOfUid:enabled:reason:

Reports whether the super resolution feature is successfully enabled. (beta feature)

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel superResolutionEnabledOfUid:(NSUInteger)uid enabled:(BOOL)enabled reason:(AgoraSuperResolutionStateReason)reason

Parameters

rtcChannel

AgoraRtcChannel

uid

The user ID of the remote user.

enabled

Whether super resolution is successfully enabled:

  • YES: Super resolution is successfully enabled.
  • NO: Super resolution is not successfully enabled.
reason

The reason why super resolution is not successfully enabled or the message that confirms success. See AgoraSuperResolutionStateReason.

Availability

v3.5.1

After calling enableRemoteSuperResolution, the SDK triggers this callback to report whether super resolution is successfully enabled. If it is not successfully enabled, use reason for troubleshooting.

Declared In

AgoraRtcChannel.h

– rtcChannel:remoteAudioStateChangedOfUid:state:reason:elapsed:

Occurs when the local audio state changes.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel remoteAudioStateChangedOfUid:(NSUInteger)uid state:(AgoraAudioRemoteState)state reason:(AgoraAudioRemoteStateReason)reason elapsed:(NSInteger)elapsed

Parameters

rtcChannel

AgoraRtcChannel

uid

ID of the remote user whose audio state changes.

state

State of the remote audio. See AgoraAudioRemoteState.

reason

The reason of the remote audio state change. See AgoraAudioRemoteStateReason.

elapsed

Time elapsed (ms) from the local user calling the joinChannelByToken method until the SDK triggers this callback.

Discussion

This callback indicates the state change of the local audio stream, including the state of the audio sampling and encoding, and allows you to troubleshoot issues when exceptions occur.

Declared In

AgoraRtcChannel.h

– rtcChannel:didLocalPublishFallbackToAudioOnly:

Occurs when the published video stream falls back to an audio-only stream due to unreliable network conditions or switches back to the video when the network conditions improve.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didLocalPublishFallbackToAudioOnly:(BOOL)isFallbackOrRecover

Parameters

rtcChannel

AgoraRtcChannel

isFallbackOrRecover

Whether the published stream falls back to audio-only or switches back to the video:

  • YES: The published stream falls back to audio-only due to unreliable network conditions.
  • NO: The published stream switches back to the video after the network conditions improve.

Discussion

If you call the setLocalPublishFallbackOption method and set option as AgoraStreamFallbackOptionAudioOnly, the SDK triggers this callback when the published stream falls back to audio-only mode due to unreliable uplink conditions, or when the audio stream switches back to the video when the uplink network condition improves.

Note

Once the published stream falls back to audio only, the remote app receives the userMuteVideoBlock callback.

Declared In

AgoraRtcChannel.h

– rtcChannel:didRemoteSubscribeFallbackToAudioOnly:byUid:

Occurs when the remote video stream falls back to an audio-only stream due to unreliable network conditions or switches back to the video after the network conditions improve.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didRemoteSubscribeFallbackToAudioOnly:(BOOL)isFallbackOrRecover byUid:(NSUInteger)uid

Parameters

rtcChannel

AgoraRtcChannel

isFallbackOrRecover

Whether the remote media stream falls back to audio-only or switches back to the video:

  • YES: The remote media stream falls back to audio-only due to unreliable network conditions.
  • NO: The remote media stream switches back to the video stream after the network conditions improve.
uid

ID of the remote user sending the stream.

Discussion

If you call setRemoteSubscribeFallbackOption and set option as AgoraStreamFallbackOptionAudioOnly, the SDK triggers this callback when the remote media stream falls back to audio only due to poor downlink conditions or switches back to the video after the downlink network condition improves.

Note:

Once the remote media stream is switched to the low stream due to unreliable network conditions, you can monitor the stream switch between a high stream and low stream in the remoteVideoStats callback.

Declared In

AgoraRtcChannel.h

– rtcChannel:reportRtcStats:

Reports the statistics of the current call. The SDK triggers this callback once every two seconds after the user joins the channel.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel reportRtcStats:(AgoraChannelStats *_Nonnull)stats

Parameters

rtcChannel

AgoraRtcChannel

stats

Statistics of the AgoraRtcEngineKit: AgoraChannelStats.

Declared In

AgoraRtcChannel.h

– rtcChannel:networkQuality:txQuality:rxQuality:

Reports the last mile network quality of each user in the channel once every two seconds.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel networkQuality:(NSUInteger)uid txQuality:(AgoraNetworkQuality)txQuality rxQuality:(AgoraNetworkQuality)rxQuality

Parameters

rtcChannel

AgoraRtcChannel

uid

User ID. The network quality of the user with this uid is reported. If uid is 0, the local network quality is reported.

txQuality

Uplink transmission quality of the user in terms of the transmission bitrate, packet loss rate, average RTT (Round-Trip Time), and jitter of the uplink network. txQuality is a quality rating helping you understand how well the current uplink network conditions can support the selected AgoraVideoEncoderConfiguration. For example, a 1000-Kbps uplink network may be adequate for video frames with a resolution of 640 * 480 and a frame rate of 15 fps in the interactive live streaming profile, but may be inadequate for resolutions higher than 1280 * 720. See AgoraNetworkQuality.

rxQuality

Downlink network quality rating of the user in terms of packet loss rate, average RTT, and jitter of the downlink network. See AgoraNetworkQuality.

Discussion

Last mile refers to the connection between the local device and Agora’s edge server. The SDK triggers this callback once every two seconds to report the last mile network conditions of each user in the channel. If a channel includes multiple users, the SDK triggers this callback as many times.

Note: txQuality is Unknown when the user is not sending a stream; rxQuality is Unknown when the user is not receiving a stream.

Declared In

AgoraRtcChannel.h

– rtcChannel:remoteVideoStats:

Reports the statistics of the video stream from each remote user/host.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel remoteVideoStats:(AgoraRtcRemoteVideoStats *_Nonnull)stats

Parameters

rtcChannel

AgoraRtcChannel

stats

Statistics of the received remote video streams. See AgoraRtcRemoteVideoStats.

Discussion

The SDK triggers this callback once every two seconds for each remote user/host. If a channel includes multiple remote users, the SDK triggers this callback as many times.

This callback reports the statistics more closely linked to the real-user experience of the video transmission quality than the statistics that the videoTransportStatsOfUid callback reports. This callback reports more about media layer statistics such as the frame loss rate, while the videoTransportStatsOfUid callback reports more about the transport layer statistics such as the packet loss rate.

Schemes such as FEC (Forward Error Correction) or retransmission counter the frame loss rate. Hence, users may find the overall video quality acceptable even when the packet loss rate is high.

Declared In

AgoraRtcChannel.h

– rtcChannel:remoteAudioStats:

Reports the statistics of the audio stream from each remote user/host.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel remoteAudioStats:(AgoraRtcRemoteAudioStats *_Nonnull)stats

Parameters

rtcChannel

AgoraRtcChannel

stats

Statistics of the received remote audio streams. See AgoraRtcRemoteAudioStats.

Discussion

The SDK triggers this callback once every two seconds for each remote user/host. If a channel includes multiple remote users, the SDK triggers this callback as many times.

This callback reports the statistics more closely linked to the real-user experience of the audio transmission quality than the statistics that the audioTransportStatsOfUid callback reports. This callback reports more about media layer statistics such as the frame loss rate, while the audioTransportStatsOfUid callback reports more about the transport layer statistics such as the packet loss rate.

Schemes such as FEC (Forward Error Correction) or retransmission counter the frame loss rate. Hence, users may find the overall audio quality acceptable even when the packet loss rate is high.

Declared In

AgoraRtcChannel.h

– rtcChannel:rtmpStreamingChangedToState:state:errorCode:

Occurs when the state of the RTMP or RTMPS streaming changes.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel rtmpStreamingChangedToState:(NSString *_Nonnull)url state:(AgoraRtmpStreamingState)state errorCode:(AgoraRtmpStreamingErrorCode)errorCode

Parameters

rtcChannel

AgoraRtcChannel

url

The CDN streaming URL.

state

The RTMP or RTMPS streaming state: AgoraRtmpStreamingState.

errorCode

The detailed error information for streaming: AgoraRtmpStreamingErrorCode.

Discussion

When the CDN live streaming state changes, the SDK triggers this callback to report the current state and the reason why the state has changed.

This callback indicates the state of the RTMP or RTMPS streaming. When exceptions occur, you can troubleshoot issues by referring to the detailed error descriptions in the errorCode parameter.

Declared In

AgoraRtcChannel.h

– rtcChannel:rtmpStreamingEventWithUrl:eventCode:

Reports events during the RTMP or RTMPS streaming.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel rtmpStreamingEventWithUrl:(NSString *_Nonnull)url eventCode:(AgoraRtmpStreamingEvent)eventCode

Parameters

rtcChannel

AgoraRtcChannel

url

The RTMP or RTMPS streaming URL.

eventCode

The event code. See AgoraRtmpStreamingEvent.

Availability

v3.1.0

Declared In

AgoraRtcChannel.h

– rtcChannelTranscodingUpdated:

Occurs when the CDN live streaming settings are updated.

- (void)rtcChannelTranscodingUpdated:(AgoraRtcChannel *_Nonnull)rtcChannel

Parameters

rtcChannel

AgoraRtcChannel

Discussion

When the LiveTranscoding class in the setLiveTranscoding method updates, the SDK triggers the rtcChannelTranscodingUpdated callback to report the update information to the local host.

Note:

If you call the setLiveTranscoding method to set the LiveTranscoding class for the first time, the SDK does not trigger the rtcChannelTranscodingUpdated callback.

Declared In

AgoraRtcChannel.h

– rtcChannel:receiveStreamMessageFromUid:streamId:data:

Occurs when the local user receives the data stream from a remote user within five seconds.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel receiveStreamMessageFromUid:(NSUInteger)uid streamId:(NSInteger)streamId data:(NSData *_Nonnull)data

Parameters

rtcChannel

AgoraRtcChannel

uid

User ID of the remote user sending the message.

streamId

Stream ID.

data

Data received by the local user.

Discussion

The SDK triggers this callback when the local user receives the stream message that the remote user sends by calling the sendStreamMessage method.

Declared In

AgoraRtcChannel.h

– rtcChannel:didOccurStreamMessageErrorFromUid:streamId:error:missed:cached:

Occurs when the local user does not receive the data stream from the remote user within five seconds.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didOccurStreamMessageErrorFromUid:(NSUInteger)uid streamId:(NSInteger)streamId error:(NSInteger)error missed:(NSInteger)missed cached:(NSInteger)cached

Parameters

rtcChannel

AgoraRtcChannel

uid

User ID of the remote user sending the message.

streamId

Stream ID.

error

Error code. See AgoraErrorCode.

missed

Number of lost messages.

cached

Number of incoming cached messages when the data stream is interrupted.

Discussion

The SDK triggers this callback when the local user fails to receive the stream message that the remote user sends by calling the sendStreamMessage method.

Declared In

AgoraRtcChannel.h

– rtcChannel:channelMediaRelayStateDidChange:error:

Occurs when the state of the media stream relay changes.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel channelMediaRelayStateDidChange:(AgoraChannelMediaRelayState)state error:(AgoraChannelMediaRelayError)error

Parameters

rtcChannel

AgoraRtcChannel

state

The state code in AgoraChannelMediaRelayState.

error

The error code in AgoraChannelMediaRelayError.

Discussion

The SDK reports the state of the current media relay and possible error messages in this callback.

Declared In

AgoraRtcChannel.h

– rtcChannel:didReceiveChannelMediaRelayEvent:

Reports events during the media stream relay.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didReceiveChannelMediaRelayEvent:(AgoraChannelMediaRelayEvent)event

Parameters

rtcChannel

AgoraRtcChannel

event

The event code in AgoraChannelMediaRelayEvent.

Declared In

AgoraRtcChannel.h

– rtcChannel:firstRemoteVideoFrameOfUid:size:elapsed:

Occurs when the first remote video frame is rendered.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel firstRemoteVideoFrameOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed

Parameters

rtcChannel

AgoraRtcChannel

uid

User ID of the remote user sending the video stream.

size

Size of the video frame (width and height).

elapsed

Time elapsed (ms) from the local user calling the joinChannelByToken method until the SDK triggers this callback.

Availability

v3.7.0

Declared In

AgoraRtcChannel.h

– rtcChannel:didAudioPublishStateChange:newState:elapseSinceLastState:

Occurs when the audio publishing state changes.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didAudioPublishStateChange:(AgoraStreamPublishState)oldState newState:(AgoraStreamPublishState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState

Parameters

rtcChannel

AgoraRtcChannel

oldState

The previous publishing state. For details, see AgoraStreamPublishState.

newState

The current publishing state. For details, see AgoraStreamPublishState.

elapseSinceLastState

The time elapsed (ms) from the previous state to the current state.

Availability

v3.1.0

This callback indicates the publishing state change of the local audio stream.

Declared In

AgoraRtcChannel.h

– rtcChannel:didVideoPublishStateChange:newState:elapseSinceLastState:

Occurs when the video publishing state changes.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didVideoPublishStateChange:(AgoraStreamPublishState)oldState newState:(AgoraStreamPublishState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState

Parameters

rtcChannel

AgoraRtcChannel

oldState

The previous publishing state. For details, see AgoraStreamPublishState.

newState

The current publishing state. For details, see AgoraStreamPublishState.

elapseSinceLastState

The time elapsed (ms) from the previous state to the current state.

Availability

v3.1.0

This callback indicates the publishing state change of the local video stream.

Declared In

AgoraRtcChannel.h

– rtcChannel:didAudioSubscribeStateChange:oldState:newState:elapseSinceLastState:

Occurs when the audio subscribing state changes.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didAudioSubscribeStateChange:(NSUInteger)uid oldState:(AgoraStreamSubscribeState)oldState newState:(AgoraStreamSubscribeState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState

Parameters

rtcChannel

AgoraRtcChannel

uid

The ID of the remote user.

oldState

The previous subscribing state. For details, see AgoraStreamSubscribeState.

newState

The current subscribing state. For details, see AgoraStreamSubscribeState.

elapseSinceLastState

The time elapsed (ms) from the previous state to the current state.

Availability

v3.1.0

This callback indicates the subscribing state change of a remote audio stream.

Declared In

AgoraRtcChannel.h

– rtcChannel:didVideoSubscribeStateChange:oldState:newState:elapseSinceLastState:

Occurs when the video subscribing state changes.

- (void)rtcChannel:(AgoraRtcChannel *_Nonnull)rtcChannel didVideoSubscribeStateChange:(NSUInteger)uid oldState:(AgoraStreamSubscribeState)oldState newState:(AgoraStreamSubscribeState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState

Parameters

rtcChannel

AgoraRtcChannel

uid

The ID of the remote user.

oldState

The previous subscribing state. For details, see AgoraStreamSubscribeState.

newState

The current subscribing state. For details, see AgoraStreamSubscribeState.

elapseSinceLastState

The time elapsed (ms) from the previous state to the current state.

Availability

v3.1.0

This callback indicates the subscribing state change of a remote video stream.

Declared In

AgoraRtcChannel.h