Agora RTC Objective-C API Reference Refactor

Properties
AgoraRtcChannelMediaOptions Class Reference

Inherits <NSObject>.

## Properties
BOOL | publishCameraTrack
BOOL | publishSecondaryCameraTrack
BOOL | publishMicrophoneTrack
BOOL | publishScreenCaptureAudio
BOOL | publishScreenCaptureVideo
BOOL | publishCustomAudioTrack
NSInteger | publishCustomAudioTrackId
BOOL | publishCustomVideoTrack
BOOL | publishEncodedVideoTrack
BOOL | publishMediaPlayerAudioTrack
BOOL | publishMediaPlayerVideoTrack
BOOL | publishTranscodedVideoTrack
BOOL | publishMixedAudioTrack
BOOL | publishLipSyncTrack
BOOL | autoSubscribeAudio
BOOL | autoSubscribeVideo
BOOL | enableAudioRecordingOrPlayout
NSInteger | publishMediaPlayerId
AgoraClientRole | clientRoleType
AgoraAudienceLatencyLevelType | audienceLatencyLevel
AgoraVideoStreamType | defaultVideoStreamType
AgoraChannelProfile | channelProfile
NSInteger | audioDelayMs
NSInteger | mediaPlayerAudioDelayMs
NSString *_Nullable | token
BOOL | enableBuiltInMediaEncryption
BOOL | publishRhythmPlayerTrack
BOOL | isInteractiveAudience
NSInteger | customVideoTrackId
BOOL | isAudioFilterable
NSString *_Nullable | parameters
BOOL | enableMultipath
AgoraMultipathMode | uplinkMultipathMode
AgoraMultipathMode | downlinkMultipathMode
AgoraMultipathType | preferMultipathType

## Detailed Description

Agora supports publishing multiple audio streams and one video stream at the same time and in the same `AgoraRtcConnection`. For example, `publishMicrophoneTrack`, `publishCustomAudioTrack`, and `publishMediaPlayerAudioTrack` can be set as `YES` at the same time, but only one of `publishCameraTrack`, `publishScreenCaptureVideo` (iOS)/`publishScreenTrack` (macOS), `publishCustomVideoTrack`, or `publishEncodedVideoTrack` can be set as `YES`.

Note
  Agora recommends that you set member parameter values yourself according to your business scenario, otherwise the SDK will automatically assign values to member parameters.

## Property Documentation

## ◆ publishCameraTrack

- (BOOL) publishCameraTrack
| read write nonatomic assign

Whether to publish the video captured by the camera:

- `YES`: Publish the video captured by the camera.
- `NO`: Do not publish the video captured by the camera.

## ◆ publishSecondaryCameraTrack

- (BOOL) publishSecondaryCameraTrack
| read write nonatomic assign

Whether to publish the video captured by the second camera:

- `YES`: Publish the video captured by the second camera.
- `NO`: Do not publish the video captured by the second camera.

## ◆ publishMicrophoneTrack

- (BOOL) publishMicrophoneTrack
| read write nonatomic assign

Whether to publish the audio captured by the microphone:

- `YES`: Publish the audio captured by the microphone.
- `NO`: Do not publish the audio captured by the microphone.

## ◆ publishScreenCaptureAudio

- (BOOL) publishScreenCaptureAudio
| read write nonatomic assign

Determines whether to publish the audio of the screen capturer.

- `YES`: Publish the audio track of the screen capturer.
- `NO`: (Default) Do not publish the audio track of the screen capturer.

## ◆ publishScreenCaptureVideo

- (BOOL) publishScreenCaptureVideo
| read write nonatomic assign

(iOS only) Whether to publish the video captured from the screen:

- `YES`: Publish the video captured from the screen.
- `NO`: Do not publish the video captured from the screen.
  Note
    As of v4.0.0, the parameter name is changed from `publishScreenTrack` to `publishScreenCaptureVideo`.

## ◆ publishCustomAudioTrack

- (BOOL) publishCustomAudioTrack
| read write nonatomic assign

Whether to publish the audio captured from a custom source:

- `YES`: Publish the audio captured from the custom source.
- `NO`: Do not publish the captured audio from a custom source.

## ◆ publishCustomAudioTrackId

- (NSInteger) publishCustomAudioTrackId
| read write nonatomic assign

The ID of the custom audio track to be published. The default value is 0. You can obtain the custom audio track ID through the `createCustomAudioTrack:config:` method.

## ◆ publishCustomVideoTrack

- (BOOL) publishCustomVideoTrack
| read write nonatomic assign

Whether to publish the video captured from a custom source:

- `YES`: Publish the video captured from the custom source.
- `NO`: Do not publish the captured video from a custom source.

## ◆ publishEncodedVideoTrack

- (BOOL) publishEncodedVideoTrack
| read write nonatomic assign

Whether to publish the encoded video:

- `YES`: Publish the encoded video.
- `NO`: Do not publish the encoded video.

## ◆ publishMediaPlayerAudioTrack

- (BOOL) publishMediaPlayerAudioTrack
| read write nonatomic assign

Whether to publish the audio from the media player:

- `YES`: Publish the audio from the media player.
- `NO`: Do not publish the audio from the media player.

## ◆ publishMediaPlayerVideoTrack

- (BOOL) publishMediaPlayerVideoTrack
| read write nonatomic assign

Whether to publish the video from the media player:

- `YES`: Publish the video from the media player.
- `NO`: Do not publish the video from the media player.

## ◆ publishTranscodedVideoTrack

- (BOOL) publishTranscodedVideoTrack
| read write nonatomic assign

Determines whether to publish the local transcoded video track.

- `YES`: Publish the video track of local transcoded video track.
- `NO`: (Default) Do not publish the local transcoded video track.

## ◆ publishMixedAudioTrack

- (BOOL) publishMixedAudioTrack
| read write nonatomic assign

Whether to publish the mixed audio track:

- `YES`: Publish the mixed audio track.
- `NO`: Do not publish the mixed audio track.

## ◆ publishLipSyncTrack

- (BOOL) publishLipSyncTrack
| read write nonatomic assign

Whether to publish the video track processed by the speech driven extension:

- `YES`: Publish the video track processed by the speech driven extension.
- `NO`: (Default) Do not publish the video track processed by the speech driven extension.

## ◆ autoSubscribeAudio

- (BOOL) autoSubscribeAudio
| read write nonatomic assign

Whether to automatically subscribe to all remote audio streams when the user joins a channel:

- `YES`: Subscribe to all remote audio streams.
- `NO`: Do not automatically subscribe to any remote audio streams.

## ◆ autoSubscribeVideo

- (BOOL) autoSubscribeVideo
| read write nonatomic assign

Whether to automatically subscribe to all remote video streams when the user joins the channel:

- `YES`: Subscribe to all remote video streams.
- `NO`: Do not automatically subscribe to any remote video streams.

## ◆ enableAudioRecordingOrPlayout

- (BOOL) enableAudioRecordingOrPlayout
| read write nonatomic assign

Whether to enable audio capturing or playback:

- `YES`: Enable audio capturing or playback.
- `NO`: Do not enable audio capturing or playback.
  Note
    If you need to publish the audio streams captured by your microphone, ensure this parameter is set as `YES`.

## ◆ publishMediaPlayerId

- (NSInteger) publishMediaPlayerId
| read write nonatomic assign

The ID of the media player to be published. The default value is 0.

## ◆ clientRoleType

- (AgoraClientRole) clientRoleType
| read write nonatomic assign

The user role. See `AgoraClientRole`.

Note
  If you set the user role as an audience member, you cannot publish audio and video streams in the channel. If you want to publish media streams in a channel during live streaming, ensure you set the user role as broadcaster.

## ◆ audienceLatencyLevel

- (AgoraAudienceLatencyLevelType) audienceLatencyLevel
| read write nonatomic assign

The latency level of an audience member in interactive live streaming. See `AgoraAudienceLatencyLevelType`.

## ◆ defaultVideoStreamType

- (AgoraVideoStreamType) defaultVideoStreamType
| read write nonatomic assign

The default video-stream type. See `AgoraVideoStreamType`.

## ◆ channelProfile

- (AgoraChannelProfile) channelProfile
| read write nonatomic assign

The channel profile. See `AgoraChannelProfile`.

## ◆ audioDelayMs

- (NSInteger) audioDelayMs
| read write nonatomic assign

Delay (in milliseconds) for sending audio frames. You can use this parameter to set the delay of the audio frames that need to be sent, to ensure audio and video synchronization. To switch off the delay, set the value to 0.

## ◆ mediaPlayerAudioDelayMs

- (NSInteger) mediaPlayerAudioDelayMs
| read write nonatomic assign

The delay in ms for sending media player audio frames. This is used for explicit control of A/V sync. To switch off the delay, set the value to zero.

## ◆ token

- (NSString* _Nullable) token
| read write nonatomic copy

(Optional) The token generated on your server for authentication.

Note
  - This parameter takes effect only when calling `updateChannelWithMediaOptions:` or `updateChannelExWithMediaOptions:connection:`.
  - Ensure that the App ID, channel name, and user name used for creating the token are the same as those used by the `sharedEngineWithConfig:delegate:` method for initializing the RTC engine, and those used by the `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` and `joinChannelExByToken:connection:delegate:mediaOptions:joinSuccess:` methods for joining the channel.

## ◆ enableBuiltInMediaEncryption

- (BOOL) enableBuiltInMediaEncryption
| read write nonatomic assign

Enable media packet encryption. It will be ignored when calling function updateChannelMediaOptions().

- `YES`: Enable media packet encryption.
- `NO`: (Default) Do not Enable media packet encryption.

## ◆ publishRhythmPlayerTrack

- (BOOL) publishRhythmPlayerTrack
| read write nonatomic assign

Whether to publish the sound of a metronome to remote users:

- `YES`: Publish processed audio frames. Both the local user and remote users can hear the metronome.
- `NO`: Do not publish the sound of the metronome. Only the local user can hear the metronome.

## ◆ isInteractiveAudience

- (BOOL) isInteractiveAudience
| read write nonatomic assign

Whether to enable interactive mode:

- `YES`: Enable interactive mode. Once this mode is enabled and the user role is set as audience, the user can receive remote video streams with low latency.
- `NO`:Do not enable interactive mode. If this mode is disabled, the user receives the remote video streams in default settings.
  Note
- This parameter only applies to co-streaming scenarios. The cohosts need to call the `joinChannelExByToken:connection:delegate:mediaOptions:joinSuccess:` method to join the other host's channel as an audience member, and set `isInteractiveAudience` to `YES`.
- This parameter takes effect only when the user role is `AgoraClientRoleAudience`.

## ◆ customVideoTrackId

- (NSInteger) customVideoTrackId
| read write nonatomic assign

The video track ID returned by calling the `createCustomVideoTrack` method. The default value is 0.

## ◆ isAudioFilterable

- (BOOL) isAudioFilterable
| read write nonatomic assign

Whether the audio stream being published is filtered according to the volume algorithm:

- `YES`: The audio stream is filtered. If the audio stream filter is not enabled, this setting does not takes effect.
- `NO`: The audio stream is not filtered.
  Note
    If you need to enable this function, contact `support@agora.io`.

## ◆ parameters

- (NSString* _Nullable) parameters
| read write nonatomic copy

Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options. @technical preview

## ◆ enableMultipath

- (BOOL) enableMultipath
| read write nonatomic assign

Whether to enable multiple transmisssion paths:

- `YES`: Enable multiple transmisssion path.
- `NO`: Dsiable multiple transmisssion path.
  Note
    Permissions and system requirements:
- iOS: iOS 12.0 or later.
- macOS: 10.14 or later.
  Since
    4.6.0

## ◆ uplinkMultipathMode

- (AgoraMultipathMode) uplinkMultipathMode
| read write nonatomic assign

Uplink transmission mode. See `AgoraMultipathMode`.

Note
  When using this parameter, make sure that `enableMultipath` is set to `YES`.

Since
  4.6.0

## ◆ downlinkMultipathMode

- (AgoraMultipathMode) downlinkMultipathMode
| read write nonatomic assign

Downlink transmission mode. See `AgoraMultipathMode`.

Note
  When using this parameter, make sure that `enableMultipath` is set to `YES`.

Since
  4.6.0

## ◆ preferMultipathType

- (AgoraMultipathType) preferMultipathType
| read write nonatomic assign

Preferred type of transmission path. See `AgoraMultipathType`.

Note
  When using this parameter, make sure that `enableMultipath` is set to `YES`.

Since
  4.6.0