BitmapOverlay
@UnstableApi
public abstract class BitmapOverlay extends TextureOverlay
CanvasOverlay |
A |
DrawableOverlay |
Creates a |
TextOverlay |
Creates a |
LottieOverlay |
A |
Creates TextureOverlays from Bitmaps.
Useful for overlaying images and animated images (e.g. GIFs).
Summary
Public constructors |
|---|
Public methods |
|
|---|---|
static BitmapOverlay |
createStaticBitmapOverlay(Bitmap overlayBitmap)Creates a |
static BitmapOverlay |
createStaticBitmapOverlay(Creates a |
static BitmapOverlay |
createStaticBitmapOverlay(Creates a |
abstract Bitmap |
getBitmap(long presentationTimeUs)Returns the overlay bitmap displayed at the specified timestamp. |
int |
getTextureId(long presentationTimeUs)Returns the overlay texture identifier displayed at the specified timestamp. |
Size |
getTextureSize(long presentationTimeUs)Returns the pixel width and height of the overlay texture displayed at the specified timestamp. |
float[] |
getVertexTransformation(long presentationTimeUs)Returns a 4x4 OpenGL matrix, controlling how the vertices of the overlay are displayed at the specified timestamp. |
void |
release()Releases all resources. |
Inherited methods |
||||
|---|---|---|---|---|
|
Public constructors
Public methods
createStaticBitmapOverlay
public static BitmapOverlay createStaticBitmapOverlay(Bitmap overlayBitmap)
Creates a BitmapOverlay that shows the overlayBitmap in the same position and size throughout the whole video.
| Parameters | |
|---|---|
Bitmap overlayBitmap |
The bitmap to overlay on the video. |
createStaticBitmapOverlay
public static BitmapOverlay createStaticBitmapOverlay(
Bitmap overlayBitmap,
StaticOverlaySettings overlaySettings
)
Creates a BitmapOverlay that shows the overlayBitmap in the same OverlaySettings throughout the whole video.
| Parameters | |
|---|---|
Bitmap overlayBitmap |
The bitmap to overlay on the video. |
StaticOverlaySettings overlaySettings |
The |
createStaticBitmapOverlay
public static BitmapOverlay createStaticBitmapOverlay(
Context context,
Uri overlayBitmapUri,
StaticOverlaySettings overlaySettings
)
Creates a BitmapOverlay that shows the input at overlayBitmapUri with the same StaticOverlaySettings throughout the whole video.
| Parameters | |
|---|---|
Context context |
The |
Uri overlayBitmapUri |
The |
StaticOverlaySettings overlaySettings |
The |
getBitmap
public abstract 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. |
getTextureId
public int getTextureId(long presentationTimeUs)
Returns the overlay texture identifier 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. |
getTextureSize
public Size getTextureSize(long presentationTimeUs)
Returns the pixel width and height of the overlay texture displayed at the specified timestamp.
This method must be called after #getTextureId(long).
Gets the width and height of the cached bitmap.
| Parameters | |
|---|---|
long presentationTimeUs |
The presentation timestamp of the current frame, in microseconds. |
getVertexTransformation
public float[] getVertexTransformation(long presentationTimeUs)
Returns a 4x4 OpenGL matrix, controlling how the vertices of the overlay are displayed at the specified timestamp.
Applied before #getOverlaySettings overlay settings.
Flips the overlay vertically to convert between Android and OpenGL texture coordinate systems.
release
public void release()
Releases all resources.
| Throws | |
|---|---|
androidx.media3.common.VideoFrameProcessingException |
If an error occurs while releasing resources. |