![]() |
Applet to play a sound clip |
This example is an applet which plays a sound clip which is available via a URL. The clip must be in a file with extension '.au'.
Here's the source, as a plain ASCII file.
The applet is compiled using the same steps as for the 'Hello World' applet. Unlike 'Hello Word', however, this applet takes as a parameter the URL of the audio clip to be played; to have the clip played from a World Wide Web page, you need to
<applet code="PlayClip.class" width=0 height=0> <param name=clip value="welclip.au"> </applet>
The width and height are set to zero as this applet needs no screen space. The value of the 'clip' parameter is a URL that will locate the soundclip, relative to the document in which the Applet tag is located. In this example, a sample from the NetRexx server is specified.
Viewing the page with any Java-enabled browser, or with the
'applet viewer' that comes with the Java Development Kit should then
play the clip. If you are using such a program to view this card, you
may already have heard a short clip being played (assuming you have a
sound card, the volume isn't set to 0, and so on).
For more details on running applets, see the Hello World applet page.
[
IBM home page |
Search |
Contact IBM |
Help |
Legal |
Privacy
]