onFacePositionChanged property

(void Function(int imageWidth, int imageHeight, List<Rectangle> vecRectangle, List<int> vecDistance, int numFaces)?) onFacePositionChanged
final

Reports the face detection result of the local user. Once you enable face detection by calling enableFaceDetection (true), you can get the following information on the local user in real-time:The width and height of the local video.The position of the human face in the local view.The distance between the human face and the screen.This value is based on the fitting calculation of the local video size and the position of the human face.This callback is for Android and iOS only.When it is detected that the face in front of the camera disappears, the callback will be triggered immediately. When no human face is detected, the frequency of this callback to be rtriggered wil be decreased to reduce power consumption on the local device.The SDK stops triggering this callback when a human face is in close proximity to the screen.On Android, the value of distance reported in this callback may be slightly different from the actual distance. Therefore, Agora does not recommend using it for accurate calculation.

  • imageWidth The width (px) of the video image captured by the local camera.
  • imageHeight The height (px) of the video image captured by the local camera.
  • vecRectangle The information of the detected human face. See Rectangle .
  • vecDistance The distance between the human face and the device screen (cm).
  • numFaces The number of faces detected. If the value is 0, it means that no human face is detected.

Implementation

final void Function(
    int imageWidth,
    int imageHeight,
    List<Rectangle> vecRectangle,
    List<int> vecDistance,
    int numFaces)? onFacePositionChanged;