enableFaceDetection method

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

@detail api @author wangjunlin.3182 @brief Starts face detection and registers the observer for the result.
With this observer, you will receive onFaceDetectResult{@link #IFaceDetectionObserver#onFaceDetectResult} periodically. @param observer See IFaceDetectionObserver{@link #IFaceDetectionObserver}. @param intervalMs The minimum time interval between two callbacks in milliseconds. The value should be greater than 0. The actual time interval is between interval_ms and interval_ms+the time slot of a captured video frame. @param faceModelPath The absolute path of the face detection algorithm file. Typically it is the tt_face_vXXX.model file in the ttfacemodel folder. @return - 0: Success. - –1000: The Effects SDK is not integrated. - –1001: This API is unavailable for your Effects SDK. - –1002: Your Effects SDK's version is incompatible. - -1004: Initializing. This function will be available when the initialization is completed. - < 0: Other error. See error code table for specific instructions.

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