views:

1460

answers:

1

So, I wrote a quick little app for the iphone that takes in an http URL, and plays the .mp4 video located at that URL (it does more than that, of course, but that's the meat of it). Naturally, I wanted to have it on more than just a single mobile platform, so I decided to target Blackberry next.

However, I'm running into a lot of problems with the Blackberry Environment. First of all, I learn that I can only download 256k files! I learn how to set that variable in my MDS simulator (and learn that this is NOT a production solution, because any end users will have to have their BES or MDS admin change the setting there). Then, I find a video less than 2 MB I can practice with. Going to the browser prompts me to save the video (rather than it playing in the browser like I expected). After saving the video, it refuses to play, saying it's the wrong format.

So. I can't find a reference to IF Blackberry can stream with HTTP (i"ve heard it CAN use RTSP, though, and heard some rumors that it can't use HTTP, which would really suck). I also can't find a reference to what format blackberry uses (although I can find a million programs that will convert one file to the 'blackberry' format).

Surely SOMEONE must have tried to stream video with the blackberry before. How did they go about doing so? Is it just a hopeless pipedream? Will I have to go with RTSP?

Sorry for the lack of a concrete question...I'm just really lost, and I hate how so many tutorials or forum posts seem to assume I know the capabilities of the Blackberry...

Edit: I finally found out that the .3gp (which I'd never heard of ) format is what Blackberry uses. Still have no idea how to stream videos off the web, though. I found a tutorial: 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 That seemed to be useful, but the code doesn't work if you give it a URL (even though it claims it does).

+1  A: 

While you are correct that the tutorial claims the code will load any valid URL, the API documentation for javax.microedition.media.Manager.createPlayer specifies "A locator string in URI syntax that describes the media content" which may not, in fact be the same as any valid URL. Luckily createPlayer will also take an InputStream and a String specifying the content type. So you should be able to open the URL as documented in the API for HttpConnection, grab the content type string, and open the input stream to create the player.

I will admit that I haven't done that, but it would be my next step.

BTW remember to run your HttpConnection fetch on a thread separate from the application event thread.

Richard
Hmmm... I'm not seeing any reference to an 'HttpConnection' class in any Java API I can find...do you mean HttpURLConnection? If so, it doesn't seem to inherit ever from InputStream...could I really use it? InputStream itself is confusing me, because there seem to be so many of them, and the documentation assumes I know how to create the appropriate InputStream, which I don't really... I'll keep flailing around in the API though, see what i can figure out.
Jenny
Okay, I figured out that HttpConnection is in the net.rim stuff...but I'm still lost, because using it gets me the same result. Maybe not running it in a separate thread is the problem? But I thought that would just affect performance? How would I do that, anyways?
Jenny