This repository includes various media player implementation methods that can be useful if you want to add multimedia components to your Jetpack Compose project.
The standard way to create a media player using the media player library component and container for the AWT component
provided by Jetpack Compose SwingPanel
.
Using a byte array of pixels as the key of the remember function will result in an exponential memory leak due to comparing by reference and creating a new key, which will result in an accumulation of unused values!
remember(pixels) // don't do this! remember(pixels.contentHashCode()) // do this instead
A more flexible method that captures video frames as an array of bytes, converts to the required format, and then displays.
plugins {
id("org.openjfx.javafxplugin") version "19"
}
javafx {
version = "19"
modules("javafx.media", "javafx.swing")
}
implementation("uk.co.caprica:vlcj:4.8.2")