FXGLGames icon indicating copy to clipboard operation
FXGLGames copied to clipboard

GeometryWars fails to load bgm.mp3: "jfxmedia.MediaException: Could not create player"

Open travisfw opened this issue 9 years ago • 5 comments

I spotted http://almasb.github.io/FXGLGames/ on reddit, and tried out the first example listed: GeometryWars. I cloned FXGLGames, changed directory to GeometryWars, executed mvn package which succeeded, and ran the jar with java -jar and it failed. See log output, etc: http://hastebin.com/fuvuholatu.sm

travisfw avatar Sep 11 '16 23:09 travisfw

Can you provide more details about your OS and jdk?

AlmasB avatar Sep 12 '16 00:09 AlmasB

~ ) cat /etc/fedora-release 
Fedora release 24 (Twenty Four)
~ ) java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

Anything else?

travisfw avatar Sep 12 '16 00:09 travisfw

FXGL uses JavaFX media to handle audio. Apparently this is what is required on linux:

Linux You must install the following in order to support AAC audio, MP3 audio, H.264 video, and HTTP Live Streaming: libavcodec52 and libavformat52 on Ubuntu Linux 10.04, 10.10, 11.04 or equivalent. libavcodec53 and libavformat53 on Ubuntu Linux 11.10, 12.04 or equivalent.

dnf search gave me nothing maybe you'll have more luck finding these.

Regarding the demo, the easiest way to run given the circumstances is to comment this line. Then run mvn clean package and start java -jar as normal.

I'll try to find an acceptable fallback audio provider for such cases. Thanks for testing this on linux

AlmasB avatar Sep 12 '16 10:09 AlmasB

There are open questions on ask.fedoraproject and stackoverflow targeting this issue: https://ask.fedoraproject.org/en/question/94059/how-to-install-libavcodec53-and-libavformat53-so-that-oracle-javafx-mediaplayer-will-initialize/ http://stackoverflow.com/questions/27475902/fedora-21-javafx-not-creating-mediaplayer

travisfw avatar Sep 12 '16 23:09 travisfw

After a long search through libraries and dependencies I've managed to install libavcodec and libavformat on a clean fedora 24. In short, ../jre/lib/amd64/ has libavplugin(53-56).so, so basically ffmpeg-compat gives version 52, which is no longer supported in jdk8_102, the new ffmpeg gives 57, which is not yet supported. So best bet is to use 56.

The rpm I used is here.

dnf install DOWNLOADED_RPM.rpm will say that a few .rpm are missing, so they have to be downloaded again manually using the same repo. Here's a shortcut for x86_64.

Once ffmpeg installs, you will find several libav*.so in /usr/lib64/ffmpeg-full-libs/ or wherever it installed them. All of the libav*.so need to be copied to /lib64/.

This should do it, though I installed a few other things along the way like gstreamer* and glib*, so not entirely sure at what point the game stopped throwing the exception

AlmasB avatar Sep 15 '16 00:09 AlmasB