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:
java.lang.NoClassDefFoundError: javafx/beans/value/ChangeListener

is there another way?
 

stevel05

Expert
Licensed User
Longtime User
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

  • NGM.zip
    1.1 KB · Views: 315
  • mp3transform.jar
    107.8 KB · Views: 324
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
It only works if i use an JRE with integrated JavaFX.
without it crashes on line "Dim Player As Reflector" with
B4X:
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: javafx/beans/value/ChangeListener
 
Last edited:
Upvote 0

stevel05

Expert
Licensed User
Longtime User
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

Philip Chatzigeorgiadis

Active Member
Licensed User
Longtime User
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
Top