TextOverlay
@UnstableApi
public abstract class TextOverlay extends BitmapOverlay
| java.lang.Object | |||
| ↳ | androidx.media3.effect.TextureOverlay | ||
| ↳ | androidx.media3.effect.BitmapOverlay | ||
| ↳ | androidx.media3.effect.TextOverlay |
Creates a TextureOverlay from text.
Uses a SpannableString to store the text and support advanced per-character text styling.
Summary
Constants |
|
|---|---|
static final int |
TEXT_SIZE_PIXELS = 100 |
Public constructors |
|---|
Public methods |
|
|---|---|
static TextOverlay |
createStaticTextOverlay(SpannableString overlayText)Creates a |
static TextOverlay |
createStaticTextOverlay(Creates a |
Bitmap |
getBitmap(long presentationTimeUs)Returns the overlay bitmap displayed at the specified timestamp. |
abstract SpannableString |
getText(long presentationTimeUs)Returns the overlay text displayed at the specified timestamp. |
Inherited methods |
||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||
|
Constants
Public constructors
Public methods
createStaticTextOverlay
public static TextOverlay createStaticTextOverlay(SpannableString overlayText)
Creates a TextOverlay that shows the overlayText with the same default settings in StaticOverlaySettings throughout the whole video.
createStaticTextOverlay
public static TextOverlay createStaticTextOverlay(
SpannableString overlayText,
StaticOverlaySettings overlaySettings
)
Creates a TextOverlay that shows the overlayText with the same StaticOverlaySettings throughout the whole video.
| Parameters | |
|---|---|
SpannableString overlayText |
The text to overlay on the video. |
StaticOverlaySettings overlaySettings |
The |
getBitmap
public Bitmap getBitmap(long presentationTimeUs)
Returns the overlay bitmap 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. |
getText
public abstract SpannableString getText(long presentationTimeUs)
Returns the overlay text displayed at the specified timestamp.
| Parameters | |
|---|---|
long presentationTimeUs |
The presentation timestamp of the current frame, in microseconds. |