用这个简易的MP3播放代码,本地播放没问题,但是部署到linux后就无法播放,请问这是什么原因?路径是服务器上的绝对路径
public void testname() throws Exception {
}
private String filename;
private Player player;
public MP3Player(String filename) {
this.filename = filename;
}
public void play() {
try {
BufferedInputStream buffer = new BufferedInputStream(new FileInputStream(filename));
player = new Player(buffer);
player.play();
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) {
String urlString = "callout/059187517113N18618216211C20180528164749751B906101033211A.mp3";
MP3Player mp3 = new MP3Player(urlString);
mp3.play();
}
linux音乐播放的路径是识别不到的,文件路径可以读,所以使用流的播放方式才可以播放,用的是前端的meida播放