Agora Java API Reference for Android

Public Member Functions | List of all members
agora::media::base::IVideoFrameObserver Class Referenceabstract

`#include <AgoraMediaBase.h>`

## Public Member Functions
virtual void | onFrame (const VideoFrame *frame)=0
| Occurs each time the player receives a video frame. More...
virtual bool | isExternal ()
virtual VIDEO_PIXEL_FORMAT | getVideoFormatPreference ()
| Sets the format of the raw video data output by the SDK. More...

## Detailed Description

The IVideoFrameObserver class.

## Member Function Documentation

## ◆ onFrame()

virtual void agora::media::base::IVideoFrameObserver::onFrame | ( | const VideoFrame * | frame | ) |
| pure virtual

Occurs each time the player receives a video frame.

After registering the video frame observer, the callback occurs every time the player receives a video frame, reporting the detailed information of the video frame.

Parameters

  frame | The video frame information. See VideoFrame.

## ◆ getVideoFormatPreference()

virtual VIDEO_PIXEL_FORMAT agora::media::base::IVideoFrameObserver::getVideoFormatPreference | ( |  | ) |
| virtual

Sets the format of the raw video data output by the SDK.

You need to register the callback when calling the `registerVideoFrameObserver` method. After you successfully register the video frame observer, the SDK triggers this callback each time it receives a video frame. You need to set your preferred video data in the return value of this callback.

Note
  The default types of pixel format ( VIDEO_PIXEL_DEFAULT ) for the raw video are as follows:
  - On the Android platform, the default video frame type may be I420Buffer or TextureBuffer. The texture format of TextureBuffer type may be OES or RGB. If the returned video frame type is VIDEO_PIXEL_DEFAULT when you call `getVideoFormatPreference`, you need to adapt to I420Buffer or TextureBuffer when processing video data. The cases where the video frame type is fixed as I420Buffer include but are not limited to:
    - Specific devices, such as: LG G5 SE (H848), Google Pixel 4a, Samsung Galaxy A7, or Xiaomi Mi Max.
    - Image enhancement extension has been integrated and video noise reduction or low-light enhancement function has been enabled.
  - On iOS and macOS platforms, the default video frame type may be I420 or CVPixelBufferRef.
  - On Windows platforms, the default video frame type is YUV420.

Returns
  Sets the raw data format of the SDK output. See `VIDEO_PIXEL_FORMAT`.