Agora Java API Reference for Android
|
Inherits io.agora.rtc.mediaio.IVideoFrameConsumer.
Public Member Functions | |
boolean | onInitialize () |
boolean | onStart () |
void | onStop () |
void | onDispose () |
long | getEGLContextHandle () |
int | getBufferType () |
int | getPixelFormat () |
![]() | |
void | consumeByteBufferFrame (ByteBuffer buffer, int format, int width, int height, int rotation, long timestamp) |
void | consumeByteArrayFrame (byte[] data, int format, int width, int height, int rotation, long timestamp) |
void | consumeTextureFrame (int textureId, int format, int width, int height, int rotation, long timestamp, float[] matrix) |
The IVideoSink interface.
By default, when you try to enable real-time communications, the Agora SDK enables the default video sink to start video rendering. However, by calling the setLocalVideoRenderer
and setRemoteVideoRenderer
methods, you can change the default video sink.
The IVideoSink
interface defines a set of protocols to create a customized video sink and pass it to the media engine to replace the default video renderer.
Once you implement this interface, you receive callbacks from the media engine indicating the state of the custom video sink and the underlying media engine and to enable their synchronization. Follow each callback to handle the resource allocation and to release and receive the video frame from the media engine.
boolean io.agora.rtc.mediaio.IVideoSink.onInitialize | ( | ) |
Initializes the video sink.
This callback initializes the video sink. You can also initialize the video sink before calling this callback and return @ true to the media engine in this callback. You need to pass true
or false
in this callback to tell the media engine if the video sink is initialized.
boolean io.agora.rtc.mediaio.IVideoSink.onStart | ( | ) |
Enables the video sink.
This SDK triggers this callback when the media engine starts streaming.
void io.agora.rtc.mediaio.IVideoSink.onStop | ( | ) |
Stops the video sink.
The SDK triggers this callback when the media engine stops video streaming. You should then stop the video sink.
void io.agora.rtc.mediaio.IVideoSink.onDispose | ( | ) |
Releases the video source.
The SDK triggers this callback when the media engine wants to release the video sink.
long io.agora.rtc.mediaio.IVideoSink.getEGLContextHandle | ( | ) |
Gets EGLContextHandle.
This callback returns the native handle of EGLContext if you use OpenGL and have your own EGLContext. You can share your EGLContext using the Texture ID returned by the SDK in your own EGLContext. If you do not have EGLContext, this callback returns 0; if the buffer type is set to Texture, the media engine creates EGLContext internally and return the Texture ID.
int io.agora.rtc.mediaio.IVideoSink.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.
Video buffer type
int io.agora.rtc.mediaio.IVideoSink.getPixelFormat | ( | ) |
Gets the pixel format.
The SDK triggers this callback to get the pixel format of the video frame when it is being initialized. You need to specify one pixel format and then pass it to the media engine. Choose the YUV (YUV420P) or RGBA format if the custom sink expects ByteArray or ByteBuffer; choose Texture of the custom expects textured frames.
Pixel format