# 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)

*** ** * ** ***


```
@UnstableApi
public final class LottieOverlay extends CanvasOverlay
```

<br />

|---|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||||
| ↳ | [androidx.media3.effect.TextureOverlay](https://developer.android.com/reference/androidx/media3/effect/TextureOverlay) ||||
|   | ↳ | [androidx.media3.effect.BitmapOverlay](https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay) |||
|   |   | ↳ | [androidx.media3.effect.CanvasOverlay](https://developer.android.com/reference/androidx/media3/effect/CanvasOverlay) ||
|   |   |   | ↳ | [androidx.media3.effect.lottie.LottieOverlay](https://developer.android.com/reference/androidx/media3/effect/lottie/LottieOverlay) |

*** ** * ** ***

A `https://developer.android.com/reference/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/androidx/media3/effect/lottie/LottieOverlay.Builder`.

## Summary

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

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/effect/lottie/LottieOverlay#configure(androidx.media3.common.util.Size)(https://developer.android.com/reference/androidx/media3/common/util/Size videoSize)` Set up resources for the overlay given the input video's dimensions. |
| `https://developer.android.com/reference/androidx/media3/common/OverlaySettings` | `https://developer.android.com/reference/androidx/media3/effect/lottie/LottieOverlay#getOverlaySettings(long)(long presentationTimeUs)` Returns the `https://developer.android.com/reference/androidx/media3/common/OverlaySettings` controlling how the overlay is displayed at the specified timestamp. |
| `synchronized void` | `https://developer.android.com/reference/androidx/media3/effect/lottie/LottieOverlay#onDraw(android.graphics.Canvas,long)(https://developer.android.com/reference/android/graphics/Canvas.html canvas, long presentationTimeUs)` Perform custom drawing onto the `https://developer.android.com/reference/android/graphics/Canvas.html`. |
| `synchronized void` | `https://developer.android.com/reference/androidx/media3/effect/lottie/LottieOverlay#release()()` Releases all resources. |

| ### Inherited methods |
|---|
| From [androidx.media3.effect.BitmapOverlay](https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay) |---|---| | `static https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay` | `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay#createStaticBitmapOverlay(android.graphics.Bitmap)(https://developer.android.com/reference/android/graphics/Bitmap.html overlayBitmap)` Creates a `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay` that shows the `overlayBitmap` in the same position and size throughout the whole video. | | `static https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay` | `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay#createStaticBitmapOverlay(android.graphics.Bitmap,androidx.media3.effect.StaticOverlaySettings)( https://developer.android.com/reference/android/graphics/Bitmap.html overlayBitmap, https://developer.android.com/reference/androidx/media3/effect/StaticOverlaySettings overlaySettings )` Creates a `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay` that shows the `overlayBitmap` in the same `https://developer.android.com/reference/androidx/media3/common/OverlaySettings` throughout the whole video. | | `static https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay` | `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay#createStaticBitmapOverlay(android.content.Context,android.net.Uri,androidx.media3.effect.StaticOverlaySettings)( https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/net/Uri.html overlayBitmapUri, https://developer.android.com/reference/androidx/media3/effect/StaticOverlaySettings overlaySettings )` Creates a `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay` that shows the input at `overlayBitmapUri` with the same `https://developer.android.com/reference/androidx/media3/effect/StaticOverlaySettings` throughout the whole video. | | `int` | `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay#getTextureId(long)(long presentationTimeUs)` Returns the overlay texture identifier displayed at the specified timestamp. | | `https://developer.android.com/reference/androidx/media3/common/util/Size` | `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay#getTextureSize(long)(long presentationTimeUs)` Returns the pixel width and height of the overlay texture displayed at the specified timestamp. | | `float[]` | `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay#getVertexTransformation(long)(long presentationTimeUs)` 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/androidx/media3/effect/CanvasOverlay) |---|---| | `https://developer.android.com/reference/android/graphics/Bitmap.html` | `https://developer.android.com/reference/androidx/media3/effect/CanvasOverlay#getBitmap(long)(long presentationTimeUs)` Returns the overlay bitmap displayed at the specified timestamp. | | `void` | `https://developer.android.com/reference/androidx/media3/effect/CanvasOverlay#setCanvasSize(int,int)(int width, int height)` Sets the size of the `https://developer.android.com/reference/android/graphics/Canvas.html`. | |

## Public methods

### configure

```
public void configure(Size videoSize)
```

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

### getOverlaySettings

```
public OverlaySettings getOverlaySettings(long presentationTimeUs)
```

Returns the `https://developer.android.com/reference/androidx/media3/common/OverlaySettings` controlling how the overlay is displayed at the specified timestamp.

| Parameters |
|---|---|
| `long presentationTimeUs` | The presentation timestamp of the current frame, in microseconds. |

### onDraw

```
synchronized public void onDraw(Canvas canvas, long presentationTimeUs)
```

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/graphics/Canvas.html canvas` | The `https://developer.android.com/reference/android/graphics/Canvas.html` to draw onto. |
| `long presentationTimeUs` | The presentation timestamp, in microseconds. |

### release

```
synchronized public void release()
```

Releases all resources.

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