ChannelMediaOptions

Channel media configuration options.

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class ChannelMediaOptions {
  const ChannelMediaOptions(
      {this.publishCameraTrack,
      this.publishSecondaryCameraTrack,
      this.publishThirdCameraTrack,
      this.publishFourthCameraTrack,
      this.publishMicrophoneTrack,
      this.publishScreenCaptureVideo,
      this.publishScreenCaptureAudio,
      this.publishScreenTrack,
      this.publishSecondaryScreenTrack,
      this.publishThirdScreenTrack,
      this.publishFourthScreenTrack,
      this.publishCustomAudioTrack,
      this.publishCustomAudioTrackId,
      this.publishCustomVideoTrack,
      this.publishEncodedVideoTrack,
      this.publishMediaPlayerAudioTrack,
      this.publishMediaPlayerVideoTrack,
      this.publishTranscodedVideoTrack,
      this.publishMixedAudioTrack,
      this.publishLipSyncTrack,
      this.autoSubscribeAudio,
      this.autoSubscribeVideo,
      this.enableAudioRecordingOrPlayout,
      this.publishMediaPlayerId,
      this.clientRoleType,
      this.audienceLatencyLevel,
      this.defaultVideoStreamType,
      this.channelProfile,
      this.audioDelayMs,
      this.mediaPlayerAudioDelayMs,
      this.token,
      this.enableBuiltInMediaEncryption,
      this.publishRhythmPlayerTrack,
      this.isInteractiveAudience,
      this.customVideoTrackId,
      this.isAudioFilterable,
      this.parameters});

  @JsonKey(name: 'publishCameraTrack')
  final bool? publishCameraTrack;

  @JsonKey(name: 'publishSecondaryCameraTrack')
  final bool? publishSecondaryCameraTrack;

  @JsonKey(name: 'publishThirdCameraTrack')
  final bool? publishThirdCameraTrack;

  @JsonKey(name: 'publishFourthCameraTrack')
  final bool? publishFourthCameraTrack;

  @JsonKey(name: 'publishMicrophoneTrack')
  final bool? publishMicrophoneTrack;

  @JsonKey(name: 'publishScreenCaptureVideo')
  final bool? publishScreenCaptureVideo;

  @JsonKey(name: 'publishScreenCaptureAudio')
  final bool? publishScreenCaptureAudio;

  @JsonKey(name: 'publishScreenTrack')
  final bool? publishScreenTrack;

  @JsonKey(name: 'publishSecondaryScreenTrack')
  final bool? publishSecondaryScreenTrack;

  @JsonKey(name: 'publishThirdScreenTrack')
  final bool? publishThirdScreenTrack;

  @JsonKey(name: 'publishFourthScreenTrack')
  final bool? publishFourthScreenTrack;

  @JsonKey(name: 'publishCustomAudioTrack')
  final bool? publishCustomAudioTrack;

  @JsonKey(name: 'publishCustomAudioTrackId')
  final int? publishCustomAudioTrackId;

  @JsonKey(name: 'publishCustomVideoTrack')
  final bool? publishCustomVideoTrack;

  @JsonKey(name: 'publishEncodedVideoTrack')
  final bool? publishEncodedVideoTrack;

  @JsonKey(name: 'publishMediaPlayerAudioTrack')
  final bool? publishMediaPlayerAudioTrack;

  @JsonKey(name: 'publishMediaPlayerVideoTrack')
  final bool? publishMediaPlayerVideoTrack;

  @JsonKey(name: 'publishTranscodedVideoTrack')
  final bool? publishTranscodedVideoTrack;

  @JsonKey(name: 'publishMixedAudioTrack')
  final bool? publishMixedAudioTrack;

  @JsonKey(name: 'autoSubscribeAudio')
  final bool? autoSubscribeAudio;

  @JsonKey(name: 'autoSubscribeVideo')
  final bool? autoSubscribeVideo;

  @JsonKey(name: 'enableAudioRecordingOrPlayout')
  final bool? enableAudioRecordingOrPlayout;

  @JsonKey(name: 'publishMediaPlayerId')
  final int? publishMediaPlayerId;

  @JsonKey(name: 'clientRoleType')
  final ClientRoleType? clientRoleType;

  @JsonKey(name: 'audienceLatencyLevel')
  final AudienceLatencyLevelType? audienceLatencyLevel;

  @JsonKey(name: 'defaultVideoStreamType')
  final VideoStreamType? defaultVideoStreamType;

  @JsonKey(name: 'channelProfile')
  final ChannelProfileType? channelProfile;

  @JsonKey(name: 'audioDelayMs')
  final int? audioDelayMs;

  @JsonKey(name: 'mediaPlayerAudioDelayMs')
  final int? mediaPlayerAudioDelayMs;

  @JsonKey(name: 'token')
  final String? token;

  @JsonKey(name: 'enableBuiltInMediaEncryption')
  final bool? enableBuiltInMediaEncryption;

  @JsonKey(name: 'publishRhythmPlayerTrack')
  final bool? publishRhythmPlayerTrack;

  @JsonKey(name: 'isInteractiveAudience')
  final bool? isInteractiveAudience;

  @JsonKey(name: 'customVideoTrackId')
  final int? customVideoTrackId;

  @JsonKey(name: 'isAudioFilterable')
  final bool? isAudioFilterable;
  @JsonKey(name: 'enableMultipath')
  final bool? enableMultipath;
  @JsonKey(name: 'uplinkMultipathMode')
  final MultipathMode? uplinkMultipathMode;
  @JsonKey(name: 'downlinkMultipathMode')
  final MultipathMode? downlinkMultipathMode;
  @JsonKey(name: 'preferMultipathType')
  final MultipathType? preferMultipathType;

  @JsonKey(name: 'parameters')
  final String? parameters;

  factory ChannelMediaOptions.fromJson(Map<String, dynamic> json) =>
      _$ChannelMediaOptionsFromJson(json);

  Map<String, dynamic> toJson() => _$ChannelMediaOptionsToJson(this);
}

RtcConnection publishMicrophoneTrack publishCustomAudioTrack publishMediaPlayerAudioTrack true publishCameraTrack publishScreenCaptureVideo, publishScreenTrack, publishCustomVideoTrack publishEncodedVideoTrack true

Note: It is recommended that you configure the member parameters based on your business scenario. Otherwise, the SDK automatically assigns values to them.

Properties

publishCameraTrack
Sets 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
Sets 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
Sets 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.
publishThirdCameraTrack
Note: This parameter is only applicable to Android, Windows, and macOS platforms.
Sets 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.
publishFourthCameraTrack
Note: This parameter is only applicable to Android, Windows, and macOS platforms.
Sets 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.
publishScreenTrack
Note: This parameter is only applicable to Windows and macOS platforms.
Sets whether to publish the video captured from the screen:
  • true: Publish the screen-captured video.
  • false: Do not publish the screen-captured video.
publishScreenCaptureVideo
Note: This parameter is only applicable to Android and iOS platforms.
Sets whether to publish the video captured from the screen:
  • true: Publish the screen-captured video.
  • false: Do not publish the screen-captured video.
publishScreenCaptureAudio
Note: This parameter is only applicable to Android and iOS platforms.
Sets whether to publish the audio captured from the screen:
  • true: Publish the screen-captured audio.
  • false: Do not publish the screen-captured audio.
publishSecondaryScreenTrack
Sets 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
Note: This parameter is only applicable to Windows and macOS platforms.
Sets whether to publish the video captured from the third screen:
  • true: Publish the video captured from the third screen.
  • false: Do not publish the video captured from the third screen.
publishFourthScreenTrack
Note: This parameter is only applicable to Windows and macOS platforms.
Sets whether to publish the video captured from the fourth screen:
  • true: Publish the video captured from the fourth screen.
  • false: Do not publish the video captured from the fourth screen.
publishTranscodedVideoTrack
Sets whether to publish the local transcoded video:
  • true: Publish the local transcoded video.
  • false: Do not publish the local transcoded video.
publishMixedAudioTrack
Sets whether to publish the local audio mixing:
  • true: Publish the local audio mixing.
  • false: Do not publish the local audio mixing.
publishLipSyncTrack
Sets whether to publish the video processed by the voice-driven plugin:
  • true: Publish the video processed by the voice-driven plugin.
  • false: (Default) Do not publish the video processed by the voice-driven plugin.
publishCustomAudioTrack
Sets whether to publish custom captured audio:
  • true: Publish the custom captured audio.
  • false: Do not publish the custom captured audio.
publishCustomAudioTrackId
ID of the custom audio track to be published. Default is 0. You can get the custom audio track ID via the createCustomAudioTrack method.
publishCustomVideoTrack
Sets whether to publish custom captured video:
  • true: Publish the custom captured video.
  • false: Do not publish the custom captured video.
publishEncodedVideoTrack
Sets whether to publish the encoded video:
  • true: Publish the encoded video.
  • false: Do not publish the encoded video.
publishMediaPlayerAudioTrack
Sets whether to publish the audio from the media player:
  • true: Publish the media player's audio.
  • false: Do not publish the media player's audio.
publishMediaPlayerVideoTrack
Sets whether to publish the video from the media player:
  • true: Publish the media player's video.
  • false: Do not publish the media player's video.
autoSubscribeAudio
Sets whether to automatically subscribe to all audio streams:
  • true: Automatically subscribe to all audio streams.
  • false: Do not automatically subscribe to any audio streams.
autoSubscribeVideo
Sets whether to automatically subscribe to all video streams:
  • true: Automatically subscribe to all video streams.
  • false: Do not automatically subscribe to any video streams.
enableAudioRecordingOrPlayout
Note: If you need to publish the audio stream captured by the microphone, make sure this parameter is set to true.
Sets whether to enable audio recording or playback:
  • true: Enable audio recording or playback.
  • false: Do not enable audio recording or playback.
publishMediaPlayerId
ID of the media player to be published. Default is 0.
clientRoleType
User role. See ClientRoleType.
audienceLatencyLevel
Audience latency level. See AudienceLatencyLevelType.
defaultVideoStreamType
Default video stream type to subscribe to: VideoStreamType.
channelProfile
Channel profile. See ChannelProfileType.
audioDelayMs
Delay (in milliseconds) for sending audio frames. You can use this parameter to delay the audio frames to ensure audio-video synchronization. To disable the delay, set this parameter to 0.
token
(Optional) A dynamic key generated on the server for authentication. See Token Authentication.
Note:
publishRhythmPlayerTrack
Sets whether to publish the virtual metronome sound to remote users:
  • true: Publish. Both local and remote users can hear the metronome.
  • false: Do not publish. Only the local user can hear the metronome.
isInteractiveAudience
Note:
  • This parameter is used for cross-room co-hosting scenarios. The co-host needs to call joinChannelEx to join the other host's channel as an audience member and set isInteractiveAudience to true.
  • This parameter only takes effect when the user role is clientRoleAudience.
Whether to enable interactive audience mode:
  • true: Enable interactive audience mode. Once enabled, the local user, as an interactive audience member, receives low-latency and smooth remote video.
  • false: Do not enable interactive audience mode. The local user receives remote video with default settings as a regular audience member.
customVideoTrackId
Video track ID returned by the createCustomVideoTrack method. Default is 0.
isAudioFilterable
Note: To enable this feature, please [contact sales](mailto:support@agora.io).
Sets whether the current audio stream participates in stream selection based on audio volume algorithm.
  • true: Participate in audio volume-based stream selection. If the feature is not enabled, this parameter has no effect.
  • false: Do not participate in audio volume-based stream selection.
enableMultipath
Note: Permissions and system requirements:
  • Android: Android 7.0 or higher (API level 24+), requires ACCESS_NETWORK_STATE and CHANGE_NETWORK_STATE permissions.
  • iOS: iOS 12.0 or higher.
  • macOS: 10.14 or higher.
  • Windows: Windows Vista or higher.
Whether to enable multipath transmission:
  • true: Enable multipath transmission.
  • false: Disable multipath transmission.
uplinkMultipathMode
Uplink transmission mode. See MultipathMode.
Note: When using this parameter, make sure enableMultipath is set to true.
downlinkMultipathMode
Downlink transmission mode. See MultipathMode.
Note: When using this parameter, make sure enableMultipath is set to true.
preferMultipathType
Preferred transmission path type. See MultipathType.
Note: When using this parameter, make sure enableMultipath is set to true.