enableFaceDetection method

Future<int?> enableFaceDetection(
  1. IFaceDetectionObserver observer,
  2. int interval,
  3. string modelPath
)

@detail api @author wangjunlin.3182 @brief 开启人脸识别功能,并设置人脸检测结果回调观察者。
此观察者后,你会周期性收到 onFaceDetectResult{@link #IFaceDetectionObserver#onFaceDetectResult} 回调。 @param observer 人脸检测结果回调观察者,参看 IFaceDetectionObserver{@link #IFaceDetectionObserver}。 @param intervalMs 两次回调之间的最小时间间隔,必须大于 0,单位为毫秒。实际收到回调的时间间隔大于 interval_ms,小于 interval_ms+视频采集帧间隔。 @param faceModelPath 人脸检测算法模型文件路径,一般为 ttfacemodel 文件夹中 tt_face_vXXX.model 文件的绝对路径。 @return - 0: 调用成功。 - –1000: 未集成特效 SDK。 - –1001: 特效 SDK 不支持该功能。 - –1002: 特效 SDK 版本不兼容。 - -1004: 初始化中,初始化完成后启动此功能。 - < 0: 调用失败,错误码对应具体描述参看 错误码表

Implementation

Future<int?> enableFaceDetection(
    IFaceDetectionObserver observer, int interval, string modelPath) async {
  $a() => ($instance as $p_a.IVideoEffect).enableFaceDetection(
      packObject(observer, () => android_IFaceDetectionObserver()),
      interval,
      modelPath);
  $i() => ($instance as $p_i.ByteRTCVideoEffect).enableFaceDetection(
      packObject(observer, () => ios_IFaceDetectionObserver()),
      interval,
      modelPath);

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