Play Video InputStream in Blackberry JDE

I think I am using InputStream incorrectly with the Blackberry 9000 simulator:

I found a sample code,

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/How_To_-_Play_video_within_a_BlackBerry_smartphone_application.html?nodeid=1383173&vernum=0

which allows you to play video from the Blackberry application. The code claims that it can handle HTTP, but it took some fandangling to get it to actually approach this:

http://pastie.org/609491

In particular, I do:

StreamConnection s = null; s = (StreamConnection)Connector.open("http://10.252.9.15/eggs.3gp"); HttpConnection c = (HttpConnection)s; InputStream i = c.openInputStream(); System.out.println("~~~~~I have a connection?~~~~~~" + c); System.out.println("~~~~~I have a URL?~~~~" + c.getURL()); System.out.println("~~~~~I have a type?~~~~" + c.getType()); System.out.println("~~~~~I have a status?~~~~~~" + c.getResponseCode()); System.out.println("~~~~~I have a stream?~~~~~~" + i); player = Manager.createPlayer(i, c.getType()); 

I found that this is the only way to get an InputStream from an HTTPConnection without calling: "JUM Error 104: Uncaught NullPointer Exception". (That is, casting as StreamConnection, and THEN as HttpConnection stops it from crashing).

However, I still do not broadcast the video. Previously, a thread could not be created (it crashes with an exception with a null pointer). Now the stream is done, the debugger claims that it started streaming video from it ... and nothing happens. The video does not play.

The application does not freeze, does not crash, or nothing. I can pause and play freely, and I receive appropriate debugging messages for both. But the video does not appear.

If I play a video stored locally on a blackberry, everything is fine (it actually plays the video), so I know that the player itself is working fine, I'm just wondering, maybe I'm something wrong with my stream?

The API says the player can use an InputStream. Is there any particular kind that it needs? How can I query my input stream to find out if it is valid? It exists further than I did before.

-Jenny

Edit: I'm on a Blackberry Bold simulator (9000). I heard that some versions of phones do not broadcast video via HTTP, however, bold does. I have not seen examples of this yet. When I go to the Internet and point to the video being played on the blackberry, it tries to transfer the stream, and then asks me to physically download the file (and then play fine after downloading).

Edit: In addition, I have a Blackberry Black Bold, but it also canโ€™t transfer (I went to m.youtube.com, only to get a server / content error not found). Is there anything special I need to do for streaming RTSP content?

+4
source share
3 answers

So, after a very long time, I determined that the Blackberry Bold 9000 does NOT do http streams. In the end, I had to (or rather my colleague) write my own methods for progressive loading in order to simulate it. Oh good.

+2
source

You must be able to stream. First, you need to make sure that you add the correct connection settings to your URL (for example, "; interface = wifi" for a Wi-Fi connection). Secondly, you must make sure that the file you are transferring is not too large. If it is too large, you will receive an HTTP error message that says "file is too large." To fix this, you need to buffer things (check out the DataSource APIs). You should limit what you request to about 1-2 MB. After you pulled out this โ€œpieceโ€, you need to continue to request consecutive fragments (with separate http connections) to continue filling the buffer. Hope this helps

+1
source

All Articles