提交 f17de4d9 编写于 作者: S shuyu

增加了拉伸填充的配置 (2017-06-16)

上级 1d1e5351
......@@ -20,7 +20,12 @@ public void setDismissControlTime(int dismissControlTime)
*/
public void setSeekRatio(float seekRatio)
```
* 增加了拉伸填充的配置
```
GSYVideoType.java
//全屏拉伸显示,使用这个属性时,surface_container建议使用FrameLayout
public final static int SCREEN_MATCH_FULL = -4;
```
### 1.6.6(2017-05-24)
* update ijkplayer to 0.8.0
......
......@@ -24,5 +24,7 @@ public class GSYApplication extends Application {
//LeakCanary.install(this);
//GSYVideoType.enableMediaCodec();
//GSYVideoManager.instance().setVideoType(this, GSYVideoType.IJKEXOPLAYER);
//GSYVideoType.setShowType(GSYVideoType.SCREEN_MATCH_FULL);
//GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_FULL);
}
}
......@@ -4,13 +4,12 @@
android:layout_height="match_parent"
android:background="@android:color/black">
<RelativeLayout
<FrameLayout
android:id="@+id/surface_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
</RelativeLayout>
</FrameLayout>
<com.shuyu.gsyvideoplayer.GSYImageCover
android:id="@+id/cover"
......
......@@ -44,6 +44,18 @@ public class GSYImageCover extends ImageView {
int widthS = getDefaultSize(videoWidth, widthMeasureSpec);
int heightS = getDefaultSize(videoHeight, heightMeasureSpec);
if (GSYVideoType.getShowType() == GSYVideoType.SCREEN_MATCH_FULL) {
boolean rotate = (getRotation() != 0 && getRotation() % 90 == 0 && Math.abs(getRotation()) != 180);
if(rotate) {
setMeasuredDimension(heightMeasureSpec, widthMeasureSpec);
} else {
setMeasuredDimension(widthMeasureSpec, heightMeasureSpec);
}
return;
}
if (originW == 0 || originH == 0) {
originW = widthS;
originH = heightS;
......
......@@ -42,6 +42,21 @@ public class GSYTextureView extends TextureView {
int widthS = getDefaultSize(videoWidth, widthMeasureSpec);
int heightS = getDefaultSize(videoHeight, heightMeasureSpec);
if (GSYVideoType.getShowType() == GSYVideoType.SCREEN_MATCH_FULL) {
boolean rotate = (getRotation() != 0 && getRotation() % 90 == 0 && Math.abs(getRotation()) != 180);
if(rotate) {
sizeW = heightMeasureSpec;
sizeH = widthMeasureSpec;
setMeasuredDimension(heightMeasureSpec, widthMeasureSpec);
} else {
sizeW = widthMeasureSpec;
sizeH = heightMeasureSpec;
setMeasuredDimension(widthMeasureSpec, heightMeasureSpec);
}
return;
}
if (originW == 0 || originH == 0) {
originW = widthS;
originH = heightS;
......
......@@ -18,6 +18,9 @@ public class GSYVideoType {
//全屏裁减显示
public final static int SCREEN_TYPE_FULL = 4;
//全屏拉伸显示,使用这个属性时,surface_container建议使用FrameLayout
public final static int SCREEN_MATCH_FULL = -4;
public final static int IJKPLAYER = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册