import java.awt.*;
import java.applet.*;
public class AudioPlay extends Applet implements Runnable
{
AudioClip bgsound;
AudioClip beep;
Thread mythread;
public void init()
{
bgsound = getAudioClip(getDocumentBase(),"loop.wav");
beep = getAudioClip(getDocumentBase(),"beep.wav");
}
public void start()
{
if(mythread == null)
{
mythread = new Thread(this);
mythread.start();
}
}
public void stop()
{
if(mythread != null)
{
if(bgsound != null)
bgsound.stop();
mythread.stop();
mythread = null;
}
}
public void run()
{
bgsound.loop();
while(mythread != null)
{
try
{
Thread.sleep(5000);
}
catch (Exception ex)
{
}
beep.play();
}
}
}
link for downloading necessary files: http://sh.st/qMF95
import java.applet.*;
public class AudioPlay extends Applet implements Runnable
{
AudioClip bgsound;
AudioClip beep;
Thread mythread;
public void init()
{
bgsound = getAudioClip(getDocumentBase(),"loop.wav");
beep = getAudioClip(getDocumentBase(),"beep.wav");
}
public void start()
{
if(mythread == null)
{
mythread = new Thread(this);
mythread.start();
}
}
public void stop()
{
if(mythread != null)
{
if(bgsound != null)
bgsound.stop();
mythread.stop();
mythread = null;
}
}
public void run()
{
bgsound.loop();
while(mythread != null)
{
try
{
Thread.sleep(5000);
}
catch (Exception ex)
{
}
beep.play();
}
}
}
link for downloading necessary files: http://sh.st/qMF95
great
ReplyDelete