is there a multiplatform video player library
# multiplatform
y
is there a multiplatform video player library
p
Perhaps look at https://github.com/icerockdev/moko-media. I'm not sure if it's just the controls or also the players
In future, if you're looking for a lib, have a look at https://github.com/terrakok/kmp-awesome for ideas
y
thanks but I am more looking for something toward web and desktop, not sure if FFmpeg could do that for me although there is a lot of FFmpeg libraries but i don't know which one to choose from
m
Did you check this directly from JetBrains? VideoPlayer
y
Ya but i am more looking to trim a video or subClip up make it into multiple clips
l
You can bundle FFmpeg and invoke it to do the trimming. Note that FFmpeg can't do modification in place (if trimming a video file, you have to make a new one, not modify the old file).
I believe the Jetbrains compose VideoPlayer sample uses VLC. If you need more control, you can use FFmpeg. They have a Kotlin/Native sample that gives a good starting point using SDL. I adapted it to Compose at my old job.
y
Thanks Landy, but what do you mean by bundling FFmpeg ?, I checked the Jetbrains compose VideoPlayer and its no what i really looking for since i am only looking to trim the video, but it would be cool to have a look on how you adapted it to compose, let me know if you wanna hop on a quick call.
l
I don't have any of the code anymore for adapting to Compose, but the quick gist was that I had it render to a byte array of RGB data, which I used JNI to send to JVM (FFmpeg is a native library, so I called it from Kotlin/Native), and converted it to a ImageBitmap.
If all you need is to trim it, you can either bundle an FFmpeg binary as part of the Jar and install it programatically, or detect that a system binary exists. Then you can call into it using ProcessBuilder, since FFmpeg is a command line tool.
y
your speaking Chinese to me, RGB data? JNI? bundle? Jar? install it programatically? system binary? ProcessBuilder? command line tool? thanks for the information you gave me but i would recommend to you to not assume that people know the things that you know.
l
Command line tools are programs you can run from a terminal (Android Studio has a terminal tab) instead of a UI. If you want to do something using a tool that you can't call directly from your code without needing the user to press a button, you'd typically use a command line tool. You need a binary that tells the computer how to run the tool. You can either see if the user already has it installed (Linux and mac have easier ways to install ffmpeg) and tell the OS 'run this program', or you can bundle it with the application you build. Either way, you need to tell the OS to run the tool. You'd use ProcessBuilder to do this on the JVM (what Kotlin on Desktop typically uses).
y
thanks, Landry I will try to learn more about how to do that, that was more clear this time.
a
https://github.com/open-ani/mediamp This one is new but looks promising