lundi 9 février 2015

How to detect audioplayer has finished playback

I am running an audioplayer.


I want to implement an actionlistener when its playback has finished.



public void mediaPlayer()
throws Exception {
// open the sound file as a Java input stream

String soundFile = "./data/1.wav";
InputStream in = new FileInputStream(soundFile);
//
// // create an audiostream from the inputstream
AudioStream audioStream = new AudioStream(in);
// // play the audio clip with the audioplayer class
AudioPlayer.player.start(audioStream);
}


Is that possible?


Aucun commentaire:

Enregistrer un commentaire