summaryrefslogtreecommitdiff
path: root/core/java/android/webkit/HTML5VideoView.java
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2011-03-21 14:01:10 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-03-21 14:01:10 -0700
commit0b933c02dddbc325498b3b73d8be9167b155801b (patch)
tree77f57bb5da40f34397e74bbf1eacdbd5241b906e /core/java/android/webkit/HTML5VideoView.java
parent5e35c4855a972960403a10811882ebded8945006 (diff)
parent265db32f31a9db60d4a93d59befa07c825cbe4f2 (diff)
Merge "Support loading image and paused image for inline video" into honeycomb-mr1
Diffstat (limited to 'core/java/android/webkit/HTML5VideoView.java')
-rw-r--r--core/java/android/webkit/HTML5VideoView.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/core/java/android/webkit/HTML5VideoView.java b/core/java/android/webkit/HTML5VideoView.java
index 663497c76c5c..b9d55e07d62b 100644
--- a/core/java/android/webkit/HTML5VideoView.java
+++ b/core/java/android/webkit/HTML5VideoView.java
@@ -27,9 +27,12 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
// prepared and not prepared.
// When the video is not prepared, we will have to save the seekTo time,
// and use it when prepared to play.
- protected static final int STATE_NOTPREPARED = 0;
- protected static final int STATE_PREPARED = 1;
-
+ // NOTE: these values are in sync with VideoLayerAndroid.h in webkit side.
+ // Please keep them in sync when changed.
+ static final int STATE_INITIALIZED = 0;
+ static final int STATE_NOTPREPARED = 1;
+ static final int STATE_PREPARED = 2;
+ static final int STATE_PLAYING = 3;
protected int mCurrentState;
protected HTML5VideoViewProxy mProxy;
@@ -121,7 +124,7 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
// Every time we start a new Video, we create a VideoView and a MediaPlayer
public void init(int videoLayerId, int position, boolean autoStart) {
mPlayer = new MediaPlayer();
- mCurrentState = STATE_NOTPREPARED;
+ mCurrentState = STATE_INITIALIZED;
mProxy = null;
mVideoLayerId = videoLayerId;
mSaveSeekTime = position;
@@ -190,6 +193,7 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
} catch (IOException e) {
e.printStackTrace();
}
+ mCurrentState = STATE_NOTPREPARED;
}
@@ -198,6 +202,15 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
return mVideoLayerId;
}
+
+ public int getCurrentState() {
+ if (mPlayer.isPlaying()) {
+ return STATE_PLAYING;
+ } else {
+ return mCurrentState;
+ }
+ }
+
private static final class TimeupdateTask extends TimerTask {
private HTML5VideoViewProxy mProxy;