setVideoOrientation method

Future<int?> setVideoOrientation(
  1. VideoOrientation orientation
)

@detail api @hiddensdk(audiosdk) @author wangjunlin.3182 @brief Sets the orientation of the video frame before custom video processing and encoding. The default value is Adaptive.
You should set the orientation to Portrait when using video effects or custom processing.
You should set the orientation to Portrait or Landscape when pushing a single stream to the CDN. @param orientation Orientation of the video frame. See VideoOrientation{@link #VideoOrientation}. @return - 0: Success. - < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details @note - The orientation setting is only applicable to internal captured video sources. For custom captured video sources, setting the video frame orientation may result in errors, such as swapping width and height. Screen sources do not support video frame orientation setting. - We recommend setting the orientation before joining room. The updates of encoding configurations and the orientation are asynchronous, therefore can cause a brief malfunction in preview if you change the orientation after joining room.

Implementation

Future<int?> setVideoOrientation(VideoOrientation orientation) async {
  $a() => ($instance as $p_a.RTCEngine)
      .setVideoOrientation(t_VideoOrientation.code_to_android(orientation));
  $i() => ($instance as $p_i.ByteRTCEngine)
      .setVideoOrientation(t_VideoOrientation.code_to_ios(orientation));

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