Reputation: 165
I'm trying to do a simple mp3 player,everything is perfect, just I have one problem I can't do (Play) the streaming radio mp3, where i do button 'play' i get this message:
Unable to handle format: mpeglayer3, 44100.0 Hz, 16-bit, Stereo, LittleEndian,
Signed, 16000.0 frame rate, FrameSize=32768 bits
Failed to realize: com.sun.media.PlaybackEngine@c88f97
Error: Unable to realize com.sun.media.PlaybackEngine@c88f97
this is my code :
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
String radiourl = direccionurl.getText();
URL url;
try {
url = new URL(radiourl);
openFile(url);
} catch (MalformedURLException ex) {
Logger.getLogger(VentanaInicio.class.getName()).log(Level.SEVERE, null, ex);
}
p.start();
}
public void openFile(URL url){
try{
p = Manager.createPlayer(url);
p.start();
}catch (Exception o){
o.printStackTrace();
}
}
Upvotes: 0
Views: 1155
Reputation: 30088
I also needed to write an audio player recently, and found an old, but good article with lots of sample code at http://onjava.com/pub/a/onjava/2004/08/11/javasound-mp3.html
I wrote a fairly simple player based on the information there. Up until now, I had only used it to play files, but I plugged your URL in, did a URL.openStream(), and sent it off to the player. Worked great.
Upvotes: 1