Play video on jme3

Of course not! JavaFX is for desktop only.

Also is there any tutorial in jme how to do it. I’m new to jme, just started to learn it. Sorry for my incompetence.

So, is there solution that will wort on desktop and in android?

Nope.

So what do ppl usually do when they want their project to be cross-platform?

You might want to take a look at http://gluonhq.com/open-source/javafxports/. This is a project with the aim to make JavaFX available for Android and iOS too. I have no experience with it tho but you might want to give it a shot.

Thank you, I’m checking it out

Hi friend
If there is any success please let us know.
I am planing to make a windows and android game which has lots of videos inside game play.
I hope there is a neat way to do it.
I never thought playing a video in game would be such difficult.

embedd a browser with html 5 on android directly in the app as a overlay,
on desktop playing it via javafx.

The second one works for sure, the first one might be worth a try.

1 Like

My friend can you give me a step by step guide ?
Or is there any tutorial ?
I’m really thanks full.

@Ali_RS, Do you want this video playback to be in full screen mode and what type of video file format are you planning on playing?

Yes in full screen.
about video format I consider mp4 or flv or anything else.

Okay cool, I might have some time to help you with this.
Give me an hour or so.

1 Like

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: http://androidexample.com/Play_Video_File_-_Android_Example/index.php?view=article_discription&aid=124&aaid=144

1 Like

Hi
As @mathiasj mentioned it is possible to use javafx in android and ios.
please take look at here : http://www.infoq.com/articles/Building-JavaFX-Android-Apps
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