Bojann
Bojann

Reputation: 69

KMP Compose UI Play Video File

I have Kotlin multiplatform project and I want to play local video on the screen. My KMP project is Desktop only, so I don't have to worry about iOS and Android. Video is located locally at my PC, so it's not a online video. What is a proper way of doing it?

I saw some solutions using JavaFX, but I was unable to integrate it in my project properly.

Upvotes: 0

Views: 791

Answers (2)

Khubaib Khan
Khubaib Khan

Reputation: 133

You can checkout the Library for Playing Videos using Compose Multiplatform and also Supports Android, iOS, Desktop, Js and Wasm as well. MediaPlayer-KMP

Upvotes: 0

Peter Tran
Peter Tran

Reputation: 1669

The compose-multiplatform repo contains sample code for a video player:

https://github.com/JetBrains/compose-multiplatform/blob/master/experimental/components/VideoPlayer/library/src/desktopMain/kotlin/org/jetbrains/compose/videoplayer/DesktopVideoPlayer.kt

If you look at the code you can see it depends on vlcj, a java wrapper around the VLC media player.

Upvotes: 0

Related Questions