home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1998 February / PCOnline_02_1998.iso / filesbbs / os2 / netrexx.arj / NETREXX.ZIP / NetRexx / PlayClip.nrx < prev    next >
Encoding:
Text File  |  1996-09-01  |  796 b   |  34 lines

  1. /* Play an audio clip; the URL of the clip is relative to base document */
  2. import sun.net.www.
  3. import sun.audio.
  4.  
  5. class PlayClip extends Applet
  6.  
  7.   audioclip=AudioStream
  8.  
  9.   method start
  10.     URLString=getParameter("clip")
  11.     if URLString=null then UrlString="welclip.au"
  12.  
  13.     say "Fetching:" UrlString
  14.  
  15.     do
  16.       myUrl=URL(getDocumentBase(), UrlString)
  17.       is=myUrl.openStream
  18.       audioclip=AudioStream(is)
  19.     catch badURL=java.net.MalformedURLException
  20.       say "Malformed URL" badURL.getMessage
  21.       return
  22.     catch badIO=java.io.IOException
  23.       say "IOException" badIO.getMessage
  24.     end
  25.  
  26.     AudioPlayer.player.start(audioclip)
  27.  
  28.  
  29.   method stop
  30.     if audioclip\=null then do
  31.       AudioPlayer.player.stop(audioclip)
  32.       audioclip=null
  33.       end
  34.