TextureOverlay
@UnstableApi
public abstract class TextureOverlay
BitmapOverlay |
Creates |
CanvasOverlay |
A |
DrawableOverlay |
Creates a |
LottieOverlay |
A |
TextOverlay |
Creates a |
Creates overlays from OpenGL textures.
Summary
Public constructors |
|---|
Public methods |
|
|---|---|
void |
Set up resources for the overlay given the input video’s dimensions. |
OverlaySettings |
getOverlaySettings(long presentationTimeUs)Returns the |
abstract int |
getTextureId(long presentationTimeUs)Returns the overlay texture identifier displayed at the specified timestamp. |
abstract Size |
getTextureSize(long presentationTimeUs)Returns the pixel width and height of the overlay texture displayed at the specified timestamp. |
float[] |
getVertexTransformation(long presentationTimeUs)Returns a 4x4 OpenGL matrix, controlling how the vertices of the overlay are displayed at the specified timestamp. |
void |
release()Releases all resources. |
Public constructors
Public methods
configure
public void configure(Size videoSize)
Set up resources for the overlay given the input video’s dimensions.
This method will be called before drawing the first frame and before drawing subsequent frames with different input dimensions.
| Parameters | |
|---|---|
Size videoSize |
The width and height of the input video, in pixels. |
getOverlaySettings
public OverlaySettings getOverlaySettings(long presentationTimeUs)
Returns the OverlaySettings controlling how the overlay is displayed at the specified timestamp.
| Parameters | |
|---|---|
long presentationTimeUs |
The presentation timestamp of the current frame, in microseconds. |
getTextureId
public abstract int getTextureId(long presentationTimeUs)
Returns the overlay texture identifier displayed at the specified timestamp.
| Parameters | |
|---|---|
long presentationTimeUs |
The presentation timestamp of the current frame, in microseconds. |
| Throws | |
|---|---|
androidx.media3.common.VideoFrameProcessingException |
If an error occurs while processing or drawing the frame. |
getTextureSize
public abstract Size getTextureSize(long presentationTimeUs)
Returns the pixel width and height of the overlay texture displayed at the specified timestamp.
This method must be called after getTextureId.
| Parameters | |
|---|---|
long presentationTimeUs |
The presentation timestamp of the current frame, in microseconds. |
getVertexTransformation
public float[] getVertexTransformation(long presentationTimeUs)
Returns a 4x4 OpenGL matrix, controlling how the vertices of the overlay are displayed at the specified timestamp.
Applied before overlay settings.
| Parameters | |
|---|---|
long presentationTimeUs |
The presentation timestamp of the current frame, in microseconds. |
release
public void release()
Releases all resources.
| Throws | |
|---|---|
androidx.media3.common.VideoFrameProcessingException |
If an error occurs while releasing resources. |