# TextOverlay

Artifact: [androidx.media3:media3-effect](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/effect/TextOverlay.java+class:androidx.media3.effect.TextOverlay)

*** ** * ** ***

<br />

```
@UnstableApi
abstract class TextOverlay : BitmapOverlay
```

<br />

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) ||||
| ↳ | [androidx.media3.effect.TextureOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/TextureOverlay) |||
|   | ↳ | [androidx.media3.effect.BitmapOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay) ||
|   |   | ↳ | [androidx.media3.effect.TextOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/TextOverlay) |

*** ** * ** ***

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/effect/TextureOverlay` from text.

Uses a `https://developer.android.com/reference/android/text/SpannableString.html` to store the text and support advanced per-character text styling.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/TextOverlay#TEXT_SIZE_PIXELS() = 100` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/effect/TextOverlay#TextOverlay()()` |

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/effect/TextOverlay!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/TextOverlay#createStaticTextOverlay(android.text.SpannableString)(overlayText: https://developer.android.com/reference/android/text/SpannableString.html!)` Creates a `https://developer.android.com/reference/kotlin/androidx/media3/effect/TextOverlay` that shows the `overlayText` with the same default settings in `https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings` throughout the whole video. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/effect/TextOverlay!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/TextOverlay#createStaticTextOverlay(android.text.SpannableString,androidx.media3.effect.StaticOverlaySettings)( overlayText: https://developer.android.com/reference/android/text/SpannableString.html!, overlaySettings: https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings! )` Creates a `https://developer.android.com/reference/kotlin/androidx/media3/effect/TextOverlay` that shows the `overlayText` with the same `https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings` throughout the whole video. |
| `https://developer.android.com/reference/android/graphics/Bitmap.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/TextOverlay#getBitmap(long)(presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Returns the overlay bitmap displayed at the specified timestamp. |
| `abstract https://developer.android.com/reference/android/text/SpannableString.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/TextOverlay#getText(long)(presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Returns the overlay text displayed at the specified timestamp. |

### Inherited functions

From [androidx.media3.effect.BitmapOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay) `java-static https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay!` `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay#createStaticBitmapOverlay(android.graphics.Bitmap)(overlayBitmap: https://developer.android.com/reference/android/graphics/Bitmap.html!)`

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay` that shows the `overlayBitmap` in the same position and size throughout the whole video.
`java-static https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay!` `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay#createStaticBitmapOverlay(android.graphics.Bitmap,androidx.media3.effect.StaticOverlaySettings)(

overlayBitmap: https://developer.android.com/reference/android/graphics/Bitmap.html!,

overlaySettings: https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings!

)`

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay` that shows the `overlayBitmap` in the same `https://developer.android.com/reference/kotlin/androidx/media3/common/OverlaySettings` throughout the whole video.
`java-static https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay!` `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay#createStaticBitmapOverlay(android.content.Context,android.net.Uri,androidx.media3.effect.StaticOverlaySettings)(

context: https://developer.android.com/reference/android/content/Context.html!,

overlayBitmapUri: https://developer.android.com/reference/android/net/Uri.html!,

overlaySettings: https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings!

)`

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay` that shows the input at `overlayBitmapUri` with the same `https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings` throughout the whole video.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay#getTextureId(long)(presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Returns the overlay texture identifier displayed at the specified timestamp.
`https://developer.android.com/reference/kotlin/androidx/media3/common/util/Size!` `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay#getTextureSize(long)(presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Returns the pixel width and height of the overlay texture displayed at the specified timestamp.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!` `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay#getVertexTransformation(long)(presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Returns a 4x4 OpenGL matrix, controlling how the vertices of the overlay are displayed at the specified timestamp.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay#release()()`

Releases all resources.
From [androidx.media3.effect.TextureOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/TextureOverlay) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/effect/TextureOverlay#configure(androidx.media3.common.util.Size)(videoSize: https://developer.android.com/reference/kotlin/androidx/media3/common/util/Size!)`

Set up resources for the overlay given the input video's dimensions.
`https://developer.android.com/reference/kotlin/androidx/media3/common/OverlaySettings!` `https://developer.android.com/reference/kotlin/androidx/media3/effect/TextureOverlay#getOverlaySettings(long)(presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/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 `https://developer.android.com/reference/kotlin/androidx/media3/effect/TextOverlay` that shows the `overlayText` with the same default settings in `https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings` throughout the whole video.

### createStaticTextOverlay

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

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/effect/TextOverlay` that shows the `overlayText` with the same `https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings` throughout the whole video.

| Parameters |
|---|---|
| `overlayText: https://developer.android.com/reference/android/text/SpannableString.html!` | The text to overlay on the video. |
| `overlaySettings: https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings!` | The `https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings` 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: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The presentation timestamp of the current frame, in microseconds. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/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: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The presentation timestamp of the current frame, in microseconds. |