Agora Java API Reference for Android
Public Member Functions | Public Attributes | List of all members
io.agora.rtc2.video.IVideoFrameObserver Interface Reference

Public Member Functions

boolean onCaptureVideoFrame (VideoFrame videoFrame)
 
boolean onScreenCaptureVideoFrame (VideoFrame videoFrame)
 
boolean onMediaPlayerVideoFrame (VideoFrame videoFrame, int mediaPlayerId)
 
boolean onRenderVideoFrame (String channelId, int uid, VideoFrame videoFrame)
 
int getVideoFrameProcessMode ()
 
int getVideoFormatPreference ()
 
int getRotationApplied ()
 
boolean getMirrorApplied ()
 

Public Attributes

int PROCESS_MODE_READ_ONLY = 0
 
int PROCESS_MODE_READ_WRITE = 1
 

Member Function Documentation

◆ onCaptureVideoFrame()

boolean io.agora.rtc2.video.IVideoFrameObserver.onCaptureVideoFrame ( VideoFrame  videoFrame)

Occurs each time the SDK receives a video frame captured by the local camera.

After you successfully register the video frame observer, the SDK triggers this callback each time a video frame is received. In this callback, you can get the video data captured by the local camera. You can then pre-process the data according to your scenarios.

After pre-processing, you can send the processed video data back to the SDK by setting the videoFrame parameter in this callback.

Note
This callback does not support sending processed RGBA video data back to the SDK.
Parameters
videoFrameA pointer to the video frame.
Returns
Determines whether to ignore the current video frame if the pre-processing fails:
  • true: Do not ignore.
  • false: Ignore, in which case this method does not send the current video frame to the SDK.

◆ onScreenCaptureVideoFrame()

boolean io.agora.rtc2.video.IVideoFrameObserver.onScreenCaptureVideoFrame ( VideoFrame  videoFrame)

Occurs each time the SDK receives a video frame captured by the screen.

After you successfully register the video frame observer, the SDK triggers this callback each time a video frame is received. In this callback, you can get the video data captured by the screen. You can then pre-process the data according to your scenarios.

After pre-processing, you can send the processed video data back to the SDK by setting the videoFrame parameter in this callback.

Parameters
videoFrameA pointer to the video frame: VideoFrame
Returns
Determines whether to ignore the current video frame if the pre-processing fails:
  • true: Do not ignore.
  • false: Ignore, in which case this method does not sent the current video frame to the SDK.

◆ onMediaPlayerVideoFrame()

boolean io.agora.rtc2.video.IVideoFrameObserver.onMediaPlayerVideoFrame ( VideoFrame  videoFrame,
int  mediaPlayerId 
)

Occurs each time the SDK receives a video frame decoded by the MediaPlayer.

After you successfully register the video frame observer, the SDK triggers this callback each time a video frame is decoded. In this callback, you can get the video data decoded by the MediaPlayer. You can then pre-process the data according to your scenarios.

After pre-processing, you can send the processed video data back to the SDK by setting the videoFrame parameter in this callback.

Parameters
videoFrameA pointer to the video frame: VideoFrame
mediaPlayerIdof the mediaPlayer.
Returns
Determines whether to ignore the current video frame if the pre-processing fails:
  • true: Do not ignore.
  • false: Ignore, in which case this method does not sent the current video frame to the SDK.

◆ onRenderVideoFrame()

boolean io.agora.rtc2.video.IVideoFrameObserver.onRenderVideoFrame ( String  channelId,
int  uid,
VideoFrame  videoFrame 
)

Occurs each time the SDK receives a video frame sent by the remote user.

After you successfully register the video frame observer, the SDK triggers this callback each time a video frame is received. In this callback, you can get the video data sent by the remote user. You can then post-process the data according to your scenarios.

After post-processing, you can send the processed data back to the SDK by setting the videoFrame parameter in this callback.

Note
This callback does not support sending processed RGBA video data back to the SDK.
Parameters
channelIdChannel name.
uidID of the remote user who sends the current video frame.
videoFrameA pointer to the video frame.
Returns
Determines whether to ignore the current video frame if the post-processing fails:
  • true: Do not ignore.
  • false: Ignore, in which case this method does not send the current video frame to the SDK.

◆ getVideoFrameProcessMode()

int io.agora.rtc2.video.IVideoFrameObserver.getVideoFrameProcessMode ( )

Indicate the video frame mode of the observer.

Returns
PROCESS_MODE_READ_ONLY or PROCESS_MODE_READ_WRITE

◆ getRotationApplied()

int io.agora.rtc2.video.IVideoFrameObserver.getRotationApplied ( )

Occurs each time needs to get rotation angle.

Returns
rotation angle.

◆ getMirrorApplied()

boolean io.agora.rtc2.video.IVideoFrameObserver.getMirrorApplied ( )

Occurs each time needs to get whether mirror is applied or not.

Returns
Determines whether to mirror.
  • true: need to mirror.
  • false: no mirror.

Member Data Documentation

◆ PROCESS_MODE_READ_ONLY

int io.agora.rtc2.video.IVideoFrameObserver.PROCESS_MODE_READ_ONLY = 0

Observer works as a pure renderer and will not modify the original frame.

◆ PROCESS_MODE_READ_WRITE

int io.agora.rtc2.video.IVideoFrameObserver.PROCESS_MODE_READ_WRITE = 1

Observer works as a filter that will process the video frame and affect the following frame processing in SDK.