Skip to content

Commit

Permalink
修改了播放器全屏时的选择90度的时候裁减了的问题(2017-04-11)
Browse files Browse the repository at this point in the history
  • Loading branch information
CarGuo committed Apr 11, 2017
1 parent 8cfe47b commit 930936d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
3 changes: 3 additions & 0 deletions UPDATE_VERSION.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 下方个版本说明,可以当做简单的wiki使用~,效果可参考DEMO。

### 1.6.3(未发布)
* 修改了播放器全屏时的选择90度问题

### 1.6.2(2017-04-05)
* 移除无用代码
* 修复了动态播放按键的显示小白点问题
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.util.AttributeSet;
import android.view.TextureView;

import com.shuyu.gsyvideoplayer.utils.Debuger;
import com.shuyu.gsyvideoplayer.utils.GSYVideoType;

/**
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit 930936d

Please sign in to comment.