Agora Java API Reference for Android
|
Public Member Functions | |
AgoraTextureView (Context context) | |
AgoraTextureView (Context context, AttributeSet attrs) | |
void | init (EglBase.Context sharedContext) |
void | init (final EglBase.Context sharedContext, final int[] configAttributes, RendererCommon.GlDrawer drawer) |
long | getEGLContextHandle () |
void | setBufferType (MediaIO.BufferType bufferType) |
void | setPixelFormat (MediaIO.PixelFormat pixelFormat) |
void | setMirror (final boolean mirror) |
boolean | onInitialize () |
boolean | onStart () |
void | onStop () |
void | onDispose () |
void | consumeTextureFrame (int texId, int format, int width, int height, int rotation, long ts, float[] matrix) |
void | consumeByteBufferFrame (ByteBuffer buffer, int format, int width, int height, int rotation, long ts) |
void | consumeByteArrayFrame (byte[] data, int format, int width, int height, int rotation, long ts) |
int | getBufferType () |
int | getPixelFormat () |
void | onSurfaceTextureAvailable (SurfaceTexture surface, int width, int height) |
void | onSurfaceTextureSizeChanged (SurfaceTexture surface, int width, int height) |
boolean | onSurfaceTextureDestroyed (SurfaceTexture surface) |
void | onSurfaceTextureUpdated (SurfaceTexture surface) |
Protected Member Functions | |
void | onLayout (boolean changed, int left, int top, int right, int bottom) |
AgoraTextureView inherits TextureView and implements the IVideoSink interface to render video frames in YUV, RGB, and Texture (2D/OES).
void io.agora.rtc.mediaio.AgoraTextureView.init | ( | EglBase.Context | sharedContext | ) |
void io.agora.rtc.mediaio.AgoraTextureView.init | ( | final EglBase.Context | sharedContext, |
final int [] | configAttributes, | ||
RendererCommon.GlDrawer | drawer | ||
) |
long io.agora.rtc.mediaio.AgoraTextureView.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.
Implements io.agora.rtc.mediaio.IVideoSink.
boolean io.agora.rtc.mediaio.AgoraTextureView.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.
Implements io.agora.rtc.mediaio.IVideoSink.
boolean io.agora.rtc.mediaio.AgoraTextureView.onStart | ( | ) |
Enables the video sink.
This SDK triggers this callback when the media engine starts streaming.
Implements io.agora.rtc.mediaio.IVideoSink.
void io.agora.rtc.mediaio.AgoraTextureView.onStop | ( | ) |
Stops the video sink.
The SDK triggers this callback when the media engine stops video streaming. You should then stop the video sink.
Implements io.agora.rtc.mediaio.IVideoSink.
void io.agora.rtc.mediaio.AgoraTextureView.onDispose | ( | ) |
Releases the video source.
The SDK triggers this callback when the media engine wants to release the video sink.
Implements io.agora.rtc.mediaio.IVideoSink.
void io.agora.rtc.mediaio.AgoraTextureView.consumeTextureFrame | ( | int | textureId, |
int | format, | ||
int | width, | ||
int | height, | ||
int | rotation, | ||
long | timestamp, | ||
float [] | matrix | ||
) |
Receives the video frame in texture.
textureId | ID of the texture |
format | Pixel format of the video frame: |
width | Width of the video frame |
height | Height of the video frame |
rotation | Clockwise rotating angle (0, 90, 180, and 270 degrees) of the video frame |
timestamp | Timestamp of the video frame. For each video frame, you need to set a timestamp |
matrix | Matrix of the texture. The float value is between 0 and 1, such as 0.1, 0.2, and so on |
Implements io.agora.rtc.mediaio.IVideoFrameConsumer.
void io.agora.rtc.mediaio.AgoraTextureView.consumeByteBufferFrame | ( | ByteBuffer | buffer, |
int | format, | ||
int | width, | ||
int | height, | ||
int | rotation, | ||
long | timestamp | ||
) |
Receives the video frame in a byte buffer.
buffer | Video in the format of ByteBuffer |
format | Pixel format of the video frame: |
width | Width of the video frame |
height | Height of the video frame |
rotation | Clockwise rotating angle (0, 90, 180, and 270 degrees) of the video frame |
timestamp | Timestamp of the video frame. For each video frame, you need to set a timestamp |
Implements io.agora.rtc.mediaio.IVideoFrameConsumer.
void io.agora.rtc.mediaio.AgoraTextureView.consumeByteArrayFrame | ( | byte [] | data, |
int | format, | ||
int | width, | ||
int | height, | ||
int | rotation, | ||
long | timestamp | ||
) |
Receives the video frame in a byte array.
data | Video in the format of ByteArray |
format | Pixel format of the video frame: |
width | Width of the video frame |
height | Height of the video frame |
rotation | Clockwise rotating angle (0, 90, 180, and 270 degrees) of the video frame |
timestamp | Timestamp of the video frame. For each video frame, you need to set a timestamp |
Implements io.agora.rtc.mediaio.IVideoFrameConsumer.
int io.agora.rtc.mediaio.AgoraTextureView.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.
Implements io.agora.rtc.mediaio.IVideoSink.
int io.agora.rtc.mediaio.AgoraTextureView.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.
Implements io.agora.rtc.mediaio.IVideoSink.