1

I have written this code for playing audio file, I want to get indication when my audio file ends after playing. I have tried AS.getMicrosecondLength() == AS.getMicrosecondPosition() but these methods are undefined for the AudioStream. Please tell how I can do that.

import java.io.FileInputStream;
import sun.audio.AudioPlayer;
import sun.audio.AudioStream;


public class A {

    public static void main(String arg[]) throws Exception {

        AudioStream AS = new AudioStream(new FileInputStream("sounds.wav"));
        AudioPlayer.player.start(AS);
    }
}
user3787543
  • 11
  • 1
  • 3
  • 1
    Just to be aware of `sun.audio`: http://stackoverflow.com/questions/22031701/sun-audio-player-and-sound-i-o – Christian Tapia Jul 06 '14 at 04:02
  • You shouldn't being the sun.audio classes directly at all. See [this question](http://stackoverflow.com/q/11919009/207421) for the correct way to do it. – user207421 Jul 06 '14 at 09:16

1 Answers1

0

AS.getMicrosecondLength() == AS.getMicrosecondPosition() could be used to set off the flag when the clip has ended