播放文件后,我正在尝试移动文件。
我正在使用javazoom的basicplayer播放文件,并且尝试了
player.close();
controler.close();
and DSP.close();
没有任何工作
这是我用来播放文件的代码
public void play(File sound) {
if (sound.exists()) {
new Thread("Sound player") {
public void run() {
currentSelectedSound = sound;
try {
control.open(currentSelectedSound);
control.play();
setVolume(currentAudioVolume);
setPan(currentAudioPan);
} catch (BasicPlayerException e) {
e.printStackTrace();
System.err.println("Error!");
}
}
}.start();
} else {
Logger.logError(TAG, "File doesn't exist!");
}
}
最佳答案
我很高兴它终于成功了,这是任何人的答案:
stop();
try {
//The thread used to play() the sound
soundPlayThread.join();
} catch (InterruptedException e1) {
e1.printStackTrace();
}
//Manually run the garbage collection and yield threads
System.gc();
Thread.yield();
我希望没有人像我一样浪费6个小时
非常感谢wuppi
https://stackoverflow.com/a/14123384/3224295
关于java - JavaZOOM播放后移动文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47426571/