Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
New Developer
Posts: 10
Registered: ‎06-08-2009
My Device: Not Specified

RTSP connection - Streaming

Hello,

I'm new in BB programming. I'm sorry if I'm having an obvious error. I hope you can help me...

I'm developing with Eclipse 3.4.2, WTK 2.5.2_01, MIDP 1.0.3, J2ME SDK 3.0 and I'v installed jre1.6.0_06.
My BB is the 8310, OSv 4.5.0.37. I'v also tried configuring the TCP APN arguments, but didn't worked.


The application I'm trying to develop is for playing an audio file (eg. qicktime, .mov) but getting it with streaming (with rtsp. I'v installed DarwinStreamingServer on the server side).


If I run the app on the eclipse emulator, the connection works fine, but on the BB it doesn't work.

I used a class that implements the RTP streaming (RTPSourceStream and RTSPProtocolHandler).

On the eclipse emulator, the connection works fine with option 1 showed above. The error I'm getting on the BB is "tunnel time out" (on the connection).

I guess this is the correct way for connecting, i don`t know if there is any restriction for using the BlackBerry Internet Service (BIS) connection, so I also tried othe connections (likw WiFi or wap) but didnt' worked.


What I did is to open a socket connection.


Is it possible to do this or I'm making a big mistake that I cant' see?


Here are the onnection optionos I tried on the BB:


Option 1:
(SocketConnection)Connector.open("socket://testserver:rtsp port");--> tunnel time out

Option 2:
(SocketConnection)Connector.open("socket://testserver:rtsp port;deviceside=true"); --> tunnel time out

Option 3:
(SocketConnection)Connector.open("socket://testserver:rtsp port;interface=wifi;"); --> tunnel time out

Option 4:
(SocketConnection)Connector.open("socket://testserver:rtsp port;deviceside=false); --> connection refused

Thanks
Leandro.
New Developer
Posts: 10
Registered: ‎06-08-2009
My Device: Not Specified

Re: RTSP connection - Streaming

Hello all,

 

I'm sorry, I'm trying to get a file with streaming, but nothing happens. I tried with this simple code, but nothing happens on the BB, no error, no message, no video, no audio... Please, I hope you can let me know if I'm forguetting something... If I change the name of the file or if I write any direction, is the same, nothing comes up...

 

I'm developing with Eclipse 3.4.2

WTK 2.5.2_01

MIDP 1.0.3

J2ME SDK 3.0, jre1.6.0_06.
My BB is 8310, OSv 4.5.0.37. 

 

This is the code:

 

 

Player p = Manager.createPlayer(
"rtsp://rtsp.youtube.com/youtube/videos/8wpa2Qplm8M/video.3gp");

p.realize();

p.prefetch();

vc = (VolumeControl) p.getControl(
"VolumeControl"); if(vc != null) {

vc.setLevel(100);}

p.start();

 

 

 

If I try to make my own connection (socket connection with my onw rtp server), I get the error "connection refused", but if I try with the Manager class directly, nothing happens...

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: RTSP connection - Streaming

Most of the BB Simulators doesn't support rtsp, but JDE 4.6.0.12 and 9000 Simulator able to run rtsp.

Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 126
Registered: ‎06-08-2009
My Device: Not Specified

Re: RTSP connection - Streaming

You are right b'coz we also face same problem for rtsp videp streaming but on device it work fine on Bold and Storm. one more thing WAP_MODE is disable by default on storm so for this we run video streaming using BrowserSession.
New Developer
Posts: 10
Registered: ‎06-08-2009
My Device: Not Specified

Re: RTSP connection - Streaming

Ok, I know that with the simulator it doesn't work (in the simulator, I get the error "Cannot create a Player for: rtsp://stream.almipa.com/addictivetech.ca/amo/OasisUntitled.mp3").

 

But I'm running the application on the device, on my BB 8310, and no error occurs, but nothing happens. The create player gives no error, the realize returns ok and player.play() returns ok. If I print the p.getState() command, it returns 400 (whit means player.STARTED), but nothing happens on the device... no sound comes up, and the player doesn`t start and doesn't shows anything...

 

I also checked the player.getDuration() and it returns -1...

All this on the device... I don't know if I'm forgetting something... After doing the player.start() the sound has to start? hoy can I see if it's wokring?

 

Thank you

 

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: RTSP connection - Streaming

Is it the same behaviour with .3gp file?

Use Search. "Accept Solution" If the problem is resolved.
New Developer
Posts: 10
Registered: ‎06-08-2009
My Device: Not Specified

Re: RTSP connection - Streaming

Yes, exactly the same with 3gp files.
Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: RTSP connection - Streaming

Can you provide me teh url which you trying for 3gp so that i can give a try to see if it is playing on my simulator.

Use Search. "Accept Solution" If the problem is resolved.
New Developer
Posts: 10
Registered: ‎06-08-2009
My Device: Not Specified

Re: RTSP connection - Streaming

I'm trying with these two urls:

 

rtsp.youtube.com/youtube/videos/8wpa2Qplm8M/video.3gp

 

rtsp://streaming.rim.com/streaming_video.3gp

 

 

The strange thing is that I'm not getting any exception or error code... and if I change the url with any other (with an existing or unexisting file), the result is the same... no error, no exception and nothing happens...

 

Just in case, the exact code I'm using is this:

 

import javax.microedition.lcdui.Command;

import javax.microedition.lcdui.CommandListener;

import javax.microedition.lcdui.Display;

import javax.microedition.lcdui.Displayable;

import javax.microedition.lcdui.TextBox;

import javax.microedition.media.Player;

import javax.microedition.midlet.MIDlet;

import javax.microedition.media.Manager;

import javax.microedition.media.control.VolumeControl;

 

 

public
class prueba6 extends MIDlet implements CommandListener{

 private Display display;

 private TextBox mainScreen = null;

 private Command exit = new Command("exit", Command.EXIT, 2);

 public void startApp() {

 VolumeControl vc;

 try { Player p = Manager.createPlayer("rtsp://streaming.rim.com/streaming_video.3gp"); //I also tried adding ;interface=wifi

 p.realize();

 p.prefetch();

 vc = (VolumeControl) p.getControl(
"VolumeControl");  if(vc != null) {

 vc.setLevel(100);}

 p.start();

 

 }
catch(Exception e) {

 mainScreen = new TextBox("Error:", e.toString(), 512,0);

 mainScreen.addCommand(exit);

 mainScreen.setCommandListener(this);

 display.setCurrent(mainScreen);

 e.printStackTrace();

 }

 }

 public void commandAction(Command c, Displayable s) {

 if (c == exit) { destroyApp(

false);

 notifyDestroyed();

 }

 }

 public void pauseApp() {

 }

 

 public void destroyApp(boolean unconditional) {

 }

}

 

New Developer
Posts: 10
Registered: ‎06-08-2009
My Device: Not Specified

Re: RTSP connection - Streaming

Sorry, this is the ed code:

 

import javax.microedition.lcdui.Command;

import javax.microedition.lcdui.CommandListener;

import javax.microedition.lcdui.Display;

import javax.microedition.lcdui.Displayable;

import javax.microedition.lcdui.TextBox;

import javax.microedition.media.Player;

import javax.microedition.midlet.MIDlet;

import javax.microedition.media.Manager;

import javax.microedition.media.control.VolumeControl;

 

public class prurtsp extends MIDlet implements CommandListener{

private Display display;

private TextBox mainScreen = null;e

private Command exit = new Command("exit", Command.EXIT, 2);

public void startApp() {

VolumeControl vc;

try {

 display = Display.getDisplay(this); Player p = Manager.createPlayer(

"rtsp://streaming.rim.com/streaming_video.3gp"); //also tried with ;interface=wifi

 p.realize();

 p.prefetch();

 vc = (VolumeControl) p.getControl(
"VolumeControl");  if(vc != null) {

 vc.setLevel(100);}

 p.start();

 mainScreen = new TextBox("Playing", "...", 512,0);

 mainScreen.addCommand(exit);

 mainScreen.setCommandListener(this);  display.setCurrent(mainScreen);

 

 } catch(Exception e) {

 mainScreen = new TextBox("Error:", e.toString(), 512,0);

 mainScreen.addCommand(exit);

 mainScreen.setCommandListener(this);  display.setCurrent(mainScreen);

 e.printStackTrace();

 }

 }

 public void commandAction(Command c, Displayable s) {

 if (c == exit) { destroyApp(

false);

 notifyDestroyed();

 }

 }

 public void pauseApp() {

 }

 

 public void destroyApp(boolean unconditional) {

 }

}