ChannelMediaOptions
频道媒体设置选项。
@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.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}); @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: '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; factory ChannelMediaOptions.fromJson(Map<String, dynamic> json) => _$ChannelMediaOptionsFromJson(json); Map<String, dynamic> toJson() => _$ChannelMediaOptionsToJson(this); }
true
; publishCameraTrack、publishScreenCaptureVideopublishScreenTrack、publishCustomVideoTrack 或 publishEncodedVideoTrack 之中同一时间只能有一个为 true
。
注意: 建议你根据业务场景自行设置成员参数值,否则 SDK 会自动对成员参数进行赋值。
属性
- publishCameraTrack
- 设置是否发布摄像头采集的视频:
true
:发布摄像头采集的视频。false
:不发布摄像头采集的视频。
- publishSecondaryCameraTrack
- 设置是否发布第二个摄像头采集的视频:
true
:发布第二个摄像头采集的视频。false
:不发布第二个摄像头采集的视频。
- publishMicrophoneTrack
- 设置是否发布麦克风采集到的音频:
true
:发布麦克风采集到的音频。false
:不发布麦克风采集到的音频。
- publishThirdCameraTrack
- 设置是否发布第三个摄像头采集的视频:
true
:发布第三个摄像头采集的视频。false
:不发布第三个摄像头采集的视频。
注意: 该参数仅适用于 Windows 和 macOS 平台。 - publishFourthCameraTrack
- 设置是否发布第四个摄像头采集的视频:
true
:发布第四个摄像头采集的视频。false
:不发布第四个摄像头采集的视频。
注意: 该参数仅适用于 Windows 和 macOS 平台。 - publishScreenTrack
-
设置是否发布屏幕采集的视频:
true
:发布屏幕采集到的视频。false
:不发布屏幕采集到的视频。
注意: 该参数仅适用于 Windows 和 macOS 平台。 - publishScreenCaptureVideo
-
设置是否发布屏幕采集的视频:
true
:发布屏幕采集到的视频。false
:不发布屏幕采集到的视频。
注意: 该参数仅适用于 Android 和 iOS 平台。 - publishScreenCaptureAudio
-
设置是否发布屏幕采集的音频:
true
:发布屏幕采集到的音频。false
:不发布屏幕采集到的音频。
注意: 该参数仅适用于 Android 和 iOS 平台。 - publishSecondaryScreenTrack
- 设置是否发布第二个屏幕采集的视频:
true
:发布第二个屏幕采集到的视频。false
:不发布第二个屏幕采集到的视频。
- publishThirdScreenTrack
- 设置是否发布第三个屏幕采集的视频:
true
:发布第三个屏幕采集到的视频。false
:不发布第三个屏幕采集到的视频。
注意: 该参数仅适用于 Windows 和 macOS 平台。 - publishFourthScreenTrack
- 设置是否发布第四个屏幕采集的视频:
true
:发布第四个屏幕采集到的视频。false
:不发布第四个屏幕采集到的视频。
注意: 该参数仅适用于 Windows 和 macOS 平台。 - publishTranscodedVideoTrack
- 设置是否发布本地的转码视频:
true
:发布本地的转码视频。false
:不发布本地的转码视频。
- publishCustomAudioTrack
- 设置是否发布自定义采集的音频:
true
:发布自定义采集到的音频。false
:不发布自定义采集到的音频。
- publishCustomAudioTrackId
- 待发布的自定义音频轨道的 ID。默认值为 0。
如果你已在 setExternalAudioSource 中设置了 sourceNumber 大于 1,SDK 会创建对应数量的自采集音频轨道,并从 0 开始为每一个音频轨道分配一个 ID。
- publishCustomVideoTrack
- 设置是否发布自定义采集的视频:
true
:发布自定义采集的视频。false
:不发布自定义采集到的视频。
- publishEncodedVideoTrack
- 设置是否发布编码后的视频:
true
:发布编码后的视频 。false
:不发布编码后的视频。
- publishMediaPlayerAudioTrack
- 设置是否发布媒体播放器的音频:
true
:发布媒体播放器的音频。false
:不发布媒体播放器的音频。
- publishMediaPlayerVideoTrack
- 设置是否发布媒体播放器的视频:
true
:发布媒体播放器的视频。false
:不发布媒体播放器的视频。
- autoSubscribeAudio
- 设置是否自动订阅所有音频流:
true
:自动订阅所有音频流。false
:不自动订阅任何音频流。
- autoSubscribeVideo
- 设置是否自动订阅所有视频流:
true
:自动订阅所有视频流。false
:不自动订阅任何视频流。
- enableAudioRecordingOrPlayout
- 设置是否开启音频录制或播放:
true
:开启音频录制或播放。-
false
:不开启音频录制或播放。
注: 如果那你需要发布麦克风采集的音频流,请确保该参数设为true
。 - publishMediaPlayerId
- 待发布的媒体播放器的 ID。默认值为 0。
- clientRoleType
- 用户角色。详见 ClientRoleType。
- audienceLatencyLevel
- 观众端延时级别。详见 AudienceLatencyLevelType。
- defaultVideoStreamType
-
默认订阅的视频流类型: VideoStreamType。
- channelProfile
-
频道使用场景。详见 ChannelProfileType。
- token
-
(可选)在服务端生成的用于鉴权的动态密钥。详见。
警告:- 该参数仅在调用 updateChannelMediaOptions 或 updateChannelMediaOptionsEx 时生效。
- 请确保用于生成 token 的 App ID、频道名和用户名和 initialize 方法初始化引擎时用的 App ID,以及 joinChannel 或 joinChannelEx 方法加入频道时设置的频道名和用户名是一致的。
- publishRhythmPlayerTrack
- 设置是否发布虚拟节拍器声音至远端:
true
:发布。本地用户和远端用户都能听到节拍器。false
:不发布。只有本地用户能听到节拍器。
- isInteractiveAudience
- 是否开启互动观众模式:
true
:开启互动观众模式。成功开启后,本地用户作为互动观众,收到低延时和流畅的远端用户视频。false
:不开启互动观众模式。本地用户作为普通观众,收到默认设置的远端用户视频。
注意:- 该参数用于实现跨直播间连麦场景。连麦主播需要调用 joinChannelEx 方法,以观众身份加入对方的直播间,并将 isInteractiveAudience 设置为
true
。 - 仅当用户角色为 clientRoleAudience 时,该参数生效。
- customVideoTrackId
- 调用 createCustomVideoTrack 方法返回的视频轨道 ID。默认值为 0。
- isAudioFilterable
- 设置是否让当前音频流根据音强算法参与选流。
true
:参与音强选流。如未开启音强选流功能,该参数不会生效。false
:不参与音强选流。
注意: 如需启用该功能,请联系 sales@agora.io。