MediaException with trivial javafx-media example
Mark Raynsford
org.openjdk at io7m.com
Mon Aug 31 11:46:48 UTC 2020
Hello!
I thought I'd give javafx-media a shot, as I'd never tried it before
and was curious as to what it was capable of. Unfortunately, it seems
that the most trivial possible example fails on Arch Linux. The symptom
is that attempting to create a Media player yields the following exception(s):
Caused by: javafx.fxml.LoadException:
/home/rm/doc/misc/2020/08/media_example/target/classes/com/io7m/media_example/mediaExample.fxml
at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2603)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
at com.io7m.jbox/com.io7m.media_example.MainApplication.start(MainApplication.java:43)
at com.io7m.jbox/com.io7m.media_example.Main.lambda$main$0(Main.java:36)
... 8 more
Caused by: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!
at javafx.media/javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:146)
at javafx.media/javafx.scene.media.MediaPlayer.init(MediaPlayer.java:518)
at javafx.media/javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:421)
at com.io7m.jbox/com.io7m.media_example.MainController.initialize(MainController.java:57)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2573)
... 12 more
Caused by: com.sun.media.jfxmedia.MediaException: Could not create player!
at javafx.media/com.sun.media.jfxmediaimpl.NativeMediaManager.getPlayer(NativeMediaManager.java:295)
at javafx.media/com.sun.media.jfxmedia.MediaManager.getPlayer(MediaManager.java:118)
at javafx.media/javafx.scene.media.MediaPlayer.init(MediaPlayer.java:474)
... 15 more
The example code is here, just run the com.io7m.media_example.Main program:
https://github.com/io7m/media_example_20200831
All the program does is unpack an included royalty-free H.264 MP4 file into
a temporary directory and attempts to play it in a 128x128 window.
I've traced the execution to this line in GSTMediaPlayer.java:
int rc = gstInitPlayer(gstMedia.getNativeMediaRef());
if (0 != rc) {
dispose();
throwMediaErrorException(rc, null);
}
It appears that gstMedia.getNativeMediaRef() returns 0L, and rc == 257
after the call. This results in the given MediaException.
I don't think I'm misusing the API, so I'm guessing that this is some
kind of system incompatibility. I've seen similar reports online, but
those appeared to be down to using a raw filesystem path as the media
source rather than a URI, but that's not the case here.
$ uname -a
Linux sunflower.int.arc7.info 5.8.4-arch1-1 #1 SMP PREEMPT Wed, 26 Aug 2020 18:35:43 +0000 x86_64 GNU/Linux
$ java -version
openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12)
OpenJDK 64-Bit Server VM (build 14.0.2+12, mixed mode)
Any assistance would be appreciated!
--
Mark Raynsford | https://www.io7m.com
More information about the openjfx-dev
mailing list