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
imageWidthWidth of the changed camera focus area.
imageHeightHeight of the changed camera focus area.
xx coordinate of the changed camera focus area.
yy 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
imageWidthThe width (px) of the local video.
imageHeightThe height (px) of the local video.
vecRectangleThe 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.
vecDistanceThe distance (cm) between the human face and the screen.
numFacesThe 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
xx coordinate of the changed camera exposure area.
yy coordinate of the changed camera exposure area.
widthWidth of the changed camera exposure area.
heightHeight of the changed camera exposure area.