ChannelMediaOptions

  • Flutter

更新时间不可用

频道媒体设置选项。

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<String, dynamic> json) =>
      _$ChannelMediaOptionsFromJson(json);

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

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

注: 建议你根据业务场景自行设置成员参数值,否则 SDK 会自动对成员参数进行赋值。

属性

参数名描述
publishCameraTrack

设置是否发布摄像头采集的视频:

  • true:发布摄像头采集的视频。
  • false:不发布摄像头采集的视频。
publishSecondaryCameraTrack

设置是否发布第二个摄像头采集的视频:

  • true:发布第二个摄像头采集的视频。
  • false:不发布第二个摄像头采集的视频。
publishMicrophoneTrack

设置是否发布麦克风采集到的音频:

  • true:发布麦克风采集到的音频。
  • false:不发布麦克风采集到的音频。
publishThirdCameraTrack

注: 该参数仅适用于 Android、Windows 和 macOS 平台。

设置是否发布第三个摄像头采集的视频:

  • true:发布第三个摄像头采集的视频。
  • false:不发布第三个摄像头采集的视频。
publishFourthCameraTrack

注: 该参数仅适用于 Android、Windows 和 macOS 平台。

设置是否发布第四个摄像头采集的视频:

  • true:发布第四个摄像头采集的视频。
  • false:不发布第四个摄像头采集的视频。
publishScreenTrack

注: 该参数仅适用于 Windows 和 macOS 平台。

设置是否发布屏幕采集的视频:

  • true:发布屏幕采集到的视频。
  • false:不发布屏幕采集到的视频。
publishScreenCaptureVideo

注: 该参数仅适用于 Android 和 iOS 平台。

设置是否发布屏幕采集的视频:

  • true:发布屏幕采集到的视频。
  • false:不发布屏幕采集到的视频。
publishScreenCaptureAudio

注: 该参数仅适用于 Android 和 iOS 平台。

设置是否发布屏幕采集的音频:

  • true:发布屏幕采集到的音频。
  • false:不发布屏幕采集到的音频。
publishSecondaryScreenTrack

设置是否发布第二个屏幕采集的视频:

  • true:发布第二个屏幕采集到的视频。
  • false:不发布第二个屏幕采集到的视频。
publishThirdScreenTrack

注: 该参数仅适用于 Windows 和 macOS 平台。

设置是否发布第三个屏幕采集的视频:

  • true:发布第三个屏幕采集到的视频。
  • false:不发布第三个屏幕采集到的视频。
publishFourthScreenTrack

注: 该参数仅适用于 Windows 和 macOS 平台。

设置是否发布第四个屏幕采集的视频:

  • true:发布第四个屏幕采集到的视频。
  • false:不发布第四个屏幕采集到的视频。
publishTranscodedVideoTrack

设置是否发布本地的转码视频:

  • true:发布本地的转码视频。
  • false:不发布本地的转码视频。
publishMixedAudioTrack

设置是否发布本地混音音频:

  • true:发布本地混音音频。
  • false:不发布本地混音音频。
publishLipSyncTrack

设置是否发布语音驱动插件处理后的视频:

  • true:发布语音驱动插件处理后的视频。
  • false:(默认)不发布语音驱动插件处理后的视频。
publishCustomAudioTrack

设置是否发布自定义采集的音频:

  • true:发布自定义采集到的音频。
  • false:不发布自定义采集到的音频。
publishCustomAudioTrackId

待发布的自定义音频轨道的 ID,默认值为 0。你可以通过 createCustomAudioTrack 方法来获取自定义音频轨道 ID。

publishCustomVideoTrack

设置是否发布自定义采集的视频:

  • true:发布自定义采集的视频。
  • false:不发布自定义采集到的视频。
publishEncodedVideoTrack

设置是否发布编码后的视频:

  • true:发布编码后的视频。
  • false:不发布编码后的视频。
publishMediaPlayerAudioTrack

设置是否发布媒体播放器的音频:

  • true:发布媒体播放器的音频。
  • false:不发布媒体播放器的音频。
publishMediaPlayerVideoTrack

设置是否发布媒体播放器的视频:

  • true:发布媒体播放器的视频。
  • false:不发布媒体播放器的视频。
autoSubscribeAudio

设置是否自动订阅所有音频流:

  • true:自动订阅所有音频流。
  • false:不自动订阅任何音频流。
autoSubscribeVideo

设置是否自动订阅所有视频流:

  • true:自动订阅所有视频流。
  • false:不自动订阅任何视频流。
enableAudioRecordingOrPlayout

注: 如果那你需要发布麦克风采集的音频流,请确保该参数设为 true。

设置是否开启音频录制或播放:

  • true:开启音频录制或播放。
  • false:不开启音频录制或播放。
publishMediaPlayerId

待发布的媒体播放器的 ID。默认值为 0。

clientRoleType

用户角色。详见 ClientRoleType。

audienceLatencyLevel

观众端延时级别。详见 AudienceLatencyLevelType。

defaultVideoStreamType

默认订阅的视频流类型: VideoStreamType。

channelProfile

频道使用场景。详见 ChannelProfileType。

audioDelayMs

发送音频帧的延时(毫秒)。你可以通过该参数来设置需要发送的音频帧的延时,以确保音画同步。 如果要关闭延时,将此参数值设置为 0。

token

(可选)在服务端生成的用于鉴权的动态密钥。详见使用 Token 鉴权。

注:

publishRhythmPlayerTrack

设置是否发布虚拟节拍器声音至远端:

  • true:发布。本地用户和远端用户都能听到节拍器。
  • false:不发布。只有本地用户能听到节拍器。
isInteractiveAudience

注:

  • 该参数用于实现跨直播间连麦场景。连麦主播需要调用 joinChannelEx 方法,以观众身份加入对方的直播间,并将 isInteractiveAudience 设置为 true。
  • 仅当用户角色为 clientRoleAudience 时,该参数生效。

是否开启互动观众模式:

  • true:开启互动观众模式。成功开启后,本地用户作为互动观众,收到低延时和流畅的远端用户视频。
  • false:不开启互动观众模式。本地用户作为普通观众,收到默认设置的远端用户视频。
customVideoTrackId

调用 createCustomVideoTrack 方法返回的视频轨道 ID。默认值为 0。

isAudioFilterable

注: 如需启用该功能,请联系销售。

设置是否让当前音频流根据音强算法参与选流。

  • true:参与音强选流。如未开启音强选流功能,该参数不会生效。
  • false:不参与音强选流。
enableMultipath

注: 权限和系统要求:

  • Android:Android 7.0 或更高版本(API 级别 24 或更高),需要 ACCESS_NETWORK_STATE 和 CHANGE_NETWORK_STATE 权限。
  • iOS:iOS 12.0 或更高版本。
  • macOS:10.14 或更高版本。
  • Windows:Windows Vista 或更高版本。

是否启用多路径传输:

  • true:启用多路径传输。
  • false:禁用多路径传输。
preferMultipathType

首选的传输路径类型。详见 MultipathType。

注: 使用该参数时,请确保已将 enableMultipath 设置为 true。

表格内容超出当前宽度,可横向滚动查看更多列。

这个页面有帮助吗?