diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2011-03-30 14:39:56 -0700 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2011-04-07 09:14:16 -0700 |
commit | 2fcf82aee30da977849adaaadf89d81c17afbac2 (patch) | |
tree | 37664d01a9bec59e6e253e3ace273c68ff9f106d | |
parent | a9cadefde4d5f79a0f3ed093bb96d9c919ce65c3 (diff) | |
download | frameworks_base-2fcf82aee30da977849adaaadf89d81c17afbac2.zip frameworks_base-2fcf82aee30da977849adaaadf89d81c17afbac2.tar.gz frameworks_base-2fcf82aee30da977849adaaadf89d81c17afbac2.tar.bz2 |
DO NOT MERGE : cherry pick of change Ieb7ae26b from master
Buffering in full screen mode will show progressView
bug:4187252
Change-Id: Ia44d880ab126c2439fb13504db87492d45c90bc8
-rw-r--r-- | core/java/android/webkit/HTML5VideoFullScreen.java | 11 | ||||
-rw-r--r-- | core/java/android/webkit/HTML5VideoView.java | 18 | ||||
-rw-r--r-- | core/java/android/webkit/HTML5VideoViewProxy.java | 14 |
3 files changed, 34 insertions, 9 deletions
diff --git a/core/java/android/webkit/HTML5VideoFullScreen.java b/core/java/android/webkit/HTML5VideoFullScreen.java index 0726266..0918683 100644 --- a/core/java/android/webkit/HTML5VideoFullScreen.java +++ b/core/java/android/webkit/HTML5VideoFullScreen.java @@ -191,8 +191,6 @@ public class HTML5VideoFullScreen extends HTML5VideoView if (mProgressView != null) { mProgressView.setVisibility(View.GONE); - mLayout.removeView(mProgressView); - mProgressView = null; } mVideoWidth = mp.getVideoWidth(); @@ -314,4 +312,13 @@ public class HTML5VideoFullScreen extends HTML5VideoView return false; } + @Override + protected void switchProgressView(boolean playerBuffering) { + if (playerBuffering) { + mProgressView.setVisibility(View.VISIBLE); + } else { + mProgressView.setVisibility(View.GONE); + } + return; + } } diff --git a/core/java/android/webkit/HTML5VideoView.java b/core/java/android/webkit/HTML5VideoView.java index ad6e5d3..fd3f358 100644 --- a/core/java/android/webkit/HTML5VideoView.java +++ b/core/java/android/webkit/HTML5VideoView.java @@ -78,6 +78,7 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener { TIMEUPDATE_PERIOD); } mPlayer.start(); + setPlayerBuffering(false); } } @@ -296,4 +297,21 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener { return 0; } + // This is true only when the player is buffering and paused + public boolean mPlayerBuffering = false; + + public boolean getPlayerBuffering() { + return mPlayerBuffering; + } + + public void setPlayerBuffering(boolean playerBuffering) { + mPlayerBuffering = playerBuffering; + switchProgressView(playerBuffering); + } + + + protected void switchProgressView(boolean playerBuffering) { + // Only used in HTML5VideoFullScreen + } + } diff --git a/core/java/android/webkit/HTML5VideoViewProxy.java b/core/java/android/webkit/HTML5VideoViewProxy.java index 18c5ec6..060c0bb 100644 --- a/core/java/android/webkit/HTML5VideoViewProxy.java +++ b/core/java/android/webkit/HTML5VideoViewProxy.java @@ -95,8 +95,10 @@ class HTML5VideoViewProxy extends Handler // identify the exact layer on the UI thread to use the SurfaceTexture. private static int mBaseLayer = 0; - // This is true only when the player is buffering and paused - private static boolean mPlayerBuffering = false; + private static void setPlayerBuffering(boolean playerBuffering) { + mHTML5VideoView.setPlayerBuffering(playerBuffering); + } + // Every time webView setBaseLayer, this will be called. // When we found the Video layer, then we set the Surface Texture to it. // Otherwise, we may want to delete the Surface Texture to save memory. @@ -111,7 +113,7 @@ class HTML5VideoViewProxy extends Handler int currentVideoLayerId = mHTML5VideoView.getVideoLayerId(); if (layer != 0 && surfTexture != null && currentVideoLayerId != -1) { int playerState = mHTML5VideoView.getCurrentState(); - if (mPlayerBuffering) + if (mHTML5VideoView.getPlayerBuffering()) playerState = HTML5VideoView.STATE_NOTPREPARED; boolean foundInTree = nativeSendSurfaceTexture(surfTexture, layer, currentVideoLayerId, textureName, @@ -166,7 +168,6 @@ class HTML5VideoViewProxy extends Handler WebChromeClient client, int videoLayerId) { int currentVideoLayerId = -1; boolean backFromFullScreenMode = false; - mPlayerBuffering = false; if (mHTML5VideoView != null) { currentVideoLayerId = mHTML5VideoView.getVideoLayerId(); if (mHTML5VideoView instanceof HTML5VideoFullScreen) { @@ -231,7 +232,6 @@ class HTML5VideoViewProxy extends Handler } public static void onPrepared() { - mPlayerBuffering = false; if (!mHTML5VideoView.isFullScreenMode() || mHTML5VideoView.getAutostart()) { mHTML5VideoView.start(); } @@ -351,11 +351,11 @@ class HTML5VideoViewProxy extends Handler break; } case BUFFERING_START: { - VideoPlayer.mPlayerBuffering = true; + VideoPlayer.setPlayerBuffering(true); break; } case BUFFERING_END: { - VideoPlayer.mPlayerBuffering = false; + VideoPlayer.setPlayerBuffering(false); break; } } |