Agora Java API Reference for Android
|
Classes | |
interface | FrameListener |
Public Member Functions | |
EglRenderer (String name) | |
void | init (final EglBase.Context sharedContext, final int[] configAttributes, RendererCommon.GlDrawer drawer) |
EglBase.Context | getEglContext () |
void | createEglSurface (Surface surface) |
void | createEglSurface (SurfaceTexture surfaceTexture) |
void | release () |
void | printStackTrace () |
void | setMirror (final boolean mirror) |
void | setLayoutAspectRatio (float layoutAspectRatio) |
void | setFpsReduction (float fps) |
void | disableFpsReduction () |
void | pauseVideo () |
void | addFrameListener (final FrameListener listener, final float scale) |
void | addFrameListener (final FrameListener listener, final float scale, final RendererCommon.GlDrawer drawerParam) |
void | addFrameListener (final FrameListener listener, final float scale, final RendererCommon.GlDrawer drawerParam, final boolean applyFpsReduction) |
void | removeFrameListener (final FrameListener listener) |
void | renderFrame (VideoFrame frame) |
void | onFrame (VideoFrame frame) |
void | releaseEglSurface (final Runnable completionCallback) |
void | clearImage () |
void | clearImage (final float r, final float g, final float b, final float a) |
Implements org.webrtc.VideoRenderer.Callbacks by displaying the video stream on an EGL Surface. This class is used as a helper class for rendering on SurfaceViews and TextureViews.
io.agora.rtc.gl.EglRenderer.EglRenderer | ( | String | name | ) |
Standard constructor. The name will be used for the render thread name and included when logging. In order to render something, you must first call init() and createEglSurface.
void io.agora.rtc.gl.EglRenderer.init | ( | final EglBase.Context | sharedContext, |
final int [] | configAttributes, | ||
RendererCommon.GlDrawer | drawer | ||
) |
void io.agora.rtc.gl.EglRenderer.release | ( | ) |
Block until any pending frame is returned and all GL resources released, even if an interrupt occurs. If an interrupt occurs during release(), the interrupt flag will be set. This function should be called before the Activity is destroyed and the EGLContext is still valid. If you don't call this function, the GL resources might leak.
void io.agora.rtc.gl.EglRenderer.setMirror | ( | final boolean | mirror | ) |
Set if the video stream should be mirrored or not.
void io.agora.rtc.gl.EglRenderer.setLayoutAspectRatio | ( | float | layoutAspectRatio | ) |
Set layout aspect ratio. This is used to crop frames when rendering to avoid stretched video. Set this to 0 to disable cropping.
void io.agora.rtc.gl.EglRenderer.setFpsReduction | ( | float | fps | ) |
Limit render framerate.
fps | Limit render framerate to this value, or use Float.POSITIVE_INFINITY to disable fps reduction. |
void io.agora.rtc.gl.EglRenderer.addFrameListener | ( | final FrameListener | listener, |
final float | scale | ||
) |
Registers a callback to invoke when a new video frame is received. This version uses the drawer of the EglRenderer passed in init.
listener | The callback to invoke. The callback will be invoked on the render thread. It should be lightweight and must not call removeFrameListener. |
scale | The scale of the Bitmap passed to the callback, or 0 if no Bitmap is required. |
void io.agora.rtc.gl.EglRenderer.addFrameListener | ( | final FrameListener | listener, |
final float | scale, | ||
final RendererCommon.GlDrawer | drawerParam | ||
) |
Registers a callback to invoke when a new video frame has been received.
listener | The callback to invoke. The callback will be invoked on the render thread. It should be lightweight and must not call removeFrameListener. |
scale | The scale of the Bitmap passed to the callback, or 0 if no Bitmap is required. |
drawerParam | Custom drawer to use for this frame listener or null to use the default one. |
void io.agora.rtc.gl.EglRenderer.addFrameListener | ( | final FrameListener | listener, |
final float | scale, | ||
final RendererCommon.GlDrawer | drawerParam, | ||
final boolean | applyFpsReduction | ||
) |
Registers a callback to invoke when a new video frame has been received.
listener | The callback to invoke. The callback will be invoked on the render thread. It should be lightweight and must not call removeFrameListener. |
scale | The scale of the Bitmap passed to the callback, or 0 if no Bitmap is required. |
drawerParam | Custom drawer to use for this frame listener or null to use the default one. |
applyFpsReduction | This callback will not be called for frames that have been dropped by FPS reduction. |
void io.agora.rtc.gl.EglRenderer.removeFrameListener | ( | final FrameListener | listener | ) |
Remove any pending callback that was added with addFrameListener. If the callback is not in the queue, nothing happens. It is ensured that callback won't be called after this method returns.
listener | The callback to remove. |
void io.agora.rtc.gl.EglRenderer.releaseEglSurface | ( | final Runnable | completionCallback | ) |
Release EGL surface. This function will block until the EGL surface is released.
void io.agora.rtc.gl.EglRenderer.clearImage | ( | ) |
Post a task to clear the surface to a transparent uniform color.
void io.agora.rtc.gl.EglRenderer.clearImage | ( | final float | r, |
final float | g, | ||
final float | b, | ||
final float | a | ||
) |
Post a task to clear the surface to a specific color.