Example usage for java.applet AudioClip loop

List of usage examples for java.applet AudioClip loop

Introduction

In this page you can find the example usage for java.applet AudioClip loop.

Prototype

void loop();

Source Link

Document

Starts playing this audio clip in a loop.

Usage

From source file:Play.java

public static void main(String args[]) {
    try {/*from  w w  w  .  j a va  2  s  .c om*/
        // Loop
        URL url = new URL("http://java.sun.com/applets/other/Hangman/audio/whoopy.au");
        AudioClip clip = Applet.newAudioClip(url);
        clip.loop();
        Thread.sleep(5000);
        //Play
        File file = new File("bark.wav");
        clip = Applet.newAudioClip(file.toURL());
        clip.play();
        Thread.sleep(500);
        System.exit(0);
    } catch (InterruptedException e) {
    } catch (MalformedURLException e) {
    }
}