Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform-Specific JavaFX Dependencies in Compose Media Player #3

Open
kdroidFilter opened this issue Jan 20, 2025 · 0 comments
Open

Comments

@kdroidFilter
Copy link
Owner

Problem Statement

The current implementation of the Compose Media Player library requires users to manually include JavaFX dependencies for their respective operating systems and architectures. While this approach ensures compatibility across platforms, it introduces additional configuration steps for users, which might hinder adoption and usage.

Current Behavior

The library relies on dynamically determining the appropriate JavaFX classifier based on the user's OS and architecture using the following logic:

val osName = System.getProperty("os.name").lowercase(Locale.getDefault())
val osArch = System.getProperty("os.arch").lowercase(Locale.getDefault())

val fxClassifier = when {
    osName.contains("linux") && osArch.contains("aarch64") -> "linux-aarch64"
    osName.contains("linux") -> "linux"
    osName.contains("windows") -> "win"
    osName.contains("mac") && osArch.contains("aarch64") -> "mac-aarch64"
    osName.contains("mac") -> "mac"
    else -> throw IllegalStateException("Unsupported OS: $osName")
}

implementation("org.openjfx:javafx-base:\${javafxVersion}:\${fxClassifier}")
implementation("org.openjfx:javafx-graphics:\${javafxVersion}:\${fxClassifier}")
implementation("org.openjfx:javafx-swing:\${javafxVersion}:\${fxClassifier}")
implementation("org.openjfx:javafx-media:\${javafxVersion}:\${fxClassifier}")

This setup requires library users to:

  1. Identify their OS and architecture.
  2. Manually include the corresponding JavaFX dependencies in their projects.

Temporary Solution

As a temporary workaround, users are advised to import the necessary JavaFX dependencies for their specific OS and architecture into their projects. The required dependencies are as follows:

implementation("org.openjfx:javafx-base:\${javafxVersion}:\${fxClassifier}")
implementation("org.openjfx:javafx-graphics:\${javafxVersion}:\${fxClassifier}")
implementation("org.openjfx:javafx-swing:\${javafxVersion}:\${fxClassifier}")
implementation("org.openjfx:javafx-media:\${javafxVersion}:\${fxClassifier}")

Additional Context

  • JavaFX Version: The current implementation uses JavaFX version 22.0.1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant