B4J Question Play MP3 without JavaFX

Blueforcer

Well-Known Member
Licensed User
Longtime User
i need to play a mp3 in my non-Gui application.
i tried this workaround:


But unfortunally this also depends on javaFX
B4X: Copy
java.lang.NoClassDefFoundError: javafx/beans/value/ChangeListener

is there another way?
 
This is my original test project, which I just tried as a non gui app and it still works. I've attached the additional library as well if it helps. I had to remove the mp3 as it was too big to upload, it is obvious where you need to put your mp3filename,
 

Attachments

Upvote 0
It only works if i use an JRE with integrated JavaFX.
without it crashes on line "Dim Player As Reflector" with
B4X: Copy
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: javafx/beans/value/ChangeListener
 
Last edited:
Upvote 0
The calls that make this work are made to private methods, which can only be accessed via reflection and not javaobject. You will probably have to find an alternative library that will play the MP3 without a gui. MP3 support is non existent in AWT, so it will have to be a library. I have heard that JLayer may help if you want to look into that.
 
Upvote 0
This is how MP3 files can be played in ABMaterial applications (non-GUI), using Javascript.
(though I am not sure if this could be applicable in your case)

 
Upvote 0
Back
Top