summaryrefslogtreecommitdiff
path: root/core/java/android/widget/VideoView.java
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-10-29 12:00:20 -0700
committerAndreas Huber <andih@google.com>2010-10-29 13:20:06 -0700
commit69b8d69aadbf0e795f1a1e1adc82c78cf0b9959f (patch)
tree6b48f22c3e0bd47427e97b13502e5f8cadcb0b90 /core/java/android/widget/VideoView.java
parent7b9652b66b76b90fd95952c42a4f82965ed80d72 (diff)
Squashed commit of the following:
commit 0d5694ba2d399dd0869532a4d6256448185a1be0 Author: Andreas Huber <andih@google.com> Date: Fri Oct 29 11:59:23 2010 -0700 suspend() and resume() methods on VideoView are back but don't do anything. They need to be back because they were public before. Change-Id: Iddfd1021ffcf341f26e8d55ba761fd33701e2425 commit 16192891ed7d349ee97e47d1729d20a2d0d247b8 Author: Andreas Huber <andih@google.com> Date: Fri Oct 29 11:47:05 2010 -0700 Revert "New API on VideoView widget to suspend/resume a session. Do not release the MediaPlayer client for video suspending/resuming." This reverts commit 2e1818a4d16c3309660f27286c77d8d1eee95a25. Conflicts: api/current.xml Change-Id: I68dd1d05871044faf3f832d0838aa40bc7f890e5 commit 8f934dc1a3ae4e60f0790fcf97671e063fa20fad Author: Andreas Huber <andih@google.com> Date: Fri Oct 29 11:44:16 2010 -0700 Revert "Release mediaplayer if the current state is not suspending. Fix for bug 2480093." This reverts commit efb882cf75eef39ecaf9f8920ed302a019fa629f. commit f2ed03550887986f39d36b5dabcd9e919949c7cf Author: Andreas Huber <andih@google.com> Date: Fri Oct 29 11:44:08 2010 -0700 Revert "Release MediaPlayer if suspend() returns false." This reverts commit 047212fd4ea360675e94d3ce83c7f5544f65b268. commit 441ecce678bd24e9660a72c8627b5bd94433ff8b Author: Andreas Huber <andih@google.com> Date: Fri Oct 29 11:40:46 2010 -0700 manually. Change-Id: I4fdd43c9f7c8b3eedddb31a196da4984e1c58e87 Change-Id: I60d4b10e7a9e4ed8d9a796f1711618f557eb6e89
Diffstat (limited to 'core/java/android/widget/VideoView.java')
-rw-r--r--core/java/android/widget/VideoView.java48
1 files changed, 5 insertions, 43 deletions
diff --git a/core/java/android/widget/VideoView.java b/core/java/android/widget/VideoView.java
index 531d9fe75c44..3d9cde4e9749 100644
--- a/core/java/android/widget/VideoView.java
+++ b/core/java/android/widget/VideoView.java
@@ -62,9 +62,6 @@ public class VideoView extends SurfaceView implements MediaPlayerControl {
private static final int STATE_PLAYING = 3;
private static final int STATE_PAUSED = 4;
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.
@@ -90,7 +87,6 @@ public class VideoView extends SurfaceView implements MediaPlayerControl {
private boolean mCanPause;
private boolean mCanSeekBack;
private boolean mCanSeekForward;
- private int mStateWhenSuspended; //state before calling suspend()
public VideoView(Context context) {
super(context);
@@ -470,14 +466,7 @@ public class VideoView extends SurfaceView implements MediaPlayerControl {
public void surfaceCreated(SurfaceHolder holder)
{
mSurfaceHolder = holder;
- //resume() was called before surfaceCreated()
- if (mMediaPlayer != null && mCurrentState == STATE_SUSPEND
- && mTargetState == STATE_RESUME) {
- mMediaPlayer.setDisplay(mSurfaceHolder);
- resume();
- } else {
- openVideo();
- }
+ openVideo();
}
public void surfaceDestroyed(SurfaceHolder holder)
@@ -485,9 +474,7 @@ public class VideoView extends SurfaceView implements MediaPlayerControl {
// after we return from this we can't use the surface any more
mSurfaceHolder = null;
if (mMediaController != null) mMediaController.hide();
- if (mCurrentState != STATE_SUSPEND) {
- release(true);
- }
+ release(true);
}
};
@@ -581,39 +568,14 @@ public class VideoView extends SurfaceView implements MediaPlayerControl {
}
public void suspend() {
- if (isInPlaybackState()) {
- if (mMediaPlayer.suspend()) {
- mStateWhenSuspended = mCurrentState;
- mCurrentState = STATE_SUSPEND;
- mTargetState = STATE_SUSPEND;
- } else {
- release(false);
- mCurrentState = STATE_SUSPEND_UNSUPPORTED;
- Log.w(TAG, "Unable to suspend video. Release MediaPlayer.");
- }
- }
+ release(false);
}
public void resume() {
- if (mSurfaceHolder == null && mCurrentState == STATE_SUSPEND){
- mTargetState = STATE_RESUME;
- return;
- }
- if (mMediaPlayer != null && mCurrentState == STATE_SUSPEND) {
- if (mMediaPlayer.resume()) {
- mCurrentState = mStateWhenSuspended;
- mTargetState = mStateWhenSuspended;
- } else {
- Log.w(TAG, "Unable to resume video");
- }
- return;
- }
- if (mCurrentState == STATE_SUSPEND_UNSUPPORTED) {
- openVideo();
- }
+ openVideo();
}
- // cache duration as mDuration for faster access
+ // cache duration as mDuration for faster access
public int getDuration() {
if (isInPlaybackState()) {
if (mDuration > 0) {