Feeling a lack of inspiration with my Encoding project, I dug up some old code I helped write for a Hackathon a few months ago - creating an mp3 player in Java. I remembered it being a rather fun challenge and thought I could rewrite it now, after everything I’ve learned, making something I could really show off.
But if you’ve read my blog thus far, you know that things don’t always go according to plan.
The original concept had us reading in the song information from a file, storing it in an ArrayList, and using that information (with some input from the user) to create a playlist based on genre, artist, or mood.
I wanted to keep a lot of that structure and add more, so my first step was to grab the old code and see what I could run of it.
Not much apparently.
After fixing the initial mini-bugs that always come with importing an existing project, I realised there was a huge issue with the Player I used to actually play the file - in short, it did not exist in my library.
Do you want bugs? This is how you get bugs.
Apparently in my haste to get something working for the Hackathon, I found an older library called javazoom that worked with media files. After some googling, I found the site but as it was last updated in 2010, I figured there had to be other, more recent libraries to explore.
And I was right. Kind of.
After much digging, I came across javafx. Truthfully, I’m not sure of its full scope, but it does have a media player and related functions, and a rather nice API. So I started tinkering around with it, eventually figuring out how to play a song.
Yup. It was Taylor Swift. Because my taste in music rocks.
At first things were going up. I rearranged the code into a semblance of structure and began poking at the other methods trying to see what else worked. (Including figuring out how to control the sound - after nearly blowing my ears out, twice!)
Unfortunately that’s where my progress has stalled. With the exception of pause() and stop(), the methods are less than obvious and when I went to run a full song as my last test, I discovered it stops after about 30 seconds.
At least it’s pretty?
I’m going to continue working on it, though I am serious considering reverting back to javazoom. I’d rather have well-written code using a slightly out-of-date library than mediocre stuff written with more modern equipment.
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
✓ Live Streaming✓ Interactive Chat✓ Private Shows✓ HD Quality✓ Free Actions
Free to watch • No registration required • HD streaming