This seems to be a recurring issue:
- JavaFX mp3 playback Ubuntu 14.04
- JavaFX mp3 playback became unsupported in Ubuntu 14.10
- https://forums.linuxmint.com/viewtopic.php?t=178503
After updating from Linux Mint 18 to Linux Mint 20, the creation of MediaPlayer
for this file fails (the locator uri is on the same file system) due to ERROR_MEDIA_AUDIO_FORMAT_UNSUPPORTED
. Loading a *.wav
file works though and from that I get this debug output:
Debug (0:00:05:544): Creating AudioClip for URI file:/home/.../target/classes/sound/organ.wav
Debug (0:00:05:591): Enabled JFXMedia platforms:
- com.sun.media.jfxmediaimpl.platform.java.JavaPlatform
- com.sun.media.jfxmediaimpl.platform.gstreamer.GSTPlatform
Debug (0:00:05:591): JFXMedia supported protocols:
file
http
https
Debug (0:00:05:594): Getting content types from platform: com.sun.media.jfxmediaimpl.platform.java.JavaPlatform@3a36fa07
Debug (0:00:05:594): Getting content types from platform: com.sun.media.jfxmediaimpl.platform.gstreamer.GSTPlatform@3e10dcb9
Debug (0:00:05:594): JFXMedia supported content types:
audio/x-aiff
audio/mp3
audio/mpeg
audio/x-wav
video/mp4
audio/x-m4a
video/x-m4v
application/vnd.apple.mpegurl
audio/mpegurl
The protocol here is file
and the mime type is audio/mpeg
which are both in the supported list above. Obviously the platform that is used is GSTPlatform.
As I understand it this is a problem with a missing codec. However I made sure that these libraries are present:
- libavutil56
- libavformat58
- libavcodec58
- Did I miss a library that is required?
- Is there a way to have an additional Platform that would work?
- What needs to be done to change the content type to be recognized as
audio/mp3
instead ofaudio/mpeg
and would that possibly solve the issue.
As mentioned above the same code could initialize the player with this file on Linux Mint 18, so it cannot be an issue with the code itself, but must be in the environment.
Java version: openjdk 14.0.1 2020-04-14
JavaFX version: 11