I'm currently working on a project in which i need to play a background mp3 sound. I managed to do that using the Jlayer library and a piece of code found here
However, I needed to add some more features to this code, such as loop playing and pause.
The loop function was fairly easy to implement, but i've spent hours looking for a way to pause and resume mp3 files.
My guess would have been to use the play(int frames) method in the Player class, using the getPosition() method and the mp3 total frame number, but i can't manage to get the total frame number.
Any clue ? I just need this pause/resume method, so if you know one way different from this, feel free to post
i've also been trying some stuff with the BasicPlayer library (link here), but i always end up getting javax.sound.sampled.UnsupportedAudioFileException when trying to read any mp3 file
You can't do that with the Default Player implementation.
You need to implement the stream classes and read data which those DataSourceLine classes. It's a bit hard work, but it's possible. I did it 2 years ago, if I found my code I post it to you.