Agora RTC Objective-C API Reference Refactor

Data Fields
ChannelMediaOptions Struct Reference

## Data Fields
Optional< bool > | publishCameraTrack
Optional< bool > | publishSecondaryCameraTrack
Optional< bool > | publishThirdCameraTrack
Optional< bool > | publishFourthCameraTrack
Optional< bool > | publishMicrophoneTrack
Optional< bool > | publishScreenCaptureAudio
Optional< bool > | publishScreenCaptureVideo
Optional< bool > | publishCustomAudioTrack
Optional< int > | publishCustomAudioTrackId
Optional< bool > | publishCustomVideoTrack
Optional< bool > | publishEncodedVideoTrack
Optional< bool > | publishMediaPlayerAudioTrack
Optional< bool > | publishMediaPlayerVideoTrack
Optional< bool > | publishTranscodedVideoTrack
Optional< bool > | publishMixedAudioTrack
Optional< bool > | publishLipSyncTrack
Optional< bool > | autoSubscribeAudio
Optional< bool > | autoSubscribeVideo
Optional< bool > | enableAudioRecordingOrPlayout
Optional< int > | publishMediaPlayerId
Optional< CLIENT_ROLE_TYPE > | clientRoleType
Optional< AUDIENCE_LATENCY_LEVEL_TYPE > | audienceLatencyLevel
Optional< VIDEO_STREAM_TYPE > | defaultVideoStreamType
Optional< CHANNEL_PROFILE_TYPE > | channelProfile
Optional< int > | audioDelayMs
Optional< int > | mediaPlayerAudioDelayMs
Optional< const char * > | token
Optional< bool > | enableBuiltInMediaEncryption
Optional< bool > | publishRhythmPlayerTrack
Optional< bool > | isInteractiveAudience
Optional< video_track_id_t > | customVideoTrackId
Optional< bool > | isAudioFilterable
Optional< const char * > | parameters
Optional< bool > | enableMultipath
Optional< MultipathMode > | uplinkMultipathMode
Optional< MultipathMode > | downlinkMultipathMode
Optional< MultipathType > | preferMultipathType

## Detailed Description

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

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.

## Constructor & Destructor Documentation

## ◆ ChannelMediaOptions()

ChannelMediaOptions | ( |  | ) |
| inline

## ◆ ~ChannelMediaOptions()

~ChannelMediaOptions | ( |  | ) |
| inline

## Member Function Documentation

## ◆ SetAll()

void SetAll | ( | const ChannelMediaOptions & | change | ) |
| inline

## ◆ operator==()

bool operator== | ( | const ChannelMediaOptions & | o | ) | const
| inline

## ◆ operator=()

ChannelMediaOptions& operator= | ( | const ChannelMediaOptions & | replace | ) |
| inline

## Field Documentation

## ◆ publishCameraTrack

Optional<bool> publishCameraTrack

Whether to publish the video captured by the camera:

- `true`: Publish the video captured by the camera.
- `false`: Do not publish the video captured by the camera.

## ◆ publishSecondaryCameraTrack

Optional<bool> publishSecondaryCameraTrack

Whether to publish the video captured by the second camera:

- `true`: Publish the video captured by the second camera.
- `false`: Do not publish the video captured by the second camera.

## ◆ publishThirdCameraTrack

Optional<bool> publishThirdCameraTrack

Whether to publish the video captured by the third camera:

- `true`: Publish the video captured by the third camera.
- `false`: Do not publish the video captured by the third camera.
  Note
    This parameter is for Android, Windows and macOS only.

## ◆ publishFourthCameraTrack

Optional<bool> publishFourthCameraTrack

Whether to publish the video captured by the fourth camera:

- `true`: Publish the video captured by the fourth camera.
- `false`: Do not publish the video captured by the fourth camera.
  Note
    This parameter is for Android, Windows and macOS only.

## ◆ publishMicrophoneTrack

Optional<bool> publishMicrophoneTrack

Whether to publish the audio captured by the microphone:

- `true`: Publish the audio captured by the microphone.
- `false`: Do not publish the audio captured by the microphone.

## ◆ publishScreenCaptureAudio

Optional<bool> publishScreenCaptureAudio

Whether to publish the audio track of the screen capturer:

- `true`: Publish the video audio of the screen capturer.
- `false`: (Default) Do not publish the audio track of the screen capturer.

## ◆ publishScreenCaptureVideo

Optional<bool> publishScreenCaptureVideo

Whether to publish the video captured from the screen:

- `true`: Publish the video captured from the screen.
- `false`: Do not publish the video captured from the screen.
  Note
    This parameter is for Android and iOS only.

## ◆ publishCustomAudioTrack

Optional<bool> publishCustomAudioTrack

Whether to publish the audio captured from a custom source:

- `true`: Publish the audio captured from the custom source.
- `false`: Do not publish the captured audio from a custom source.

## ◆ publishCustomAudioTrackId

Optional<int> publishCustomAudioTrackId

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` method.

## ◆ publishCustomVideoTrack

Optional<bool> publishCustomVideoTrack

Whether to publish the video captured from a custom source:

- `true`: Publish the video captured from the custom source.
- `false`: Do not publish the captured video from a custom source.

## ◆ publishEncodedVideoTrack

Optional<bool> publishEncodedVideoTrack

Whether to publish the encoded video:

- `true`: Publish the encoded video.
- `false`: Do not publish the encoded video.

## ◆ publishMediaPlayerAudioTrack

Optional<bool> publishMediaPlayerAudioTrack

Whether to publish the audio from the media player:

- `true`: Publish the audio from the media player.
- `false`: Do not publish the audio from the media player.

## ◆ publishMediaPlayerVideoTrack

Optional<bool> publishMediaPlayerVideoTrack

Whether to publish the video from the media player:

- `true`: Publish the video from the media player.
- `false`: Do not publish the video from the media player.

## ◆ publishTranscodedVideoTrack

Optional<bool> publishTranscodedVideoTrack

Whether to publish the local transcoded video:

- `true`: Publish the local transcoded video.
- `false`: Do not publish the local transcoded video.
  Note
    As of v4.2.0, the parameter name is corrected from `publishTrancodedVideoTrack` to `publishTranscodedVideoTrack`.

## ◆ publishMixedAudioTrack

Optional<bool> publishMixedAudioTrack

Whether to publish the mixed audio track:

- `true`: Publish the mixed audio track.
- `false`: Do not publish the mixed audio track.

## ◆ publishLipSyncTrack

Optional<bool> publishLipSyncTrack

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

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

## ◆ autoSubscribeAudio

Optional<bool> autoSubscribeAudio

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

- `true`: Subscribe to all remote audio streams.
- `false`: Do not automatically subscribe to any remote audio streams.

## ◆ autoSubscribeVideo

Optional<bool> autoSubscribeVideo

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

- `true`: Subscribe to all remote video streams.
- `false`: Do not automatically subscribe to any remote video streams.

## ◆ enableAudioRecordingOrPlayout

Optional<bool> enableAudioRecordingOrPlayout

Whether to enable audio capturing or playback:

- `true`: Enable audio capturing or playback.
- `false`: 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 `true`.

## ◆ publishMediaPlayerId

Optional<int> publishMediaPlayerId

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

## ◆ clientRoleType

Optional<CLIENT_ROLE_TYPE> clientRoleType

The user role. See `CLIENT_ROLE_TYPE`.

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

Optional<AUDIENCE_LATENCY_LEVEL_TYPE> audienceLatencyLevel

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

## ◆ defaultVideoStreamType

Optional<VIDEO_STREAM_TYPE> defaultVideoStreamType

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

## ◆ channelProfile

Optional<CHANNEL_PROFILE_TYPE> channelProfile

The channel profile. See `CHANNEL_PROFILE_TYPE`.

## ◆ audioDelayMs

Optional<int> audioDelayMs

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

Optional<int> mediaPlayerAudioDelayMs

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

Optional<const char*> token

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

Note
  - This parameter takes effect only when calling `updateChannelMediaOptions` or `updateChannelMediaOptionsEx`.
  - Ensure that the App ID, channel name, and user name used for creating the token are the same as those used by the `initialize` method for initializing the RTC engine, and those used by the `joinChannel(const char* token, const char* channelId, uid_t uid, const ChannelMediaOptions& options)` and `joinChannelEx` methods for joining the channel.

## ◆ enableBuiltInMediaEncryption

Optional<bool> enableBuiltInMediaEncryption

Whether to enable media packet encryption:

- `true`: Yes.
- `false`: (Default) No.

Note
  This parameter is ignored when calling `updateChannelMediaOptions`.

## ◆ publishRhythmPlayerTrack

Optional<bool> publishRhythmPlayerTrack

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

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

## ◆ isInteractiveAudience

Optional<bool> isInteractiveAudience

Whether to enable interactive mode:

- `true`: 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.
- `false`: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 `joinChannelEx` method to join the other host's channel as an audience member, and set `isInteractiveAudience` to `true`.
- This parameter takes effect only when the user role is `CLIENT_ROLE_AUDIENCE`.

## ◆ customVideoTrackId

Optional<video_track_id_t> customVideoTrackId

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

## ◆ isAudioFilterable

Optional<bool> isAudioFilterable

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

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

## ◆ parameters

Optional<const char*> parameters

Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options. Pointer to the set parameters in a JSON string. @technical preview

## ◆ enableMultipath

Optional<bool> enableMultipath

Whether to enable multiple transmisssion paths:

- `true`: Enable multiple transmisssion path.
- `false`: Dsiable multiple transmisssion path.
  Note
    Permissions and system requirements: Android: Android 7.0 or higher (API level 24 or higher), and the ACCESS_NETWORK_STATE and CHANGE_NETWORK_STATE permissions are required. iOS: iOS 12.0 or later. macOS: 10.14 or later. Windows: Windows Vista or higher.
  Since
    4.6.0

## ◆ uplinkMultipathMode

Optional<MultipathMode> uplinkMultipathMode

Uplink transmission mode. See `MultipathMode`.

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

Since
  4.6.0

## ◆ downlinkMultipathMode

Optional<MultipathMode> downlinkMultipathMode

Downlink transmission mode. See `MultipathMode`.

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

Since
  4.6.0

## ◆ preferMultipathType

Optional<MultipathType> preferMultipathType

Preferred type of transmission path. See `MultipathType`.

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

Since
  4.6.0