MediaException with trivial javafx-media example

Mark Raynsford org.openjdk at
Mon Aug 31 11:46:48 UTC 2020


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: 

	at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(
	at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(
	at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(
	at javafx.fxml/javafx.fxml.FXMLLoader.load(
	at com.io7m.jbox/com.io7m.media_example.MainApplication.start(
	at com.io7m.jbox/com.io7m.media_example.Main.lambda$main$0(
	... 8 more
Caused by: MediaException: UNKNOWN : Could not create player! : Could not create player!
	at com.io7m.jbox/com.io7m.media_example.MainController.initialize(
	at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(
	... 12 more
Caused by: Could not create player!
	... 15 more

The example code is here, just run the com.io7m.media_example.Main program:

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

        int rc = gstInitPlayer(gstMedia.getNativeMediaRef());
        if (0 != rc) {
            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 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 |

More information about the openjfx-dev mailing list