Agora RTC Objective-C API Reference Refactor

Instance Methods
<AgoraLiveDelegate> Protocol Reference

Inherits <NSObjectNSObject>.

## Instance Methods
(void) | - liveKit:didOccurError:
(void) | - liveKit:didJoinChannel:withUid:elapsed:
(void) | - liveKitDidLeaveChannel:
(void) | - liveKit:didRejoinChannel:withUid:elapsed:
(void) | - liveKitRequestToken:
(void) | - liveKit:tokenPrivilegeWillExpire:
(void) | - liveKit:reportLiveStats:
(void) | - liveKitConnectionDidInterrupted:
(void) | - liveKitConnectionDidLost:
(void) | - liveKit:networkQuality:txQuality:rxQuality:

## Detailed Description

Protocol providing the AgoraLiveKit class with callbacks.

## Method Documentation

## ◆ liveKit:didOccurError:

- (void) liveKit: |  | (AgoraLiveKit *_Nonnull) | kit
didOccurError: |  | (AgoraErrorCode) | errorCode
| optional

An error occurred during SDK runtime.

The SDK cannot resume a normal state, and the app needs to handle it.

Parameters

  kit | AgoraLiveKit
  errorCode | AgoraErrorCode

## ◆ liveKit:didJoinChannel:withUid:elapsed:

- (void) liveKit: |  | (AgoraLiveKit *_Nonnull) | kit
didJoinChannel: |  | (NSString *_Nonnull) | channel
withUid: |  | (NSUInteger) | uid
elapsed: |  | (NSInteger) | elapsed
| optional

A user joined the channel.

Parameters

  kit | AgoraLiveKit
  channel | Channel name
  uid | Local user ID
  elapsed | Time elapsed (ms) from the beginning of the session

## ◆ liveKitDidLeaveChannel:

- (void) liveKitDidLeaveChannel: |  | (AgoraLiveKit *_Nonnull) | kit |
| optional

The statistics of the call when leaving a channel

Parameters

  kit | AgoraLiveKit

## ◆ liveKit:didRejoinChannel:withUid:elapsed:

- (void) liveKit: |  | (AgoraLiveKit *_Nonnull) | kit
didRejoinChannel: |  | (NSString *_Nonnull) | channel
withUid: |  | (NSUInteger) | uid
elapsed: |  | (NSInteger) | elapsed
| optional

A user rejoined the channel

Parameters

  kit | AgoraLiveKit
  channel | Channel name
  uid | User id
  elapsed | Time elapsed (ms) from the beginning of the session

## ◆ liveKitRequestToken:

- (void) liveKitRequestToken: |  | (AgoraLiveKit *_Nonnull) | kit |
| optional

Generates a new Token.

When the Token is enabled, and the specified Token is invalid or has expired, this function will be called. The app should generate a new Token and call renewToken to refresh the key.

NOTE: To be compatible with previous versions, AgoraErrorCodeTokenExpired = 109 and AgoraErrorCodeInvalidToken = 110 are also reported through the [didOccurError](liveKit:didOccurError:) callback. You should move the renew token logic into this callback.

Parameters

  kit | AgoraLiveKit

## ◆ liveKit:tokenPrivilegeWillExpire:

- (void) liveKit: |  | (AgoraLiveKit *_Nonnull) | kit
tokenPrivilegeWillExpire: |  | (NSString *_Nonnull) | token
| optional

The token privilege will expire.

If the Token you specified when calling [joinChannelByToken](joinChannelByToken:channelId:info:uid:joinSuccess:) expires, you will become offline. This callback is triggered 30 seconds before the Token expires to remind the app to renew the Token.

Upon receiving this callback, the user needs to generate a new Token on your server and call renewToken to pass the new Token on to the SDK.

Parameters

  kit | AgoraLiveKit
  token | The Token that will expire in 30 seconds.

## ◆ liveKit:reportLiveStats:

- (void) liveKit: |  | (AgoraLiveKit *_Nonnull) | kit
reportLiveStats: |  | (AgoraChannelStats *_Nonnull) | stats
| optional

The statistics of the RTC AgoraLiveKit status every two seconds.

Parameters

  kit | AgoraLiveKit
  stats | Statistics of the RTC status, including the duration, sent bytes, and received bytes

## ◆ liveKitConnectionDidInterrupted:

- (void) liveKitConnectionDidInterrupted: |  | (AgoraLiveKit *_Nonnull) | kit |
| optional

The SDK disconnected from the server.

This event is reported when the SDK loses connection to the server. The SDK tries to automatically reconnect with the server until the app calls [leaveChannel]([AgoraLiveKit leaveChannel]).

Parameters

  kit | AgoraLiveKit

## ◆ liveKitConnectionDidLost:

- (void) liveKitConnectionDidLost: |  | (AgoraLiveKit *_Nonnull) | kit |
| optional

The connection to the server is lost.

This event is reported after the connection to the server is interrupted and the reconnection time has exceeded (10 seconds by default). The SDK tries to automatically reconnect with the server until the app calls [leaveChannel]([AgoraLiveKit leaveChannel]).

Parameters

  kit | AgoraLiveKit

## ◆ liveKit:networkQuality:txQuality:rxQuality:

- (void) liveKit: |  | (AgoraLiveKit *_Nonnull) | kit
networkQuality: |  | (NSUInteger) | uid
txQuality: |  | (AgoraNetworkQuality) | txQuality
rxQuality: |  | (AgoraNetworkQuality) | rxQuality
| optional

The network quality of the local user.

Parameters

  kit | AgoraLiveKit
  uid | User ID
  txQuality | Network transmission quality: AgoraNetworkQuality
  rxQuality | Network receiving quality: AgoraNetworkQuality