summaryrefslogtreecommitdiff
path: root/core/java/android/webkit/HTML5VideoView.java
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2011-03-18 14:56:10 -0700
committerTeng-Hui Zhu <ztenghui@google.com>2011-03-21 10:36:00 -0700
commit265db32f31a9db60d4a93d59befa07c825cbe4f2 (patch)
tree0490dde33eec68733a3a833f4e42ca57ac8ef2d4 /core/java/android/webkit/HTML5VideoView.java
parentdd76dc0297f4c39fefbbc1ac23d9b1add187d9e9 (diff)
Support loading image and paused image for inline video
bug:4142131 Change-Id: I28d82a8e30a2146a3380c63dcdcbd51228f23f56
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;