Results 1 to 3 of 3
  1. #1
    jomla is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Default To play wav or mp3

    Hi at all
    first I do not know java.
    I simply ask an applet like rhis:

    http://www.roseindia.net/java/exampl...undApplet.html

    Applet must be sure and standalone with e paramreter to can pass to applet the name of wav or mp3

    Thamk you

  2. #2
    jomla is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Default

    This is code:
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;

    public class PlaySoundApplet extends Applet implements ActionListener{
    Button play,stop;
    AudioClip audioClip;

    public void init(){
    play = new Button(" Play in Loop ");
    add(play);
    play.addActionListener(this);
    stop = new Button(" Stop ");
    add(stop);
    stop.addActionListener(this);
    audioClip = getAudioClip(getCodeBase(), "TestSnd.wav");
    }

    public void actionPerformed(ActionEvent ae){
    Button source = (Button)ae.getSource();
    if (source.getLabel() == " Play in Loop "){
    audioClip.play();
    }
    else if(source.getLabel() == " Stop "){
    audioClip.stop();
    }
    }
    }

    It work well but I am unable to build it as an aoolket accepting as parameter the name of audio file

  3. #3
    cultclassic is offline Member
    Join Date
    Mar 2011
    Posts
    64
    Rep Power
    0

Similar Threads

  1. Play the latest
    By jsntg in forum New To Java
    Replies: 3
    Last Post: 10-08-2010, 05:43 AM
  2. Come play gp latale
    By Blinger in forum Reviews / Advertising
    Replies: 0
    Last Post: 06-10-2010, 03:56 AM
  3. Play files
    By Doctor Cactus in forum New To Java
    Replies: 3
    Last Post: 11-01-2008, 06:33 AM
  4. Play music
    By carderne in forum New To Java
    Replies: 4
    Last Post: 08-05-2008, 02:09 PM
  5. play() and mp3
    By willemjav in forum Advanced Java
    Replies: 3
    Last Post: 12-23-2007, 03:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •