Marcus Johansson
Marcus Johansson

Reputation: 2667

MediaPlayer.getCurrentPosition() has system dependent offset

I'm using the android.media.MediaPlayer to play a song in my Android application. Some events in my app are triggered at certain parts of the song. To know where in the song I am right now I use MediaPlayer.getCurrentPosition().

A problem with this approach is that getCurrentPosition() returns the current position in the song, plus a small error. The error is constant, but different for all phones I tested. The error also changes when updating Android. The error ranges from -50 to 150 ms.

Is this a known problem? Any ideas on how to work around it? (Except creating a table over all known phones and android versions)

Upvotes: 1

Views: 2106

Answers (1)

Sergey
Sergey

Reputation: 344

It is a known problem. See http://code.google.com/p/android/issues/detail?id=11590 And as of today, I have not seen any good solutions.

Upvotes: 1

Related Questions