I'm trying to play streaming music. The user has previously requested
that the stream start a certain way into the stream. How do I do this?

What I'm finding is that if I do:

mediaplayer.setDataSource(...);
mediaplayer.prepare();
mediaplayer.seekTo(...);

...then the seek happens *after* the initial buffer is read, which of
course is a waste [*]. But if I do:

mediaplayer.setDataSource(...);
mediaplayer.seekTo(...);
mediaplayer.prepare();

...then of course I get an IllegalStateException because the MediaPlayer
hasn't been prepared yet!

Has anyone managed to make anything like this work?



[*] Actually, of course, I'm using prepareAsync(). In fact, what I'm
observing is that calling seekTo() from the onPrepared() callback tends
to confuse MediaPlayer and it hands me a -38 error and I have to reset
and start again. It seems to only want to seek after the playback has
had a chance to settle for a few moments.

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ ⍎'⎕',∊N⍴⊂S←'←⎕←(3=T)⋎M⋏2=T←⊃+/(V⌽"⊂M),(V⊝"M),(V,⌽V)⌽"(V,V←1⎺1)⊝"⊂M)'
│ --- Conway's Game Of Life, in one line of APL

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to