11-21-2008 12:01 PM
Has anyone been sucessful with the getDuration() function on an mp3 file? It works for .wav, m4a, midi, but not mp3 for some strange reason.
Get player.getduration() has been returning -1 or 0 for me.
I'm trying to create a progress slider in an mp3 player application.
12-01-2008 01:52 PM
12-02-2008 06:48 PM
I am playing the Alarm Early Riser that comes default on the blackberry simulator.
Running on the 8820 Simulator. v188.8.131.52
I'm only having problems with the MP3. Can you show me code you are using to get duration? This is exactly what I'm doing.
Player p = Manager.createPlayer(in, "audio/mpeg");
I'm calling player.getMediaTime() and player.getDuration()
getMediaTime() gives me timeupdate progress as the player is playing,
getDuration() keeps reporting -1, on .mp3 files.
I didn't have a problem with .wav files, .m4a
I've tried on various random .mp3 files, and got the same result.
12-04-2008 02:45 PM
I used it after the player had already started.
Note that you are not able to reference the built in media files on a real BlackBerry handheld. They are copy protected and not accessible from third party applications.
12-04-2008 02:50 PM
I'm also calling getDuration() from within a PlayerListener after the Player started. I'm even calling it ever time the player listener fires a com.rim.timeUpdate event in the listener.
I've tried it on other .mp3 files I added myself.
02-09-2010 01:22 PM
I'm experiencing the same problem. Anyone got a solution to this already? GetDuration() keeps returning -1 on .mp3 files, getMediaTime() works normal. I am on 4.6.0 Simulator. Don't know if it makes a difference but I am streaming a remote file (nevertheless it works with a rtsp stream) with Manager.createPlayer(stream,type). Have not tried local files yet.
03-23-2010 10:03 AM - edited 03-23-2010 10:04 AM
Can you provide your sample code, how you tried it ?
I tried with custom DataSource and then i got something back, but when i convert it to minutes and seconds it return much more then the expected. The inbuild media player shows 4 min and 05 sec and i got back 27 min and 43 seconds....
Any idea what i made wrong ? I think i did something worng in the custom DataSource, however i can play the mp3 programmatically.