home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 October / PCO1097.ISO / FilesBBS / OS2 / NETREXX.ARJ / NETREXX.ZIP / NetRexx / PlayClip.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-06-25  |  1.5 KB  |  51 lines

  1. import java.applet.Applet;
  2. import java.io.IOException;
  3. import java.io.InputStream;
  4. import java.net.MalformedURLException;
  5. import java.net.URL;
  6. import netrexx.lang.Rexx;
  7. import netrexx.lang.RexxIO;
  8. import netrexx.lang.RexxSet;
  9. import sun.audio.AudioPlayer;
  10. import sun.audio.AudioStream;
  11.  
  12. public class PlayClip extends Applet {
  13.    protected AudioStream audioclip;
  14.    // $FF: renamed from: $0 java.lang.String
  15.    private static final String field_0 = "PlayClip.nrx";
  16.  
  17.    public void start() {
  18.       Object var2 = null;
  19.       Object var3 = null;
  20.       Object var4 = null;
  21.       Object var5 = null;
  22.       String var1 = ((Applet)this).getParameter("clip");
  23.       if (var1 == null) {
  24.          var1 = "welclip.au";
  25.       }
  26.  
  27.       RexxIO.Say((new Rexx("Fetching:")).OpCcblank((RexxSet)null, new Rexx(var1)));
  28.  
  29.       try {
  30.          URL var9 = new URL(((Applet)this).getDocumentBase(), var1);
  31.          InputStream var10 = var9.openStream();
  32.          this.audioclip = new AudioStream(var10);
  33.       } catch (MalformedURLException var7) {
  34.          RexxIO.Say((new Rexx("Malformed URL")).OpCcblank((RexxSet)null, new Rexx(((Throwable)var7).getMessage())));
  35.          return;
  36.       } catch (IOException var8) {
  37.          RexxIO.Say((new Rexx("IOException")).OpCcblank((RexxSet)null, new Rexx(((Throwable)var8).getMessage())));
  38.       }
  39.  
  40.       AudioPlayer.player.start(this.audioclip);
  41.    }
  42.  
  43.    public void stop() {
  44.       if (this.audioclip != null) {
  45.          AudioPlayer.player.stop(this.audioclip);
  46.          this.audioclip = null;
  47.       }
  48.  
  49.    }
  50. }
  51.