Agora RTC Objective-C API Reference Refactor

Instance Methods | Properties
AgoraChannelMediaRelayConfiguration Class Reference

Inherits <NSObject>.

## Instance Methods
(BOOL) | - setDestinationInfo:forChannelName:
(BOOL) | - removeDestinationInfoForChannelName:

## Properties
NSDictionary< NSString *, AgoraChannelMediaRelayInfo * > *_Nullable | destinationInfos
AgoraChannelMediaRelayInfo *_Nonnull | sourceInfo

## Method Documentation

## ◆ setDestinationInfo:forChannelName:

- (BOOL) setDestinationInfo: |  | (AgoraChannelMediaRelayInfo *_Nonnull) | destinationInfo
forChannelName: |  | (NSString *_Nonnull) | channelName

Sets the information of the target channel.

Parameters

  destinationInfo | The information of the target channel. See `AgoraChannelMediaRelayInfo`. It contains the following members: `channelName`: The name of the destination channel. `uid`: The unique user ID to identify the relay stream in the target channel. The value ranges from 0 to (2 32-1). To avoid user ID conflicts, this user ID must be different from any other user ID in the target channel. The default value is 0, which means the SDK generates a random UID. `token`: The token for joining the destination channel. It is generated with the `channelName` and `uid` you set in `destinationInfo`. If you have not enabled the App Certificate, set this parameter as the default value `nil`, which means the SDK applies the App ID. If you have enabled the App Certificate, you must use the `token` generated with the `channelName` and `uid`. Attention: If the token of any target channel expires, the whole media relay stops; hence Agora recommends that you specify the same expiration time for the tokens of all the target channels.
  channelName | The channel name of the target channel.

Returns
  - YES: Success.
  - NO: Failure.

## ◆ removeDestinationInfoForChannelName:

- (BOOL) removeDestinationInfoForChannelName: |  | (NSString *_Nonnull) | channelName |

Deletes the information of target channel.

Parameters

  channelName | The channel name of the target channel.

Returns
  - YES: Success.
  - NO: Failure.

## Property Documentation

## ◆ destinationInfos

- (NSDictionary<NSString *, AgoraChannelMediaRelayInfo *>* _Nullable) destinationInfos
| read nonatomic strong

The information of the target channel `AgoraChannelMediaRelayInfo`. It contains the following members:

- `channelName`: The name of the target channel.
- `token`: The `token` for joining the target channel. It is generated with the `channelName` and `uid` you set in `destInfos`.
  - If you have not enabled the App Certificate, set this parameter as the default value `nil`, which means the SDK applies the App ID.
  - If you have enabled the App Certificate, you must use the `token` generated with the `channelName` and `uid`.
- `uid`: The unique user ID to identify the relay stream in the target channel. The value ranges from 0 to (2 32-1). To avoid user ID conflicts, this user ID must be different from any other user ID in the target channel. The default value is 0, which means the SDK generates a random UID.
  Note
    If the token of any target channel expires, the whole media relay stops; hence Agora recommends that you specify the same expiration time for the tokens of all the target channels.

## ◆ sourceInfo

- (AgoraChannelMediaRelayInfo* _Nonnull) sourceInfo
| read write nonatomic strong

The information of the source channel. See `AgoraChannelMediaRelayInfo`. It contains the following members:

- `channelName`: The name of the source channel. The default value is `nil`, which means the SDK applies the name of the current channel.
- `token`: The `token` for joining the source channel. This token is generated with the `channelName` and `uid` you set in `srcInfo`.
  - If you have not enabled the App Certificate, set this parameter as the default value `nil`, which means the SDK applies the App ID.
  - If you have enabled the App Certificate, you must use the `token` generated with the `channelName` and `uid`, and the `uid` must be set as 0.
- `uid`: The unique user ID to identify the relay stream in the source channel. Agora recommends leaving the default value of 0 unchanged.