Public Member Functions

boolean onInitialize (IVideoFrameConsumer consumer)
 
boolean onStart ()
 
void onStop ()
 
void onDispose ()
 
int getBufferType ()
 
int getCaptureType ()
 
int getContentHint ()
 

Detailed Description

The IVideoSource interface. Used when calling setVideoSource to set a custom video source.

Member Function Documentation

◆ onInitialize()

boolean io.agora.rtc.mediaio.IVideoSource.onInitialize ( IVideoFrameConsumer  consumer)

Notification for initializing the custom video source.

The SDK triggers this callback to remind you to initialize the custom video source. After receiving this callback, you can do some preparation, such as enabling the camera, and then use the return value to tell the SDK whether the custom video source is prepared.

Note
When initializing the video source, you need to specify a buffer type in the getBufferType method and pass the video source in the specified type to the SDK.
Parameters
consumerAn IVideoFrameConsumer object that the SDK passes to you. You need to reserve this object and use it to send the video frame to the SDK once the custom video source is started.
Returns
  • true: The custom video source is initialized.
  • false: The custom video source is not ready or fails to initialize. The SDK stops and reports the error.

◆ onStart()

boolean io.agora.rtc.mediaio.IVideoSource.onStart ( )

Notification for starting the custom video source.

The SDK triggers this callback to remind you to start the custom video source for capturing video. The SDK uses IVideoFrameConsumer to receive the video frame that you capture after the video source is started. You must use the return value to tell the SDK whether the custom video source is started.

Returns
  • true: The custom video source is started.
  • false: The custom video source fails to start. The SDK stops and reports the error.

◆ onStop()

void io.agora.rtc.mediaio.IVideoSource.onStop ( )

Notification for stopping capturing video.

The SDK triggers this callback to remind you to stop capturing video. This callback tells you that the SDK is about to stop using IVideoFrameConsumer to receive the video frame that you capture.

◆ onDispose()

void io.agora.rtc.mediaio.IVideoSource.onDispose ( )

Notification for disabling the custom video source.

The SDK triggers this callback to remind you to disable the custom video source device. This callback tells you that the SDK is about to release the IVideoFrameConsumer object. Ensure that you no longer use IVideoFrameConsumer after receiving this callback.

◆ getBufferType()

int io.agora.rtc.mediaio.IVideoSource.getBufferType ( )

Gets the video frame type.

Before you initialize the custom video source, the SDK triggers this callback to query the video frame type. You must specify the video frame type in the return value and then pass it to the SDK.

Returns
Video buffer type.

◆ getCaptureType()

int io.agora.rtc.mediaio.IVideoSource.getCaptureType ( )

Gets the capture type of the custom video source.

Since
3.1.0

Before you initialize the custom video source, the SDK triggers this callback to query the capture type of the video source. You must specify the capture type in the return value and then pass it to the SDK. The SDK enables the corresponding video processing algorithm according to the capture type after receiving the video frame.

Returns
Video capture type.

◆ getContentHint()

int io.agora.rtc.mediaio.IVideoSource.getContentHint ( )

Gets the content hint of the custom video source.

Since
3.1.0

If you specify the custom video source as a screen-sharing video, the SDK triggers this callback to query the content hint of the video source before you initialize the video source. You must specify the content hint in the return value and then pass it to the SDK. The SDK enables the corresponding video processing algorithm according to the content hint after receiving the video frame.

Returns
Video content hint.