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

JavaFX Video Player #326

Closed
wants to merge 35 commits into from
Closed

Conversation

Gamebuster19901
Copy link
Contributor

@Gamebuster19901 Gamebuster19901 commented Mar 29, 2020

I've been working on #291 using JavaFX.

As a result I had to make some changes to how LitiEngine is compiled.

If you're compiling using a JDK older than JDK11, then JavaFX must exist on the system classpath. Some JDKs older than JDK11 come with JavaFX, but some don't (most notably openjdk8). If yours doesn't you will have to upgrade to Java 11 or install OpenJFX onto your system manually.

If you're compiling with JDK11 or newer, then you don't have to do anything. Gradle will automatically add it to the build path.

Using gradle to add JavaFX to the build path is not possible with JDKs older than JDK11, as the OpenJFX gradle plugin required to install it is only compatible with Java 11 or higher. If you attempt to use it on an older version of Java, you will get an UnsupportedClassVersionError upon building the project.

Travis will now build LitiEngine using both Java 8 and Java 11 to ensure it can run on both.

TODO

  • Add JavaFX to classpath
  • Travis builds with both Java 8 and Java 11
  • Implement a VideoPlayer which is a GuiComponent
  • Implement VideoRenderer to render the GuiComponent
  • Add tests

@Gamebuster19901
Copy link
Contributor Author

Gamebuster19901 commented Mar 29, 2020

Obviously the build will fail as the build server is using openjdk 11, which does not have openjfx. OpenJDK 11 doesn't include OpenJFX.

There is also no gradle/maven repository for openjfx 8...

* Add JavaFX to classpath

* Figured out how to make JavaFX compile with jdk8 and jdk11

* Travis needs OpenJFX 8 to compile for Java 8
@Gamebuster19901
Copy link
Contributor Author

Gamebuster19901 commented Mar 29, 2020

Merge conflicts are now resolved.

This is what it looks like (the video is low definition, here is the original for comparison)

image

@Gamebuster19901 Gamebuster19901 changed the title Video Player Video Player, Closes #291 Mar 31, 2020
@Gamebuster19901 Gamebuster19901 changed the title Video Player, Closes #291 Video Player Mar 31, 2020
@Gamebuster19901
Copy link
Contributor Author

This PR is ready for review

@nightm4re94
Copy link
Member

nightm4re94 commented Mar 31, 2020

Thank you for the remarkable work you've done here! It's really nice to see major features being tackled by the community.
We are currently reviewing this PR, yet I want to share some thoughts already:
While the implementation of video Resource management and the overall execution seems fine so far, having picked JavaFX for the solution to our problem kind of contradicts fundamental design principles of LITIengine.
Referencing an external framework is by itself something we want to avoid as much as possible, but in this case we are dealing with a framework that provides alternatives to other LITIengine features. If we use JavaFX for a video player, why stop there? Why not port LITIengine's entire rendering pipeline to JFX? Why not the GUI framework as well? With JFX no longer being an official part of Java, I think we need to consider referencing it very carefully, as the answer to the above questions would be "because LITIengine is a 2D Java game engine based on AWT".
Had we picked JavaFX right from the get-go as we began implementing LITIengine, it would've been an absolutely feasible (and yes, in many regards superior to AWT) choice for rendering and UI. However, we did not. We also do not possess the capacities to port LITIengine to JavaFX within a resonable amount of time. At this point I think AWT has become our trademark for simplicity, steadiness, and learnability. There are plenty of JFX alternatives for game development out there, but the lack of alternatives based on AWT also gives us an advantage in the market, I think.

How do you feel about this? What possible alternatives to a JavaFX panel did you find during your research?

@Gamebuster19901
Copy link
Contributor Author

Gamebuster19901 commented Mar 31, 2020

The reason I selected JavaFX is because there are simply are no other java video libraries that are under active development and are compatible with LitiEngine's license.

Xuggler has a compatible license (LGPL) but hasn't been updated in 6 years, and is deprecated by the authors
Humble-Video is AGPL so is not compatible
VLCJ is GPL so is not compatible

I also tried using VLC's remote control interface but I wasn't able to figure out how to stream the video output the java process.

I suppose the most promising alternative is ffmpeg-cli-wrapper which is BSD but it hasn't had a new release in ~ 3 years. The latest commit to the repo was 2 years ago, excluding the one they just pushed 3 hours ago. I thought the project was dead up until the point I started typing this.

I'm willing to try using ffmpeg-cli-wrapper if you want.

@nightm4re94
Copy link
Member

Thanks for the suggestions, I'll update the original issue with a list of options.
I'm sure we can find a fitting alternative together ;)

@Gamebuster19901
Copy link
Contributor Author

Gamebuster19901 commented Apr 1, 2020

There's also a possibility of not including this with LitiEngine itself but instead making it a separate, optional 'plugin' of sorts.

@nightm4re94
Copy link
Member

I agree, but I'd prefer an out-of-the-box approach here.
Updated #291 with an overview of potentially useful frameworks.

@nightm4re94
Copy link
Member

Can I suggest splitting this up into two separate PRs?

@Gamebuster19901 Gamebuster19901 marked this pull request as draft April 25, 2020 05:14
@Gamebuster19901 Gamebuster19901 changed the title Video Player JavaFX Video Player Apr 25, 2020
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

Successfully merging this pull request may close these issues.

None yet

2 participants