TextureOverlay


@UnstableApi
abstract class TextureOverlay

Known direct subclasses
Known indirect subclasses
DrawableOverlay

Creates a TextureOverlay from Drawable.

TextOverlay

Creates a TextureOverlay from text.


Creates overlays from OpenGL textures.

Summary

Public constructors

Public functions

Unit
configure(videoSize: Size!)

Set up resources for the overlay given the input video’s dimensions.

OverlaySettings!
getOverlaySettings(presentationTimeUs: Long)

Returns the OverlaySettings controlling how the overlay is displayed at the specified timestamp.

abstract Int
getTextureId(presentationTimeUs: Long)

Returns the overlay texture identifier displayed at the specified timestamp.

abstract Size!
getTextureSize(presentationTimeUs: Long)

Returns the pixel width and height of the overlay texture displayed at the specified timestamp.

FloatArray<Float>!
getVertexTransformation(presentationTimeUs: Long)

Returns a 4x4 OpenGL matrix, controlling how the vertices of the overlay are displayed at the specified timestamp.

Unit

Releases all resources.

Public constructors

TextureOverlay

TextureOverlay()

Public functions

configure

fun configure(videoSize: Size!): Unit

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
videoSize: Size!

The width and height of the input video, in pixels.

getOverlaySettings

fun getOverlaySettings(presentationTimeUs: Long): OverlaySettings!

Returns the OverlaySettings controlling how the overlay is displayed at the specified timestamp.

Parameters
presentationTimeUs: Long

The presentation timestamp of the current frame, in microseconds.

getTextureId

abstract fun getTextureId(presentationTimeUs: Long): Int

Returns the overlay texture identifier displayed at the specified timestamp.

Parameters
presentationTimeUs: Long

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

abstract fun getTextureSize(presentationTimeUs: Long): Size!

Returns the pixel width and height of the overlay texture displayed at the specified timestamp.

This method must be called after getTextureId.

Parameters
presentationTimeUs: Long

The presentation timestamp of the current frame, in microseconds.

getVertexTransformation

fun getVertexTransformation(presentationTimeUs: Long): FloatArray<Float>!

Returns a 4x4 OpenGL matrix, controlling how the vertices of the overlay are displayed at the specified timestamp.

Applied before overlay settings.

Parameters
presentationTimeUs: Long

The presentation timestamp of the current frame, in microseconds.

release

fun release(): Unit

Releases all resources.

Throws
androidx.media3.common.VideoFrameProcessingException

If an error occurs while releasing resources.