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

## Detailed Description

The definition of AgoraChannelMediaRelayConfiguration.

## Method Documentation

## ◆ setDestinationInfo:forChannelName:

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

Sets the information of the destination channel.

If you want to relay the media stream to multiple channels, call this method as many times (at most four).

Parameters

  destinationInfo | The information of the destination channel: AgoraChannelMediaRelayInfo. It contains the following members:

- `channelName`: The name of the destination channel.
- `uid`: ID of the broadcaster in the destination channel. The value ranges from 0 to (232-1). To avoid UID conflicts, this `uid` must be different from any other UIDs in the destination 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`.

Parameters

  channelName | The name of the destination channel. Ensure that the value of this parameter is the same as that of the `channelName` member in `destinationInfo`.

Returns
  - YES: Success.
  - NO: Failure.

## ◆ removeDestinationInfoForChannelName:

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

Removes the destination channel.

Parameters

  channelName | The name of the destination channel.

Returns
  - YES: Success.
  - NO: Failure.

## Property Documentation

## ◆ destinationInfos

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

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

- `channelName`: The name of the destination channel.
- `uid`: ID of the broadcaster in the destination channel. The value ranges from 0 to (232-1). To avoid UID conflicts, this `uid` must be different from any other UIDs in the destination 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 `destinationInfos`.
- 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`.

## ◆ sourceInfo

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

The information of the source channel: 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.
- `uid`: ID of the broadcaster whose media stream you want to relay. The default value is 0, which means the SDK generates a random UID. You must set it as 0.
- `token`: The token for joining the source channel. It is generated with the `channelName` and `uid` you set in `sourceInfo`.
- 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.