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
Developer
Posts: 157
Registered: ‎03-03-2009
My Device: Not Specified
Accepted Solution

player calls source stream seek()

On Bold OS4.6.0 simulator, I tried to use buffered video demo that comes with simulator to play a 3gp file. After I changed seek type to Random, it worked for small video files. However, on a large video file, it is not working. Looking at the debug, it seems that at the very early few seconds, the player calls seek(int where) of the data source (or source stream) with a value that close to size of the video file. Since the file has not been completely downloaded to that point yet, the whole thing stops.

 

My understanding is that the seek(int where) function is a way for player to tell where to  position the next read. Then is there any reason that the player needs to read toward the end of the file pretty earlier? Because that kill the whole purpose of progressive downloading and playing.

 

Any suggestions on how to get around this are aprreciated.

 

Thanks

Highlighted
Developer
Posts: 163
Registered: ‎07-16-2008
My Device: Not Specified
My Carrier: Sprint

Re: player calls source stream seek()

I believe (but am not sure) that it's looking for headers.  If it does not find them at the beginning, it will then check at the end of the file.  I'm not sure how to fix this, though - My suggestion would be trying a different video format, or a different encoding process/program for 3gp.

Andrew Cowart | Metova
www.metova.com
Developer
Developer
Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified

Re: player calls source stream seek()

The Datasource is used to feed data to the player, for both cases ( local and remote).

So if you have the file, the seek_type should be set to Random. In this mode the player seeks to begin and then to the end. By specifying Random, it means that you can play anywhere in the file, and this cannot be done unless you have the whole thing.

 

The other case when you are downloading, you need to specify the seekType to SEEKABLE_TO_START. In this mode the player starts playing as soon as it gets enough bytes to play. It does not wait for the whole file.

 

So in your code you got to select the seekType based on the file being downloaded and complete or not.

This is the current behavior even with other files such as mp4, mp3....

 

Rab 

 

Developer
Posts: 163
Registered: ‎07-16-2008
My Device: Not Specified
My Carrier: Sprint

Re: player calls source stream seek()

I had this problem with a streaming AAC player, and received from RIM:

 

"Do the (aac files) contain ID3 tags, and if so, are they at the start of the file or at the end?

Our media player implementation will look for them at the beginning and if not found, they will look for them 128 bytes from the end of the file."

 

During testing, we did try attaching id3 tags to the beginning of the file, and it prevented the first seek to the end of the file.

 

From rab's response, though, changing the seek type may work for your needs as well or better.

Andrew Cowart | Metova
www.metova.com
Developer
Posts: 157
Registered: ‎03-03-2009
My Device: Not Specified

Re: player calls source stream seek()

Thanks acowart and rab. Both of you provided very good suggestions that are hard to find in existing documentations. Thanks!
New Developer
Posts: 21
Registered: ‎09-18-2009
My Device: Not Specified

Re: player calls source stream seek()

Hello,

 

You did successfully on GSM Device. I am trying on BB Bold to play live audio using Datasource/Sourcestream . It works fine for some time , but aftter

that player gets stopped . No callback event is received to notify that playback is stopped. And no other functions of sourcestream are called . At last read was called

Then player was stopped.

 

 

So Does anyone have any idea.. what may be the problem ???

 

If anyone knows , then please reply.