Hi everyone. I'm currently doing my final year project and I'm really short of time. I'll really appreciate your help.
I want to recieve the rtsp stream and play it in my nokia e65 ( symbian s60 v3 ).
I do the streaming from my laptop with VLC media player with proper encoding for mobile( I do the stream of my webcam ), I checked if it works or not from another pc in my network, and I can recieve the stream when I try the link "rtsp://ipaddress:554/webcam.sdp" with quicktime .
I checked if my phone supports rtsp and sdp, and get the result as it supports rtsp protocol for "application/sdp" file type.
so I started my mobile application, but I get the problem "Cannot create player for rtsp://ipaddress:554/webcam.sdp".
Can you please check my code ? or provide me with some other alternatives to do this.
I've checked internet for some kind of application like this but all I got was streaming applications for video on demand systems. I never saw someting for sdp.
here's my code for video
//imports here
public class VideoCanvas extends Canvas implements PlayerListener, CommandListener {
private Command start;
private Command stop;
private Command back;
private Command exit;
private String url;
private String status;
private String status2;
private Player player;
private VideoControl control;
public VideoCanvas(String url) // the url is "rtsp://ipaddress:554/webcam.sdp"
{
start = new Command("Start",Command.OK,0);
stop = new Command("Stop",Command.OK,0);
back = new Command("Back",Command.OK,0);
exit = new Command("Exit",Command.BACK,0);
status = "Press left softkey";
status2 = "";
player = null;
control = null;
this.url = url;
addCommand(start);
addCommand(stop);
addCommand(back);
addCommand(exit);
setCommandListener(this);
this.setFullScreenMode(true);
}
public void commandAction(Command c, Displayable d) {
if(c == start) {
start();
}
else if(c == stop) {
stop();
}
else if(c == exit) {
Main.midlet.notifyDestroyed();
}
else if(c == back) {
Main.mobileDisplay.setCurrent(Main.loginForm);
}
}
protected void paint(Graphics g) {
g.setColor(255,255,255);
g.fillRect(0,0,getWidth(),getHeight());
g.setColor(0,0,0);
g.drawString(status2,0,0,Graphics.LEFT|Graphics.TOP);
g.drawString(status,getWidth(),getHeight(),Graphics.RIGHT|Graphics.BOTTOM);
}
public void start()
{
try {
player = Manager.createPlayer(url);
player.addPlayerListener(this);
player.realize();
// Grab the video control and set it to the current display.
control = (VideoControl)player.getControl("VideoControl");
if (control != null) {
control.initDisplayMode(VideoControl.USE_DIRECT_VIDEO,this);
control.setDisplaySize(176,144);
int width = control.getSourceWidth();
int height = control.getSourceHeight();
status2 = "Before: SW=" + width + "-SH=" + height + "-DW=" + control.getDisplayWidth() + "-DH=" + control.getDisplayHeight();
}
player.start();
}
catch(Exception e) {
Alert erro = new Alert("Erro",e.getMessage(),null,AlertType.ERROR);
Main.mobileDisplay.setCurrent(erro);
}
}
public void stop() {
if(player != null) {
player.deallocate();
player.close();
}
}
public void playerUpdate(Player p, String s, Object o) {
status = s;
if(p.getState() == Player.STARTED)
{
int width = control.getDisplayWidth();
int height = control.getDisplayHeight();
control.setDisplayLocation((getWidth() - width)/2,(getHeight() - height)/2);
control.setVisible(true);
status = s + ": DW=" + width + "-DH=" + height + "-SW=" + control.getSourceWidth() + "-SH=" + control.getSourceHeight();
}
repaint();
setTitle(status);
}
}