Hello guys.

I'm wondering is it possible to stream mp3 songs from some site with java?
I tried to find something but allways everything what i found was only for reading mp3 songs from local disk.
If you know feel free to answer me.

- Regards, David.

Recommended Answers

All 3 Replies

Hello guys.

I'm wondering is it possible to stream mp3 songs from some site with java?
I tried to find something but allways everything what i found was only for reading mp3 songs from local disk.
If you know feel free to answer me.

- Regards, David.

Hmm im not sure, may this be of help:http://www.exampledepot.com/egs/javax.sound.sampled/StreamAudio.html , maybe this:http://stackoverflow.com/questions/657921/how-to-stream-mp3-using-pure-java and this:http://stackoverflow.com/questions/343240/how-do-i-convert-an-audio-stream-to-mp3-using-java

commented: Thanks for help +0

Finally i finished code. @cOrPuPtG3n3t!x i found something from there so thanks for links. Here is code for someone who need this:

package stream;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import javax.media.*;

import com.sun.media.codec.audio.mp3.JavaDecoder;

public class Aligner {

	static {
		JavaDecoder.main(new String[] {});
	}
	
	public static void main(String[] args) throws NoPlayerException, MalformedURLException, IOException  
	{
		Player player = Manager.createPlayer(new URL("/* URL of MP3 song */"));    
		player.start();
	}
}

PS. You will need Java MP3 PlugIn

now lets try to do it with live microphone audio... :S

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.