I am trying to run a sound file in Java using this code:
public class Audio3
{
public static void main(String[] args) throws Exception
{
URL soundFile =new URL(
"http://everyayah.com/data/Ghamadi_40kbps/audhubillah.mp3");
AudioInputStream ais = AudioSystem.getAudioInputStream(soundFile);
AudioPlayer.player.start(ais);
}
}
I am getting this exception
javax.sound.sampled.UnsupportedAudioFileException:
could not get audio input stream from input URL
Any idea what could be the reason?
According to the JavaSound info. page.
I can vouch for that information since I’ve successfully loaded MP3s using Java Sound and the MP3 SPI (& also wrote the info. page 😉 ). The JMF installer download is becoming hard to find, but you can get the
mp3plugin.jardirect from where I put it for use in JWS apps.