提交 6533c9dc 编写于 作者: S shuyu

1.1.7

上级 33c4b382
05.gif

3.9 MB

......@@ -9,6 +9,7 @@
* <h4>直接添加控件为封面</h4>
* <h4>兼容一些5.0的过场效果</h4>
* <h4>列表的全屏效果优化</h4>
* <h4>列表的小窗口播放,可拖动</h4>
## [简书详解入口](http://www.jianshu.com/p/9fe377dd9750)
......@@ -16,13 +17,13 @@
<dependency>
<groupId>com.shuyu</groupId>
<artifactId>gsyVideoPlayer</artifactId>
<version>1.1.6</version>
<version>1.1.7</version>
<type>pom</type>
</dependency>
```
```
compile 'com.shuyu:gsyVideoPlayer:1.1.6'
compile 'com.shuyu:gsyVideoPlayer:1.1.7'
```
## 效果,录屏下的屏幕旋转和实际有些出入
......@@ -37,11 +38,37 @@ compile 'com.shuyu:gsyVideoPlayer:1.1.6'
* <h4>2、列表</h4>
<img src="https://github.com/CarGuo/GSYVideoPlayer/blob/master/02.gif" width="240px" height="426px"/>
<img src="https://github.com/CarGuo/GSYVideoPlayer/blob/master/03.gif" width="240px" height="426px"/>
<img src="https://github.com/CarGuo/GSYVideoPlayer/blob/master/04.gif" width="240px" height="426px"/>
* <h4>3、详情模式</h4>
<img src="https://github.com/CarGuo/GSYVideoPlayer/blob/master/04.gif" width="240px" height="426px"/>
## 1.1.7 增加了第二种列表 ListVideoUtil可拖动小窗口支持
```
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
int lastVisibleItem = firstVisibleItem + visibleItemCount;
//大于0说明有播放,//对应的播放列表TAG
if (listVideoUtil.getPlayPosition() >= 0 && listVideoUtil.getPlayTAG().equals(ListVideoAdapter.TAG)) {
//当前播放的位置
int position = listVideoUtil.getPlayPosition();
//不可视的是时候
if ((position < firstVisibleItem || position > lastVisibleItem)) {
//如果是小窗口就不需要处理
if (!listVideoUtil.isSmall()) {
//小窗口
int size = CommonUtil.dip2px(ListVideo2Activity.this, 150);
listVideoUtil.showSmallVideo(new Point(size, size), false, true);
}
} else {
if (listVideoUtil.isSmall()) {
listVideoUtil.smallVideoToNormal();
}
}
}
}
```
## 1.1.6 优化了第二种列表ListVideoUtil的全屏效果,和列表一的全屏效果一致,两种全屏效果增加是否打开关闭接口。
......
......@@ -18,7 +18,7 @@ org.gradle.jvmargs=-Xmx1536m
BINTRAY_USER=
BINTRAY_KEY=
PROJ_GROUP=com.shuyu
PROJ_VERSION=1.1.6
PROJ_VERSION=1.1.7
PROJ_NAME=gsyVideo
PROJ_WEBSITEURL=hhttps://github.com/CarGuo/GSYVideoPlayer
PROJ_ISSUETRACKERURL=
......
......@@ -152,6 +152,7 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
this.mContext = context;
View.inflate(context, getLayoutId(), this);
mStartButton = findViewById(R.id.start);
mSmallClose = findViewById(R.id.small_close);
mBackButton = (ImageView) findViewById(R.id.back);
mFullscreenButton = (ImageView) findViewById(R.id.fullscreen);
mProgressBar = (SeekBar) findViewById(R.id.progress);
......@@ -433,9 +434,25 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
mProgressBar.setOnTouchListener(null);
mFullscreenButton.setOnTouchListener(null);
mTextureView.setOnClickListener(null);
mSmallClose.setVisibility(VISIBLE);
mSmallClose.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
hideSmallVideo();
releaseAllVideos();
}
});
}
public void setSmallCloseShow() {
mSmallClose.setVisibility(VISIBLE);
}
public void setSmallCloseHide() {
mSmallClose.setVisibility(GONE);
}
/**
* 设置界面选择
*/
......
......@@ -100,6 +100,11 @@ public class ListVideoUtil {
* @param url 播放的URL
*/
public void startPlay(String url) {
if (isSmall()) {
smallVideoToNormal();
}
gsyVideoPlayer.release();
gsyVideoPlayer.setUp(url, true, "");
......
......@@ -74,6 +74,8 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
private Handler mHandler = new Handler();
protected View mSmallClose;
public GSYBaseVideoPlayer(Context context) {
super(context);
......@@ -315,8 +317,6 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
GSYBaseVideoPlayer gsyVideoPlayer = constructor.newInstance(getContext());
gsyVideoPlayer.setId(SMALL_ID);
//int size = CommonUtil.
FrameLayout.LayoutParams lpParent = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
FrameLayout frameLayout = new FrameLayout(mContext);
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black">
<RelativeLayout
android:id="@+id/surface_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
</RelativeLayout>
<LinearLayout
android:id="@+id/layout_bottom"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="#99000000"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/current"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:text="00:00"
android:textColor="#ffffff" />
<SeekBar
android:id="@+id/progress"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1.0"
android:background="@null"
android:max="100"
android:maxHeight="4dp"
android:minHeight="4dp"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:progressDrawable="@drawable/video_seek_progress"
android:thumb="@drawable/video_seek_thumb" />
<TextView
android:id="@+id/total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:text="00:00"
android:textColor="#ffffff" />
<ImageView
android:id="@+id/fullscreen"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingRight="16dp"
android:scaleType="center"
android:src="@drawable/video_enlarge" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_top"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/video_title_bg"
android:gravity="center_vertical"
android:orientation="horizontal">
</LinearLayout>
<ProgressBar
android:id="@+id/loading"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:indeterminateDrawable="@drawable/video_loading"
android:visibility="invisible" />
<ImageView
android:id="@+id/start"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:src="@drawable/video_click_play_selector" />
</RelativeLayout>
......@@ -144,4 +144,16 @@
android:layout_centerVertical="true"
android:layout_gravity="center_vertical" />
<ImageView
android:id="@+id/small_close"
android:layout_width="30dp"
android:layout_height="30dp"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:scaleType="centerInside"
android:src="@drawable/video_small_close"
android:visibility="gone" />
</RelativeLayout>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册