views:

620

answers:

4

I've seen a lot of different methods for doing so, but none of them are specific (and my attempts to implement them have all failed).

Does there exist a known way to stream http video on a Blackberry? Sample code, tutorials, anything?

The closest I've found is: http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/How%5FTo%5F-%5FPlay%5Fvideo%5Fwithin%5Fa%5FBlackBerry%5Fsmartphone%5Fapplication.html?nodeid=1383173&vernum=0

The above tutorial, but it has several problems:

First, the sample code it gives is for a local video (which I can successfully play). It claims that "any valid URL" will work for HTTP streaming, but this is patently false, as supplying a known good .sgp URL does nothing.

The createPlayer method has the ability to accept an InputStream, which sounded promising, so I modified the sample code to have the lines:

 // player = Manager.createPlayer("file:///SDCard/eggs.3gp");
            HttpConnection c = (HttpConnection)Connector.open("http://good-3gp-videos.com/viapic/e39903da6e5c1e1c5d572a49a88a99e6.3gp");
            int rc = c.getResponseCode();
            if (rc != HttpConnection.HTTP_OK) {
                throw new IOException("HTTP response code: " + rc);
            }

             player = Manager.createPlayer(c.openInputStream(), null);
            player.realize();

Instead of the previous player created from a string (commented out in my source).

This however, gets me the exact same problem (specifically, attempting to play the video gets me a "JUM Error 104: Uncaught NullPointer Exception". )

It seems that both ways I attempt to read from a URL are getting me a Null response.

This is my first Blackberry App, so I'm not very familiar with how to debug it (for example, several times there is a System.out.println() call in the sample code, but I never see it displayed on the console.

How would I go about debugging the code, or alternatively, what is the correct way to stream HTTP video?

A: 

Are you doing this in the simulator with MDS running? If you don't launch MDS when you launch you might need to append ";deviceSide=True" to the URL. Also, I don't think the embedded video player was supported until 4.3. Have you tried using 4.3+ JDE?

Brandon
I am *definitely* running the MDS. I'm not trying to embed a video in a web browser, rather, I"m trying to follow a tutorial to use the blackberry media player in an application. Either case, I CAN use the video media player, it just only works (right now) with local videos, despite the claim that it can stream videos from the web as well.
Jenny
I meant embedding the video within an application. With older version you'd have to launch the media player separately. What JDE are you using?
Brandon
A: 

(This is the original poster, I realized I wasn't logged in, did so, then realize it made me lose contact with my unregistered account)

4.6, I believe. It's the component update I have installed. But, like I said, I can embed a video within an application. That isn't my problem. My problem is specifying the source of the video. I can embed a video that is local, I cannot embed a video that is on the internet.

-Jenny

Jenny
A: 

Appropriate codecs to play the video need not be bundled in Blackberry Simulator. This definitely is the case with Sun's Java ME emulators. And also, the link that you have provided actually does an RTSP streaming. And the codecs that support streaming (samr/H.263 in your case) usually don't come with simulators.

I don't see any problem with the code. It must play fine on phone. I shall get it tested and let you know how it goes - I don't have access to BB phone at the moment.

Kiran Kuppa
A: 

Original Poster again (how would I log back into my cookies based account?) Modifying the code slightly, (adding a cast to Stream Connection) gets rid of my null pointer error, but even though nothing crashes, and there are no exceptions, it's still not streaming.

I have indeed heard that the simulators cannot stream, but putting the code on a phone doesn't work for me either.

Even more confusing, neither my simulator or my actual phone can stream RTSP from m.youtube, which I've heard works. I get a server/content not found error.

Is it possible that my workplace's firewall is preventing something important from happening?

-Jenny

Jenny
http://stackoverflow.com/questions/1393772/playing-an-inputstream-video-in-blackberry-jde Here is a link to the question from my current account, with more detail.
Jenny