- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlaySound.java
More file actions
Latest commit
21 lines (15 loc) · 525 Bytes
/
Copy pathPlaySound.java
File metadata and controls
21 lines (15 loc) · 525 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
importjava.applet.*;
importjava.net.*;
// Play a sound file from the network using the java.applet.Applet API.
publicclassPlaySound {
publicstaticvoidmyPlay(Stringurl) throwsInterruptedException {
try {
longdelay = 5; //should still work even though deprecated
AudioClipclip = Applet.newAudioClip(newURL(url));
clip.play();
Thread.sleep(delay);
} catch (MalformedURLExceptionmurle) {
System.out.println(murle);
}
}
}