Skip to content

Commit de10bac

Browse files
committed
Merge branch 'develop'
2 parents a275ea0 + 271e852 commit de10bac

26 files changed

+562
-368
lines changed

README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* 支持重力感应横竖屏旋转及开关设置</br>
1010
* 支持任意位置启动Activity级别悬浮窗口播放</br>
1111
* 支持任意位置启动全局悬浮窗口播放</br>
12+
* 窗口播放器支持自动吸附悬停</br>
1213
* 支持任意位置直接启动全屏播放</br>
1314
* 支持连续播放视频列表</br>
1415
* Demo:列表或组件之间无缝转场播放</br>
@@ -24,7 +25,7 @@
2425
#### 三、SDK集成
2526
* 建议集成前先[下载apk][2]体验,找到自己想要实现的功能模块,后续集成可参考demo源码。
2627

27-
[2]:https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/apk/iPlayer-2.1.0.apk?version=2.1.0 "下载apk"
28+
[2]:https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/apk/iPlayer-2.1.1.apk?version=2.1.1 "下载apk"
2829

2930
##### 1、项目根build.gradle配置</br>
3031
```
@@ -38,16 +39,16 @@
3839
```
3940
dependencies {
4041
//播放器(无UI交互)
41-
implementation 'com.github.hty527.iPlayer:iplayer:2.1.0'
42+
implementation 'com.github.hty527.iPlayer:iplayer:2.1.1'
4243
//UI交互组件,可根据需要使用
43-
implementation 'com.github.hty527.iPlayer:widget:2.1.0'
44+
implementation 'com.github.hty527.iPlayer:widget:2.1.1'
4445
4546
//ijk音视频解码器,根据需要使用
46-
//implementation 'com.github.hty527.iPlayer:ijk:2.1.0'
47+
//implementation 'com.github.hty527.iPlayer:ijk:2.1.1'
4748
//exo音视频解码器,根据需要使用
48-
//implementation 'com.github.hty527.iPlayer:exo:2.1.0'
49+
//implementation 'com.github.hty527.iPlayer:exo:2.1.1'
4950
//音视频预缓存+边播边存,根据需要使用
50-
//implementation 'com.github.hty527.iPlayer:cache:2.1.0'
51+
//implementation 'com.github.hty527.iPlayer:cache:2.1.1'
5152
}
5253
```
5354
##### 3、在需要播放视频的xml中添加如下代码,或在适合的位置new VideoPlayer()</br>

app/build.gradle

+10-10
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,24 @@ dependencies {
7777
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
7878
implementation 'com.google.code.gson:gson:2.8.5'
7979
//播放器SDK
80-
// implementation project(':iplayer')
80+
implementation project(':iplayer')
8181
//UI交互组件
82-
// implementation project(':widget')
82+
implementation project(':widget')
8383
//ijk音视频解码器
84-
// implementation project(':ijk')
84+
implementation project(':ijk')
8585
//exo音视频解码器
86-
// implementation project(':exo')
86+
implementation project(':exo')
8787
//音视频缓存
88-
// implementation project(':cache')
88+
implementation project(':cache')
8989

9090
//播放器SDK
91-
implementation 'com.github.hty527.iPlayer:iplayer:2.1.0'
91+
// implementation 'com.github.hty527.iPlayer:iplayer:2.1.1'
9292
//UI交互组件,可根据需要使用
93-
implementation 'com.github.hty527.iPlayer:widget:2.1.0'
93+
// implementation 'com.github.hty527.iPlayer:widget:2.1.1'
9494
//音视频预缓存+边播边存,根据需要使用
95-
implementation 'com.github.hty527.iPlayer:cache:2.1.0'
95+
// implementation 'com.github.hty527.iPlayer:cache:2.1.1'
9696
//ijk音视频解码器,根据自己需要实现
97-
implementation 'com.github.hty527.iPlayer:ijk:2.1.0'
97+
// implementation 'com.github.hty527.iPlayer:ijk:2.1.1'
9898
//exo音视频解码器,根据自己需要实现
99-
implementation 'com.github.hty527.iPlayer:exo:2.1.0'
99+
// implementation 'com.github.hty527.iPlayer:exo:2.1.1'
100100
}

app/src/main/java/com/android/videoplayer/ui/activity/MainActivity.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ private void startGlobalWindowPlayer() {
189189
VideoController controller = videoPlayer.createController();//初始化一个默认的控制器(内部适用默认的一套交互UI控制器组件)
190190
WidgetFactory.bindDefaultControls(controller,false,true);
191191
controller.setTitle("任意界面开启一个悬浮窗窗口播放器");//视频标题(默认视图控制器横屏可见)
192+
//悬浮窗口播放默认开启自动吸附悬停,如需禁用请阅读多参方法参数说明
192193
boolean globalWindow = videoPlayer.startGlobalWindow(ScreenUtils.getInstance().dpToPxInt(3), Color.parseColor("#99000000"));
193194
Logger.d(TAG,"startGoableWindow-->globalWindow:"+globalWindow);
194195
if(globalWindow) {
@@ -233,16 +234,18 @@ public void onPlayerState(PlayerState state, String message) {
233234
mVideoPlayer.setProgressCallBackSpaceMilliss(300);
234235
mVideoPlayer.getController().setTitle("测试播放地址");//视频标题(默认视图控制器横屏可见)
235236
mVideoPlayer.setDataSource(MP4_URL2);//播放地址设置
236-
//自定义窗口播放的宽,高,起始X轴,起始Y轴属性,这里示例将播放器添加到标题栏下方右侧
237+
//自定义窗口播放的宽,高,起始X轴,起始Y轴属性,这里示例将播放器添加到标题栏下方右侧,距离顶部及右侧编剧12dp
237238
// mVideoPlayer.startWindow();
238239
int[] screenLocation=new int[2];
239240
TitleView titleView = findViewById(R.id.title_view);
240241
titleView.getLocationInWindow(screenLocation);
241242
int width = (PlayerUtils.getInstance().getScreenWidth(MainActivity.this)/2)+ScreenUtils.getInstance().dpToPxInt(30f);
242243
int height = width*9/16;
243-
float startX=PlayerUtils.getInstance().getScreenWidth(MainActivity.this)/2-PlayerUtils.getInstance().dpToPxInt(45f);//开始位置
244+
float startX=PlayerUtils.getInstance().getScreenWidth(MainActivity.this)/2-PlayerUtils.getInstance().dpToPxInt(42f);//开始位置
244245
float startY=screenLocation[1]+titleView.getHeight()+PlayerUtils.getInstance().dpToPxInt(15f);
245246
//启动窗口播放
247+
// mVideoPlayer.startWindow(PlayerUtils.getInstance().dpToPxInt(3f),Color.parseColor("#80000000"),true);
248+
//悬浮窗口播放默认开启自动吸附悬停,如需禁用请阅读多参方法参数说明
246249
mVideoPlayer.startWindow(width,height,startX,startY,ScreenUtils.getInstance().dpToPxInt(3f),Color.parseColor("#99000000"));//初始显示的位置并添加窗口颜色和圆角大小
247250
mVideoPlayer.prepareAsync();//开始异步准备播放
248251
}

app/src/main/java/com/android/videoplayer/video/ui/activity/VideoDetailsActivity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public void onPlayerState(PlayerState state, String message) {
311311
IControllerView controllerView = controller.findControlWidgetByTag(IVideoController.TARGET_CONTROL_TOOL);
312312
if(null!=controllerView&&controllerView instanceof ControlToolBarView){
313313
ControlToolBarView controlToolBarView= (ControlToolBarView) controllerView;
314-
controlToolBarView.showMenus(true,true,true);
314+
controlToolBarView.showMenus(false,true,true);
315315
controlToolBarView.setOnToolBarActionListener(new ControlToolBarView.OnToolBarActionListener() {
316316
@Override
317317
public void onWindow() {

app/src/main/java/com/android/videoplayer/video/ui/fragment/ListPlayerFragment.java

-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ protected void startPlayer(ViewGroup playerContainer,int position) {
282282
String[] videoPath = PlayerManager.getInstance().getVideoPath(itemData);
283283
mVideoPlayer.getController().setTitle(videoPath[1]);//视频标题(默认视图控制器横屏可见)
284284
mVideoPlayer.setDataSource(videoPath[0]);//播放地址设置
285-
mVideoPlayer.setAutoChangeOrientation(true);
286285
mVideoPlayer.prepareAsync();//开始异步准备播放
287286
}
288287
}

config.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ext {
22
sdk=[
3-
versionCode : 20100,
4-
versionName : "2.1.0"//SDK版本号
3+
versionCode : 20101,
4+
versionName : "2.1.1"//SDK版本号
55
]
66
}
Binary file not shown.

doc/update/api.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,10 @@
311311
##### 8.1、Activity级别悬浮窗
312312
* 8.1.1、Activity级别悬浮窗无需悬浮窗权限直接开启:
313313
```
314-
//startWindow支持多参传入,请阅读api。参数1:给窗口设置一个圆角,参数2:给窗口设置一个背景色
314+
//开启Activity级别窗口播放并启用拖拽窗口松手后自动吸附至屏幕边缘
315+
mVideoPlayer.startWindow(true);
316+
317+
//startWindow支持多参传入,示例参数1:给窗口设置一个圆角,参数2:给窗口设置一个背景色,其它更多参数请阅读api。
315318
mVideoPlayer.startWindow(ScreenUtils.getInstance().dpToPxInt(3f), Color.parseColor("#99000000"));
316319
```
317320
* 8.1.2、SDK支持在任意位置直接启动Activity级别悬浮窗播放:
@@ -357,6 +360,7 @@
357360
}
358361
}
359362
```
363+
* 8.1.3、Activity级别悬浮窗默认是开启松手后自定吸附悬停至最近的X轴方向的屏幕边缘功能的,如需关闭,请查阅:startWindow()多参方法参数说明。
360364

361365
##### 8.2、全局悬浮窗
362366
###### 8.2.1、悬浮窗开启
@@ -366,7 +370,10 @@
366370
<!--如您的播放器需要支持全局悬浮窗窗口播放请申明此权限-->
367371
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
368372
369-
//2、开启全局悬浮窗窗口播放,startGlobalWindow支持多参传入,请阅读api。参数1:给窗口设置一个圆角,参数2:给窗口设置一个背景色
373+
//2、开启全局悬浮窗窗口播放并启用拖拽窗口松手后自动吸附至屏幕边缘
374+
boolean globalWindow = mVideoPlayer.startGlobalWindow(true);
375+
376+
//startGlobalWindow支持多参传入,示例参数1:给窗口设置一个圆角,参数2:给窗口设置一个背景色,其它更多参数请阅读api。
370377
boolean globalWindow = mVideoPlayer.startGlobalWindow(ScreenUtils.getInstance().dpToPxInt(3), Color.parseColor("#99000000"));
371378
```
372379
* 8.2.1.2、SDK支持在任意位置直接启动全局悬浮窗窗口播放:
@@ -386,6 +393,7 @@
386393
videoPlayer.prepareAsync();//开始异步准备播放,注意界面关闭不要销毁播放器实例
387394
}
388395
```
396+
* 8.2.1.3、全局悬浮窗默认是开启松手后自定吸附悬停至最近的X轴方向的屏幕边缘功能的,如需关闭,请查阅:startGlobalWindow()多参方法参数说明。
389397

390398
###### 8.2.2、悬浮窗点击
391399
* 8.2.2.1、SDK内部提供了监听悬浮窗窗口播放器的关闭、点击回调监听器

doc/update/updateLog.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
历史版本
22

3+
### 2.1.1
4+
**更新日期:** 2022-9-20<br/>
5+
**更新内容:**<br/>
6+
>1. 窗口播放器新增自动吸附悬停功能<br/>
7+
>2. 组件库优化<br/>
8+
>3. 修复已知问题<br/>
9+
___
310
### 2.1.0
411
**更新日期:** 2022-9-16<br/>
512
**更新内容:**<br/>

0 commit comments

Comments
 (0)