[android-developers] Re: MediaPlayer seek on startup
I can't think of any alternative solution at this time. The code that handles this is in the OpenCore engine and not something you can address with a Java API. Perhaps this is something we can address in a future release. On Nov 28, 1:22 pm, David Given [EMAIL PROTECTED] wrote: David Given 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? [...] Does anyone have any suggestions on how do this? If I can't make this work, my app is basically stuffed, and nothing I've tried is working. Brief summary: I need to be able to tell MediaPlayer to start playing from somewhere in the middle of the stream, not the start. If I call seekTo() after prepare() then the user has to wait for the buffer to be filled twice, which can take up to thirty seconds, and they're not going to put up with that. Is there a way to tell it to prepare the stream (reading the stream header, etc) but *not* to fill the buffer until I tell it to start playing? That would work. -- ┌─── 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 -~--~~~~--~~--~--~---
[android-developers] Re: MediaPlayer seek on startup
David Given 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? [...] Does anyone have any suggestions on how do this? If I can't make this work, my app is basically stuffed, and nothing I've tried is working. Brief summary: I need to be able to tell MediaPlayer to start playing from somewhere in the middle of the stream, not the start. If I call seekTo() after prepare() then the user has to wait for the buffer to be filled twice, which can take up to thirty seconds, and they're not going to put up with that. Is there a way to tell it to prepare the stream (reading the stream header, etc) but *not* to fill the buffer until I tell it to start playing? That would work. -- ┌─── 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 Description: OpenPGP digital signature
[android-developers] Re: MediaPlayer seek on startup
Dave Sparks wrote: 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). Well, yes, I'm aware of that. However, it doesn't just read the stream header, it spends 10-15 seconds buffering the initial stream. This is leading to a really poor user experience, as the user has to wait (and pay) for the first part of the stream to be buffered --- then the seek happens, it all gets thrown away, and the user has to wait (and pay) for *another* 10-15 seconds while the buffer gets filled from the correct location. Is there any way of streamlining this? Can I tell MediaPlayer to *just* read the metadata and not to try and fill the buffer, for example? -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: MediaPlayer seek on startup
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 -~--~~~~--~~--~--~---