LottieOverlay
@UnstableApi
public final class LottieOverlay extends CanvasOverlay
| java.lang.Object | ||||
| ↳ | androidx.media3.effect.TextureOverlay | |||
| ↳ | androidx.media3.effect.BitmapOverlay | |||
| ↳ | androidx.media3.effect.CanvasOverlay | |||
| ↳ | androidx.media3.effect.LottieOverlay |
A 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 Builder.
Summary
Nested types |
|---|
public final class LottieOverlay.BuilderA builder for |
@UnstableApiProvides assets for a Lottie animation and manages their lifecycle. |
Public methods |
|
|---|---|
void |
Set up resources for the overlay given the input video’s dimensions. |
OverlaySettings |
getOverlaySettings(long presentationTimeUs)Returns the |
synchronized void |
Perform custom drawing onto the |
synchronized void |
release()Releases all resources. |
Inherited methods |
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||
|
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 | |
|---|---|
Size videoSize |
The width and height of the input video, in pixels. |
getOverlaySettings
public OverlaySettings getOverlaySettings(long presentationTimeUs)
Returns the 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 Canvas.
release
synchronized public void release()
Releases all resources.
| Throws | |
|---|---|
androidx.media3.common.VideoFrameProcessingException |
If an error occurs while releasing resources. |