Play video on jme3

I really really appreciate you my friend.

I can’t, but i know that the android browser supports html5, html5 supports videos, and a html browser can be embedded into an app.

1 Like

Sorry, I am struggling to get this to work and my free time is up.
Here is another example I just found.
It might be useful:

1 Like

As @mathiasj mentioned it is possible to use javafx in android and ios.
please take look at here :
it goes with details . please take look at it and say if it is possible for using in jme ?

Has anyone explored the option of creating a wrapper API that only defines interface and Factory methods then having platform-specific implementation JARS that use the appropriate native libs for the given platform (via JNA or JNI) for video playback? Something along the lines of:

  • Windows : Factory/Interface(JAR)->Windows Implementation Jar(Wraps)->Windows Media Framework
  • Linux : FI(JAR)->Linux Implementation Jar(Wraps)->GStreamer
  • Android : FI(JAR)->Android Implementation Jar(Wraps)->Android Video/Media API
  • etc…

EDIT: To clarify further…

It seems to me that all that is needed is a way to decode a video stream (OGG Theora, h264, VP8/9, or whatever you choose to include as an asset with your game) into an audio stream and a series of frames to map to a texture (or a window if full-screen playback). Using the underyling OS-specific DRM/Media libs for this seems to be the best/most efficient way of achieving this without introducing a lot of unnecessary dependencies (like JavaFX etc).

I’m just beginning to explore JME3 and game development, so, as I get into it, I’ll likely explore this option given that none of the solutions I’ve seen presented in these threads seems workable across all platforms without a lot of hacks.

If this option has already been explored and deemed inappropriate for JME3, is there any discussion that can be pointed to explaining why it is not the sensible option?

There have been attempts to do this in the past … Its just that there are many differences between various platforms on how this functionality is exposed. It requires a lot of native code to be maintained constantly to make sure it is properly supported. Oracle takes care of this in JavaFX, so I do not see the problem there. In the end its just reinventing their wheel.

The alternative is to implement a really light-weight version of ffmpeg with just has VP9 / Opus decoding (i.e. the patent free codecs) - if I had to implement video playback for jME3 this would be the approach I would take.

I would probably look for a pure java implementation of one video codec, and use this everywhere. Scaleing down the videos on mobile if performance wise necessary.

1 Like

Thanks bro.
This is what i wanted. no thing can feel better than a pure library.
again thanks.

Wouldn’t it be best to utilize hardware decoding etc when available? More efficient. Less battery usage. Less CPU usage. etc. etc. I would think sticking to a software only implementation (especially a pure java implementation) would be counter-productive. Just my humble opinion.

1 Like

Yes it would be,
but since I am mainly time constrained (development time), I would not care.

That would be stuff to check on later when it works, and it can be improved by paying for itself.

1 Like

You can still use JOGL to play the videos under Android instead of reinventing the wheel or using OpenJFX/JavaFX :slight_smile:

Can you quote an example in jme.
as I know JME use LWJGL not JOGL.

Just a heads up, I tried JCodec, pure java mentioned in that link, couldn’t get it playing at more than 5fps on my desktop.

Mr Marbles explained how to use it with JMonkeyEngine 3 here. Sorry to contradict you but all major scenegraph APIs, frameworks and engines including JMonkeyEngine 2 and 3 rely on several sets of Java bindings for OpenGL and/or OpenGL ES. Note that JMonkeyEngine doesn’t use the first set of bindings you mentioned under Android, it uses the build-in Android OpenGL ES API but it’s possible to use the JOGL media player under Android without using it for the rest of the rendering.

The JOGL JMonkeyEngine 3 renderer is experimental and works only in desktop environments even though JOGL supports Android.

1 Like

Which video type have you tried? VP8?

Thanks friend .
I did not know about it. Sorry for my lacking of knowledge. And thanks you to let me know about it.

I only tried mp4. The problem (from what I could tell) was that it will only grab individual frames, and does not go from frame to frame, it always started from the beginning and went to the frame number/time you requested.

If you could solve problem and successfully play the video whit jCodec ; please provide the code so we can use it tooooooooooo. :kissing_heart:

Unfortunately I don’t think the devs work on it anymore, and I could not solve it so abandoned it long ago.

EDIT: I think I’m wrong it is still updated; either way I could not figure it out. Examples on the home page didn’t run. A better programmer than I might find an easy solution, I didn’t exactly look too deeply and don’t know what I’m doing :slight_smile:

I’d like to add a small example into JMonkeyEngine, a simple rotating cube with a video played on each face, by porting this example using JOGL:

However, it will be useless for you if you persist in not using the JOGL backend and it’s difficult to port to JMonkeyEngine as it uses a lot of JOGL helper classes.

1 Like