MediaPlayer.reset() always gets invoked. Here's the exact lines of
code:
_mediaPlayer.reset();
_mediaPlayer.setDataSource(resource);
_mediaPlayer.prepare();
_mediaPlayer.start();
Additionally, the error occurs only when next audio starts while
previous audio is about to end.
If next audio starts in the middle of the playback or after it has
completely stopped playing, then everything works fine.
It looks pretty much like a synchronization issue to me.
This method is not synchronized at the moment.
Since most of the MediaPlayer code is native I'm not sure what should
be synchronized.
On Apr 7, 9:20 pm, Marco Nelissen <[email protected]> wrote:
> Looks like you're calling MediaPlayer.setDataSource() on a MediaPlayer
> that was already initialized, without first calling
> MediaPlayer.reset()
>
> On Tue, Apr 7, 2009 at 1:28 PM, ATrubka <[email protected]> wrote:
>
> > Hi, guys.
>
> > I'm using MediaPlayer and sometimes when first audio is about to end
> > and I click to the next audio I get the exception below. Looks like
> > the MediaPlayer is in some weird state of stopping playing and cannot
> > accept audio at the moment.
>
> > The exception goes to the native code which is greeks to me.
> > I couldn't find anything about this error on the internet either.
>
> > Is anyone here familiar with the problem?
>
> > Thank you in advance!
>
> > 04-07 20:19:35.855: ERROR/MediaPlayer(1066): setDataSource called in
> > state 128
> > 04-07 20:19:35.855: ERROR/AudioPlayerService(1066): Unable to play
> > chapter audio
> > 04-07 20:19:35.855: ERROR/AudioPlayerService(1066):
> > java.lang.IllegalStateException
> > 04-07 20:19:35.855: ERROR/AudioPlayerService(1066): at
> > android.media.MediaPlayer.setDataSource(Native Method)
> > 04-07 20:19:35.855: ERROR/AudioPlayerService(1066): at
> > com.tourizo.android.services.AudioPlayerService.playResource
> > (AudioPlayerService.java:291)
> > 04-07 20:19:35.855: ERROR/AudioPlayerService(1066): at
> > com.tourizo.android.services.AudioPlayerService.access$3
> > (AudioPlayerService.java:287)
> > 04-07 20:19:35.855: ERROR/AudioPlayerService(1066): at
> > com.tourizo.android.services.AudioPlayerService$1.playCurrentChapter
> > (AudioPlayerService.java:89)
> > 04-07 20:19:35.855: ERROR/AudioPlayerService(1066): at
> > com.tourizo.android.services.AudioPlayerRemoteInterface$Stub.onTransact
> > (AudioPlayerRemoteInterface.java:99)
> > 04-07 20:19:35.855: ERROR/AudioPlayerService(1066): at
> > android.os.Binder.execTransact(Binder.java:276)
> > 04-07 20:19:35.855: ERROR/AudioPlayerService(1066): at
> > dalvik.system.NativeStart.run(Native Method)
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---