Jme-video-player

Hi everyone,
as promised, here is the source code of the demo you asked for!
I hope it is useful for you to learn and experiment. Let me know what you think! What do you like? What would you do differently? Post your improvements and suggestions here on the forum.

“If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas."

-George Bernard Shaw

14 Likes

Suggestion: commit a Gradle wrapper to the repo, so that potential users don’t have to install Gradle in order to run the app.

2 Likes

ok, I will do it asap

Edit:
Done, let me know if everything works.

1 Like

not yet:

sgold:~/NetBeansProjects/ext/jme-video-player$ ./gradlew run
bash: ./gradlew: Permission denied
sgold:~/NetBeansProjects/ext/jme-video-player$ chmod +x gradlew
sgold:~/NetBeansProjects/ext/jme-video-player$ ./gradlew run
Starting a Gradle Daemon, 3 incompatible Daemons could not be reused, use --status for details

> Configure project :
Project : => no module-info.java found

> Task :run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> No main class specified and classpath is not an executable jar.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s
4 actionable tasks: 3 executed, 1 up-to-date

Two action items:

  • Make the “gradlew” script in the repo executable.
  • Add instructions to “README.md” for building and running the app.
1 Like

This is a general problem with the way Unix does work permissions. I’m trying to figure out how to do what you ask me in Windows. Could you send me a PR please by editing the file with the permissions chmod = + x gradlew?

I’ll send you a PR ASAP.

1 Like

Thanks

1 Like

I still need build instructions, however…

sgold:~/NetBeansProjects/ext/jme-video-player$ git reset --hard
HEAD is now at 69d3d18 add Gradle wrapper
sgold:~/NetBeansProjects/ext/jme-video-player$ git pull
Updating 69d3d18..e4872a8
Fast-forward
 gradlew | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 gradlew
sgold:~/NetBeansProjects/ext/jme-video-player$ ./gradlew clean build
Starting a Gradle Daemon, 2 incompatible Daemons could not be reused, use --status for details

> Configure project :
Project : => no module-info.java found

> Task :startScripts FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':startScripts' (type 'CreateStartScripts').
> No value has been specified for property 'mainClassName'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 13s
9 actionable tasks: 5 executed, 4 up-to-date
sgold:~/NetBeansProjects/ext/jme-video-player$ cat README.md 
# jme-video-player

### Requirements
- [jmonkeyengine](https://github.com/jMonkeyEngine/jmonkeyengine) - A complete 3D game development suite written purely in Java.
- [Minie](https://github.com/stephengold/Minie) - A physics library for JMonkeyEngine.
- JavaFX

### Youtube Videos
- [How to play a video intro for your game](https://youtu.be/5lwIorg5tbM)
- [Destructible Wall Generator](https://www.youtube.com/watch?v=Vp7nPncpZqs)
sgold:~/NetBeansProjects/ext/jme-video-player$ 
2 Likes

OpenJfx requires a module info to include the jfx modules for the package, make sure you have module-info.java at src/main :

module hellofx {
    requires javafx.controls;
    
    exports mainPackage;
}

If you don’t want to use java modules then you need to specify a mainClassName explicitly, i think, those are the openjfx samples :

The non-modular :

The modular :

EDIT:
I added a PR that will fix this problem and another one for readme :wink:.

1 Like

@capdevon I will do a PR, if you don’t mind with building…and how to build…

EDIT :
BTW, to run a java11+ app, you must use gradle7.0+ wrapper, i will make sure to update this, no worry.

1 Like

I got an exception running on lwjgl-2 :

May 24, 2022 2:56:10 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.5.2-stable
 * Branch: HEAD
 * Git Hash: 8ab3d24
 * Build Date: 2022-04-21
Exception in thread "jME3 Main" java.lang.UnsatisfiedLinkError: /home/pavl/IdeaProjects/jme-video-player/liblwjgl64.so: /home/pavl/.jdks/openjdk-17.0.2/lib/libjawt.so: version `SUNWprivate_1.1' not found (required by /home/pavl/IdeaProjects/jme-video-player/liblwjgl64.so)
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
	at java.base/java.lang.Runtime.load0(Runtime.java:755)
	at java.base/java.lang.System.load(System.java:1953)
	at org.lwjgl.Sys$1.run(Sys.java:70)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
	at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
	at org.lwjgl.Sys.loadLibrary(Sys.java:87)
	at org.lwjgl.Sys.<clinit>(Sys.java:117)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:220)
	at java.base/java.lang.Thread.run(Thread.java:833)

However, the project runs fine on lwjgl-3…anyone knows why ?? Seems incompatibility of native binaries, not sure, last time i was running jme3-lwjgl-3.3.2 fine w/o problems…

EDIT: or just the jdk !!

EDIT2: just ignore this for now, i will investigate into it later, isn’t related to your project…

1 Like

Thank you so much for your contributions guys. Sorry if I answer late, unfortunately these days I don’t have much free time. If you both agree on the solution, I accept the PR software changes. I apologize for the inconvenience, but there are some technical aspects of ‘gradle’ that I still don’t know well. :slightly_smiling_face:

3 Likes