setVideoOrientation method

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

@detail api @hiddensdk(audiosdk) @author wangjunlin.3182 @brief 在自定义视频前处理及编码前,设置 RTC 链路中的视频帧朝向,默认为 Adaptive 模式。
移动端开启视频特效贴纸,或使用自定义视频前处理时,建议固定视频帧朝向为 Portrait 模式。单流转推场景下,建议根据业务需要固定视频帧朝向为 Portrait 或 Landscape 模式。不同模式的具体显示效果参看视频帧朝向。 @param orientation 视频帧朝向,参看 VideoOrientation{@link #VideoOrientation}。 @return - 0: 调用成功。 - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 @note - 视频帧朝向设置仅适用于内部采集视频源。对于自定义采集视频源,设置视频帧朝向可能会导致错误,例如宽高对调。屏幕源不支持设置视频帧朝向。 - 编码分辨率的更新与视频帧处理是异步操作,进房后切换视频帧朝向可能导致画面出现短暂的裁切异常,因此建议在进房前设置视频帧朝向,且不在进房后进行切换。

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}');
  }
}