these days i did some research on github on how to play a video inside a demo with jme. I reworked some code and created a little project to discuss it with you. The project uses JavaFX libraries to play the videos. I would like to know if there is a more efficient way to play a video with jme or if what I have found can be improved.
Let me know what you think.
Here is the code:
Thanks for your reply, I’ll do some tests also with VLC
Nice, I have read before that java Reflection may be an expensive solution, another solution to use jfx player without real jme-jfx context, in case you are using lwjgl2, try the following :
1- build jme context on a Swing/AWT canvas.
2- create a JFrame with a Full screen JComponent or JPanel.
JFXPanel concrete class from
javafx.embed.swing.JFXPanel you can manage to create jfx scene & attach a jfx Video Player widget on it & destroy whenever needed.
Synchronize the add of the JFXPanel & the Jme-swing canvas in order to get a splash screen with sound (jfx vid) before game shows up (Notice that game already starts on jme-canvas in foreground without showing up).
=>Downsides are multiple contexts, you need to handle this via enqueue actions for the right context in a thread safe way.
=>Refer to :
In theory there is the concept here, but in order to use that, you’d need to implement it, which is a summer full of work:
The only real advantage is not requiring JavaFX and thus hand-rolling the integration, which is hard to do, though.