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

Posts: 37
Registered: ‎10-10-2008
My Device: Not Specified

How do you get max time of a Mediaplayer

Does anyone know how to get the max duration of an audioplayer.


I want to show my custom player progress indicator of the audio file position, but I cannot seem to get the duration using getduration() from the Player class. it is always returing -1.


Any ideas would be grateful.



BlackBerry Development Advisor
Posts: 15,882
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: How do you get max time of a Mediaplayer

The duration may not be available depending on the format of the file.  Are you seeing this with all file formats?  What BlackBerry handheld software version are you testing with?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.