Streaming Media : Stream Media « J2ME « Java Tutorial






import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.Display;
import javax.microedition.media.Manager;
import javax.microedition.media.Player;
import javax.microedition.midlet.MIDlet;

public class StreamingMediaMIDlet extends MIDlet {

  private Player player = null;

  private Display display = Display.getDisplay(this);

  private Alert alert = new Alert("Message");

  public StreamingMediaMIDlet() {
    try {
      player = Manager.createPlayer("rtsp://www.y.com/a.ra");
      player.realize();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  public void startApp() {
    try {
      player.start();
    } catch (Exception e) {
      e.printStackTrace();
    }

    alert.setString("Playing streaming radio");
    display.setCurrent(alert);
  }

  public void pauseApp() {
  }

  public void destroyApp(boolean unconditional) {
  }
}








31.56.Stream Media
31.56.1.Streaming Media