Agora Java API Reference for Android
Classes | Public Member Functions | List of all members
io.agora.rtc.mediaio.AgoraBufferedCamera2 Class Reference
Inheritance diagram for io.agora.rtc.mediaio.AgoraBufferedCamera2:
io.agora.rtc.mediaio.CameraSource io.agora.rtc.mediaio.IVideoSource

Classes

class  CompareSizesByArea
 

Public Member Functions

 AgoraBufferedCamera2 (Context context)
 
 AgoraBufferedCamera2 (Context context, CaptureParameters parameters)
 
void useFrontCamera (boolean front)
 
boolean onInitialize (IVideoFrameConsumer consumer)
 
boolean onStart ()
 
void onStop ()
 
void onDispose ()
 
int getBufferType ()
 

Additional Inherited Members

- Protected Attributes inherited from io.agora.rtc.mediaio.CameraSource
IVideoFrameConsumer consumer
 

Member Function Documentation

◆ onInitialize()

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

Initializes the video source.

This callback initializes the video source. You can enable the camera or initialize the video source and then pass one of the following return values to inform the media engine whether the video source is ready.

Parameters
consumerThe IVideoFrameConsumer object which the media engine passes back. You need to reserve this object and pass the video frame to the media engine through this object once the video source is initialized. See the following contents for the definition of IVideoFrameConsumer.
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 media engine.
Returns
  • true: The external video source is initialized.
  • false: The external video source is not ready or fails to initialize, the media engine stops and reports the error.

Implements io.agora.rtc.mediaio.IVideoSource.

◆ onStart()

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

Enables the video source.

The SDK triggers this callback when the underlying media engine is ready to start video streaming. You should start the video source to capture the video frame. Once the frame is ready, use IVideoFrameConsumer to consume the video frame.

Returns
  • true: The external video source is enabled and the SDK calls IVideoFrameConsumer to receive video frames.
  • false: The external video source is not ready or fails to enable, the media engine stops and reports the error.

Implements io.agora.rtc.mediaio.IVideoSource.

◆ onStop()

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

Stops the video source.

The SDK triggers this callback when the media engine stops streaming. You should then stop capturing and consuming the video frame. After calling this method, the video frames are discarded by the media engine.

Implements io.agora.rtc.mediaio.IVideoSource.

◆ onDispose()

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

Releases the video source.

The SDK triggers this callback when IVideoFrameConsumer is released by the media engine. You can now release the video source as well as IVideoFrameConsumer.

Implements io.agora.rtc.mediaio.IVideoSource.

◆ getBufferType()

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

Gets the buffer type.

The SDK triggers this callback to get the buffer type of the video frame when it is being initialized. You need to specify one buffer type and then pass it to the media engine.

Returns
Video buffer type

Implements io.agora.rtc.mediaio.IVideoSource.