私は次のコードを持っています:
InputStream stream = (InputStream)this.getClass().getResourceAsStream("/preview.mp3");
Player p = Manager.createPlayer(stream, "audio/mpeg");
p.realize();
p.prefetch();
p.setLoopCount(-1);
VolumeControl volume = (VolumeControl) p.getControl("VolumeControl");
volume.setLevel(1);
p.start();
次に、stopAlarm()を呼び出すと
// Stop playing music
void stopAlarm()
{
try
{
// Tell player to stop playing
p.stop();
}
catch (Exception e)
{
Dialog.alert("Error stopping music");
}
// Then release the data and close out the player
p.deallocate();
p.close();
}
要するに、それはオーディオを止めません。
誰かがこれについて私を助けてくれたらとてもありがたいです。