Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
ServerDemo.java
Package: RTSPStreaming.zip [view]
Upload User: gmxazy
Upload Date: 2022-06-06
Package Size: 70k
Code Size: 2k
Category:
J2ME
Development Platform:
Java
- import java.io.*;
- import javax.microedition.io.*;
- import javax.microedition.lcdui.*;
- import javax.microedition.midlet.*;
- import javax.microedition.media.*;
- /**
- * Simple midlet to demo the RTSP server. Install, run, wait for the
- * screen to say "Server running" then select a method to play the sound.
- * Then watch it fail! Alternatively, run it in WTK and connect to the
- * audio stream using Quicktime, Realplayer, VLC, etc. (but not Windows Media
- * Player, for some reason).
- */
- public class ServerDemo extends MIDlet implements CommandListener, Runnable {
- private Command play1;
- private Command play2;
- private Command exit;
- private Form form;
- private Display display;
- private RTSPServer server;
- public ServerDemo() {
- play1 = new Command("Play MMAPI", Command.SCREEN, 1);
- play2 = new Command("Play External", Command.SCREEN, 1);
- exit = new Command("Exit", Command.EXIT, 1);
- form = new Form ("Server Test");
- form.addCommand(play1);
- form.addCommand(play2);
- form.addCommand(exit);
- form.setCommandListener(this);
- }
- protected void startApp() {
- display = Display.getDisplay(this);
- display.setCurrent(form);
- if (server == null) {
- server = new RTSPServer();
- server.start();
- form.append("Server running");
- }
- }
- protected void pauseApp() {}
- protected void destroyApp(boolean unconditional) {
- if (server != null) {
- server.stop();
- }
- notifyDestroyed();
- }
- public void commandAction(Command cmd, Displayable dsp) {
- if (cmd == play1) {
- new Thread(this).start();
- }
- if (cmd == play2) {
- try {
- platformRequest("rtsp://localhost:8554/stream.wav");
- } catch (Exception e) {
- form.append(e.toString());
- }
- }
- if (cmd == exit) {
- destroyApp(true);
- }
- }
- public void run() {
- try {
- Player player = Manager.createPlayer("rtsp://localhost:8554/stream.wav");
- player.realize();
- player.start();
- } catch (Exception e) {
- form.append(e.toString());
- }
- }
- }