facePositionChanged property

FacePositionCallback? facePositionChanged
getter/setter pair

Reports the face detection result of the local user.

Once you enable face detection by calling RtcEngine.enableFaceDetection, 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 video.
  • The distance between the human face and the device screen. This value is based on the fitting calculation of the local video size and the position of the human face.

Note

  • If the SDK does not detect a face, it reduces the frequency of this callback 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 distance value reported in this callback may be slightly different from the actual distance. Therefore, Agora does not recommend using it for accurate calculation.

The FacePositionCallback typedef includes the following parameters:

  • int imageWidth: The width (px) of the local video.
  • int imageHeight: The height (px) of the local video.
  • List<FacePositionInfo> faces: The information of the detected human face. For details, see FacePositionInfo. The number of the FacePositionInfo array depends on the number of human faces detected. If the array length is 0, it means that no human face is detected.

Implementation

FacePositionCallback? facePositionChanged;