# LottieOverlay

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

*** ** * ** ***

<br />

```
@UnstableApi
class LottieOverlay : CanvasOverlay
```

<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.CanvasOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/CanvasOverlay) ||
|   |   |   | ↳ | [androidx.media3.effect.lottie.LottieOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/lottie/LottieOverlay) |

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/media3/effect/CanvasOverlay` that renders a Lottie animation.

This overlay uses the Lottie library to draw an animation loaded from a raw resource. The animation's size, position, speed, and looping behavior can be configured using the `https://developer.android.com/reference/kotlin/androidx/media3/effect/lottie/LottieOverlay.Builder`.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/effect/lottie/LottieOverlay.Builder` A builder for `https://developer.android.com/reference/kotlin/androidx/media3/effect/lottie/LottieOverlay` instances. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi interface https://developer.android.com/reference/kotlin/androidx/media3/effect/lottie/LottieOverlay.LottieProvider` Provides assets for a Lottie animation and manages their lifecycle. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/lottie/LottieOverlay#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/lottie/LottieOverlay#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. |
| `synchronized https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/lottie/LottieOverlay#onDraw(android.graphics.Canvas,long)(canvas: https://developer.android.com/reference/android/graphics/Canvas.html!, presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Perform custom drawing onto the `https://developer.android.com/reference/android/graphics/Canvas.html`. |
| `synchronized https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/lottie/LottieOverlay#release()()` Releases all resources. |

### 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.
From [androidx.media3.effect.CanvasOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/CanvasOverlay) `https://developer.android.com/reference/android/graphics/Bitmap.html!` `https://developer.android.com/reference/kotlin/androidx/media3/effect/CanvasOverlay#getBitmap(long)(presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Returns the overlay bitmap 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/CanvasOverlay#setCanvasSize(int,int)(width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets the size of the `https://developer.android.com/reference/android/graphics/Canvas.html`.

## 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: https://developer.android.com/reference/kotlin/androidx/media3/common/util/Size!` | The width and height of the input video, in pixels. |

### getOverlaySettings

```
fun getOverlaySettings(presentationTimeUs: Long): OverlaySettings!
```

Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/OverlaySettings` controlling how the overlay is 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. |

### onDraw

```
synchronized fun onDraw(canvas: Canvas!, presentationTimeUs: Long): Unit
```

Perform custom drawing onto the `https://developer.android.com/reference/android/graphics/Canvas.html`.

| Parameters |
|---|---|
| `canvas: https://developer.android.com/reference/android/graphics/Canvas.html!` | The `https://developer.android.com/reference/android/graphics/Canvas.html` to draw onto. |
| `presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The presentation timestamp, in microseconds. |

### release

```
synchronized fun release(): Unit
```

Releases all resources.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessingException` | If an error occurs while releasing resources. |