Yes, I call prepareAsync after I register a OnPreparedListenter - this
is happening after that gets triggered (as a test, in the onPrepared
method, I log the duration: It's zero there, too).

What's really strange to me (here's a snippet) is that it takes a few
seconds to determine the duration.

---
mediaPlayer.start();
mediaPlayer.pause();
Log.d(TAG, "waiting 10 seconds for duration to be known...");
long waitForIt = System.currentTimeMillis() + 10000;
while (System.currentTimeMillis() < waitForIt) {
  if (mediaPlayer.getDuration() > 0) break;
}
Log.d(TAG, "now:       " + System.currentTimeMillis());
Log.d(TAG, "waitForIt: " + waitForIt);
Log.d(TAG, "duration:  " + mediaPlayer.getDuration());

Log.d(TAG, "seeking to: " + milliseconds);
Log.d(TAG, "playing:    " + mediaPlayer.isPlaying());
mediaPlayer.seekTo(milliseconds);
---

This hideous mess takes anywhere from 2-6 seconds to break out of the
while loop. Once it does, I get a duration and can call seekTo().

Also, even though the start() and pause() calls are executed that
close together, they still cause the player to play 1-2 seconds of
audio.

Without those calls, the full 10 seconds elapse and I *still* don't
get a duration and seekTo doesn't work. :-/

Larry

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to