ChannelMediaOptions
Configures media publishing and subscription options in the channel.
public class ChannelMediaOptions {
public Boolean publishCameraTrack;
public Boolean publishSecondaryCameraTrack;
public Boolean publishThirdCameraTrack;
public Boolean publishFourthCameraTrack;
public Boolean publishMicrophoneTrack;
public Boolean publishScreenCaptureVideo;
public Boolean publishScreenCaptureAudio;
public Boolean publishCustomAudioTrack;
public Integer publishCustomAudioTrackId;
public Boolean publishCustomVideoTrack;
public Boolean publishEncodedVideoTrack;
public Boolean publishMediaPlayerAudioTrack;
public Boolean publishMediaPlayerVideoTrack;
public Boolean publishTranscodedVideoTrack;
public Boolean publishMixedAudioTrack;
public Boolean publishLipSyncTrack;
public Boolean autoSubscribeAudio;
public Boolean autoSubscribeVideo;
public Boolean enableAudioRecordingOrPlayout;
public Integer publishMediaPlayerId;
public Integer clientRoleType;
public Integer audienceLatencyLevel;
public Integer defaultVideoStreamType;
public Integer channelProfile;
public Integer audioDelayMs;
public Integer mediaPlayerAudioDelayMs;
public String token;
public Boolean enableBuiltInMediaEncryption;
public Boolean publishRhythmPlayerTrack;
public Boolean isInteractiveAudience;
public Integer customVideoTrackId;
public Boolean isAudioFilterable;
public Boolean startPreview;
public String parameters;
public Boolean enableMultipath;
public Integer uplinkMultipathMode;
public Integer downlinkMultipathMode;
public Integer preferMultipathType;
}
Supports publishing multiple audio streams and one video stream simultaneously within the same RtcConnection. For example, you can enable publishMicrophoneTrack, publishCustomAudioTrack, and publishMediaPlayerAudioTrack at the same time, but only one of publishCameraTrack, publishScreenCaptureVideo, publishCustomVideoTrack, and publishEncodedVideoTrack can be set to true.
Note: It is recommended that you set the values of each member parameter according to your business scenario; otherwise, the SDK will assign default values automatically.
Properties
- 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 second camera video track:
- true: Publish the second camera video track.
- false: (Default) Do not publish the second camera video track.
- publishThirdCameraTrack
- Whether to publish the third camera video:
- true: Publish the third camera video.
- false: Do not publish the third camera video.
- publishFourthCameraTrack
- Whether to publish the fourth camera video:
- true: Publish the fourth camera video.
- false: Do not publish the fourth camera video.
- 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.
- publishScreenCaptureVideo
-
Note: Since v4.0.0, the parameter has been renamed fromWhether to publish the video captured from the screen:
publishScreenTracktopublishScreenCaptureVideo.- true: Publish the screen capture video.
- false: Do not publish the screen capture video.
- publishScreenCaptureAudio
- Whether to publish the audio captured from the screen:
- true: Publish the screen capture audio.
- false: Do not publish the screen capture audio.
- publishCustomAudioTrack
- Whether to publish audio captured from a custom audio source:
- true: Publish audio from a custom audio source.
- false: Do not publish audio from a custom audio source.
- publishCustomAudioTrackId
- The ID of the custom audio track to publish. You can obtain this ID via the createCustomAudioTrack method.
- publishCustomVideoTrack
- Whether to publish the video captured from a custom video source:
- true: Publish video from a custom video source.
- false: Do not publish video from a custom video 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.
- publishTranscodedVideoTrack
- Whether to publish the locally transcoded video track:
- true: Publish the locally transcoded video track.
- false: (Default) Do not publish the locally transcoded video track.
- publishMixedAudioTrack
- Whether to publish the mixed audio track:
true: Publish the mixed audio track.false: Do not publish the mixed audio track.
- publishLipSyncTrack
- Whether to publish the video track processed by voice-driven extension:
true: Publish the video track processed by voice-driven extension.false: (Default) Do not publish the video track processed by voice-driven extension.
- autoSubscribeAudio
- Whether to automatically subscribe to all remote audio streams when a user joins the 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 a user joins the channel:
true: Subscribe to all remote video streams.false: Do not automatically subscribe to any remote video streams.
- enableAudioRecordingOrPlayout
-
Note: To publish audio from the microphone, ensure this parameter is set toWhether to enable audio recording or playback:
true.true: Enable audio recording or playback.false: Do not enable audio recording or playback.
- publishMediaPlayerId
- The ID of the media player to publish. Default is 0.
- clientRoleType
-
Note: If the user role is set to audience, you cannot publish audio or video streams in the channel. To publish media streams during a live broadcast, ensure the user role is set to broadcaster.User role type:
- CLIENT_ROLE_BROADCASTER (1): Broadcaster.
- CLIENT_ROLE_AUDIENCE (2): Audience.
- audienceLatencyLevel
- Latency level for audience in interactive live streaming:
- AUDIENCE_LATENCY_LEVEL_LOW_LATENCY (1): Low latency.
- AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY (2): Ultra-low latency (default).
- defaultVideoStreamType
- Default video stream type:
- VIDEO_STREAM_HIGH (0): High-quality video stream with high resolution and high bitrate.
- VIDEO_STREAM_LOW (1): Low-quality video stream with low resolution and low bitrate.
- channelProfile
- Channel profile:
- CHANNEL_PROFILE_COMMUNICATION (0): Communication profile. Agora recommends using the live broadcast profile for better audio and video experience.
- CHANNEL_PROFILE_LIVE_BROADCASTING (1): Live broadcast profile (default).
- CHANNEL_PROFILE_GAME (2): Game profile. This profile is deprecated. Use CHANNEL_PROFILE_LIVE_BROADCASTING instead.
- CHANNEL_PROFILE_CLOUD_GAMING (3): Interactive profile. This profile is optimized for low latency and suitable for scenarios requiring frequent interaction between users. This profile is deprecated. Use CHANNEL_PROFILE_LIVE_BROADCASTING instead.
- audioDelayMs
- Delay (in milliseconds) for sending audio frames. You can use this parameter to synchronize audio and video. To disable delay, set this value to 0.
- mediaPlayerAudioDelayMs
- Delay (in milliseconds) for sending media player audio frames, used for explicit audio-video synchronization. To disable delay, set this value to 0.
- token
- (Optional) The token generated by your server for authentication.
Note: This parameter is only effective when calling updateChannelMediaOptions or updateChannelMediaOptionsEx. Ensure that the App ID, channel name, and user name used to generate the token are consistent with those used in create to initialize the RTC engine and in joinChannel and joinChannelEx to join the channel.
- enableBuiltInMediaEncryption
-
Note: This setting is ignored when calling updateChannelMediaOptions.Whether to enable media packet encryption:
true: Enable media packet encryption.false: (Default) Do not enable media packet encryption.
- publishRhythmPlayerTrack
- Whether to publish the metronome sound to remote users:
true: Publish the processed audio frames so both local and remote users can hear the metronome.false: Do not publish the metronome sound; only the local user can hear it.
- isInteractiveAudience
-
Note: This parameter is only applicable in co-hosting scenarios. A co-host must call joinChannelEx to join another host's channel as an audience and set isInteractiveAudience toWhether to enable interactive mode:
true. This parameter is only effective when the user role is CLIENT_ROLE_AUDIENCE.true: Enable interactive mode.false: Do not enable interactive mode.
- customVideoTrackId
- The video track ID returned by calling the createCustomVideoTrack method. Default is 0.
- isAudioFilterable
-
Note: To enable this feature, contact technical support.Whether the published audio stream is filtered based on volume algorithm:
true: The audio stream will be filtered.false: The audio stream will not be filtered.
- startPreview
- Whether to start preview when joining the channel if the canvas is already set:
true: (Default) Start preview when joining the channel.false: Do not start preview.
- enableMultipath
-
Note: Permissions and system requirements: Android 7.0 or later (API level 24 or higher), requiresWhether to enable multipath transmission:
ACCESS_NETWORK_STATEandCHANGE_NETWORK_STATEpermissions.- true: Enable multipath transmission.
- false: Disable multipath transmission.
- uplinkMultipathMode
- Uplink transmission mode. See MultipathMode.
Note: To use this parameter, ensure
enableMultipathis set to true. - downlinkMultipathMode
- Downlink transmission mode. See MultipathMode.
Note: To use this parameter, ensure
enableMultipathis set to true. - preferMultipathType
- Preferred transmission path type. See MultipathType.
Note: To use this parameter, ensure
enableMultipathis set to true.