How to play a .mp3 file successfully
This question already has an answer here:
Check Xuggle or jLayer.
Google them and you will come up with nice results.
Good >> http://kxhitiz.blogspot.com.tr/2010/09/playing-mp3-in-java-programming.html
Java Jlayer Mp3 Player - how to repeat and stop song
public class JavaAudioPlaySoundExample
{
public static void main(String[] args)
throws Exception
{
// open the sound file as a Java input stream
String gongFile = "/Users/al/DevDaily/Projects/MeditationApp/resources/gong.au";
InputStream in = new FileInputStream(gongFile);
// create an audiostream from the inputstream
AudioStream audioStream = new AudioStream(in);
// play the audio clip with the audioplayer class
AudioPlayer.player.start(audioStream);
}
}
链接地址: http://www.djcxy.com/p/73804.html
下一篇: 如何成功播放.mp3文件