News about playing videos on jme?

And here are the results of playing around with that. On the left, there is plain quad with movie texture. Middle - rotating sphere with movie texture. Right - Spot light projecting movie cinema-like, with two annoying cubes floating in the way.

Only 87 fps because I have limited them to 90 and enabled Fraps. Without any limitations, it runs at around 1000fps (movies are 30fps anyway, so it doesn’t really mean much except that it is not that heavy to run 3 mp4 movies in parallel).

Code for using textures is something like

media = new Media("file:///link/to/movie.mp4");
mp = new MediaPlayer(media);
mp.volume = 0;
mp.play();
tex = new TextureMovie(mp, LetterboxMode.VALID_LETTERBOX);
material.setTexture("ColorMap",tex.getTexture());

MediaPlayer is jfx class, so it has all fancy controls for looping, audio control, skipping to specific part of the movie etc.

I plan to check in code into jfx-jme3 soon. It is not dependent on the rest of jfx integration, but of course requires java 8 installation. Also, media support is not that great
http://docs.oracle.com/javafx/2/api/javafx/scene/media/package-summary.html#SupportedMediaTypes
Basically only MP4(H.264) and FLV(VP6).

14 Likes