Need help whit JavaFx installation for Video presentation in game

Edit : Am working on it, il get back when i tested a few things

I go whit the gradle thing but i get an errors :

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘C:\Users\Simon\Documents\JME3-JFX\build.gradle’ line: 13

  • What went wrong:
    A problem occurred evaluating root project ‘jfx’.

Cannot run program “git”: CreateProcess error=2, Le fichier spécifié est introuvable

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Any solution?

Ah yes, you need git installed in a way, that it can be called from cmd.

1 Like

Well git is install, i have a feelling it have something to do whit my enviroment variables, but it seem like am not doing the right thing. I put it in path, i put it in it own space but nothing work xD

Il restard my computer and see if it help in any ways

If you need video playback only then just grab all files that you need and add them into your project. I did it this way.

As far as I remember you need only Movie.j3md (with shaders), TextureMovie and ImageExchanger. The code is written so well that it is easy to use it even as GUI object.

1 Like

True that, or grab the already build jar from bintray and just include it.

1 Like

Edit : My bad, the jar do work, i think am just not using the right class.

So… what next? I saw an exemple by abies

But it don’t seem to work at all :/. I can’t creat the class media and mediaPlayer don’t want to be imported. For the texture il guess its a texture il apply the surface i want to video on?

I don’t know if it would help you, since I’m using eclipse and Java 1.7, but I put jfxrt.jar (JavaFX) into my classpath.

1 Like

i am also using eclipse and work whit java 1.7, but i don’t seem to be able to doawload the javaFX jar anywhere.

But i also see everywhere that javaFx need to be install on the computer. Does that mean it will need to be package whit my installer if i want people to be able to use it in game?

see the full source of abies fragment in the test directory of JME-JFX

JME-JFX require java8. under eclipse you may need to add/enable the javafx Library, because it can be hide iirc.

1 Like

I’m afraid but in that classes I mentioned before, there is some code that needs Java 8. That code can be replaced, but probably you’ll need to add those files into your project instead of using precompiled jar.

JavaFX is included into JRE/JDK from 1.7.0 update 45 (or something like that). Check if you have jfxrt.jar somewhere inside your installation.

Thanks! Il have to check that tomorow or i won’t sleep the whole night but il give you feedback when its done!

if you want to try javafx for java 7 + maven/gradle take look at Maybe the Movie part of JME-JFX doesn’t require javafx 8 -but there are lot changes javafx (7) and 8

You where right, its inside java itself, now i only have on problem left : what is that

PlatformImpl.startup(() → { });

i do underthant that startup need a runnable argument but what is () → { } suppose to mean?

It’s a lambda, java 8 new feature.

the hacky solutin is “new JfxPanel()” instead, that starts up the platform as well.

1 Like

And it work! Marvellous! All is left is to make sure it take the whole screen no matter the size and then some integration, but i can do that on my own :wink:

Thanks again :smiley: I’ll soon post the results and try to put every anwser at the begening of the topic if anyone was in need to do the same x).

Okay everything is working great in the testing class but as soon as i get it out of there, i get a green screen. Am applying the texture on a Label build in tonegod, and as i said it work when every part of the code are in the same area. The green screen also play the music. Il get back after a few test

Okay found it. It was actully the
public void simpleUpdate(float tpf) {

But i kinda wonder, won,t that slow in any way my whole program having this command looping all the time? I could probably put it in a AbstractControl to avoid that? o well any way il have to test that later, il come back whit a complet class

Did you see I've made a MovieAppState so you don't have to ?

Nan, i did not saw it, but then again I kinda prefers my solution : simply build an extends label whit an AbstractControl inside and i have full control. I can then creat multiple label and they simpl act like normal labels.

I think everything is pretty much done, i just have one question left : how can i make it loop? Is theire any method for that? Cause after searching a bit in MediaPlayer i could not find any setLooping(true) or something like that.

        Media media = new Media(fpath); //
        _mp = new MediaPlayer(media); //
        _mp.setVolume((float)Config.getInstance().getVolumeSfx() / 10f);
        _mp.setOnEndOfMedia(some Runnable); // <------- HERE

This is how I did it.

try (not tested)

1 Like