Agora RTC Objective-C API Reference Refactor

Public Member Functions
IVideoFrameObserver Class Referenceabstract

## Public Member Functions
virtual void | onFrame (const VideoFrame *frame)=0
virtual VIDEO_PIXEL_FORMAT | getVideoFormatPreference ()

## Detailed Description

The IVideoFrameObserver class.

## Constructor & Destructor Documentation

## ◆ ~IVideoFrameObserver()

virtual ~IVideoFrameObserver | ( |  | ) |
| inline virtual

## Member Function Documentation

## ◆ onFrame()

virtual void 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.

## ◆ isExternal()

virtual bool isExternal | ( |  | ) |
| inline virtual

## ◆ getVideoFormatPreference()

virtual VIDEO_PIXEL_FORMAT getVideoFormatPreference | ( |  | ) |
| inline 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`.