【发布时间】:2013-12-16 23:31:02
【问题描述】:
好的,所以我正在尝试在应用程序打开时让声音文件永远循环播放。这是目前我得到的运行声音文件的代码。
public class Game {
public static void main(String[] args) {
JFrame window = new JFrame("Josh's 2D College Project");
window.setContentPane(new GamePanel());
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setResizable(false);
window.pack();
window.setVisible(true);
try{
File file = new File("C:/Users/Josh Scott (Zinotia)/Desktop/2D College Project/Resources/Sounds/BGSong.mp3");
FileInputStream fis = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fis);
try{
Player player = new Player(bis);
player.play();
} catch(JavaLayerException ex) {}
} catch(IOException e){}
}
}
我正在使用 JavaZoom 的 JavaLayer 来播放 Mp3 文件。谁能给我另一种方式来循环和使用声音文件,或者以不同的方式或使用JavaLayer。
【问题讨论】:
-
您好,请看this answer.
标签: java