setLocalSimulcastMode method

Future<int?> setLocalSimulcastMode(
  1. VideoSimulcastMode mode,
  2. List<VideoEncoderConfig> streamConfig
)

@valid since 3.60. @detail api @brief Enable the Simulcast feature and configure the lower-quality video streams settings. @param mode Whether to publish lower-quality streams and how many of them to be published. See VideoSimulcastMode{@link #VideoSimulcastMode}. By default, it is set to Single, where the publisher sends the video in a single profile. In the other modes, the low-quality stream is set to a default resolution of 160px × 90px with a bitrate of 50Kbps. @param streamConfig The specification of the lower quality stream. You can configure up to three low-quality streams for a video source. See VideoEncoderConfig{@link #VideoEncoderConfig}. The resolution of the lower quality stream must be smaller than the standard stream set via setVideoEncoderConfig{@link #RTCEngine#setVideoEncoderConfig}. The specifications in the array must be arranged in ascending order based on resolution. In the other modes, the low-quality stream is set to a default resolution of 160px × 90px with a bitrate of 50Kbps. @return - 0: Success. - < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details. @note - The default specification of the video stream is 640px × 360px @15fps. - The method applies to the camera video only. - Refer to Simulcasting for more information.

Implementation

Future<int?> setLocalSimulcastMode(
    VideoSimulcastMode mode, List<VideoEncoderConfig> streamConfig) async {
  $a() => ($instance as $p_a.RTCEngine).setLocalSimulcastMode(
      t_VideoSimulcastMode.code_to_android(mode),
      streamConfig
          .map(($item) => unpackObject<$p_a.VideoEncoderConfig>($item))
          .toList());
  $i() => ($instance as $p_i.ByteRTCEngine).setLocalSimulcastMode(
      t_VideoSimulcastMode.code_to_ios(mode),
      streamConfig
          .map(($item) => unpackObject<$p_i.ByteRTCVideoEncoderConfig>($item))
          .toList());

  if (Platform.isAndroid) {
    return $a();
  } else if (Platform.isIOS) {
    return $i();
  } else {
    throw UnsupportedError(
        'Not Support Platform ${Platform.operatingSystem}');
  }
}