Is it possible to stream mp3s using pure Java? If so, what are the best resources to implement this.
If not, are any other music formats streamable using Java only?
To stream an mp3 file, upload your mp3 file to your public-html directory (or to a subdirectory of your public-html directory) preferably in MP3 format. OGG is also supported in Chrome and Firefox, but not in Safari and Internet Explorer. For example: Create a subdirectory (e.g., media) in your public-html directory.
It turned out that Java 7 has support for mp3 files: String bip = "example. mp3"; Media hit = new Media(bip); MediaPlayer mediaPlayer = new MediaPlayer(hit); mediaPlayer. play();
As Mario says, JMF - Java Media Framework is a good starting point.
What Mario does not say is that Sun killed MP3 support since 2.1.1b as detailed in the "My Lost Streaming MP3 Article" blog entry.
So you need to add a plugin to support MP3:
the JMF Formats list does mention MP3 (under the ACM -- Window's Audio Compression Manager support -- section), but only for Windows, and not with JMF alone.
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