|
How to play a sound file in an Applet |
|
|
This Java tip illustrates a method of playing audio files in Java applets. Developer needs to to take care
that the audio clip resides on the same web server where your applet resides. Some time it may be the case
that the developer may need to sign the applet to get the audio file from the server.
public void init() {
// The first thing is to load the audio clip
AudioClip clip = getAudioClip(getDocumentBase(),
"http://server.com/clip.au");
// Play the audio clip
clip.play();
// Stop playing audio clip
clip.stop();
// In case audio clip needs to be played continuously
clip.loop();
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.