Agora Java API Reference for Android

Public Member Functions | List of all members
agora::rtc::ICameraCaptureObserver Class Reference

`#include <NGIAgoraCameraCapturer.h>`

## Public Member Functions
virtual void | onCameraFocusAreaChanged (int imageWidth, int imageHeight, int x, int y)
virtual void | onFacePositionChanged (int imageWidth, int imageHeight, const Rectangle *vecRectangle, const int *vecDistance, int numFaces)
virtual void | onCameraExposureAreaChanged (int x, int y, int width, int height)
virtual void | onCameraStateChanged (ICameraCapturer::CAMERA_STATE state, ICameraCapturer::CAMERA_SOURCE source)

## Detailed Description

The ICameraCaptureObserver class, which handles camera capture events.

## Member Function Documentation

## ◆ onCameraFocusAreaChanged()

virtual void agora::rtc::ICameraCaptureObserver::onCameraFocusAreaChanged | ( | int | imageWidth,
|  | int | imageHeight,
|  | int | x,
|  | int | y
| ) |  |
| virtual

Occurs when the camera focus area changes.

Note
  The SDK triggers this callback when the local user changes the camera focus position by calling the setCameraFocus method.

Parameters

  imageWidth | Width of the changed camera focus area.
  imageHeight | Height of the changed camera focus area.
  x | x coordinate of the changed camera focus area.
  y | y coordinate of the changed camera focus area.

## ◆ onFacePositionChanged()

virtual void agora::rtc::ICameraCaptureObserver::onFacePositionChanged | ( | int | imageWidth,
|  | int | imageHeight,
|  | const Rectangle * | vecRectangle,
|  | const int * | vecDistance,
|  | int | numFaces
| ) |  |
| virtual

Reports the face detection result of the local user. Applies to Android and iOS only.

Once you enable face detection by calling setCameraFaceDetection (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 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.

Parameters

  imageWidth | The width (px) of the local video.
  imageHeight | The height (px) of the local video.
  vecRectangle | A Rectangle array of length 'numFaces', which represents the position and size of the human face on the local video： `x`: The x coordinate (px) of the human face in the local video. Taking the top left corner of the captured video as the origin, the x coordinate represents the relative lateral displacement of the top left corner of the human face to the origin. `y`: The y coordinate (px) of the human face in the local video. Taking the top left corner of the captured video as the origin, the y coordinate represents the relative longitudinal displacement of the top left corner of the human face to the origin. `width`: The width (px) of the human face in the captured video. `height`: The height (px) of the human face in the captured video.
  vecDistance | An int array of length 'numFaces', which represents distance (cm) between the human face and the screen.
  numFaces | The number of faces detected. If the value is 0, it means that no human face is detected.

## ◆ onCameraExposureAreaChanged()

virtual void agora::rtc::ICameraCaptureObserver::onCameraExposureAreaChanged | ( | int | x,
|  | int | y,
|  | int | width,
|  | int | height
| ) |  |
| virtual

Occurs when the camera exposure area changes.

The SDK triggers this callback when the local user changes the camera exposure position by calling the setCameraExposurePosition method.

Note
  This callback is for Android and iOS only.

Parameters

  x | x coordinate of the changed camera exposure area.
  y | y coordinate of the changed camera exposure area.
  width | Width of the changed camera exposure area.
  height | Height of the changed camera exposure area.