You are on page 1of 1

import javax.microedition.midled.*; import javax.microedition.lcdui.*; import javax.microedition.media.*; import javax.microedition.media.

control*; public class PlaneSpace extends MIDlet implements PlayerListener { private Play play; private Display display; private satatis Player player; private VolumeControl vc; public PlaneSpace() { display = Display.getDisplay(this); } public void startApp(){ try { playMedia("background.wav"); }catch (Exception e) { e.printStackTrace(); } play = new Play(this, display, player); play.setFullScreenMode (true); display.setCurrent (play); new Thread(play).start(); } public void pauseApp() {} public void destroyApp(boolean unconditional) { if(player != null){ player.close(); } } public void exitMIDlet() { destroyApp(false); notifyDestroyed(); } private void playMedia (String file) throws Exception { player = Manager.create Player(getClass().getResourceAsStream(file),"audio/x-wav "); player.addPlayerListener(this); player.setLoopCount(-1); player.prefetch(); player.realize(); vc = (VolumeControl)player.getControl("VolumeControl"); if (vc != null) vc.setLevel(30); player.start(); } public void playerUpdate (Player palyer, String event, Object evenData) { if(event.equals(PlayerListener.STARTED) && new Long(OL).equals((Long)eventData)){ } else if(event.equals(PLayerListener.CLOSED)) { } } };

You might also like