AlbertPi -3 Light Poster

This is my function. see below:

 public void SoundTest() {
    try {
        AudioInputStream audioInputStream;
        File file = new File("C:\\Temp\\online.wav");
        audioInputStream = AudioSystem.getAudioInputStream(file);
        Clip line;
        line = (Clip) AudioSystem.getLine(new DataLine.Info(Clip.class, audioInputStream.getFormat()));
        line.open(audioInputStream);
      line.start();
      line.drain();
      audioInputStream.close();
    }
    catch (Exception e) {e.printStackTrace();}
    Toolkit.getDefaultToolkit().beep();
  }

I got this error when I ran it:
javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file.
Need help about "could not get audio input stream from input file". also I can play this .wav file from real player and Windows media play. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.