Here's the code, like the title says the music stops after 10ish seconds, i played the file normally in vlc or other programs, it lasts more than 5 minutes.
public void music(){
String bip = "src/data/fjordmusic.mp3";
Media hit = new Media(Paths.get(bip).toUri().toString());
MediaPlayer mediaPlayer = new MediaPlayer(hit);
mediaPlayer.play();
}
Try AudioClip instead:
javafx.scene.media.AudioClip;
public void music(){
String bip = "src/data/fjordmusic.mp3";
Media hit = new Media(Paths.get(bip).toUri().toString());
AudioClip mediaPlayer = new AudioClip(hit.getSource());
mediaPlayer.play();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With