[求助]Java应用程序播放声音出错
播放不了文件,错误提示 :: could not create audio stream from input streamat sun.audio.AudioStream.<init>(AudioStream.java:65)
at com.swt.code.PlayMusic.play(PlayMusic.java:24)
播放文件的类型(mp3.wav.mid)都试过了 ,报一样的错,请指教
也已经找到了正确的文件路径path;
程序如下
public void play(String path){
try {
FileInputStream fis=new FileInputStream(path);
try {
AudioStream as=new AudioStream(fis);///显示此行 报错
AudioPlayer.player.start(as);
} catch (IOException e1) {
// TODO Auto-generated catch block
System.out.println("Play music fail!");
e1.printStackTrace();
}
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}