import java.io.IOException;
import java.io.InputStream;
import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class MyWavMidlet extends MIDlet
{
Player player;
public MyWavMidlet()
{
super();
try
{
InputStream is=this.getClass().getResourceAsStream("/OKSOUND.WAV");
player=Manager.createPlayer(is, "audio/x-wav");
}
catch(IOException e){}
catch(MediaException e){}
}
// TODO Auto-generated constructor stub
protected void destroyApp(boolean arg0) throws MIDletStateChangeException
{
// TODO Auto-generated method stub
}
protected void pauseApp()
{
// TODO Auto-generated method stub
}
protected void startApp() throws MIDletStateChangeException
{
try
{
player.start();
}
catch(MediaException e){}
}
}
二月
19
发表评论