提交 42667f43 编写于 作者: S shuyu

1.4.3

上级 3649bc1b
......@@ -41,7 +41,7 @@ dependencies {
 
## [*********** *问题集锦入口* ***********](https://github.com/CarGuo/GSYVideoPlayer/blob/master/QUESTION.md)
 
## [*********** *IJKPlayer问题入口* ***********](http://www.jianshu.com/p/220b00d00deb) 
## [IJKPlayer问题入口](http://www.jianshu.com/p/220b00d00deb) 
 
## 效果,录屏下的屏幕旋转和实际有些出入
......@@ -64,11 +64,11 @@ dependencies {
### 1.4.3
* 增加了设置显示比例CommonType。
* DEMO增加SampleVideo,在PlayActivity使用,可调节显示比例
* 增加了开启和关闭硬解码的接口CommonType。
* 增加了设置显示比例GSYVideoType。
* DEMO增加SampleVideo,在PlayActivity使用,调节显示比例效果
* 增加了开启和关闭硬解码的接口GSYVideoType。
CommonType
GSYVideoType
```
/**
* 设置显示比例
......
......@@ -2,8 +2,6 @@ package com.example.gsyvideoplayer;
import android.app.Application;
import com.shuyu.gsyvideoplayer.utils.CommonType;
//import com.squareup.leakcanary.LeakCanary;
/**
......@@ -21,6 +19,6 @@ public class GSYApplication extends Application {
//return;
//}
//LeakCanary.install(this);
//CommonType.enableMediaCodec();
//GSYVideoType.enableMediaCodec();
}
}
......@@ -6,7 +6,7 @@ import android.view.View;
import android.widget.TextView;
import com.example.gsyvideoplayer.R;
import com.shuyu.gsyvideoplayer.utils.CommonType;
import com.shuyu.gsyvideoplayer.utils.GSYVideoType;
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;
/**
......@@ -37,19 +37,19 @@ public class SampleVideo extends StandardGSYVideoPlayer {
if (type == 0) {
type = 1;
mMoreScale.setText("16:9");
CommonType.setShowType(CommonType.SCREEN_TYPE_16_9);
GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_16_9);
if (mTextureView != null)
mTextureView.requestLayout();
} else if (type == 1) {
type = 2;
mMoreScale.setText("4:3");
CommonType.setShowType(CommonType.SCREEN_TYPE_4_3);
GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_4_3);
if (mTextureView != null)
mTextureView.requestLayout();
} else if (type == 2) {
type = 0;
mMoreScale.setText("默认比例");
CommonType.setShowType(CommonType.SCREEN_TYPE_DEFAULT);
GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_DEFAULT);
if (mTextureView != null)
mTextureView.requestLayout();
}
......
......@@ -4,7 +4,7 @@ import android.content.Context;
import android.util.AttributeSet;
import android.view.TextureView;
import com.shuyu.gsyvideoplayer.utils.CommonType;
import com.shuyu.gsyvideoplayer.utils.GSYVideoType;
/**
* 用于显示video的,做了横屏与竖屏的匹配,还有需要rotation需求的
......@@ -103,13 +103,13 @@ public class GSYTextureView extends TextureView {
}
//如果设置了比例
if (CommonType.getShowType() == CommonType.SCREEN_TYPE_16_9) {
if (GSYVideoType.getShowType() == GSYVideoType.SCREEN_TYPE_16_9) {
if (height > width) {
width = height * 9 / 16;
} else {
height = width * 9 / 16;
}
} else if (CommonType.getShowType() == CommonType.SCREEN_TYPE_4_3) {
} else if (GSYVideoType.getShowType() == GSYVideoType.SCREEN_TYPE_4_3) {
if (height > width) {
width = height * 3 / 4;
} else {
......
......@@ -14,7 +14,7 @@ import com.danikula.videocache.HttpProxyCacheServer;
import com.danikula.videocache.file.Md5FileNameGenerator;
import com.shuyu.gsyvideoplayer.listener.GSYMediaPlayerListener;
import com.shuyu.gsyvideoplayer.model.GSYModel;
import com.shuyu.gsyvideoplayer.utils.CommonType;
import com.shuyu.gsyvideoplayer.utils.GSYVideoType;
import com.shuyu.gsyvideoplayer.utils.CommonUtil;
import com.shuyu.gsyvideoplayer.utils.Debuger;
import com.shuyu.gsyvideoplayer.utils.FileUtils;
......@@ -233,7 +233,7 @@ public class GSYVideoManager implements IMediaPlayer.OnPreparedListener, IMediaP
currentVideoHeight = 0;
mediaPlayer.release();
mediaPlayer = new IjkMediaPlayer();
if (CommonType.isMediaCodec()) {
if (GSYVideoType.isMediaCodec()) {
Debuger.printfLog("enable mediaCodec");
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 1);
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-auto-rotate", 1);
......
......@@ -4,7 +4,7 @@ package com.shuyu.gsyvideoplayer.utils;
* Created by shuyu on 2016/12/7.
*/
public class CommonType {
public class GSYVideoType {
//默认显示比例
public final static int SCREEN_TYPE_DEFAULT = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册