diff --git a/UPDATE_VERSION.md b/UPDATE_VERSION.md index 1f435b206..7afac7b71 100644 --- a/UPDATE_VERSION.md +++ b/UPDATE_VERSION.md @@ -1,5 +1,8 @@ ## 下方个版本说明,可以当做简单的wiki使用~,效果可参考DEMO。 +### 1.6.3(未发布) +* 修改了播放器全屏时的选择90度问题 + ### 1.6.2(2017-04-05) * 移除无用代码 * 修复了动态播放按键的显示小白点问题 diff --git a/app/src/main/java/com/example/gsyvideoplayer/adapter/ListNormalAdapter.java b/app/src/main/java/com/example/gsyvideoplayer/adapter/ListNormalAdapter.java index 19a2ae9ad..1fe4c1905 100644 --- a/app/src/main/java/com/example/gsyvideoplayer/adapter/ListNormalAdapter.java +++ b/app/src/main/java/com/example/gsyvideoplayer/adapter/ListNormalAdapter.java @@ -89,6 +89,7 @@ public View getView(final int position, View convertView, ViewGroup parent) { holder.gsyVideoPlayer.setThumbImageView(holder.imageView); final String url = "http://baobab.wdjcdn.com/14564977406580.mp4"; + //final String url = "http://7xse1z.com1.z0.glb.clouddn.com/1491813192"; //默认缓存路径 holder.gsyVideoPlayer.setUp(url, true , null, "这是title"); diff --git a/gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYTextureView.java b/gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYTextureView.java index b16c5d644..17455bcd6 100644 --- a/gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYTextureView.java +++ b/gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYTextureView.java @@ -4,6 +4,7 @@ import android.util.AttributeSet; import android.view.TextureView; +import com.shuyu.gsyvideoplayer.utils.Debuger; import com.shuyu.gsyvideoplayer.utils.GSYVideoType; /** @@ -37,7 +38,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int widthS = getDefaultSize(videoWidth, widthMeasureSpec); int heightS = getDefaultSize(videoHeight, heightMeasureSpec); - + //Debuger.printfError("******** video size " + getRotation() + " " + videoHeight + " *****1 " + videoWidth); + //Debuger.printfError("******** widget size " + widthS + " *****2 " + heightS); if (videoWidth > 0 && videoHeight > 0) { int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec); @@ -82,6 +84,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // no size yet, just adopt the given spec sizes } + //Debuger.printfError("******** rotate before " + width + " *****3 " + height); + if (getRotation() != 0 && getRotation() % 90 == 0) { if (widthS < heightS) { if (width > height) { @@ -100,8 +104,24 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { height = widthS; } } + + //如果旋转后的高度大于宽度 + if (width > height) { + //如果视频的旋转后,width(高度)大于控件高度,需要压缩下高度 + if (width > heightS) { + width = heightS; + height = (int) (height * (float) (width / heightS)); + } + } else { + //如果旋转后的宽度大于高度 + if (height > widthS) { + height = widthS; + width = (int) (width * (float) (height / widthS)); + } + } } + //Debuger.printfError("******** real size " + width + " *****3 " + height); //如果设置了比例 if (GSYVideoType.getShowType() == GSYVideoType.SCREEN_TYPE_16_9) { if (height > width) {