Loading and Playing Audio in an Application - Java Media

Java examples for Media:Audio

Description

Loading and Playing Audio in an Application

Demo Code

import java.applet.Applet;
import java.applet.AudioClip;
import java.net.URL;

public class Main {
  public static void main(String[] args) throws Exception {
    URL url = new URL("http://hostname/audio.au");
    AudioClip ac = Applet.newAudioClip(url);
    ac.play();/*ww w .ja v a 2  s . c  o  m*/
  }
}

Related Tutorials