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

setMediaTime does not work for AMR files

by BlackBerry Development Advisor ‎02-16-2010 01:34 PM - edited ‎09-16-2010 03:29 PM (1,265 Views)

Summary

 

This article applies to the following:

 

  • BlackBerry® Device Software 4.0 through 4.2.2


Details


When using the Player method to seek the media time in an Adaptive Multi-Rate (AMR) encoded file, seeking past the first 58 KB of the file does not work. Seeking is possible within the first 58 KB of the AMR file, provided the file size is known, and setMediaTime is called after the PlayerListener.STARTED event is received.

 

To work around this limitation, implement and call a custom DataSource method to handle the seeking separately.

 

See this article for instructions on creating a custom DataSource and SourceStream.

The SourceStream implementation should contain a special operation to handle the AMR seeking. The following is an example for 12.2kbps AMR files, which is the encoding standard used for files recorded on the BlackBerry device. AMR files are broken into 20 millisecond frames, and 12.2kbps files have 32bytes per frame. Each AMR file also has a 6 byte header.

 

 

public void amrSeek(long millis) {
int frame = (int) millis/20;
readLocation = (framenumber * 32) + 6;
}

 

reads to the media stream will start because it is the beginning of the frame that has been seeked.
Contributors
Users Online
Currently online: 33 members 808 guests
Recent signins:
Please welcome our newest community members: