You must always call prepare() before seekTo(). The player engine
needs to read the first part of the stream to identify the stream type
and required codecs and read the content index (if it exists).

On Nov 26, 2:55 pm, David Given <[EMAIL PROTECTED]> wrote:
> 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
>
>  signature.asc
> < 1KViewDownload
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to