ChannelMediaOptions

The channel media options.

public class ChannelMediaOptions : OptionalJsonParse
    {
        public Optional<bool> publishCameraTrack = new Optional<bool>();
        public Optional<bool> publishSecondaryCameraTrack = new Optional<bool>();
        public Optional<bool> publishThirdCameraTrack = new Optional<bool>();
        public Optional<bool> publishFourthCameraTrack = new Optional<bool>();
        public Optional<bool> publishMicrophoneTrack = new Optional<bool>();
        public Optional<bool> publishScreenCaptureVideo = new Optional<bool>();
        public Optional<bool> publishScreenCaptureAudio = new Optional<bool>();
        public Optional<bool> publishScreenTrack = new Optional<bool>();
        public Optional<bool> publishSecondaryScreenTrack = new Optional<bool>();
        public Optional<bool> publishThirdScreenTrack = new Optional<bool>();
        public Optional<bool> publishFourthScreenTrack = new Optional<bool>();
        public Optional<bool> publishCustomAudioTrack = new Optional<bool>();
        public Optional<int> publishCustomAudioTrackId = new Optional<int>();
        public Optional<bool> publishCustomVideoTrack = new Optional<bool>();
        public Optional<bool> publishEncodedVideoTrack = new Optional<bool>();
        public Optional<bool> publishMediaPlayerAudioTrack = new Optional<bool>();
        public Optional<bool> publishMediaPlayerVideoTrack = new Optional<bool>();
        public Optional<bool> publishTranscodedVideoTrack = new Optional<bool>();
        public Optional<bool> autoSubscribeAudio = new Optional<bool>();
        public Optional<bool> autoSubscribeVideo = new Optional<bool>();
        public Optional<bool> enableAudioRecordingOrPlayout = new Optional<bool>();
        public Optional<int> publishMediaPlayerId = new Optional<int>();
        public Optional<CLIENT_ROLE_TYPE> clientRoleType = new Optional<CLIENT_ROLE_TYPE>();
        public Optional<AUDIENCE_LATENCY_LEVEL_TYPE> audienceLatencyLevel = new Optional<AUDIENCE_LATENCY_LEVEL_TYPE>();
        public Optional<VIDEO_STREAM_TYPE> defaultVideoStreamType = new Optional<VIDEO_STREAM_TYPE>();
        public Optional<CHANNEL_PROFILE_TYPE> channelProfile = new Optional<CHANNEL_PROFILE_TYPE>();
        public Optional<string> token = new Optional<string>();
        public Optional<bool> publishRhythmPlayerTrack = new Optional<bool>();
        public Optional<bool> isInteractiveAudience = new Optional<bool>();
        public Optional<video_track_id_t> customVideoTrackId = new Optional<video_track_id_t>();
        public Optional<bool> isAudioFilterable = new Optional<bool>();

   }
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, publishScreenCaptureVideopublishScreenTrack, publishCustomVideoTrack, or publishEncodedVideoTrack can be set as true.
Attention: Agora recommends that you set member parameter values yourself according to your business scenario, otherwise the SDK will automatically assign values to member parameters.

Attributes

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
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.
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.
Note:
  • As of v4.0.0, the parameter name is changed from publishAudioTrack to publishMicrophoneTrack.
  • If you set this parameter as false, SDK turns off microphone capturing.
  • If you want to publish the audio streams captured by your microphone, ensure enableAudioRecordingOrPlayout is set as true.
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.
Attention: This is for Windows and macOS only.
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.
Attention: This is for Windows and macOS only.
publishScreenTrack
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.
Attention: This is for Windows and macOS only.
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.
Attention: This parameter applies to Android and iOS only.
publishScreenCaptureAudio
Whether to publish the audio captured from the screen:
  • true: Publish the audio captured from the screen.
  • false: Publish the audio captured from the screen.
Attention: This parameter applies to Android and iOS only.
publishSecondaryScreenTrack
Whether to publish the video captured from the second screen:
  • true: Publish the video captured from the second screen.
  • false: Do not publish the video captured from the second screen.
publishThirdScreenTrack
Whether to publish the video captured from the third screen:
  • true: Publish the captured video from the third screen.
  • false: Do not publish the video captured from the third screen.
Attention: This is for Windows and macOS only.
publishFourthScreenTrack
Whether to publish the video captured from the fourth screen:
  • true: Publish the captured video from the fourth screen.
  • false: Do not publish the video captured from the fourth screen.
Attention: This is for Windows and macOS only.
publishTranscodedVideoTrack
Whether to publish the local transcoded video:
  • true: Publish the local transcoded video.
  • false: Do not publish the local transcoded video.

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
The ID of the custom audio source to publish. The default value is 0.

If you have set sourceNumber in SetExternalAudioSource to a value greater than 1, the SDK creates the corresponding number of custom audio tracks and assigns an ID to each audio track, starting from 0.

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
Whether to publish the encoded video:
  • true: Publish the encoded video.
  • false: Do not publish the encoded video.
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
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.
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
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
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
The ID of the media player to be published. The default value is 0.
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
The latency level of an audience member in interactive live streaming. See AUDIENCE_LATENCY_LEVEL_TYPE.
defaultVideoStreamType

The default video-stream type. See VIDEO_STREAM_TYPE.

channelProfile

The channel profile. See CHANNEL_PROFILE_TYPE.

token

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

CAUTION:
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
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.
Attention:
  • This parameter only applies to scenarios involving cohosting across channels. 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
The video track ID returned by calling the CreateCustomVideoTrack method. The default value is 0.
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.
Attention: If you need to enable this function, contact support@agora.io.