@UnstableApi
abstract class TextOverlay : BitmapOverlay


Creates a TextureOverlay from text.

Uses a SpannableString to store the text and support advanced per-character text styling.

Summary

Constants

const Int

Public constructors

Public functions

java-static TextOverlay!

Creates a TextOverlay that shows the overlayText with the same default settings in OverlaySettings throughout the whole video.

java-static TextOverlay!
createStaticTextOverlay(
    overlayText: SpannableString!,
    overlaySettings: OverlaySettings!
)

Creates a TextOverlay that shows the overlayText with the same throughout the whole video.

Bitmap!
getBitmap(presentationTimeUs: Long)

Returns the overlay bitmap displayed at the specified timestamp.

abstract SpannableString!
getText(presentationTimeUs: Long)

Returns the overlay text displayed at the specified timestamp.

Inherited functions

From androidx.media3.effect.BitmapOverlay
java-static BitmapOverlay!

Creates a BitmapOverlay that shows the overlayBitmap in the same position and size throughout the whole video.

java-static BitmapOverlay!
createStaticBitmapOverlay(
    overlayBitmap: Bitmap!,
    overlaySettings: OverlaySettings!
)

Creates a BitmapOverlay that shows the overlayBitmap in the same throughout the whole video.

java-static BitmapOverlay!
createStaticBitmapOverlay(
    context: Context!,
    overlayBitmapUri: Uri!,
    overlaySettings: OverlaySettings!
)

Creates a BitmapOverlay that shows the input at overlayBitmapUri with the same OverlaySettings throughout the whole video.

Int
getTextureId(presentationTimeUs: Long)

Returns the overlay texture identifier displayed at the specified timestamp.

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.

From androidx.media3.effect.TextureOverlay
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.

Constants

TEXT_SIZE_PIXELS

const val TEXT_SIZE_PIXELS = 100: Int

Public constructors

TextOverlay

TextOverlay()

Public functions

createStaticTextOverlay

java-static fun createStaticTextOverlay(overlayText: SpannableString!): TextOverlay!

Creates a TextOverlay that shows the overlayText with the same default settings in OverlaySettings throughout the whole video.

createStaticTextOverlay

java-static fun createStaticTextOverlay(
    overlayText: SpannableString!,
    overlaySettings: OverlaySettings!
): TextOverlay!

Creates a TextOverlay that shows the overlayText with the same throughout the whole video.

Parameters
overlayText: SpannableString!

The text to overlay on the video.

overlaySettings: OverlaySettings!

The OverlaySettings configuring how the overlay is displayed on the frames.

getBitmap

fun getBitmap(presentationTimeUs: Long): Bitmap!

Returns the overlay bitmap 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.

getText

abstract fun getText(presentationTimeUs: Long): SpannableString!

Returns the overlay text displayed at the specified timestamp.

Parameters
presentationTimeUs: Long

The presentation timestamp of the current frame, in microseconds.