The official documentation about pause():

pause()
Valid states: {Started, Paused}
Invalid states: {Idle, Initialized, Prepared, Stopped,
PlaybackCompleted, Error}

"Calling this method in an invalid state transfers the object to the
Error state."

In the practice, pause() works in the PlaybackCompleted state. I know
that the SDK documentation should be followed in questionable cases,
but in this case, I think it's a problematic issue because you have no
way to know synchronously whether the PlaybackCompleted state is
reached. Therefore, pause() cannot be safely called without making
sure it's not in PlaybackCompleted yet.

I know source code is not public API (that can be relied on for
decisions), so just as an interesting note, the MediaPlayer::pause()
implementation in Android is this:

    if (mCurrentState & (MEDIA_PLAYER_PAUSED|
MEDIA_PLAYER_PLAYBACK_COMPLETE))
        return NO_ERROR;

I.e. it also follows the logical decision that a pause() shouldn't
hurt in playbackComplete. So what is with documentation?!

-- 
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