Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
kdroidFilter committed Mar 3, 2025
2 parents 5abfbb8 + a0361e8 commit 548dbc5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 22 deletions.
19 changes: 7 additions & 12 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,6 @@ dependencies {
}
```

> [!IMPORTANT]
>It is necessary (for now) to add the following Maven repository to your dependencies because Compose Media Player relies on a snapshot version of the [FileKt core](https://github.com/vinceglb/FileKit/tree/main/filekit-core):
```kotlin
repositories {
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
```

For more information, visit: [FileKt on GitHub](https://github.com/vinceglb/FileKit/)

> [!IMPORTANT]
> Currently, you also need to manually include JavaFX dependencies if your application is also intended for macOS.
Expand Down Expand Up @@ -121,8 +110,14 @@ You can play a video by providing a direct URL:
playerState.openUri("http://example.com/video.mp4")
```

To play a local video file, please refer to [example](sample/composeApp/src/commonMain/kotlin/sample/app/App.kt) using [FileKt](https://github.com/vinceglb/FileKit).
To play a local video file you can use [PlatformFile](https://filekit.mintlify.app/core/platform-file) from [FileKit](https://github.com/vinceglb/FileKit).

```kotlin
val file = FileKit.openFilePicker(type = FileKitType.Video)
file?.let { playerState.openFile(file) }
```

Check the [sample project](sample/composeApp/src/commonMain/kotlin/sample/app/App.kt) for a complete example.

### Full Controls

Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[versions]

androidcontextprovider = "1.0.1"
filekit = "0.10.0-SNAPSHOT"
filekit = "0.10.0-beta01"
gst1JavaCore = "1.4.0"
gst1JavaSwing = "0.9.0"
kotlin = "2.1.10"
agp = "8.7.3"
agp = "8.8.2"
kotlinLogging = "7.0.4"
kotlinx-coroutines = "1.10.1"
kotlinxBrowserWasmJs = "0.3"
Expand All @@ -24,7 +24,7 @@ androidcontextprovider = { module = "io.github.kdroidfilter:androidcontextprovid
androidx-media3-exoplayer = { module = "androidx.media3:media3-exoplayer", version.ref = "media3Exoplayer" }
androidx-media3-ui = { module = "androidx.media3:media3-ui", version.ref = "media3Exoplayer" }
filekit-core = { module = "io.github.vinceglb:filekit-core", version.ref = "filekit" }
filekit-dialog-compose = { module = "io.github.vinceglb:filekit-dialog-compose", version.ref = "filekit" }
filekit-dialogs-compose = { module = "io.github.vinceglb:filekit-dialogs-compose", version.ref = "filekit" }
gst1-java-core = { module = "org.freedesktop.gstreamer:gst1-java-core", version.ref = "gst1JavaCore" }
gst1-java-swing = { module = "org.freedesktop.gstreamer:gst1-java-swing", version.ref = "gst1JavaSwing" }
kotlin-logging = { module = "io.github.oshai:kotlin-logging", version.ref = "kotlinLogging" }
Expand Down
2 changes: 1 addition & 1 deletion sample/composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ kotlin {
implementation(compose.material3)
implementation(project(":mediaplayer"))
implementation(compose.materialIconsExtended)
implementation(libs.filekit.dialog.compose)
implementation(libs.filekit.dialogs.compose)
}

androidMain.dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import io.github.vinceglb.filekit.FileKit
import io.github.vinceglb.filekit.dialog.init
import io.github.vinceglb.filekit.dialogs.init

class AppActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
10 changes: 5 additions & 5 deletions sample/composeApp/src/commonMain/kotlin/sample/app/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import io.github.kdroidfilter.composemediaplayer.VideoPlayerError
import io.github.kdroidfilter.composemediaplayer.VideoPlayerSurface
import io.github.kdroidfilter.composemediaplayer.rememberVideoPlayerState
import io.github.kdroidfilter.composemediaplayer.util.getUri
import io.github.vinceglb.filekit.dialog.PickerType
import io.github.vinceglb.filekit.dialog.compose.rememberFilePickerLauncher
import io.github.vinceglb.filekit.dialogs.FileKitType
import io.github.vinceglb.filekit.dialogs.compose.rememberFilePickerLauncher
import io.github.vinceglb.filekit.name

@Composable
Expand All @@ -48,7 +48,7 @@ fun App() {

// Launcher for selecting a local video file
val videoFileLauncher = rememberFilePickerLauncher(
type = PickerType.Video,
type = FileKitType.Video,
title = "Select a video"
) { file ->
file?.let {
Expand All @@ -58,13 +58,13 @@ fun App() {

// Launcher for selecting a local subtitle file (VTT format)
val subtitleFileLauncher = rememberFilePickerLauncher(
type = PickerType.File(extensions = listOf("vtt")),
type = FileKitType.File("vtt"),
title = "Select a subtitle file"
) { file ->
file?.let {
val subtitleUri = it.getUri()
val track = SubtitleTrack(
label = it.name ?: "Local",
label = it.name,
language = "en",
src = subtitleUri
)
Expand Down

0 comments on commit 548dbc5

Please sign in to comment.