Are you sure you're not calling MediaPlayer.release() anywhere in your code?


On Sun, Sep 13, 2009 at 5:38 AM, Martin Obreshkov <manig...@gmail.com> wrote:
>
> I have a simple file that wrap the android media player and when i
> want to play file call the reset method to reset the player something
> like this
> .....
> private final MediaPlayer mPlayer;
> .....
> mPlayer = new MediaPlayer(); somewhere in constructor
> .....
> public void play(String songUri) {
>        // reset the player
>        mPlayer.reset(); // every state is valid state for reset and go to 
> state IDLE
>        // set new data source
>        mPlayer.setDataSource(songUri); // IDLE is valid state for this method
>        // plat the new source async
>        mPlayer.prepareAsync();
> }
> On Sat, Sep 12, 2009 at 6:46 PM, Marco Nelissen <marc...@android.com> wrote:
>>
>> What does your code look like?
>>
>>
>> On Sat, Sep 12, 2009 at 6:41 AM, manigault <manig...@gmail.com> wrote:
>>>
>>> Hi,
>>> I have the following issue i have an application that uses
>>> android.media.MediaPlayer and got this exception:
>>>
>>> 09-12 16:21:05.921: ERROR/AndroidRuntime(9890): Uncaught handler:
>>> thread main exiting due to uncaught exception
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):
>>> java.lang.IllegalStateException
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> android.media.MediaPlayer._reset(Native Method)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> android.media.MediaPlayer.reset(MediaPlayer.java:856)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> com.predictsystems.media.SongPlayer.play(SongPlayer.java:185)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> com.predictsystems.media.SongPlayer.playSong(SongPlayer.java:287)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> com.predictsystems.media.SongPlayer.playCurrent(SongPlayer.java:276)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> com.predictsystems.player.activity.SongListActivity.onListItemClick
>>> (SongListActivity.java:198)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> com.predictsystems.player.activity.AbstractInstinctivActivity
>>> $1.onItemClick(AbstractInstinctivActivity.java:83)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> android.widget.AdapterView.performItemClick(AdapterView.java:283)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> android.widget.ListView.performItemClick(ListView.java:3132)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> android.widget.AbsListView$PerformClick.run(AbsListView.java:1620)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> android.os.Handler.handleCallback(Handler.java:587)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> android.os.Handler.dispatchMessage(Handler.java:92)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> android.os.Looper.loop(Looper.java:123)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> android.app.ActivityThread.main(ActivityThread.java:3948)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> java.lang.reflect.Method.invokeNative(Native Method)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> java.lang.reflect.Method.invoke(Method.java:521)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
>>> (ZygoteInit.java:782)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
>>> 09-12 16:21:06.101: ERROR/AndroidRuntime(9890):     at
>>> dalvik.system.NativeStart.main(Native Method)
>>>
>>> in the documentation there are no invalid states for the reset method.
>>> From the stack trace it seems that the exception is thrown by the
>>> native call.
>>> i read about some issues about the same problem but this time for
>>> setDataSource method and the solution is the surround with try catch
>>> http://code.google.com/p/android/issues/detail?id=957.
>>> Any suggestions ? Thanks
>>>
>>> >
>>>
>>
>> >
>>
>
>
>
> --
> When I raise my flashing sword, and my hand takes hold on judgment, I
> will take vengeance upon mine enemies, and I will repay those who haze
> me. Oh, Lord, raise me to Thy right hand and count me among Thy
> saints.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to