提交 f09e51c0 编写于 作者: S shuyu

1.2.9

上级 71811897
......@@ -17,13 +17,13 @@
<dependency>
<groupId>com.shuyu</groupId>
<artifactId>gsyVideoPlayer</artifactId>
<version>1.2.8</version>
<version>1.2.9</version>
<type>pom</type>
</dependency>
```
```
compile 'com.shuyu:gsyVideoPlayer:1.2.8'
compile 'com.shuyu:gsyVideoPlayer:1.2.9'
```
## 效果,录屏下的屏幕旋转和实际有些出入
......@@ -43,6 +43,26 @@ compile 'com.shuyu:gsyVideoPlayer:1.2.8'
* <h4>3、详情模式</h4>
<img src="https://github.com/CarGuo/GSYVideoPlayer/blob/master/04.gif" width="240px" height="426px"/>
### 1.2.9 增加了下载速度的接口
```
/**
* 网络速度
* 注意,这里如果是开启了缓存,因为读取本地代理,缓存成功后还是存在速度的
* 再打开已经缓存的本地文件,网络速度才会回0.因为是播放本地文件了
*/
public long getNetSpeed()
/**
* 网络速度
* 注意,这里如果是开启了缓存,因为读取本地代理,缓存成功后还是存在速度的
* 再打开已经缓存的本地文件,网络速度才会回0.因为是播放本地文件了
*/
public String getNetSpeedText()
```
### 1.2.8 升级IJKPlayer到0.7.5;增加了改变播放速度(0-2左右的速度),但只支持6.0以上。
```
/**
......
......@@ -18,7 +18,7 @@ org.gradle.jvmargs=-Xmx1536m
BINTRAY_USER=
BINTRAY_KEY=
PROJ_GROUP=com.shuyu
PROJ_VERSION=1.2.8
PROJ_VERSION=1.2.9
PROJ_NAME=gsyVideo
PROJ_WEBSITEURL=hhttps://github.com/CarGuo/GSYVideoPlayer
PROJ_ISSUETRACKERURL=
......
......@@ -34,6 +34,8 @@ import java.util.TimerTask;
import tv.danmaku.ijk.media.player.IMediaPlayer;
import static com.shuyu.gsyvideoplayer.utils.CommonUtil.getTextSpeed;
/**
* Created by shuyu on 2016/11/11.
......@@ -103,6 +105,7 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
protected int mSeekToInAdvance = -1; //// TODO: 2016/11/13 跳过广告
protected int mRotate = 0; //针对某些视频的旋转信息做了旋转处理
protected int mSeekTimePosition; //手动改变滑动的位置
......@@ -732,6 +735,7 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
if (mLooping && percent == 0 && mProgressBar.getProgress() > 3) {
loopSetProgressAndTime();
}
Debuger.printfLog("Net speed: " + getNetSpeedText());
}
}
......@@ -1043,5 +1047,24 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
return backFrom;
}
/**
* 网络速度
* 注意,这里如果是开启了缓存,因为读取本地代理,缓存成功后还是存在速度的
* 再打开已经缓存的本地文件,网络速度才会回0.因为是播放本地文件了
*/
public long getNetSpeed() {
return GSYVideoManager.instance().getMediaPlayer().getTcpSpeed();
}
/**
* 网络速度
* 注意,这里如果是开启了缓存,因为读取本地代理,缓存成功后还是存在速度的
* 再打开已经缓存的本地文件,网络速度才会回0.因为是播放本地文件了
*/
public String getNetSpeedText() {
long speed = GSYVideoManager.instance().getMediaPlayer().getTcpSpeed();
return getTextSpeed(speed);
}
}
\ No newline at end of file
......@@ -101,8 +101,9 @@ public class CommonUtil {
public static void hideSupportActionBar(Context context, boolean actionBar, boolean statusBar) {
if (actionBar) {
if (context instanceof FragmentActivity) {
FragmentActivity fragmentActivity = (FragmentActivity)context;
android.app.ActionBar ab = fragmentActivity.getActionBar();if (ab != null) {
FragmentActivity fragmentActivity = (FragmentActivity) context;
android.app.ActionBar ab = fragmentActivity.getActionBar();
if (ab != null) {
ab.hide();
}
} else {
......@@ -115,7 +116,7 @@ public class CommonUtil {
}
if (statusBar) {
if (context instanceof FragmentActivity) {
FragmentActivity fragmentActivity = (FragmentActivity)context;
FragmentActivity fragmentActivity = (FragmentActivity) context;
fragmentActivity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
......@@ -128,8 +129,9 @@ public class CommonUtil {
public static void showSupportActionBar(Context context, boolean actionBar, boolean statusBar) {
if (actionBar) {
if (context instanceof FragmentActivity) {
FragmentActivity fragmentActivity = (FragmentActivity)context;
android.app.ActionBar ab = fragmentActivity.getActionBar();if (ab != null) {
FragmentActivity fragmentActivity = (FragmentActivity) context;
android.app.ActionBar ab = fragmentActivity.getActionBar();
if (ab != null) {
ab.show();
}
} else {
......@@ -143,7 +145,7 @@ public class CommonUtil {
if (statusBar) {
if (context instanceof FragmentActivity) {
FragmentActivity fragmentActivity = (FragmentActivity)context;
FragmentActivity fragmentActivity = (FragmentActivity) context;
fragmentActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
CommonUtil.getAppCompActivity(context).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
......@@ -211,6 +213,21 @@ public class CommonUtil {
return outMetrics.heightPixels;
}
/**
* 下载速度文本
*/
public static String getTextSpeed(long speed) {
String text = "";
if (speed >= 0 && speed < 1024) {
text = speed + " KB/s";
} else if (speed >= 1024 && speed < (1024 * 1024)) {
text = Long.toString(speed / 1024) + " KB/s";
} else if (speed >= (1024 * 1024) && speed < (1024 * 1024 * 1024)) {
text = Long.toString(speed / (1024 * 1024)) + " MB/s";
}
return text;
}
public static void deleteFile(String filePath) {
File file = new File(filePath);
if (file.exists()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册