Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java

Issue 56443002: Fix an issue that mediaplayer can return size(0,0) for a valid video (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use MATCH_PARENT Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/renderer/media/android/webmediaplayer_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java b/content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java
index c1fcd580b60e93feef765c730c98df2598648d79..daa0b20db0b832a8d0dd6adf0f66bafdc4184750 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java
@@ -110,10 +110,6 @@ public class ContentVideoView
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- if (mVideoWidth == 0 && mVideoHeight == 0) {
- setMeasuredDimension(1, 1);
- return;
- }
int width = getDefaultSize(mVideoWidth, widthMeasureSpec);
int height = getDefaultSize(mVideoHeight, heightMeasureSpec);
if (mVideoWidth > 0 && mVideoHeight > 0) {
@@ -235,8 +231,8 @@ public class ContentVideoView
private void showContentVideoView() {
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.WRAP_CONTENT,
- ViewGroup.LayoutParams.WRAP_CONTENT,
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT,
Gravity.CENTER);
this.addView(mVideoSurfaceView, layoutParams);
View progressView = mClient.getVideoLoadingProgressView();
@@ -245,7 +241,10 @@ public class ContentVideoView
} else {
mProgressView = new ProgressView(getContext(), mVideoLoadingText);
}
- this.addView(mProgressView, layoutParams);
+ this.addView(mProgressView, new FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.WRAP_CONTENT,
+ ViewGroup.LayoutParams.WRAP_CONTENT,
+ Gravity.CENTER));
mVideoSurfaceView.setZOrderOnTop(true);
mVideoSurfaceView.setOnKeyListener(this);
mVideoSurfaceView.setOnTouchListener(this);
@@ -309,9 +308,8 @@ public class ContentVideoView
private void onVideoSizeChanged(int width, int height) {
mVideoWidth = width;
mVideoHeight = height;
- if (mVideoWidth != 0 && mVideoHeight != 0) {
- mVideoSurfaceView.getHolder().setFixedSize(mVideoWidth, mVideoHeight);
- }
+ // This will trigger the SurfaceView.onMeasure() call.
+ mVideoSurfaceView.getHolder().setFixedSize(mVideoWidth, mVideoHeight);
}
@CalledByNative
« no previous file with comments | « no previous file | content/renderer/media/android/webmediaplayer_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698