I am trying to play audio streaming using a simple java application. I have written the code but getting the following exception:
"javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input URL"
Not sure what I am doing wrong. Please help. Thank you.
Pasted below is my code:
public static void main(String[] args) {
URL url = null;
try {
url = new URL("http://stream.xmission.com:8000/kcpw");
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(url);
Clip clip = AudioSystem.getClip();
clip.open(audioInputStream);
clip.start();
} catch (IOException e) {
e.printStackTrace();
} catch (UnsupportedAudioFileException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (LineUnavailableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}