We put together a demo that shows what JavaFX can do on a RaspberryPi running fill 1080p HD on a TV using 5 way navigation(Arrows + Select). I hope you enjoy it, we had a lot of fun making it.
The first section of the video is a real recording direct of the HDMI output of the Raspberry Pi. So you can see the raw performance of the device, though video capture was limited to 30fps when the Pi was rendering at 60fps much of the time. The second section is a demo of how SceneBuilder could be used to build one of the demos. In all the menus we show the little overlay of arrow keys in top right corner so you can see how the menu is being navigated.
There are 4 separate menu demos:
- The first menu is a classic 2D menu system with a cool 2.5D section chooser.
- This is a cool vector 2D animated menu with a fun visual style. Playing with the idea of rotation.
- This is a cartoon retro style 3D menu showing 3D extruded text and 3D modeled TVs. The text and TVs were created in Cheetah 3D and exported as OBJ then imported using the OBJ importer available in the open source 3D Viewer sample app. In this demo and the next we have random animated lighting in and the ability to spin the 3D model with the <- and -> arrow keys so that the user can get a feeling for it being real time rendered 3D rather than video of offline rendered content.
- This was a way out 3D menu featuring DukeBot who was a early alternative design for the Java Duke mascot that did not get chosen. He was modeled and animated by John Yoon in Maya and we then imported the Maya ASCII file directly with all animation into JavaFX. The code for this menu is pretty tiny as its mostly working off the imported Maya file. The Maya importer is also open source and in the 3D Viewer sample app.
Its mostly running on the shipping EA of JavaFX 8 Embedded we prototyped a couple changes to the platform that we are working on making them real and I hope they will make it into 8 but not sure yet if we will have time. The changes are some performance improvements to how we draw into frame buffer, also the ability to draw JavaFX with transparent background on a hardware layer over hardware decoded video.
Great design, and very cool menus. But… Is that Media Support on the Raspi? That would be great news. I thought Media and WebView won’t be supported on embedded.
There is no JavaFX media support on Pi, we prototyped passing hardware decoded frames of video into OpenGL so that it could be drawn in JavaFX Scene but performance was not great. So what we do is draw JavaFX with a transparent background just like a transparent window on desktop. Then use the native omx media player to play video to a lower layer under the JavaFX graphics. So basically standard hardware overlay graphics. This works great on PI and there is only about a 10% drop in JavaFX performance when playing a HD video stream underneath. So simple animations we can get 50+ fps with video at same time.
Thanks for the explanation, sound like a good workaround. Do you have a hint what we can do to play small audio clips like the ones required for games. I know that @Jerady is looking for something like that for an application he’s developing, and I would like to include it in a little game engine.
How can we make the stage transparent?
I tried with:
Scene scene = new Scene(root,Color.TRANSPARENT);
primaryStage.initStyle(StageStyle.TRANSPARENT);
But this gives me a stage with a black background. (Build b109)
Dear Jasper,
Hi, I’ve been trying to implement a similar approach (overlay of omxplayer + javafx app via console). My problem is that JavaFX’ Stage transparency seems to be not supported in the RPi (even using CSS styles + Color.Tansparent +StageStyle.TRANSPARENT wont work, you always get a solid non-transparent box) . May you please share some tips on this issue?
Greets from Bolivia
I would like to know how you did this. OmxPlayer always appears on top for me. How can you force JavaFX to appear on top and transparent?
Hi,
thanks for posting your demo – the menu looks way cool.
I am working on a similar project except I want to INTERACT WITH omxplayer from my JavaFX app, i.e. I not only want to start an mp3 file in the background; I want omxplayer to respond to button clicks from my app, which, I guess can be described as a GUI for omxplayer. I know tboplayer is an option, but if I were to implement this myself, I need some guidance as to how it is done (how can my javafx app interact with omxplayer, a command line program?). My approach so far involves a mess of threads / processes, and the major setback I have is that I cannot talk to the omxplayer process after it has started playing an mp3 file. Any ideas are appreciated
You can try making fake keyboard events in your java program with the ” com.sun.glass.ui.robot.Robot” class.
Robot robot = com.sun.glass.ui.Application.GetApplication().createRobot();
robot.keyPress(KeyEvent.Q);
That might be able to control Omxplayer
I use Fedora / Ubuntu Linux distribution, and I have Oracle JDK 7 and 8 (with JavaFX), but I have no 3D support for JavaFX API, I meet all system requirements (and even more). How do I fix this?:
Note: Install Windows 7 on my PC and if worked, but Linux distributions does not support the API.
It looks cool but I have a comment.
It’s only for techies. Period. Any content creator or designer would blow chunks over all the aliasing in the overlay graphics. Apple or Adobe would never allow such flagrant shortcomings to air, not even for techies.
And you can’t say it’s ONLY for techies since a techie showing this to a fellow designer will be laughed at and being defaced never recommend JavaFX again.
Do it right or wait until it is.
It does show promise though.
Bill
Hi, i’ve tried the current version of the jdk (build 1.8.0-ea-b109) on the raspberry pi, but the commands “primaryStage.initStyle(StageStyle.TRANSPARENT)” and “scene.setFill(null)” seems to have no effect. I get a black panel drawn over my pi text and also over the omx-player video. What am i doing wrong?
ı have the same issue. Any suggestion please?
The StopWatch (from the fx examples) is also on a black instead of a transparent background on the pi
Ok, now i read that the transparent background is only available with the changes you made 🙁 . When do you think will this feature be available in the jvm for linux ARM systems?
All,
Indeed with current JavaFx for RPi the transparency will be an issue (e.g overlay on top of omxplayer is not possible, and you have a solid non-teansparent stage). I found a “reverse” workaround for this without JavaFx, by using JOGL 2.0 and NEWT, with these you can have full transparency (however omxplayer is shown on top of your app plus your own canvas, working 100%). Not a replacement to JavaFx but at least a nice solution if you want to use omxplayer on your java app. brief, with JOGL you can have omxplayer and transparency on java apps. I’ll to put a screenshot later
could u send sample code please
hey…i want to create a 3D scene for my project using javafx technology So wanted to know whether maya and javafx can be comined ? if yes than how?plz reply as soon as possible..
Check out 3DViewer sample which you can download in Demos and Samples bundle from here http://www.oracle.com/technetwork/java/javafx/samples/index.html
Great job!!!
I’m trying an to do a module for a vending machine that need to reproduce a video, but I have serious problems with performance using QT.
Could you give to me some clues or where to find information about how to reproduce media with JavaFX?
Thank’s and sorry my poor english.
Check out MediaPlayer sample code in Ensemble http://www.oracle.com/technetwork/java/javafx/samples/index.html
There is MediaView node with MediaPlayer and Media classes. See here, for example: http://download.oracle.com/otndocs/products/javafx/2/samples/Ensemble/index.html#SAMPLES/Media/Advanced Media
Hi Alexander,
MEdia classes don’t work with JavaFx JDK8 (raspberry option, if you want to use javaFx on RPi).
Do you know how can I still play music without media classe (I havent been able to get the older option (sound sampled) running).
Thanks
I’m in dire need of embedding video into JavaFX. Anyone care to explain any way at all to obtain that? I just can’t get video to play with javafx in any way.
Please see my comment above.
Check out MediaPlayer sample code in Ensemble http://www.oracle.com/technetwork/java/javafx/samples/index.html
I know this is pretty old but is there any way to get project source code you used to do this on the raspberry pi? I have yet to get anywhere close to this level of performance on the pi with JavaFX!
By the way… unless I am doing something wrong the ensemble media examples do not work at all on the raspberry pi!