Java Tutorial/J2ME/Stream Media
Streaming Media
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.ru/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) {
}
}