diff options
| author | Gloria Wang <gwang@google.com> | 2010-03-18 14:50:05 -0700 |
|---|---|---|
| committer | Gloria Wang <gwang@google.com> | 2010-03-18 15:44:30 -0700 |
| commit | 047212fd4ea360675e94d3ce83c7f5544f65b268 (patch) | |
| tree | b249aa43c4e8b17865941615b2744dcee69b92e4 /core/java/android/widget/VideoView.java | |
| parent | ceffa1597d574599cbaca71f5855a986b0857463 (diff) | |
Release MediaPlayer if suspend() returns false.
Change-Id: Ic6467a19bac453b72b56294487c9b835b20affd7
Diffstat (limited to 'core/java/android/widget/VideoView.java')
| -rw-r--r-- | core/java/android/widget/VideoView.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/core/java/android/widget/VideoView.java b/core/java/android/widget/VideoView.java index ded055961cda..531d9fe75c44 100644 --- a/core/java/android/widget/VideoView.java +++ b/core/java/android/widget/VideoView.java @@ -64,6 +64,7 @@ public class VideoView extends SurfaceView implements MediaPlayerControl { private static final int STATE_PLAYBACK_COMPLETED = 5; private static final int STATE_SUSPEND = 6; private static final int STATE_RESUME = 7; + private static final int STATE_SUSPEND_UNSUPPORTED = 8; // mCurrentState is a VideoView object's current state. // mTargetState is the state that a method caller intends to reach. @@ -586,8 +587,9 @@ public class VideoView extends SurfaceView implements MediaPlayerControl { mCurrentState = STATE_SUSPEND; mTargetState = STATE_SUSPEND; } else { - Log.w(TAG, "Unable to suspend video"); - mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); + release(false); + mCurrentState = STATE_SUSPEND_UNSUPPORTED; + Log.w(TAG, "Unable to suspend video. Release MediaPlayer."); } } } @@ -603,8 +605,11 @@ public class VideoView extends SurfaceView implements MediaPlayerControl { mTargetState = mStateWhenSuspended; } else { Log.w(TAG, "Unable to resume video"); - mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); } + return; + } + if (mCurrentState == STATE_SUSPEND_UNSUPPORTED) { + openVideo(); } } |
