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
New Contributor
Posts: 3
Registered: ‎10-15-2010
My Device: Not Specified

Problem with dataSource/sourceStream and media player

On a variety of Handsets (9700, 9800, 9520, 9550,etc.) I am having a problem with my dataSource/sourceStream. I am streaming discrete aac/mp4 files to the media player. My streaming content is not the problem.

 

With my stream I do the following:

Create an HttpConnection with the URL of the content.

Get the length with httpConnection.getLength();  

Open an InputStream on the httpConnection

Then in my implementation of read() I read that inputstream.

About 50% of the time, the input stream read completes (returns -1) with having only downloaded ~70% of the file. As a result the media player overruns the buffer and treats it as an EOF because it does not think there is anymore content.

 

There are no errors being reported at all.

 

The content being streamed is not the problem. I never see this on very old BBs like the 8110 and on my Android use of the same content stream. Also, it is inconsistent, as in two devices that have this problem don't fail on the same piece of content.

 

The simplest solution I can think of is to reconnect to the content when the media player reaches the EOF and the full content has not been downloaded. How can I do this? I want to be able to pick up playback where the download had stopped.

 

Are there other solutions that people have used for this problem?

BlackBerry Development Advisor
Posts: 14,947
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Problem with dataSource/sourceStream and media player

Are you able to play the same streams using the Media Player?  What route are you making your connection over?  This article explains the various routes:

 

Different ways to make an HTTP or socket connection

http://supportforums.blackberry.com/t5/Java-Development/Different-ways-to-make-an-HTTP-or-socket-con...

 

If you haven't seen it, this article may help.

 

Streaming media - Start to finish

http://supportforums.blackberry.com/t5/Java-Development/Streaming-media-Start-to-finish/ta-p/488255

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Contributor
Posts: 3
Registered: ‎10-15-2010
My Device: Not Specified

Re: Problem with dataSource/sourceStream and media player

We are making our connection over direct tcp.

 

I don't know if I understand the question: "Are you able to play the same streams using the Media Player?"

 Yes, the J2ME player gotten from Manager.createPlayer() plays the media correctly. The stream download is ending prematurely though. As a result, this is most likely an issue with the download of the stream and not the MediaPlayer using it.

 

Thank you for the links. I was aware of those articles. Pretty much any issue posted here results in those links being posted.

 

Thanks

 

Andrew

BlackBerry Development Advisor
Posts: 14,947
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Problem with dataSource/sourceStream and media player

I meant the Media Player application on the BlackBerry Smartphone.  Try to open the same stream in the BlackBerry Browser.  Are you able to play it?  This can help determine whether or not the issue is specific to your application.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Visitor
Posts: 1
Registered: ‎10-25-2010
My Device: Not Specified

Re: Problem with dataSource/sourceStream and media player

Hi I bought new torch 2 weeks back and I am trying to play youtube and it fails, showing there is an error with the media player, please assist me 

 

thank you

 

Bluhar 123