Skip to content

Commit 166b249

Browse files
committed
readme
1 parent a4706d6 commit 166b249

10 files changed

Lines changed: 8 additions & 21 deletions

File tree

‎0034.gif‎

-1.25 MB
Binary file not shown.

‎01.gif‎

2.14 MB
Loading

‎01.jpg‎

587 KB
Loading

‎02.gif‎

5.86 MB
Loading

‎02.jpg‎

-399 KB
Loading

‎03.gif‎

-6.96 MB
Loading

‎03.jpg‎

17.4 KB
Loading

‎04.gif‎

-1.35 MB
Loading

‎README.md‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,15 @@ compile 'com.shuyu:gsyVideoPlayer:1.1.4'
3333
<img src="https://github.com/CarGuo/GSYVideoPlayer/blob/master/01.gif" width="240px" height="426px"/>
3434
<img src="https://github.com/CarGuo/GSYVideoPlayer/blob/master/02.gif" width="240px" height="426px"/>
3535
* <h4>2、列表</h4>
36-
<img src="https://github.com/CarGuo/GSYVideoPlayer/blob/master/0034.gif" width="240px" height="426px"/>
36+
<img src="https://github.com/CarGuo/GSYVideoPlayer/blob/master/02.gif" width="240px" height="426px"/>
37+
<img src="https://github.com/CarGuo/GSYVideoPlayer/blob/master/03.gif" width="240px" height="426px"/>
3738
* <h4>3、详情模式</h4>
3839
<img src="https://github.com/CarGuo/GSYVideoPlayer/blob/master/04.gif" width="240px" height="426px"/>
3940

4041
## 1.1.4
4142
* 优化了第一种列表的全屏动画,5.0以上展开和返回过渡顺畅,支持自动旋转的开启与关闭
4243
* 修改了全屏下的滑动接口不正常问题,全屏下自动变为滑动的,非全屏可以设置。
4344

44-
* GIF 效果
45-
</p>
46-
<img src="https://github.com/CarGuo/GSYVideoPlayer/blob/master/0034.gif" width="240px" height="426px"/>
47-
4845
```
4946
/**
5047
* 是否可以滑动界面改变进度,声音等

‎gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYTextureView.java‎

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,43 +39,34 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
3939
int heightSpecSize = MeasureSpec.getSize(heightMeasureSpec);
4040

4141
if (widthSpecMode == MeasureSpec.EXACTLY && heightSpecMode == MeasureSpec.EXACTLY) {
42-
// the size is fixed
4342
width = widthSpecSize;
4443
height = heightSpecSize;
4544

46-
// for compatibility, we adjust size based on aspect ratio
4745
if (videoWidth * height < width * videoHeight) {
4846
width = height * videoWidth / videoHeight;
4947
} else if (videoWidth * height > width * videoHeight) {
5048
height = width * videoHeight / videoWidth;
5149
}
5250
} else if (widthSpecMode == MeasureSpec.EXACTLY) {
53-
// only the width is fixed, adjust the height to match aspect ratio if possible
5451
width = widthSpecSize;
5552
height = width * videoHeight / videoWidth;
5653
if (heightSpecMode == MeasureSpec.AT_MOST && height > heightSpecSize) {
57-
// couldn't match aspect ratio within the constraints
5854
height = heightSpecSize;
5955
}
6056
} else if (heightSpecMode == MeasureSpec.EXACTLY) {
61-
// only the height is fixed, adjust the width to match aspect ratio if possible
6257
height = heightSpecSize;
6358
width = height * videoWidth / videoHeight;
6459
if (widthSpecMode == MeasureSpec.AT_MOST && width > widthSpecSize) {
65-
// couldn't match aspect ratio within the constraints
6660
width = widthSpecSize;
6761
}
6862
} else {
69-
// neither the width nor the height are fixed, try to use actual video size
7063
width = videoWidth;
7164
height = videoHeight;
7265
if (heightSpecMode == MeasureSpec.AT_MOST && height > heightSpecSize) {
73-
// too tall, decrease both width and height
7466
height = heightSpecSize;
7567
width = height * videoWidth / videoHeight;
7668
}
7769
if (widthSpecMode == MeasureSpec.AT_MOST && width > widthSpecSize) {
78-
// too wide, decrease both width and height
7970
width = widthSpecSize;
8071
height = width * videoHeight / videoWidth;
8172
}
@@ -85,25 +76,24 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
8576
}
8677

8778
if (getRotation() != 0 && getRotation() % 90 == 0) {
88-
if (widthS < heightS) {//旋转了90度,其实是竖的,适配宽度
89-
if (width > height) {//竖版的视频
79+
if (widthS < heightS) {
80+
if (width > height) {
9081
width = (int) (width * (float) widthS / height);
9182
height = widthS;
92-
} else {//横版的视频
83+
} else {
9384
height = (int) (height * (float) width / widthS);
9485
width = widthS;
9586
}
96-
} else {//旋转了90度,其实是横的,适配高度
97-
if (width > height) {//竖版的视频
87+
} else {
88+
if (width > height) {
9889
height = (int) (height * (float) width / widthS);
9990
width = widthS;
100-
} else {//横版的视频
91+
} else {
10192
width = (int) (width * (float) widthS / height);
10293
height = widthS;
10394
}
10495
}
10596
}
106-
//Log.e("back", "width " + width + " height " + height);
10797
setMeasuredDimension(width, height);
10898
}
10999
}

0 commit comments

Comments
 (0)