On Fri, May 8, 2009 at 2:31 AM, Sudha <[email protected]> wrote: > > By the way what are these states 1, 2, 128 etc.
1 is 'idle' 2 is 'initialized' 128 is 'playback complete' (see mediaplayer.h) So let's take another look at the error messages you were seeing: 1- E/MediaPlayer( 2173): stop called in state 1 This means you called MediaPlayer.stop() while the MediaPlayer was 'idle', i.e. never initialized. This should be harmless, but I don't see how it could happen with the code you posted, since you only seem to be calling stop() from your OnCompletionListener, and in order for your OnCompletionListener to be called, the MediaPlayer would have to be initialized, and in any case would be in the 'playback complete' state. 2- E/MediaPlayer( 2173): stop called in state 2 I made a comment about this one in my earlier reply, but that comment was wrong. This one means you called stop() in the 'initialized' state, which is the state MediaPlayer is in once you call setDataSource(). Not sure how this would happen with the code you posted, since you appear to always be following a call to setDataSource() with a call to start(). 3- E/MediaPlayer( 2173): setDataSource called in state 2 This means you're calling setDataSource() twice in a row. Again, not sure how this could happen with the code you posted, and given that you said you only have one thread. 4- E/MediaPlayer( 2173): setDataSource called in state 128 > This means you're calling setDataSource() after playback has completed, without first resetting the MediaPlayer to its uninitialized state by calling reset(). Not sure how this could happen with the code you posted, since you call stop() and reset() in your OnCompletionListener. 5- E/MediaPlayer( 2173): prepareAsync called in state 128 > E/MediaPlayer( 2173): setDataSource called in state 128 > W/System.err( 2173): java.lang.IllegalStateException > W/System.err( 2173): at > android.media.MediaPlayer.setDataSource(Native Method) > This one looks a bit suspicious, since it complains about both prepareAsync and setDataSource at the same time, and you're not even calling prepareAsync() in the code you posted. 6- E/MediaPlayerService( 31): offset error > E/MediaPlayer( 2173): Unable to to create media player > You would get this when using the (filedescriptor+offset+length) parameters for playback, and the offset is past the end of the file. Since you're only specifying a filedescriptor, and aren't using the offset/length parameters, it can only mean that the file you tried to play had a size of zero. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

