# ChannelMediaOptions (/zh-CN/api-reference/rtc/flutter/class-channelmediaoptions)
> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).
```dart
@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 json) =>
_$ChannelMediaOptionsFromJson(json);
Map toJson() => _$ChannelMediaOptionsToJson(this);
}
```
[RtcConnection](/zh-CN/api-reference/rtc/flutter/class-rtcconnection)
`publishMicrophoneTrack`
`publishCustomAudioTrack`
`publishMediaPlayerAudioTrack`
true
`publishCameraTrack`
`publishScreenCaptureVideo`、
`publishScreenTrack`、
`publishCustomVideoTrack`
`publishEncodedVideoTrack`
true
:::note
注: 建议你根据业务场景自行设置成员参数值,否则 SDK 会自动对成员参数进行赋值。
:::
## 属性 [#属性]
设置是否发布摄像头采集的视频:
- true:发布摄像头采集的视频。
- false:不发布摄像头采集的视频。
设置是否发布第二个摄像头采集的视频:
- true:发布第二个摄像头采集的视频。
- false:不发布第二个摄像头采集的视频。
设置是否发布麦克风采集到的音频:
- true:发布麦克风采集到的音频。
- false:不发布麦克风采集到的音频。
:::note
注: 该参数仅适用于 Android、Windows 和 macOS 平台。
:::
设置是否发布第三个摄像头采集的视频:
- true:发布第三个摄像头采集的视频。
- false:不发布第三个摄像头采集的视频。
:::note
注: 该参数仅适用于 Android、Windows 和 macOS 平台。
:::
设置是否发布第四个摄像头采集的视频:
- true:发布第四个摄像头采集的视频。
- false:不发布第四个摄像头采集的视频。
:::note
注: 该参数仅适用于 Windows 和 macOS 平台。
:::
设置是否发布屏幕采集的视频:
- true:发布屏幕采集到的视频。
- false:不发布屏幕采集到的视频。
:::note
注: 该参数仅适用于 Android 和 iOS 平台。
:::
设置是否发布屏幕采集的视频:
- true:发布屏幕采集到的视频。
- false:不发布屏幕采集到的视频。
:::note
注: 该参数仅适用于 Android 和 iOS 平台。
:::
设置是否发布屏幕采集的音频:
- true:发布屏幕采集到的音频。
- false:不发布屏幕采集到的音频。
设置是否发布第二个屏幕采集的视频:
- true:发布第二个屏幕采集到的视频。
- false:不发布第二个屏幕采集到的视频。
:::note
注: 该参数仅适用于 Windows 和 macOS 平台。
:::
设置是否发布第三个屏幕采集的视频:
- true:发布第三个屏幕采集到的视频。
- false:不发布第三个屏幕采集到的视频。
:::note
注: 该参数仅适用于 Windows 和 macOS 平台。
:::
设置是否发布第四个屏幕采集的视频:
- true:发布第四个屏幕采集到的视频。
- false:不发布第四个屏幕采集到的视频。
设置是否发布本地的转码视频:
- true:发布本地的转码视频。
- false:不发布本地的转码视频。
设置是否发布本地混音音频:
- true:发布本地混音音频。
- false:不发布本地混音音频。
设置是否发布语音驱动插件处理后的视频:
- true:发布语音驱动插件处理后的视频。
- false:(默认)不发布语音驱动插件处理后的视频。
设置是否发布自定义采集的音频:
- true:发布自定义采集到的音频。
- false:不发布自定义采集到的音频。
待发布的自定义音频轨道的 ID,默认值为 0。你可以通过 [createCustomAudioTrack](/zh-CN/api-reference/rtc/flutter/audio/audio-custom-capturenrendering#api_imediaengine_createcustomaudiotrack) 方法来获取自定义音频轨道 ID。
设置是否发布自定义采集的视频:
- true:发布自定义采集的视频。
- false:不发布自定义采集到的视频。
设置是否发布编码后的视频:
- true:发布编码后的视频。
- false:不发布编码后的视频。
设置是否发布媒体播放器的音频:
- true:发布媒体播放器的音频。
- false:不发布媒体播放器的音频。
设置是否发布媒体播放器的视频:
- true:发布媒体播放器的视频。
- false:不发布媒体播放器的视频。
设置是否自动订阅所有音频流:
- true:自动订阅所有音频流。
- false:不自动订阅任何音频流。
设置是否自动订阅所有视频流:
- true:自动订阅所有视频流。
- false:不自动订阅任何视频流。
:::note
注: 如果那你需要发布麦克风采集的音频流,请确保该参数设为 true。
:::
设置是否开启音频录制或播放:
- true:开启音频录制或播放。
- false:不开启音频录制或播放。
待发布的媒体播放器的 ID。默认值为 0。
用户角色。详见 [ClientRoleType](/zh-CN/api-reference/rtc/flutter/enum-clientroletype)。
观众端延时级别。详见 [AudienceLatencyLevelType](/zh-CN/api-reference/rtc/flutter/enum-audiencelatencyleveltype)。
默认订阅的视频流类型: [VideoStreamType](/zh-CN/api-reference/rtc/flutter/enum-videostreamtype)。
频道使用场景。详见 [ChannelProfileType](/zh-CN/api-reference/rtc/flutter/enum-channelprofiletype)。
发送音频帧的延时(毫秒)。你可以通过该参数来设置需要发送的音频帧的延时,以确保音画同步。
如果要关闭延时,将此参数值设置为 0。
(可选)在服务端生成的用于鉴权的动态密钥。详见[使用 Token 鉴权](/zh-CN/realtime-media/rtc/build/setup-and-access/token-authentication)。
:::note
注:
- 该参数仅在调用 [updateChannelMediaOptions](/zh-CN/api-reference/rtc/flutter/channel#api_irtcengine_updatechannelmediaoptions) 或 [updateChannelMediaOptionsEx](/zh-CN/api-reference/rtc/flutter/channel#api_irtcengineex_updatechannelmediaoptionsex) 时生效。
- 请确保用于生成 token 的 App ID、频道名和用户名和 [initialize](/zh-CN/api-reference/rtc/flutter/initialize#api_irtcengine_initialize) 方法初始化引擎时用的 App ID,以及 [joinChannel](/zh-CN/api-reference/rtc/flutter/channel#api_irtcengine_joinchannel2) 或 [joinChannelEx](/zh-CN/api-reference/rtc/flutter/channel#api_irtcengineex_joinchannelex) 方法加入频道时设置的频道名和用户名是一致的。
:::
设置是否发布虚拟节拍器声音至远端:
- true:发布。本地用户和远端用户都能听到节拍器。
- false:不发布。只有本地用户能听到节拍器。
:::note
注:
- 该参数用于实现跨直播间连麦场景。连麦主播需要调用 [joinChannelEx](/zh-CN/api-reference/rtc/flutter/channel#api_irtcengineex_joinchannelex) 方法,以观众身份加入对方的直播间,并将 `isInteractiveAudience` 设置为 true。
- 仅当用户角色为 `clientRoleAudience` 时,该参数生效。
:::
是否开启互动观众模式:
- true:开启互动观众模式。成功开启后,本地用户作为互动观众,收到低延时和流畅的远端用户视频。
- false:不开启互动观众模式。本地用户作为普通观众,收到默认设置的远端用户视频。
调用 [createCustomVideoTrack](/zh-CN/api-reference/rtc/flutter/video/video-custom-capturenrendering#api_irtcengine_createcustomvideotrack) 方法返回的视频轨道 ID。默认值为 0。
:::note
注: 如需启用该功能,请[联系销售](https://www.shengwang.cn/contact-sales/)。
:::
设置是否让当前音频流根据音强算法参与选流。
- true:参与音强选流。如未开启音强选流功能,该参数不会生效。
- false:不参与音强选流。
:::note
注: 权限和系统要求:
- Android:Android 7.0 或更高版本(API 级别 24 或更高),需要 ACCESS_NETWORK_STATE 和 CHANGE_NETWORK_STATE 权限。
- iOS:iOS 12.0 或更高版本。
- macOS:10.14 或更高版本。
- Windows:Windows Vista 或更高版本。
:::
是否启用多路径传输:
- true:启用多路径传输。
- false:禁用多路径传输。
首选的传输路径类型。详见 [MultipathType](/zh-CN/api-reference/rtc/flutter/enum-multipathtype)。
:::note
注: 使用该参数时,请确保已将 `enableMultipath` 设置为 true。
:::