From 22acc2cb3060393c16ea7c0744c0f1c224d72be3 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Tue, 11 Sep 2018 14:40:12 +0800 Subject: [PATCH 01/36] fix progress back --- .../src/main/java/cn/jzvd/Jzvd.java | 19 ++++++++++++++++++- .../src/main/java/cn/jzvd/JzvdStd.java | 8 ++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java index ec47ae57a..0f581e453 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java @@ -895,7 +895,21 @@ public void cancelProgressTimer() { public void setProgressAndText(int progress, long position, long duration) { // Log.d(TAG, "setProgressAndText: progress=" + progress + " position=" + position + " duration=" + duration); if (!mTouchingProgressBar) { - if (progress != 0) progressBar.setProgress(progress); +// if (progress != 0) progressBar.setProgress(progress); +// Log.e(TAG, "setProgressAndText: " + seekToManulPosition + " : " + progress); + + if (seekToManulPosition != -1) { + if (seekToManulPosition > progress) { + Log.e(TAG, "setProgressAndText: " + seekToManulPosition + " return " + progress); + return; + } else { + Log.e(TAG, "setProgressAndText: " + seekToManulPosition + " : " + progress); + seekToManulPosition = -1; + } + } else { + Log.e(TAG, "setProgressAndText: " + progress); + if (progress != 0) progressBar.setProgress(progress); + } } if (position != 0) currentTimeTextView.setText(JZUtils.stringForTime(position)); totalTimeTextView.setText(JZUtils.stringForTime(duration)); @@ -964,10 +978,13 @@ public void onStopTrackingTouch(SeekBar seekBar) { if (currentState != CURRENT_STATE_PLAYING && currentState != CURRENT_STATE_PAUSE) return; long time = seekBar.getProgress() * getDuration() / 100; + seekToManulPosition = seekBar.getProgress(); JZMediaManager.seekTo(time); Log.i(TAG, "seekTo " + time + " [" + this.hashCode() + "] "); } + public int seekToManulPosition = -1; + @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java index e653d4cc7..ee0b5543d 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java @@ -387,11 +387,11 @@ public void onStartTrackingTouch(SeekBar seekBar) { @Override public void onStopTrackingTouch(SeekBar seekBar) { super.onStopTrackingTouch(seekBar); - if (currentState == CURRENT_STATE_PLAYING) { - dissmissControlView(); - } else { +// if (currentState == CURRENT_STATE_PLAYING) { +// dissmissControlView(); +// } else { startDismissControlViewTimer(); - } +// } } public void onClickUiToggle() { From 7d7e602ac64840d16d11d6e0fac28acc26307527 Mon Sep 17 00:00:00 2001 From: "imknown J. Kimu" <1034557712@qq.com> Date: Tue, 11 Sep 2018 16:23:20 +0800 Subject: [PATCH 02/36] Create jz_network_security_config_allow_cleartext.xml --- .../res/xml/jz_network_security_config_allow_cleartext.xml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 jiaozivideoplayer/src/main/res/xml/jz_network_security_config_allow_cleartext.xml diff --git a/jiaozivideoplayer/src/main/res/xml/jz_network_security_config_allow_cleartext.xml b/jiaozivideoplayer/src/main/res/xml/jz_network_security_config_allow_cleartext.xml new file mode 100644 index 000000000..2439f15c2 --- /dev/null +++ b/jiaozivideoplayer/src/main/res/xml/jz_network_security_config_allow_cleartext.xml @@ -0,0 +1,4 @@ + + + + From f6dd2b0bd9612709378b6bc9b18c7b15040c551b Mon Sep 17 00:00:00 2001 From: "imknown J. Kimu" <1034557712@qq.com> Date: Tue, 11 Sep 2018 16:24:56 +0800 Subject: [PATCH 03/36] Add networkSecurityConfig for demo ONLY --- app/src/main/AndroidManifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ade2f44c7..37dc0aea2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -10,6 +10,7 @@ android:allowBackup="false" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" + android:networkSecurityConfig="@xml/jz_network_security_config_allow_cleartext" android:theme="@style/AppTheme"> Date: Tue, 11 Sep 2018 18:13:15 +0800 Subject: [PATCH 04/36] rm bad code --- app/src/main/AndroidManifest.xml | 3 ++- jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java | 5 +---- jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java | 6 +----- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 37dc0aea2..d65940396 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,7 +4,6 @@ - + + diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java index 0f581e453..c7d1ee634 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java @@ -895,12 +895,9 @@ public void cancelProgressTimer() { public void setProgressAndText(int progress, long position, long duration) { // Log.d(TAG, "setProgressAndText: progress=" + progress + " position=" + position + " duration=" + duration); if (!mTouchingProgressBar) { -// if (progress != 0) progressBar.setProgress(progress); -// Log.e(TAG, "setProgressAndText: " + seekToManulPosition + " : " + progress); - if (seekToManulPosition != -1) { if (seekToManulPosition > progress) { - Log.e(TAG, "setProgressAndText: " + seekToManulPosition + " return " + progress); + Log.e(TAG, "setProgressAndText: "); return; } else { Log.e(TAG, "setProgressAndText: " + seekToManulPosition + " : " + progress); diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java index ee0b5543d..ce3ac86ea 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java @@ -387,11 +387,7 @@ public void onStartTrackingTouch(SeekBar seekBar) { @Override public void onStopTrackingTouch(SeekBar seekBar) { super.onStopTrackingTouch(seekBar); -// if (currentState == CURRENT_STATE_PLAYING) { -// dissmissControlView(); -// } else { - startDismissControlViewTimer(); -// } + startDismissControlViewTimer(); } public void onClickUiToggle() { From f2a8bd9cafa225a57c97284e65b236b6f4397218 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Wed, 12 Sep 2018 07:24:55 +0800 Subject: [PATCH 05/36] rm code --- app/src/main/AndroidManifest.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d65940396..378af04d2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -99,7 +99,6 @@ android:configChanges="orientation|screenSize|keyboardHidden" android:screenOrientation="portrait" /> - From 337f994b0cb09be910a47bd3a70ae7c0b3ceeed7 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Sat, 15 Sep 2018 22:17:49 +0800 Subject: [PATCH 06/36] change onprogress name make it easy to understandard --- jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java | 9 +++------ jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java index c7d1ee634..620089d7e 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java @@ -892,19 +892,16 @@ public void cancelProgressTimer() { } } - public void setProgressAndText(int progress, long position, long duration) { -// Log.d(TAG, "setProgressAndText: progress=" + progress + " position=" + position + " duration=" + duration); + public void onProgress(int progress, long position, long duration) { +// Log.d(TAG, "onProgress: progress=" + progress + " position=" + position + " duration=" + duration); if (!mTouchingProgressBar) { if (seekToManulPosition != -1) { if (seekToManulPosition > progress) { - Log.e(TAG, "setProgressAndText: "); return; } else { - Log.e(TAG, "setProgressAndText: " + seekToManulPosition + " : " + progress); seekToManulPosition = -1; } } else { - Log.e(TAG, "setProgressAndText: " + progress); if (progress != 0) progressBar.setProgress(progress); } } @@ -1185,7 +1182,7 @@ public void run() { long position = getCurrentPositionWhenPlaying(); long duration = getDuration(); int progress = (int) (position * 100 / (duration == 0 ? 1 : duration)); - setProgressAndText(progress, position, duration); + onProgress(progress, position, duration); } }); } diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java index ce3ac86ea..ca4f446b3 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java @@ -473,8 +473,8 @@ public void onCLickUiToggleToClear() { } @Override - public void setProgressAndText(int progress, long position, long duration) { - super.setProgressAndText(progress, position, duration); + public void onProgress(int progress, long position, long duration) { + super.onProgress(progress, position, duration); if (progress != 0) bottomProgressBar.setProgress(progress); } From 58dfb08d499614511130148e7d8a0de4538e286c Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Tue, 18 Sep 2018 00:29:41 +0800 Subject: [PATCH 07/36] fix slogen --- README-ZH.md | 4 ++++ README.md | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README-ZH.md b/README-ZH.md index 7bdbe8ddd..b1c167899 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -7,6 +7,10 @@

+高度自定义的安卓视频播放器 + +Q群: 490442439 2群: 761899104 验证信息:jzvd + ## 主要特点 1. 可以完全自定义UI和任何功能 diff --git a/README.md b/README.md index 858181df3..35281ae36 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@

-Perfect list sliding detection, one line of code to replace the system player with IJKplayer, ExoPlayer, Vitamio, etc. +Highly customizable Android video player -Q群: 490442439 2群: 761899104 authentication information: jzvd +Q群: 490442439 2群: 761899104 验证信息:jzvd [Wiki](https://github.com/lipangit/JiaoZiVideoPlayer/wiki) [EnglishWiki](https://github.com/felipetorres/VideoPlayer-Wiki) [Chinese README](https://github.com/lipangit/JiaoZiVideoPlayer/blob/develop/README-ZH.md) From e6f5899041fe57cbc17c4f73605d74303dbf5a24 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Tue, 18 Sep 2018 19:06:43 +0800 Subject: [PATCH 08/36] readme --- README-ZH.md | 7 +++++++ README.md | 11 +++++++++-- jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README-ZH.md b/README-ZH.md index b1c167899..d648035cc 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -11,6 +11,13 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd +## 使用步骤 + +1. 通读ReadMe +2. 下载安装demo,各个页面都进入一次,各个按钮都点一次 +3. 下载调试develop分支,有针对性的通过效果找到实现的源码 +4. 看[自定义相关的WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),实现自己的需求 + ## 主要特点 1. 可以完全自定义UI和任何功能 diff --git a/README.md b/README.md index 35281ae36..e65012985 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,17 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd [Wiki](https://github.com/lipangit/JiaoZiVideoPlayer/wiki) [EnglishWiki](https://github.com/felipetorres/VideoPlayer-Wiki) [Chinese README](https://github.com/lipangit/JiaoZiVideoPlayer/blob/develop/README-ZH.md) -[WorkPlan](https://github.com/lipangit/JiaoZiVideoPlayer/projects/2) -[Video tutorial](https://github.com/lipangit/JiaoZiVideoPlayer/wiki/%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B) +[WorkPlan](https://github.com/lipangit/JiaoZiVideoPlayer/projects/2) [Weibo](http://weibo.com/2342820395/profile?topnav=1&wvr=6&is_all=1) + +## 使用步骤 + +1. 通读ReadMe +2. 下载安装demo,各个页面都进入一次,各个按钮都点一次 +3. 下载调试develop分支,有针对性的通过效果找到实现的源码 +4. 看[自定义相关的WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),实现自己的需求 + ## Features 1. You can completely customize the UI and any method diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java index 620089d7e..e9ed026d7 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java @@ -45,6 +45,7 @@ public abstract class Jzvd extends FrameLayout implements View.OnClickListener, public static final int SCREEN_WINDOW_FULLSCREEN = 2; public static final int SCREEN_WINDOW_TINY = 3; + public static final int CURRENT_STATE_IDLE = -1; public static final int CURRENT_STATE_NORMAL = 0; public static final int CURRENT_STATE_PREPARING = 1; public static final int CURRENT_STATE_PREPARING_CHANGING_URL = 2; From 0053530ae21fc3a99cd6cc0d087243e8b403f525 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Tue, 18 Sep 2018 19:08:01 +0800 Subject: [PATCH 09/36] readme --- README-ZH.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README-ZH.md b/README-ZH.md index d648035cc..4ee4a3129 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -14,7 +14,7 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd ## 使用步骤 1. 通读ReadMe -2. 下载安装demo,各个页面都进入一次,各个按钮都点一次 +2. 下载安装demo,各个页面都进入一次,各个按钮点一次 3. 下载调试develop分支,有针对性的通过效果找到实现的源码 4. 看[自定义相关的WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),实现自己的需求 diff --git a/README.md b/README.md index e65012985..b976ad174 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd ## 使用步骤 1. 通读ReadMe -2. 下载安装demo,各个页面都进入一次,各个按钮都点一次 +2. 下载安装demo,各个页面都进入一次,各个按钮点一次 3. 下载调试develop分支,有针对性的通过效果找到实现的源码 4. 看[自定义相关的WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),实现自己的需求 From fb23106780899e873a2b13f555aed74917fc7416 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Tue, 18 Sep 2018 19:09:55 +0800 Subject: [PATCH 10/36] readme --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index b976ad174..70312ab26 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,9 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd [Wiki](https://github.com/lipangit/JiaoZiVideoPlayer/wiki) [EnglishWiki](https://github.com/felipetorres/VideoPlayer-Wiki) [Chinese README](https://github.com/lipangit/JiaoZiVideoPlayer/blob/develop/README-ZH.md) -[WorkPlan](https://github.com/lipangit/JiaoZiVideoPlayer/projects/2) +[WorkPlan](https://github.com/lipangit/JiaoZiVideoPlayer/projects/2) [Weibo](http://weibo.com/2342820395/profile?topnav=1&wvr=6&is_all=1) - ## 使用步骤 1. 通读ReadMe From cdbdeea762ba474f516057ab7a39f8958f71fdca Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Wed, 19 Sep 2018 14:08:01 +0800 Subject: [PATCH 11/36] read me --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 70312ab26..cab0f0ebc 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Highly customizable Android video player Q群: 490442439 2群: 761899104 验证信息:jzvd [Wiki](https://github.com/lipangit/JiaoZiVideoPlayer/wiki) [EnglishWiki](https://github.com/felipetorres/VideoPlayer-Wiki) -[Chinese README](https://github.com/lipangit/JiaoZiVideoPlayer/blob/develop/README-ZH.md) +[中文ReadMe](https://github.com/lipangit/JiaoZiVideoPlayer/blob/develop/README-ZH.md) [WorkPlan](https://github.com/lipangit/JiaoZiVideoPlayer/projects/2) [Weibo](http://weibo.com/2342820395/profile?topnav=1&wvr=6&is_all=1) From 03ea2d4bc20a4c4e7e766250dbc3bbf7415c49fe Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Thu, 20 Sep 2018 15:55:48 +0800 Subject: [PATCH 12/36] readme --- README-ZH.md | 17 ++++++++--------- README.md | 19 ++++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README-ZH.md b/README-ZH.md index 4ee4a3129..cf5c5021e 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -11,13 +11,6 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd -## 使用步骤 - -1. 通读ReadMe -2. 下载安装demo,各个页面都进入一次,各个按钮点一次 -3. 下载调试develop分支,有针对性的通过效果找到实现的源码 -4. 看[自定义相关的WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),实现自己的需求 - ## 主要特点 1. 可以完全自定义UI和任何功能 @@ -33,9 +26,15 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd 11. WebView嵌套本地视频控件 12. demo中添加视频缓存的例子 -## 效果 +## 使用步骤 + +1. 通读ReadMe +2. 下载安装demo apk [jiaozivideoplayer-6.3.1.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.3.1/jiaozivideoplayer-6.3.1.apk),各个页面都进入一次,各个按钮点一次 +3. 下载调试develop分支,有针对性的通过效果找到实现的源码 +4. 看[自定义相关的WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),实现自己的需求 +[入门文档1](https://www.jianshu.com/p/4c187a09b838)[入门文档2](https://shimo.im/docs/xj5F85W1gqEEBXRJ) -**[jiaozivideoplayer-6.3.1.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.3.1/jiaozivideoplayer-6.3.1.apk)** +## 效果 ![Demo Screenshot][1] diff --git a/README.md b/README.md index cab0f0ebc..676f3f3a1 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,6 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd [WorkPlan](https://github.com/lipangit/JiaoZiVideoPlayer/projects/2) [Weibo](http://weibo.com/2342820395/profile?topnav=1&wvr=6&is_all=1) -## 使用步骤 - -1. 通读ReadMe -2. 下载安装demo,各个页面都进入一次,各个按钮点一次 -3. 下载调试develop分支,有针对性的通过效果找到实现的源码 -4. 看[自定义相关的WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),实现自己的需求 - ## Features 1. You can completely customize the UI and any method @@ -38,12 +31,20 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd 11. WebView Nested Local Video Controls 12. VideoCache in demo -## Demo apk +## Steps for usage -A demo apk [jiaozivideoplayer-6.3.1.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.3.1/jiaozivideoplayer-6.3.1.apk) is available on Google Play showing all available features like this [small window effect on list sliding](http://weibo.com/tv/v/FtxpWgqmg?fid=1034:5cda6fc7f394b403d592bd9b1d5a9701). +1. Read through ReadMe +2. Download and install the demo apk[jiaozivideoplayer-6.3.1.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.3.1/jiaozivideoplayer-6.3.1.apk), each page enters once, each button clicks once +3. Download and debug the develop branch, and find the source code through the effect +4. See [custom-related WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),Realize your own needs +[Getting Started Document 1](https://www.jianshu.com/p/4c187a09b838)[Getting Started Document 2](https://shimo.im/docs/xj5F85W1gqEEBXRJ) + +## Screenshot ![Demo screenshot][1] +[small window effect on list sliding](http://weibo.com/tv/v/FtxpWgqmg?fid=1034:5cda6fc7f394b403d592bd9b1d5a9701). + ## Usage Only five steps to use the player: From 8519150737d6ef5f69808665b3a9dee6dc676954 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Thu, 20 Sep 2018 15:57:20 +0800 Subject: [PATCH 13/36] readme --- README-ZH.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README-ZH.md b/README-ZH.md index cf5c5021e..dbd0dac4c 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -32,6 +32,7 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd 2. 下载安装demo apk [jiaozivideoplayer-6.3.1.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.3.1/jiaozivideoplayer-6.3.1.apk),各个页面都进入一次,各个按钮点一次 3. 下载调试develop分支,有针对性的通过效果找到实现的源码 4. 看[自定义相关的WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),实现自己的需求 + [入门文档1](https://www.jianshu.com/p/4c187a09b838)[入门文档2](https://shimo.im/docs/xj5F85W1gqEEBXRJ) ## 效果 diff --git a/README.md b/README.md index 676f3f3a1..931eca6e8 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd 2. Download and install the demo apk[jiaozivideoplayer-6.3.1.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.3.1/jiaozivideoplayer-6.3.1.apk), each page enters once, each button clicks once 3. Download and debug the develop branch, and find the source code through the effect 4. See [custom-related WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),Realize your own needs + [Getting Started Document 1](https://www.jianshu.com/p/4c187a09b838)[Getting Started Document 2](https://shimo.im/docs/xj5F85W1gqEEBXRJ) ## Screenshot From a805475d1cca51c70fdfa9974d24b1052b83f110 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Thu, 20 Sep 2018 15:58:05 +0800 Subject: [PATCH 14/36] readme --- README-ZH.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README-ZH.md b/README-ZH.md index dbd0dac4c..a52dd4003 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -33,7 +33,7 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd 3. 下载调试develop分支,有针对性的通过效果找到实现的源码 4. 看[自定义相关的WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),实现自己的需求 -[入门文档1](https://www.jianshu.com/p/4c187a09b838)[入门文档2](https://shimo.im/docs/xj5F85W1gqEEBXRJ) +[入门文档1](https://www.jianshu.com/p/4c187a09b838) [入门文档2](https://shimo.im/docs/xj5F85W1gqEEBXRJ) ## 效果 diff --git a/README.md b/README.md index 931eca6e8..733472fae 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd 3. Download and debug the develop branch, and find the source code through the effect 4. See [custom-related WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),Realize your own needs -[Getting Started Document 1](https://www.jianshu.com/p/4c187a09b838)[Getting Started Document 2](https://shimo.im/docs/xj5F85W1gqEEBXRJ) +[Getting Started Document1](https://www.jianshu.com/p/4c187a09b838) [Getting Started Document2](https://shimo.im/docs/xj5F85W1gqEEBXRJ) ## Screenshot From 232d186eb7e82ec5d7655d2b998323b52cd39d7d Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Tue, 25 Sep 2018 15:10:54 +0800 Subject: [PATCH 15/36] make timer private --- .../jzvd/demo/ActivityApiUISmallChange.java | 19 ++++++++++--------- .../src/main/java/cn/jzvd/Jzvd.java | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java index 80a375856..55a289c0c 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java @@ -41,7 +41,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { jzvdStdWithShareButton = findViewById(R.id.custom_videoplayer_standard_with_share_button); jzvdStdWithShareButton.setUp(VideoConstant.videoUrlList[3], "饺子想呼吸", Jzvd.SCREEN_WINDOW_NORMAL - ); + ); Glide.with(this) .load(VideoConstant.videoThumbList[3]) .into(jzvdStdWithShareButton.thumbImageView); @@ -49,28 +49,28 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { jzvdStdShowTitleAfterFullscreen = findViewById(R.id.custom_videoplayer_standard_show_title_after_fullscreen); jzvdStdShowTitleAfterFullscreen.setUp(VideoConstant.videoUrlList[4], "饺子想摇头", Jzvd.SCREEN_WINDOW_NORMAL - ); + ); Glide.with(this) .load(VideoConstant.videoThumbList[4]) .into(jzvdStdShowTitleAfterFullscreen.thumbImageView); jzvdStdShowTextureViewAfterAutoComplete = findViewById(R.id.custom_videoplayer_standard_show_textureview_aoto_complete); jzvdStdShowTextureViewAfterAutoComplete.setUp(VideoConstant.videoUrlList[5], "饺子想旅行", Jzvd.SCREEN_WINDOW_NORMAL - ); + ); Glide.with(this) .load(VideoConstant.videoThumbList[5]) .into(jzvdStdShowTextureViewAfterAutoComplete.thumbImageView); jzvdStdAutoCompleteAfterFullscreen = findViewById(R.id.custom_videoplayer_standard_aoto_complete); jzvdStdAutoCompleteAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], "饺子没来", Jzvd.SCREEN_WINDOW_NORMAL - ); + ); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzvdStdAutoCompleteAfterFullscreen.thumbImageView); jzvdStd_1_1 = findViewById(R.id.jz_videoplayer_1_1); jzvdStd_1_1.setUp(VideoConstant.videoUrls[0][1], "饺子有事吗", Jzvd.SCREEN_WINDOW_NORMAL - ); + ); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzvdStd_1_1.thumbImageView); @@ -79,7 +79,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { jzvdStd_16_9 = findViewById(R.id.jz_videoplayer_16_9); jzvdStd_16_9.setUp(VideoConstant.videoUrls[0][1], "饺子来不了", Jzvd.SCREEN_WINDOW_NORMAL - ); + ); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzvdStd_16_9.thumbImageView); @@ -88,14 +88,15 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { jzvdStdVolumeAfterFullscreen = findViewById(R.id.jz_videoplayer_volume); jzvdStdVolumeAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], "饺子摇摆", Jzvd.SCREEN_WINDOW_NORMAL - ); + ); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzvdStdVolumeAfterFullscreen.thumbImageView); jzvdStdMp3 = findViewById(R.id.jz_videoplayer_mp3); - jzvdStdMp3.setUp("https://in-20170815011809382-q34ludd68h.oss-cn-shanghai.aliyuncs.com/video/401edae1-16431aa8156-0007-1823-c86-de200.mp3?Expires=1532102862&OSSAccessKeyId=LTAIPZHZDaUNpnca&Signature=apruidffjNeN0O584VJiz8q1mJ4%3D", "饺子摇摆", Jzvd.SCREEN_WINDOW_NORMAL - ); + jzvdStdMp3.setUp("https://in-20170815011809382-q34ludd68h.oss-cn-shanghai.aliyuncs.com/video/401edae1-16431aa8156-0007-1823-c86-de200.mp3?Expires=1532102862&OSSAccessKeyId=LTAIPZHZDaUNpnca&Signature=apruidffjNeN0O584VJiz8q1mJ4%3D", + "饺子你听", Jzvd.SCREEN_WINDOW_NORMAL + ); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzvdStdMp3.thumbImageView); diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java index e9ed026d7..8d9438e26 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java @@ -94,7 +94,7 @@ public void onAudioFocusChange(int focusChange) { } }; protected static JZUserAction JZ_USER_EVENT; - protected static Timer UPDATE_PROGRESS_TIMER; + protected Timer UPDATE_PROGRESS_TIMER; public int currentState = -1; public int currentScreen = -1; public long seekToInAdvance = 0; From 2c73c62ab6b4b368258009a585f03f99b07d694c Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Thu, 27 Sep 2018 14:06:37 +0800 Subject: [PATCH 16/36] readme --- README-ZH.md | 3 ++- README.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README-ZH.md b/README-ZH.md index a52dd4003..2dd4af78d 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -33,7 +33,8 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd 3. 下载调试develop分支,有针对性的通过效果找到实现的源码 4. 看[自定义相关的WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),实现自己的需求 -[入门文档1](https://www.jianshu.com/p/4c187a09b838) [入门文档2](https://shimo.im/docs/xj5F85W1gqEEBXRJ) +* [入门文档 1](https://www.jianshu.com/p/4c187a09b838) +* [入门文档 2](https://shimo.im/docs/xj5F85W1gqEEBXRJ) ## 效果 diff --git a/README.md b/README.md index 733472fae..d99b1af5a 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,8 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd 3. Download and debug the develop branch, and find the source code through the effect 4. See [custom-related WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),Realize your own needs -[Getting Started Document1](https://www.jianshu.com/p/4c187a09b838) [Getting Started Document2](https://shimo.im/docs/xj5F85W1gqEEBXRJ) +* [Getting Started Document 1](https://www.jianshu.com/p/4c187a09b838) +* [Getting Started Document 2](https://shimo.im/docs/xj5F85W1gqEEBXRJ) ## Screenshot From f6352d58c530ff8862b022443d4399d7bfccc54c Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Sat, 29 Sep 2018 15:30:23 +0800 Subject: [PATCH 17/36] upgrade libs version and add readthedoc --- app/build.gradle | 4 +- build.gradle | 2 +- docs/Makefile | 19 +++ docs/conf.py | 173 +++++++++++++++++++++++ docs/index.rst | 20 +++ docs/make.bat | 35 +++++ gradle/wrapper/gradle-wrapper.properties | 4 +- jiaozivideoplayer/build.gradle | 2 +- 8 files changed, 253 insertions(+), 6 deletions(-) create mode 100644 docs/Makefile create mode 100644 docs/conf.py create mode 100644 docs/index.rst create mode 100644 docs/make.bat diff --git a/app/build.gradle b/app/build.gradle index f3ee433ce..dbdae6721 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -33,11 +33,11 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') testImplementation 'junit:junit:4.12' - implementation 'com.android.support:appcompat-v7:28.0.0-rc02' + implementation 'com.android.support:appcompat-v7:28.0.0' implementation project(':jiaozivideoplayer') implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.4' implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.4' - implementation 'com.android.support:recyclerview-v7:28.0.0-rc02' + implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.danikula:videocache:2.7.0' implementation 'com.github.bumptech.glide:glide:4.6.1' implementation 'com.google.android.exoplayer:exoplayer:2.7.1' diff --git a/build.gradle b/build.gradle index 55db43fb8..f6f90b25b 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.4' + classpath 'com.android.tools.build:gradle:3.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 000000000..298ea9e21 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,19 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 000000000..c3e447ad2 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,173 @@ +# -*- coding: utf-8 -*- +# +# Configuration file for the Sphinx documentation builder. +# +# This file does only contain a selection of the most common options. For a +# full list see the documentation: +# http://www.sphinx-doc.org/en/master/config + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'JiaoZiVideoPlayer' +copyright = '2018, Nathen' +author = 'Nathen' + +# The short X.Y version +version = '' +# The full version, including alpha/beta/rc tags +release = '' + + +# -- General configuration --------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = 'zh' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = None + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. +# +# html_sidebars = {} + + +# -- Options for HTMLHelp output --------------------------------------------- + +# Output file base name for HTML help builder. +htmlhelp_basename = 'JiaoZiVideoPlayerdoc' + + +# -- Options for LaTeX output ------------------------------------------------ + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'JiaoZiVideoPlayer.tex', 'JiaoZiVideoPlayer Documentation', + 'Nathen', 'manual'), +] + + +# -- Options for manual page output ------------------------------------------ + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'jiaozivideoplayer', 'JiaoZiVideoPlayer Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ---------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'JiaoZiVideoPlayer', 'JiaoZiVideoPlayer Documentation', + author, 'JiaoZiVideoPlayer', 'One line description of project.', + 'Miscellaneous'), +] + + +# -- Options for Epub output ------------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = project + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +# +# epub_identifier = '' + +# A unique identification for the text. +# +# epub_uid = '' + +# A list of files that should not be packed into the epub file. +epub_exclude_files = ['search.html'] \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 000000000..667013bf1 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,20 @@ +.. JiaoZiVideoPlayer documentation master file, created by + sphinx-quickstart on Sat Sep 29 14:41:21 2018. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to JiaoZiVideoPlayer's documentation! +============================================= + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 000000000..27f573b87 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e2cc6cb34..86ac57120 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Mar 29 12:45:37 CST 2018 +#Sat Sep 29 15:04:20 CST 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip diff --git a/jiaozivideoplayer/build.gradle b/jiaozivideoplayer/build.gradle index fbb65d916..d81c45544 100644 --- a/jiaozivideoplayer/build.gradle +++ b/jiaozivideoplayer/build.gradle @@ -23,7 +23,7 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) testImplementation 'junit:junit:4.12' - compileOnly 'com.android.support:appcompat-v7:28.0.0-rc02' + compileOnly 'com.android.support:appcompat-v7:28.0.0' } apply from: '../gradle/maven_push.gradle' From ea6a97880d3be6b5a7a5ed3c501baa39c82a057b Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Sat, 29 Sep 2018 16:10:37 +0800 Subject: [PATCH 18/36] gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 680c1a544..c57554891 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ build /captures *.asc projectFilesBackup -release \ No newline at end of file +release +_build \ No newline at end of file From ad5987b0fffeeab9cd3b8e6534056550477dea92 Mon Sep 17 00:00:00 2001 From: Chintan Rathod Date: Thu, 4 Oct 2018 12:55:07 +0530 Subject: [PATCH 19/36] Implementation Replacement Replaced compile with implementation as it will be deprecated end 2018. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d99b1af5a..baca48560 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Only five steps to use the player: 1.Import library: ```gradle -compile 'cn.jzvd:jiaozivideoplayer:6.3.1' +implementation 'cn.jzvd:jiaozivideoplayer:6.3.1' ``` Or download [lib](https://github.com/lipangit/JiaoZiVideoPlayer/releases/tag/v6.3.1) (not recommended). From 7ba390f3dc9a56d6eb93827afb5b7fa18613a976 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Mon, 15 Oct 2018 21:05:40 +0800 Subject: [PATCH 20/36] upgrade env --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f6f90b25b..ae9fbafb9 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.0' + classpath 'com.android.tools.build:gradle:3.2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files From e885663f7207a271c99a8eea661397c0ae0ee16e Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Mon, 15 Oct 2018 23:11:05 +0800 Subject: [PATCH 21/36] speed ui --- .../jzvd/demo/ActivityApiUISmallChange.java | 32 +-- .../jzvd/demo/CustomView/JzvdStdFresco.java | 2 +- ...JzvdStdShowShareButtonAfterFullscreen.java | 2 +- .../cn/jzvd/demo/CustomView/JzvdStdSpeed.java | 52 ++++ .../cn/jzvd/demo/CustomView/MyJzvdStd.java | 2 +- .../res/layout/activity_ui_small_change.xml | 12 + ...ndard_fresco.xml => layout_std_fresco.xml} | 0 app/src/main/res/layout/layout_std_speed.xml | 252 ++++++++++++++++++ ...n.xml => layout_std_with_share_button.xml} | 0 .../src/main/java/cn/jzvd/JzvdStd.java | 2 +- ..._layout_standard.xml => jz_layout_std.xml} | 0 11 files changed, 336 insertions(+), 20 deletions(-) create mode 100644 app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdSpeed.java rename app/src/main/res/layout/{layout_standard_fresco.xml => layout_std_fresco.xml} (100%) create mode 100644 app/src/main/res/layout/layout_std_speed.xml rename app/src/main/res/layout/{layout_standard_with_share_button.xml => layout_std_with_share_button.xml} (100%) rename jiaozivideoplayer/src/main/res/layout/{jz_layout_standard.xml => jz_layout_std.xml} (100%) diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java index 55a289c0c..98b0f8f50 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java @@ -14,6 +14,7 @@ import cn.jzvd.demo.CustomView.JzvdStdShowShareButtonAfterFullscreen; import cn.jzvd.demo.CustomView.JzvdStdShowTextureViewAfterAutoComplete; import cn.jzvd.demo.CustomView.JzvdStdShowTitleAfterFullscreen; +import cn.jzvd.demo.CustomView.JzvdStdSpeed; import cn.jzvd.demo.CustomView.JzvdStdVolumeAfterFullscreen; /** @@ -26,6 +27,7 @@ public class ActivityApiUISmallChange extends AppCompatActivity { JzvdStdAutoCompleteAfterFullscreen jzvdStdAutoCompleteAfterFullscreen; JzvdStdVolumeAfterFullscreen jzvdStdVolumeAfterFullscreen; JzvdStdMp3 jzvdStdMp3; + JzvdStdSpeed jzvdStdSpeed; JzvdStd jzvdStd_1_1, jzvdStd_16_9; @@ -40,37 +42,32 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { setContentView(R.layout.activity_ui_small_change); jzvdStdWithShareButton = findViewById(R.id.custom_videoplayer_standard_with_share_button); - jzvdStdWithShareButton.setUp(VideoConstant.videoUrlList[3], "饺子想呼吸", Jzvd.SCREEN_WINDOW_NORMAL - ); + jzvdStdWithShareButton.setUp(VideoConstant.videoUrlList[3], "饺子想呼吸", Jzvd.SCREEN_WINDOW_NORMAL); Glide.with(this) .load(VideoConstant.videoThumbList[3]) .into(jzvdStdWithShareButton.thumbImageView); jzvdStdShowTitleAfterFullscreen = findViewById(R.id.custom_videoplayer_standard_show_title_after_fullscreen); - jzvdStdShowTitleAfterFullscreen.setUp(VideoConstant.videoUrlList[4], "饺子想摇头", Jzvd.SCREEN_WINDOW_NORMAL - ); + jzvdStdShowTitleAfterFullscreen.setUp(VideoConstant.videoUrlList[4], "饺子想摇头", Jzvd.SCREEN_WINDOW_NORMAL); Glide.with(this) .load(VideoConstant.videoThumbList[4]) .into(jzvdStdShowTitleAfterFullscreen.thumbImageView); jzvdStdShowTextureViewAfterAutoComplete = findViewById(R.id.custom_videoplayer_standard_show_textureview_aoto_complete); - jzvdStdShowTextureViewAfterAutoComplete.setUp(VideoConstant.videoUrlList[5], "饺子想旅行", Jzvd.SCREEN_WINDOW_NORMAL - ); + jzvdStdShowTextureViewAfterAutoComplete.setUp(VideoConstant.videoUrlList[5], "饺子想旅行", Jzvd.SCREEN_WINDOW_NORMAL); Glide.with(this) .load(VideoConstant.videoThumbList[5]) .into(jzvdStdShowTextureViewAfterAutoComplete.thumbImageView); jzvdStdAutoCompleteAfterFullscreen = findViewById(R.id.custom_videoplayer_standard_aoto_complete); - jzvdStdAutoCompleteAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], "饺子没来", Jzvd.SCREEN_WINDOW_NORMAL - ); + jzvdStdAutoCompleteAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], "饺子没来", Jzvd.SCREEN_WINDOW_NORMAL); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzvdStdAutoCompleteAfterFullscreen.thumbImageView); jzvdStd_1_1 = findViewById(R.id.jz_videoplayer_1_1); - jzvdStd_1_1.setUp(VideoConstant.videoUrls[0][1], "饺子有事吗", Jzvd.SCREEN_WINDOW_NORMAL - ); + jzvdStd_1_1.setUp(VideoConstant.videoUrls[0][1], "饺子有事吗", Jzvd.SCREEN_WINDOW_NORMAL); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzvdStd_1_1.thumbImageView); @@ -78,8 +75,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { jzvdStd_1_1.heightRatio = 1; jzvdStd_16_9 = findViewById(R.id.jz_videoplayer_16_9); - jzvdStd_16_9.setUp(VideoConstant.videoUrls[0][1], "饺子来不了", Jzvd.SCREEN_WINDOW_NORMAL - ); + jzvdStd_16_9.setUp(VideoConstant.videoUrls[0][1], "饺子来不了", Jzvd.SCREEN_WINDOW_NORMAL); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzvdStd_16_9.thumbImageView); @@ -87,20 +83,24 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { jzvdStd_16_9.heightRatio = 9; jzvdStdVolumeAfterFullscreen = findViewById(R.id.jz_videoplayer_volume); - jzvdStdVolumeAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], "饺子摇摆", Jzvd.SCREEN_WINDOW_NORMAL - ); + jzvdStdVolumeAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], "饺子摇摆", Jzvd.SCREEN_WINDOW_NORMAL); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzvdStdVolumeAfterFullscreen.thumbImageView); jzvdStdMp3 = findViewById(R.id.jz_videoplayer_mp3); jzvdStdMp3.setUp("https://in-20170815011809382-q34ludd68h.oss-cn-shanghai.aliyuncs.com/video/401edae1-16431aa8156-0007-1823-c86-de200.mp3?Expires=1532102862&OSSAccessKeyId=LTAIPZHZDaUNpnca&Signature=apruidffjNeN0O584VJiz8q1mJ4%3D", - "饺子你听", Jzvd.SCREEN_WINDOW_NORMAL - ); + "饺子你听", Jzvd.SCREEN_WINDOW_NORMAL); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzvdStdMp3.thumbImageView); + jzvdStdSpeed = findViewById(R.id.jz_videoplayer_speed); + jzvdStdSpeed.setUp(VideoConstant.videoUrls[0][1], + "饺子快点", Jzvd.SCREEN_WINDOW_NORMAL); + Glide.with(this) + .load(VideoConstant.videoThumbs[0][1]) + .into(jzvdStdSpeed.thumbImageView); } diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdFresco.java b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdFresco.java index 74c0266eb..0dd097ed8 100755 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdFresco.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdFresco.java @@ -63,7 +63,7 @@ public void setUp(JZDataSource jzDataSource, int screen) { @Override public int getLayoutId() { - return R.layout.layout_standard_fresco; + return R.layout.layout_std_fresco; } diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdShowShareButtonAfterFullscreen.java b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdShowShareButtonAfterFullscreen.java index 5d9f11648..d39be837f 100755 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdShowShareButtonAfterFullscreen.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdShowShareButtonAfterFullscreen.java @@ -36,7 +36,7 @@ public void init(Context context) { @Override public int getLayoutId() { - return R.layout.layout_standard_with_share_button; + return R.layout.layout_std_with_share_button; } @Override diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdSpeed.java b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdSpeed.java new file mode 100644 index 000000000..d0a6eb1f7 --- /dev/null +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdSpeed.java @@ -0,0 +1,52 @@ +package cn.jzvd.demo.CustomView; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.View; +import android.widget.TextView; + +import cn.jzvd.JZDataSource; +import cn.jzvd.JzvdStd; +import cn.jzvd.demo.R; + +public class JzvdStdSpeed extends JzvdStd { + TextView tvSpeed; + + public JzvdStdSpeed(Context context) { + super(context); + } + + public JzvdStdSpeed(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + public void init(Context context) { + super.init(context); + tvSpeed = findViewById(R.id.tv_speed); + tvSpeed.setOnClickListener(this); + } + + @Override + public void setUp(JZDataSource jzDataSource, int screen) { + super.setUp(jzDataSource, screen); + if (currentScreen == SCREEN_WINDOW_FULLSCREEN) { + tvSpeed.setVisibility(View.VISIBLE); + } else { + tvSpeed.setVisibility(View.GONE); + } + } + + @Override + public void onClick(View v) { + super.onClick(v); + if (v.getId() == R.id.tv_speed) { + + } + } + + @Override + public int getLayoutId() { + return R.layout.layout_std_speed; + } +} diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/MyJzvdStd.java b/app/src/main/java/cn/jzvd/demo/CustomView/MyJzvdStd.java index 64d5e5ad8..393467442 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomView/MyJzvdStd.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/MyJzvdStd.java @@ -42,7 +42,7 @@ public void onClick(View v) { @Override public int getLayoutId() { - return R.layout.jz_layout_standard; + return R.layout.jz_layout_std; } @Override diff --git a/app/src/main/res/layout/activity_ui_small_change.xml b/app/src/main/res/layout/activity_ui_small_change.xml index ee7909082..cda9e4e71 100644 --- a/app/src/main/res/layout/activity_ui_small_change.xml +++ b/app/src/main/res/layout/activity_ui_small_change.xml @@ -108,6 +108,18 @@ android:id="@+id/jz_videoplayer_mp3" android:layout_width="match_parent" android:layout_height="200dp" /> + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_standard_fresco.xml b/app/src/main/res/layout/layout_std_fresco.xml similarity index 100% rename from app/src/main/res/layout/layout_standard_fresco.xml rename to app/src/main/res/layout/layout_std_fresco.xml diff --git a/app/src/main/res/layout/layout_std_speed.xml b/app/src/main/res/layout/layout_std_speed.xml new file mode 100644 index 000000000..986adf32c --- /dev/null +++ b/app/src/main/res/layout/layout_std_speed.xml @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/layout_standard_with_share_button.xml b/app/src/main/res/layout/layout_std_with_share_button.xml similarity index 100% rename from app/src/main/res/layout/layout_standard_with_share_button.xml rename to app/src/main/res/layout/layout_std_with_share_button.xml diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java index ca4f446b3..91457443b 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java @@ -164,7 +164,7 @@ public void changeStartButtonSize(int size) { @Override public int getLayoutId() { - return R.layout.jz_layout_standard; + return R.layout.jz_layout_std; } @Override diff --git a/jiaozivideoplayer/src/main/res/layout/jz_layout_standard.xml b/jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml similarity index 100% rename from jiaozivideoplayer/src/main/res/layout/jz_layout_standard.xml rename to jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml From 6977c0e454b66a9ade133d6f3735efcd61ee195b Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Mon, 29 Oct 2018 22:31:10 +0800 Subject: [PATCH 22/36] remove fresco --- .../main/java/cn/jzvd/demo/ActivityApi.java | 1 - .../jzvd/demo/CustomView/JzvdStdFresco.java | 70 --------- app/src/main/res/layout/layout_std_fresco.xml | 138 ------------------ 3 files changed, 209 deletions(-) delete mode 100755 app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdFresco.java delete mode 100755 app/src/main/res/layout/layout_std_fresco.xml diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApi.java b/app/src/main/java/cn/jzvd/demo/ActivityApi.java index 15d7a9b42..979f77dde 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApi.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApi.java @@ -83,7 +83,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { /** ImageLoader **/ // ImageLoader.getInstance().displayImage(VideoConstant.videoThumbs[0][1], // videoController1.thumbImageView); - /** volley Fresco omit **/ mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); mSensorEventListener = new Jzvd.JZAutoFullscreenListener(); } diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdFresco.java b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdFresco.java deleted file mode 100755 index 0dd097ed8..000000000 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdFresco.java +++ /dev/null @@ -1,70 +0,0 @@ -package cn.jzvd.demo.CustomView; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.View; - -import cn.jzvd.JZDataSource; -import cn.jzvd.JzvdStd; -import cn.jzvd.demo.R; - -//import com.facebook.drawee.view.SimpleDraweeView; - -/** - * Just replace thumb from ImageView to SimpleDraweeView - * Created by Nathen - * On 2016/05/01 22:59 - */ -public class JzvdStdFresco extends JzvdStd { - // public SimpleDraweeView thumbImageView; - - public JzvdStdFresco(Context context) { - super(context); - } - - public JzvdStdFresco(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override - public void init(Context context) { - super.init(context); - bottomProgressBar = findViewById(R.id.bottom_progress); - titleTextView = findViewById(R.id.title); - backButton = findViewById(R.id.back); -// thumbImageView = findViewById(R.id.thumb); - loadingProgressBar = findViewById(R.id.loading); - tinyBackImageView = findViewById(R.id.back_tiny); - -// thumbImageView.setOnClickListener(this); - backButton.setOnClickListener(this); - tinyBackImageView.setOnClickListener(this); - - } - - @Override - public void setUp(JZDataSource jzDataSource, int screen) { - super.setUp(jzDataSource, screen); - titleTextView.setText(jzDataSource.title); - if (currentScreen == SCREEN_WINDOW_FULLSCREEN) { - fullscreenButton.setImageResource(R.drawable.jz_shrink); - backButton.setVisibility(View.VISIBLE); - tinyBackImageView.setVisibility(View.INVISIBLE); - } else if (currentScreen == SCREEN_WINDOW_LIST) { - fullscreenButton.setImageResource(R.drawable.jz_enlarge); - backButton.setVisibility(View.GONE); - tinyBackImageView.setVisibility(View.INVISIBLE); - } else if (currentScreen == SCREEN_WINDOW_TINY) { - tinyBackImageView.setVisibility(View.VISIBLE); - setAllControlsVisiblity(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, - View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); - } - } - - @Override - public int getLayoutId() { - return R.layout.layout_std_fresco; - } - - -} diff --git a/app/src/main/res/layout/layout_std_fresco.xml b/app/src/main/res/layout/layout_std_fresco.xml deleted file mode 100755 index 3190dbf05..000000000 --- a/app/src/main/res/layout/layout_std_fresco.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From e508694a6d63d65182d6562f5e35146f2b99c94a Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Tue, 30 Oct 2018 18:15:43 +0800 Subject: [PATCH 23/36] fix readme --- README-ZH.md | 2 +- README.md | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README-ZH.md b/README-ZH.md index 2dd4af78d..9b5fd00c8 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -65,7 +65,7 @@ compile 'cn.jzvd:jiaozivideoplayer:6.3.1' ```java JzvdStd jzvdStd = (JzvdStd) findViewById(R.id.videoplayer); jzvdStd.setUp("http://jzvd.nathen.cn/c6e3dc12a1154626b3476d9bf3bd7266/6b56c5f0dc31428083757a45764763b0-5287d2089db37e62345123a1be272f8b.mp4" - , Jzvd.SCREEN_WINDOW_NORMAL, "饺子闭眼睛"); + , "饺子闭眼睛", Jzvd.SCREEN_WINDOW_NORMAL); jzvdStd.thumbImageView.setImage("http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640"); ``` diff --git a/README.md b/README.md index baca48560..a2b110924 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,8 @@ Or download [lib](https://github.com/lipangit/JiaoZiVideoPlayer/releases/tag/v6. 3.Set the video uri, video thumb url and video title: ```java JzvdStd jzvdStd = (JzvdStd) findViewById(R.id.videoplayer); -jzvdStd.setUp("http://jzvd.nathen.cn/c6e3dc12a1154626b3476d9bf3bd7266/6b56c5f0dc31428083757a45764763b0-5287d2089db37e62345123a1be272f8b.mp4", - Jzvd.SCREEN_WINDOW_NORMAL, - "饺子闭眼睛"); +jzvdStd.setUp("http://jzvd.nathen.cn/c6e3dc12a1154626b3476d9bf3bd7266/6b56c5f0dc31428083757a45764763b0-5287d2089db37e62345123a1be272f8b.mp4" + , "饺子闭眼睛" , Jzvd.SCREEN_WINDOW_NORMAL); jzvdStd.thumbImageView.setImage("http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640"); ``` From b0575b89e28b4862bbe3c1ab09efa4f33f089c16 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Sun, 4 Nov 2018 00:40:51 +0800 Subject: [PATCH 24/36] upgrade gradle --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 86ac57120..812141942 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip From 12a7abeab827d7fd6670996f0ae89868dfba622f Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Thu, 8 Nov 2018 16:02:10 +0800 Subject: [PATCH 25/36] fix null point exception --- jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java index 8d9438e26..79f310c2f 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java @@ -432,7 +432,7 @@ public void onClick(View v) { int i = v.getId(); if (i == R.id.start) { Log.i(TAG, "onClick start [" + this.hashCode() + "] "); - if (jzDataSource.urlsMap.isEmpty() || jzDataSource.getCurrentUrl() == null) { + if (jzDataSource == null || jzDataSource.urlsMap.isEmpty() || jzDataSource.getCurrentUrl() == null) { Toast.makeText(getContext(), getResources().getString(R.string.no_url), Toast.LENGTH_SHORT).show(); return; } From 231ea231a10c4bcde42c6913f414b70e8854912b Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Tue, 13 Nov 2018 19:29:30 +0800 Subject: [PATCH 26/36] upgrade gradle --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 86ac57120..812141942 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip From 7dff1cf2e8f551441edca8f392ae893c71f437c0 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Wed, 14 Nov 2018 11:26:20 +0800 Subject: [PATCH 27/36] main logic --- .../CustomMediaPlayerAssertFolder.java | 11 +++++ .../demo/CustomMediaPlayer/JZExoPlayer.java | 6 +++ .../CustomMediaPlayer/JZMediaIjkplayer.java | 5 ++ .../cn/jzvd/demo/CustomView/JzvdStdSpeed.java | 46 ++++++++++++++++++- .../main/java/cn/jzvd/JZMediaInterface.java | 2 + .../src/main/java/cn/jzvd/JZMediaManager.java | 4 ++ .../src/main/java/cn/jzvd/JZMediaSystem.java | 11 +++++ 7 files changed, 83 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/CustomMediaPlayerAssertFolder.java b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/CustomMediaPlayerAssertFolder.java index 867128820..320bcac2f 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/CustomMediaPlayerAssertFolder.java +++ b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/CustomMediaPlayerAssertFolder.java @@ -3,6 +3,9 @@ import android.content.res.AssetFileDescriptor; import android.media.AudioManager; import android.media.MediaPlayer; +import android.media.PlaybackParams; +import android.os.Build; +import android.support.annotation.RequiresApi; import android.view.Surface; import cn.jzvd.JZMediaInterface; @@ -93,6 +96,14 @@ public void setVolume(float leftVolume, float rightVolume) { mediaPlayer.setVolume(leftVolume, rightVolume); } + @RequiresApi(api = Build.VERSION_CODES.M) + @Override + public void setSpeed(float speed) { + PlaybackParams pp = mediaPlayer.getPlaybackParams(); + pp.setSpeed(speed); + mediaPlayer.setPlaybackParams(pp); + } + @Override public void onPrepared(MediaPlayer mediaPlayer) { mediaPlayer.start(); diff --git a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java index 3b4dae111..de798d118 100755 --- a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java +++ b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java @@ -194,6 +194,12 @@ public void setVolume(float leftVolume, float rightVolume) { simpleExoPlayer.setVolume(rightVolume); } + @Override + public void setSpeed(float speed) { + PlaybackParameters playbackParameters = new PlaybackParameters(speed, 1.0F); + simpleExoPlayer.setPlaybackParameters(playbackParameters); + } + @Override public void onTimelineChanged(final Timeline timeline, Object manifest, final int reason) { Log.e(TAG, "onTimelineChanged"); diff --git a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZMediaIjkplayer.java b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZMediaIjkplayer.java index c060b8bc5..2cd60467d 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZMediaIjkplayer.java +++ b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZMediaIjkplayer.java @@ -97,6 +97,11 @@ public void setVolume(float leftVolume, float rightVolume) { ijkMediaPlayer.setVolume(leftVolume, rightVolume); } + @Override + public void setSpeed(float speed) { + ijkMediaPlayer.setSpeed(speed); + } + @Override public void onPrepared(IMediaPlayer iMediaPlayer) { ijkMediaPlayer.start(); diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdSpeed.java b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdSpeed.java index d0a6eb1f7..71d4fde32 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdSpeed.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdSpeed.java @@ -6,11 +6,13 @@ import android.widget.TextView; import cn.jzvd.JZDataSource; +import cn.jzvd.JZMediaManager; import cn.jzvd.JzvdStd; import cn.jzvd.demo.R; public class JzvdStdSpeed extends JzvdStd { TextView tvSpeed; + int currentSpeedIndex = 2; public JzvdStdSpeed(Context context) { super(context); @@ -35,13 +37,32 @@ public void setUp(JZDataSource jzDataSource, int screen) { } else { tvSpeed.setVisibility(View.GONE); } + if (jzDataSource.objects == null) { + Object[] object = {2}; + jzDataSource.objects = object; + currentSpeedIndex = 2; + } else { + currentSpeedIndex = (int) jzDataSource.objects[0]; + } + if (currentSpeedIndex == 2) { + tvSpeed.setText("倍速"); + } else { + tvSpeed.setText(getSpeedFromIndex(currentSpeedIndex) + "X"); + } } @Override public void onClick(View v) { super.onClick(v); - if (v.getId() == R.id.tv_speed) { - + if (v.getId() == R.id.tv_speed) {//0.5 0.75 1.0 1.25 1.5 1.75 2.0 + if (currentSpeedIndex == 6) { + currentSpeedIndex = 0; + } else { + currentSpeedIndex += 1; + } + JZMediaManager.setSpeed(getSpeedFromIndex(currentSpeedIndex)); + tvSpeed.setText(getSpeedFromIndex(currentSpeedIndex) + "X"); + jzDataSource.objects[0] = currentSpeedIndex; } } @@ -49,4 +70,25 @@ public void onClick(View v) { public int getLayoutId() { return R.layout.layout_std_speed; } + + private float getSpeedFromIndex(int index) { + float ret = 0f; + if (index == 0) { + ret = 0.5f; + } else if (index == 1) { + ret = 0.75f; + } else if (index == 2) { + ret = 1.0f; + } else if (index == 3) { + ret = 1.25f; + } else if (index == 4) { + ret = 1.5f; + } else if (index == 5) { + ret = 1.75f; + } else if (index == 6) { + ret = 2.0f; + } + return ret; + } + } diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaInterface.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaInterface.java index c9bc3eb64..09f437e6c 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaInterface.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaInterface.java @@ -29,4 +29,6 @@ public abstract class JZMediaInterface { public abstract void setSurface(Surface surface); public abstract void setVolume(float leftVolume, float rightVolume); + + public abstract void setSpeed(float speed); } diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaManager.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaManager.java index f577aa854..57666ba59 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaManager.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaManager.java @@ -91,6 +91,10 @@ public static boolean isPlaying() { return instance().jzMediaInterface.isPlaying(); } + public static void setSpeed(float speed) { + instance().jzMediaInterface.setSpeed(speed); + } + public void releaseMediaPlayer() { mMediaHandler.removeCallbacksAndMessages(null); Message msg = new Message(); diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java index b31a8b78c..9178f2224 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java @@ -2,6 +2,9 @@ import android.media.AudioManager; import android.media.MediaPlayer; +import android.media.PlaybackParams; +import android.os.Build; +import android.support.annotation.RequiresApi; import android.view.Surface; import java.lang.reflect.Method; @@ -100,6 +103,14 @@ public void setVolume(float leftVolume, float rightVolume) { mediaPlayer.setVolume(leftVolume, rightVolume); } + @RequiresApi(api = Build.VERSION_CODES.M) + @Override + public void setSpeed(float speed) { + PlaybackParams pp = mediaPlayer.getPlaybackParams(); + pp.setSpeed(speed); + mediaPlayer.setPlaybackParams(pp); + } + @Override public void onPrepared(MediaPlayer mediaPlayer) { mediaPlayer.start(); From 3c4b43428bd08bc61573a34c6c222e4b82e4f27e Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Wed, 14 Nov 2018 12:21:46 +0800 Subject: [PATCH 28/36] cp new back button from toutiao --- .../res/drawable-xhdpi/jz_back_normal.png | Bin 260 -> 625 bytes .../res/drawable-xhdpi/jz_back_pressed.png | Bin 317 -> 435 bytes .../src/main/res/layout/jz_layout_std.xml | 30 +++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) mode change 100755 => 100644 jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_back_normal.png mode change 100755 => 100644 jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_back_pressed.png diff --git a/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_back_normal.png b/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_back_normal.png old mode 100755 new mode 100644 index b6582c387a859c995e75aa8a013284f915b755ad..8b58353f6de6d695e785e69475e683a561429d84 GIT binary patch literal 625 zcmeAS@N?(olHy`uVBq!ia0vp^P9V&|3?#2~eYgdrDgt~$T!Az)U}R*3b5l}M%FE0D z{Q2|i*RP*He}4V?)y2gH$OeMXpFcM?HbU4xe*Ad<{(W!Up{#7VC&YcKyK>ilIK91)JuZ=f*F|DS-1rGc}1n zRN&~&>8j^Xt?JSenlgV@e`~$i=kITF%pJWiF-9{mFgAL+IEF+V-g@J<-(dqDwg*eL zct%RL7PT?nw)pb*{)8*u1xplU-e0dV&J>^jZ;Nl%^*`Ze*KP*+u6SzxH#19%c~(eH z1`Csyv!cL-W2bm}Co~k^;*U>>&|3Onul)Pxm2y#if!Znu>~#Ln+x9UaX8U*`g)@1AvG@9_5dzn z&Tz+qoeBM7E{jCwO`f37EWV=T&|NQmlfa5lE;ca>7a=*19c#sT)C>YS%pD7+Hl1{0 zdDz?1tx%$MP|V5y^n<-en?xSja@w{hII2WcykT}!jF`a5_0jW?01IEB;*2*zH7*Mk zd`vgScf6m+`E$#W;0M>4_ACD=ZnU5KLvCXEE3fUrA3rmhe%LH*fAHh?jz4D3Jums0 z-|#Xd>wXdUnBM$7s^a+a_c3!F7Tndp*L-@ji;TESo4N4u_Vs@p(gkGwB`RL!O{!VazI@)2oou?wo|9*-nc*iYJCSW#*sM9T w$_!ik%?uqI751L_TzbJI=f`7Ko2UxLnqt0O4ezW6KzkTGUHx3vIVCg!0PqNervLx| diff --git a/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_back_pressed.png b/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_back_pressed.png old mode 100755 new mode 100644 index aef045d79cf7c492efd5c8f4d692ee998d2aa6db..774904c6617330b4dcc7d5afbf7b8579e1b7bbf7 GIT binary patch literal 435 zcmeAS@N?(olHy`uVBq!ia0vp^P9V&|3?#2~eYgdrJOX?|T!AzYFfua!|Nozfi778H zuc@i&*RNkcfByXP<;$Nxf4+YG`tIGku&^+Q;Kz?2fhym=eG63Z{rmTqFJC@*@L=oK zt@RzQO!N`m}?8JO7{IQc{}<9xCMUAa<|Ju4kTL(F6pKc^YZ1KP#p>Eaj?aro@@ zZoVc19@Yza+OGuUfBgAxZ#rRCTH>)S({;Wu`>~ZQo&GO8LPSz~fy;_%?j1p8i&#G0 z*ni~%$M-2g^0_XIA5@kEa!mi=5uB>{hN-*2f-_Nc#?K$3EetHuf#OO!91lgTu6;A% zsua_c)o$coxV1pH<%QU}Rsku_MAO6w&l|T{R&n=mT2EGBQJEn3Xc^P&^dn9MXE_9a zMJ9;yoc|bd(7UHqfhCe-UZ*)TO9j`T*az_}Z@M>GvoEl2v}U?fdVpb>m_hAq>B3~U zb$^2um2*xi1U}B`TApgN`7ql-wn{FhEp<%t Xrs^VIVhgTe~DWM4fR$sKp literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyApt%iu0Z-fwShsr%`~97G9^KN z!3+&G`5w+prCCWPnnHYB>?~=qkv=N6mU^P05>ZbtiU8Hsc)B=-Se%}F*<7qaLBKW8 z-7x*&p8vI0Az?P>5^w$Ho-si+^l4FZo@>#ERAIr%?}}H)E&IJ?mHdO=Uy|Q0R~x^GWWGhuablSsidnY?>}5945@iuRX8g i#}|{tSO4d3{Kb%##4=B`I`uWs9SokXelF{r5}E*`TBWl9 diff --git a/jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml b/jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml index 00de6d8fd..0914c3718 100644 --- a/jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml +++ b/jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml @@ -16,9 +16,9 @@ android:id="@+id/thumb" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_alignParentBottom="true" - android:layout_alignParentLeft="true" android:layout_alignParentStart="true" + android:layout_alignParentLeft="true" + android:layout_alignParentBottom="true" android:background="#000000" android:scaleType="fitCenter" /> @@ -50,10 +50,10 @@ android:max="100" android:maxHeight="1dp" android:minHeight="1dp" - android:paddingBottom="8dp" android:paddingLeft="12dp" - android:paddingRight="12dp" android:paddingTop="8dp" + android:paddingRight="12dp" + android:paddingBottom="8dp" android:progressDrawable="@drawable/jz_bottom_seek_progress" android:thumb="@drawable/jz_bottom_seek_thumb" /> @@ -106,21 +106,23 @@ android:id="@+id/layout_top" android:layout_width="match_parent" android:layout_height="60dp" - android:layout_alignParentLeft="true" android:layout_alignParentStart="true" + android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:background="@drawable/jz_title_bg" android:gravity="center_vertical"> @@ -130,11 +132,9 @@ android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginEnd="12dp" - android:layout_marginLeft="12dp" android:layout_marginRight="12dp" - android:layout_marginStart="12dp" - android:layout_toEndOf="@+id/back" android:layout_toLeftOf="@+id/battery_time_layout" + android:layout_toEndOf="@+id/back" android:layout_toRightOf="@+id/back" android:ellipsize="end" android:maxLines="2" @@ -231,10 +231,10 @@ android:layout_height="wrap_content" android:layout_marginTop="15dp" android:background="@drawable/retry_bg" - android:paddingBottom="4dp" android:paddingLeft="9dp" - android:paddingRight="9dp" android:paddingTop="4dp" + android:paddingRight="9dp" + android:paddingBottom="4dp" android:text="@string/click_to_restart" android:textColor="@android:color/white" android:textSize="14sp" /> From c97e968c53607a976b3bb64e304af467848cd280 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Wed, 14 Nov 2018 12:55:45 +0800 Subject: [PATCH 29/36] fix ui --- jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml b/jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml index 0914c3718..de3b8dd3c 100644 --- a/jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml +++ b/jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml @@ -105,12 +105,13 @@ + android:paddingStart="10dp"> From 461e81b7c272efef21af8824ca826d5560e69da4 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Wed, 14 Nov 2018 13:47:20 +0800 Subject: [PATCH 30/36] change fullscreen button --- .../src/main/res/drawable-xhdpi/jz_enlarge.png | Bin 167 -> 164 bytes .../src/main/res/drawable-xhdpi/jz_shrink.png | Bin 226 -> 224 bytes .../src/main/res/layout/jz_layout_std.xml | 6 +++--- 3 files changed, 3 insertions(+), 3 deletions(-) mode change 100755 => 100644 jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_enlarge.png mode change 100755 => 100644 jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_shrink.png diff --git a/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_enlarge.png b/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_enlarge.png old mode 100755 new mode 100644 index 190fc88bfd8e647e2aadbfc736b8e54a9cd5c312..bf69e8bbac02a9a765b25a2c5de3b60192ad6a1a GIT binary patch delta 53 zcmZ3^xP)oyU*c?>|{>FVdQ I&MBb@01w_1HUIzs delta 56 zcmZ3&xSVl4|>EYV5%dkHwYjPfnbB;^g@-Wo8D3EdS=~tMspZW&i?D LS3j3^P6N-9Q$5NswPK z1Gh-)e}RJ;wL86lLdBjgjv*Dd-rl&#bwEI*;h`-1`~N3`S6iwJFWtK3|8D2M;ZA%E z4ayJ8e6MW$qr7V4hKmszfs0(8cTD|tQRSL~r_`LfE59{Xh1GSXZC$qLV&)>=MT;|z zCzQ_DIPmQGi)zDNbsuwU->(^b delta 210 zcmaFB_=s_WL_G^L0|Uc5SKd!RN+`f5#1%*b!K+uVfaLe@-~a#r?-y?w0OYWi1o;Is zh_rGa{90-9A1F}e>EamTas2JIgPaWpJgpB!#4}2mjxvgv7qq|G-?j8$) zdH%1>)nJq`E`HD{!+uvjQ+v@$kNzuJw{!&O2YX+;>0)_Y%X@15WWI|POIG`Ftz0qX zozAk(Wu99_dSn|Ly(^~LRkcn1e&Datrfnt@#e#3k3pKpYHPUUl=;^9+66g#DPgg&e IbxsLQ0Pm<&aR2}S diff --git a/jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml b/jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml index de3b8dd3c..01e5e26e0 100644 --- a/jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml +++ b/jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml @@ -115,12 +115,12 @@ From aedf07b40b476f5e893591173226a947e2fe448a Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Wed, 14 Nov 2018 13:49:28 +0800 Subject: [PATCH 31/36] fix button pic --- .../main/res/drawable-xhdpi/jz_back_pressed.png | Bin 435 -> 378 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_back_pressed.png b/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_back_pressed.png index 774904c6617330b4dcc7d5afbf7b8579e1b7bbf7..82d2ba65f6fd3e7065250f6ec2268655c0bbe2e1 100644 GIT binary patch delta 351 zcmV-l0igb~1Ns7xB!4zgOjJbx0000000993|NsAJXlVQU`}+F&?(Xh_f`a+^`SkSk z_4W1m`1tYh@&Et->FMd<;NZ2jwUJ-y`2YX_5_D2dQvd@8fDCG6Llj<2QB+BJHXI>7 zMy`MW007}hL_t(o!_C)=3c@f9h2f-iUaC%g|CbfCrHpMz@_)y%^8g=XZ9|Uyj?N;+ zC?#|;9wF7(i78OV;n@tIaLYLl$woAw3wf-BU&y5re&KScghRMCp%Or_5NkrBLL<1K zMxlI!<5x&Qf^IF`CqfDmbR$8-gj0|(*aZ2DaJC4IK!PBl6End+Bak3Xcr?LJj9uu2 z*ojvH1pEsAFIf1AfO`>nJAnb-Ixxu80@HVUBkjy63x*&=_hi6rEy@sN@clV{2j@+I x_YvNTcsJt>k@r;ImU(B#hG0WHK|s$c@CJ9s5OjUxr+xqc002ovPDHLkV1llbrU(E4 delta 409 zcmV;K0cQUC0`uh6$`T6wp^!)t% z_4W1c?(SArR{Hw-`T6EPhtwY9ZF0ckn_000;j8$I0<1DnECh>ga8B^Q5PaC2;meu*7h_Cc@{1mD}f84wQwzj=oZd} z5E=<#HDOpu*nisustb$>JCh&;B#<8BrUIL1#6ob*2od^OU=<9{@l?S}jD;WsSqPqq zHvOfr)4~|!v?_yc?trwegYpgClVA&7U3W(00000NkvXXu0mjf Db;YtN From c77fb9bd8eba5fe66e9bfa77b5c6b7e58b149ec4 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Fri, 16 Nov 2018 00:09:53 +0800 Subject: [PATCH 32/36] upgrade exo and ijkplayer --- app/build.gradle | 8 ++++++-- .../java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java | 2 +- jiaozivideoplayer/build.gradle | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index dbdae6721..fada9c7ed 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -25,6 +25,10 @@ android { signingConfig signingConfigs.releaseConfig } } + compileOptions { + sourceCompatibility 1.8 + targetCompatibility 1.8 + } lintOptions { abortOnError false } @@ -35,10 +39,10 @@ dependencies { testImplementation 'junit:junit:4.12' implementation 'com.android.support:appcompat-v7:28.0.0' implementation project(':jiaozivideoplayer') - implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.4' + implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8' implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.4' implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.danikula:videocache:2.7.0' implementation 'com.github.bumptech.glide:glide:4.6.1' - implementation 'com.google.android.exoplayer:exoplayer:2.7.1' + implementation 'com.google.android.exoplayer:exoplayer:2.9.0' } diff --git a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java index de798d118..a160356f2 100755 --- a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java +++ b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java @@ -77,7 +77,7 @@ public void prepare() { // 2. Create the player RenderersFactory renderersFactory = new DefaultRenderersFactory(context); - simpleExoPlayer = ExoPlayerFactory.newSimpleInstance(renderersFactory, trackSelector, loadControl); + simpleExoPlayer = ExoPlayerFactory.newSimpleInstance(JzvdMgr.getCurrentJzvd().getContext(), renderersFactory, trackSelector, loadControl); // Produces DataSource instances through which media data is loaded. DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context, Util.getUserAgent(context, context.getResources().getString(R.string.app_name))); diff --git a/jiaozivideoplayer/build.gradle b/jiaozivideoplayer/build.gradle index d81c45544..92d115991 100644 --- a/jiaozivideoplayer/build.gradle +++ b/jiaozivideoplayer/build.gradle @@ -15,6 +15,10 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + compileOptions { + sourceCompatibility 1.8 + targetCompatibility 1.8 + } lintOptions { abortOnError false } From 4a9bd303f1702dce2e0b6f17d5871cec523e9d0c Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Fri, 16 Nov 2018 13:46:03 +0800 Subject: [PATCH 33/36] change code --- .../demo/ActivityApiCustomMediaPlayer.java | 35 ++------ .../java/cn/jzvd/demo/ActivityWebView.java | 63 +++++++------- .../CustomMediaPlayerAssertFolder.java | 69 ++++++--------- .../demo/CustomMediaPlayer/JZExoPlayer.java | 83 +++++++------------ .../CustomMediaPlayer/JZMediaIjkplayer.java | 69 ++++++--------- .../src/main/java/cn/jzvd/JZMediaSystem.java | 73 ++++++---------- .../src/main/java/cn/jzvd/Jzvd.java | 13 ++- .../src/main/java/cn/jzvd/JzvdStd.java | 21 ++--- 8 files changed, 155 insertions(+), 271 deletions(-) diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java b/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java index 41bc24294..3ea42593d 100755 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java @@ -69,34 +69,19 @@ public void onClick(View view) { switch (view.getId()) { case R.id.change_to_ijkplayer: Jzvd.releaseAllVideos(); - handler.postDelayed(new Runnable() { - @Override - public void run() { - Jzvd.setMediaInterface(new JZMediaIjkplayer()); - } - }, 1000); + handler.postDelayed(() -> Jzvd.setMediaInterface(new JZMediaIjkplayer()), 1000); Toast.makeText(ActivityApiCustomMediaPlayer.this, "Change to Ijkplayer", Toast.LENGTH_SHORT).show(); finish(); break; case R.id.change_to_system_mediaplayer: Jzvd.releaseAllVideos(); - handler.postDelayed(new Runnable() { - @Override - public void run() { - Jzvd.setMediaInterface(new JZMediaSystem()); - } - }, 1000); + handler.postDelayed(() -> Jzvd.setMediaInterface(new JZMediaSystem()), 1000); Toast.makeText(this, "Change to MediaPlayer", Toast.LENGTH_SHORT).show(); finish(); break; case R.id.change_to_exo: Jzvd.releaseAllVideos(); - handler.postDelayed(new Runnable() { - @Override - public void run() { - Jzvd.setMediaInterface(new JZExoPlayer()); - } - }, 1000); + handler.postDelayed(() -> Jzvd.setMediaInterface(new JZExoPlayer()), 1000); Toast.makeText(this, "Change to ExoPlayer", Toast.LENGTH_SHORT).show(); finish(); break; @@ -109,12 +94,7 @@ public void onBackPressed() { return; } Jzvd.releaseAllVideos(); - handler.postDelayed(new Runnable() { - @Override - public void run() { - Jzvd.setMediaInterface(new JZMediaSystem()); - } - }, 1000); + handler.postDelayed(() -> Jzvd.setMediaInterface(new JZMediaSystem()), 1000); super.onBackPressed(); } @@ -129,12 +109,7 @@ public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Jzvd.releaseAllVideos(); - handler.postDelayed(new Runnable() { - @Override - public void run() { - Jzvd.setMediaInterface(new JZMediaSystem()); - } - }, 1000); + handler.postDelayed(() -> Jzvd.setMediaInterface(new JZMediaSystem()), 1000); finish(); break; } diff --git a/app/src/main/java/cn/jzvd/demo/ActivityWebView.java b/app/src/main/java/cn/jzvd/demo/ActivityWebView.java index 1bd27b8b3..3289447c5 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityWebView.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityWebView.java @@ -66,40 +66,37 @@ public class JZCallBack { @JavascriptInterface public void adViewJiaoZiVideoPlayer(final int width, final int height, final int top, final int left, final int index) { - runOnUiThread(new Runnable() { - @Override - public void run() { - if (index == 0) { - JzvdStd webVieo = new JzvdStd(ActivityWebView.this); - webVieo.setUp(VideoConstant.videoUrlList[1], "饺子骑大马", - Jzvd.SCREEN_WINDOW_LIST); - Glide.with(ActivityWebView.this) - .load(VideoConstant.videoThumbList[1]) - .into(webVieo.thumbImageView); - ViewGroup.LayoutParams ll = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - AbsoluteLayout.LayoutParams layoutParams = new AbsoluteLayout.LayoutParams(ll); - layoutParams.y = JZUtils.dip2px(ActivityWebView.this, top); - layoutParams.x = JZUtils.dip2px(ActivityWebView.this, left); - layoutParams.height = JZUtils.dip2px(ActivityWebView.this, height); - layoutParams.width = JZUtils.dip2px(ActivityWebView.this, width); - mWebView.addView(webVieo, layoutParams); - } else { - JzvdStd webVieo = new JzvdStd(ActivityWebView.this); - webVieo.setUp(VideoConstant.videoUrlList[2], "饺子失态了", - Jzvd.SCREEN_WINDOW_LIST); - Glide.with(ActivityWebView.this) - .load(VideoConstant.videoThumbList[2]) - .into(webVieo.thumbImageView); - ViewGroup.LayoutParams ll = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - AbsoluteLayout.LayoutParams layoutParams = new AbsoluteLayout.LayoutParams(ll); - layoutParams.y = JZUtils.dip2px(ActivityWebView.this, top); - layoutParams.x = JZUtils.dip2px(ActivityWebView.this, left); - layoutParams.height = JZUtils.dip2px(ActivityWebView.this, height); - layoutParams.width = JZUtils.dip2px(ActivityWebView.this, width); - mWebView.addView(webVieo, layoutParams); - } - + runOnUiThread(() -> { + if (index == 0) { + JzvdStd webVieo = new JzvdStd(ActivityWebView.this); + webVieo.setUp(VideoConstant.videoUrlList[1], "饺子骑大马", + Jzvd.SCREEN_WINDOW_LIST); + Glide.with(ActivityWebView.this) + .load(VideoConstant.videoThumbList[1]) + .into(webVieo.thumbImageView); + ViewGroup.LayoutParams ll = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + AbsoluteLayout.LayoutParams layoutParams = new AbsoluteLayout.LayoutParams(ll); + layoutParams.y = JZUtils.dip2px(ActivityWebView.this, top); + layoutParams.x = JZUtils.dip2px(ActivityWebView.this, left); + layoutParams.height = JZUtils.dip2px(ActivityWebView.this, height); + layoutParams.width = JZUtils.dip2px(ActivityWebView.this, width); + mWebView.addView(webVieo, layoutParams); + } else { + JzvdStd webVieo = new JzvdStd(ActivityWebView.this); + webVieo.setUp(VideoConstant.videoUrlList[2], "饺子失态了", + Jzvd.SCREEN_WINDOW_LIST); + Glide.with(ActivityWebView.this) + .load(VideoConstant.videoThumbList[2]) + .into(webVieo.thumbImageView); + ViewGroup.LayoutParams ll = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + AbsoluteLayout.LayoutParams layoutParams = new AbsoluteLayout.LayoutParams(ll); + layoutParams.y = JZUtils.dip2px(ActivityWebView.this, top); + layoutParams.x = JZUtils.dip2px(ActivityWebView.this, left); + layoutParams.height = JZUtils.dip2px(ActivityWebView.this, height); + layoutParams.width = JZUtils.dip2px(ActivityWebView.this, width); + mWebView.addView(webVieo, layoutParams); } + }); } diff --git a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/CustomMediaPlayerAssertFolder.java b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/CustomMediaPlayerAssertFolder.java index 320bcac2f..71e6085f4 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/CustomMediaPlayerAssertFolder.java +++ b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/CustomMediaPlayerAssertFolder.java @@ -108,12 +108,9 @@ public void setSpeed(float speed) { public void onPrepared(MediaPlayer mediaPlayer) { mediaPlayer.start(); if (jzDataSource.getCurrentUrl().toString().toLowerCase().contains("mp3")) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onPrepared(); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onPrepared(); } }); } @@ -121,48 +118,36 @@ public void run() { @Override public void onCompletion(MediaPlayer mediaPlayer) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onAutoCompletion(); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onAutoCompletion(); } }); } @Override public void onBufferingUpdate(MediaPlayer mediaPlayer, final int percent) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().setBufferProgress(percent); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().setBufferProgress(percent); } }); } @Override public void onSeekComplete(MediaPlayer mediaPlayer) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onSeekComplete(); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onSeekComplete(); } }); } @Override public boolean onError(MediaPlayer mediaPlayer, final int what, final int extra) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onError(what, extra); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onError(what, extra); } }); return true; @@ -170,15 +155,12 @@ public void run() { @Override public boolean onInfo(MediaPlayer mediaPlayer, final int what, final int extra) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { - JzvdMgr.getCurrentJzvd().onPrepared(); - } else { - JzvdMgr.getCurrentJzvd().onInfo(what, extra); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { + JzvdMgr.getCurrentJzvd().onPrepared(); + } else { + JzvdMgr.getCurrentJzvd().onInfo(what, extra); } } }); @@ -189,12 +171,9 @@ public void run() { public void onVideoSizeChanged(MediaPlayer mediaPlayer, int width, int height) { JZMediaManager.instance().currentVideoWidth = width; JZMediaManager.instance().currentVideoHeight = height; - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onVideoSizeChanged(); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onVideoSizeChanged(); } }); } diff --git a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java index a160356f2..04835f93a 100755 --- a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java +++ b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java @@ -105,12 +105,9 @@ public void prepare() { public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) { JZMediaManager.instance().currentVideoWidth = width; JZMediaManager.instance().currentVideoHeight = height; - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onVideoSizeChanged(); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onVideoSizeChanged(); } }); } @@ -124,12 +121,9 @@ private class onBufferingUpdate implements Runnable { @Override public void run() { final int percent = simpleExoPlayer.getBufferedPercentage(); - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().setBufferProgress(percent); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().setBufferProgress(percent); } }); if (percent < 100) { @@ -203,15 +197,11 @@ public void setSpeed(float speed) { @Override public void onTimelineChanged(final Timeline timeline, Object manifest, final int reason) { Log.e(TAG, "onTimelineChanged"); -// JZMediaManager.instance().mainThreadHandler.post(new Runnable() { -// -// @Override -// public void run() { +// JZMediaManager.instance().mainThreadHandler.post(() -> { // if (reason == 0) { // // JzvdMgr.getCurrentJzvd().onInfo(reason, timeline.getPeriodCount()); // } -// } // }); } @@ -228,30 +218,27 @@ public void onLoadingChanged(boolean isLoading) { @Override public void onPlayerStateChanged(final boolean playWhenReady, final int playbackState) { Log.e(TAG, "onPlayerStateChanged" + playbackState + "/ready=" + String.valueOf(playWhenReady)); - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - switch (playbackState) { - case Player.STATE_IDLE: { - } - break; - case Player.STATE_BUFFERING: { - mainHandler.post(callback); - } - break; - case Player.STATE_READY: { - if (playWhenReady) { - JzvdMgr.getCurrentJzvd().onPrepared(); - } else { - } - } - break; - case Player.STATE_ENDED: { - JzvdMgr.getCurrentJzvd().onAutoCompletion(); + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + switch (playbackState) { + case Player.STATE_IDLE: { + } + break; + case Player.STATE_BUFFERING: { + mainHandler.post(callback); + } + break; + case Player.STATE_READY: { + if (playWhenReady) { + JzvdMgr.getCurrentJzvd().onPrepared(); + } else { } - break; } + break; + case Player.STATE_ENDED: { + JzvdMgr.getCurrentJzvd().onAutoCompletion(); + } + break; } } }); @@ -270,12 +257,9 @@ public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) { @Override public void onPlayerError(ExoPlaybackException error) { Log.e(TAG, "onPlayerError" + error.toString()); - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onError(1000, 1000); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onError(1000, 1000); } }); } @@ -292,12 +276,9 @@ public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) { @Override public void onSeekProcessed() { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onSeekComplete(); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onSeekComplete(); } }); } diff --git a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZMediaIjkplayer.java b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZMediaIjkplayer.java index 2cd60467d..8f6c99dd3 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZMediaIjkplayer.java +++ b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZMediaIjkplayer.java @@ -106,12 +106,9 @@ public void setSpeed(float speed) { public void onPrepared(IMediaPlayer iMediaPlayer) { ijkMediaPlayer.start(); if (jzDataSource.getCurrentUrl().toString().toLowerCase().contains("mp3")) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onPrepared(); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onPrepared(); } }); } @@ -121,36 +118,27 @@ public void run() { public void onVideoSizeChanged(IMediaPlayer iMediaPlayer, int i, int i1, int i2, int i3) { JZMediaManager.instance().currentVideoWidth = iMediaPlayer.getVideoWidth(); JZMediaManager.instance().currentVideoHeight = iMediaPlayer.getVideoHeight(); - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onVideoSizeChanged(); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onVideoSizeChanged(); } }); } @Override public void onCompletion(IMediaPlayer iMediaPlayer) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onAutoCompletion(); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onAutoCompletion(); } }); } @Override public boolean onError(IMediaPlayer iMediaPlayer, final int what, final int extra) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onError(what, extra); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onError(what, extra); } }); return true; @@ -158,15 +146,12 @@ public void run() { @Override public boolean onInfo(IMediaPlayer iMediaPlayer, final int what, final int extra) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { - JzvdMgr.getCurrentJzvd().onPrepared(); - } else { - JzvdMgr.getCurrentJzvd().onInfo(what, extra); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { + JzvdMgr.getCurrentJzvd().onPrepared(); + } else { + JzvdMgr.getCurrentJzvd().onInfo(what, extra); } } }); @@ -175,24 +160,18 @@ public void run() { @Override public void onBufferingUpdate(IMediaPlayer iMediaPlayer, final int percent) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().setBufferProgress(percent); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().setBufferProgress(percent); } }); } @Override public void onSeekComplete(IMediaPlayer iMediaPlayer) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onSeekComplete(); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onSeekComplete(); } }); } diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java index 9178f2224..b267e2c8c 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java @@ -116,12 +116,9 @@ public void onPrepared(MediaPlayer mediaPlayer) { mediaPlayer.start(); if (jzDataSource.getCurrentUrl().toString().toLowerCase().contains("mp3") || jzDataSource.getCurrentUrl().toString().toLowerCase().contains("wav")) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onPrepared(); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onPrepared(); } }); } @@ -129,48 +126,36 @@ public void run() { @Override public void onCompletion(MediaPlayer mediaPlayer) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onAutoCompletion(); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onAutoCompletion(); } }); } @Override public void onBufferingUpdate(MediaPlayer mediaPlayer, final int percent) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().setBufferProgress(percent); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().setBufferProgress(percent); } }); } @Override public void onSeekComplete(MediaPlayer mediaPlayer) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onSeekComplete(); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onSeekComplete(); } }); } @Override public boolean onError(MediaPlayer mediaPlayer, final int what, final int extra) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onError(what, extra); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onError(what, extra); } }); return true; @@ -178,18 +163,15 @@ public void run() { @Override public boolean onInfo(MediaPlayer mediaPlayer, final int what, final int extra) { - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { - if (JzvdMgr.getCurrentJzvd().currentState == Jzvd.CURRENT_STATE_PREPARING - || JzvdMgr.getCurrentJzvd().currentState == Jzvd.CURRENT_STATE_PREPARING_CHANGING_URL) { - JzvdMgr.getCurrentJzvd().onPrepared(); - } - } else { - JzvdMgr.getCurrentJzvd().onInfo(what, extra); + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { + if (JzvdMgr.getCurrentJzvd().currentState == Jzvd.CURRENT_STATE_PREPARING + || JzvdMgr.getCurrentJzvd().currentState == Jzvd.CURRENT_STATE_PREPARING_CHANGING_URL) { + JzvdMgr.getCurrentJzvd().onPrepared(); } + } else { + JzvdMgr.getCurrentJzvd().onInfo(what, extra); } } }); @@ -200,12 +182,9 @@ public void run() { public void onVideoSizeChanged(MediaPlayer mediaPlayer, int width, int height) { JZMediaManager.instance().currentVideoWidth = width; JZMediaManager.instance().currentVideoHeight = height; - JZMediaManager.instance().mainThreadHandler.post(new Runnable() { - @Override - public void run() { - if (JzvdMgr.getCurrentJzvd() != null) { - JzvdMgr.getCurrentJzvd().onVideoSizeChanged(); - } + JZMediaManager.instance().mainThreadHandler.post(() -> { + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onVideoSizeChanged(); } }); } diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java index 79f310c2f..9893fb177 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java @@ -1177,14 +1177,11 @@ public class ProgressTimerTask extends TimerTask { public void run() { if (currentState == CURRENT_STATE_PLAYING || currentState == CURRENT_STATE_PAUSE) { // Log.v(TAG, "onProgressUpdate " + "[" + this.hashCode() + "] "); - post(new Runnable() { - @Override - public void run() { - long position = getCurrentPositionWhenPlaying(); - long duration = getDuration(); - int progress = (int) (position * 100 / (duration == 0 ? 1 : duration)); - onProgress(progress, position, duration); - } + post(() -> { + long position = getCurrentPositionWhenPlaying(); + long duration = getDuration(); + int progress = (int) (position * 100 / (duration == 0 ? 1 : duration)); + onProgress(progress, position, duration); }); } } diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java index 91457443b..37946468d 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java @@ -816,18 +816,15 @@ public void dissmissControlView() { if (currentState != CURRENT_STATE_NORMAL && currentState != CURRENT_STATE_ERROR && currentState != CURRENT_STATE_AUTO_COMPLETE) { - post(new Runnable() { - @Override - public void run() { - bottomContainer.setVisibility(View.INVISIBLE); - topContainer.setVisibility(View.INVISIBLE); - startButton.setVisibility(View.INVISIBLE); - if (clarityPopWindow != null) { - clarityPopWindow.dismiss(); - } - if (currentScreen != SCREEN_WINDOW_TINY) { - bottomProgressBar.setVisibility(View.VISIBLE); - } + post(() -> { + bottomContainer.setVisibility(View.INVISIBLE); + topContainer.setVisibility(View.INVISIBLE); + startButton.setVisibility(View.INVISIBLE); + if (clarityPopWindow != null) { + clarityPopWindow.dismiss(); + } + if (currentScreen != SCREEN_WINDOW_TINY) { + bottomProgressBar.setVisibility(View.VISIBLE); } }); } From 4e8daabb3e1140c9e4896d6cb74d0fcc8340ba74 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Fri, 16 Nov 2018 22:15:39 +0800 Subject: [PATCH 34/36] fix mem leak --- jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java index 9893fb177..9287ac4f3 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java @@ -810,7 +810,7 @@ public void release() { public void initTextureView() { removeTextureView(); - JZMediaManager.textureView = new JZTextureView(getContext()); + JZMediaManager.textureView = new JZTextureView(getContext().getApplicationContext()); JZMediaManager.textureView.setSurfaceTextureListener(JZMediaManager.instance()); } From f423b1a67235f846e94493c814a66ca1c70ebd69 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Fri, 16 Nov 2018 23:52:25 +0800 Subject: [PATCH 35/36] fix mem leak thank you @luckybilly --- jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java index 9287ac4f3..2447352ff 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java @@ -596,7 +596,7 @@ public void startVideo() { Log.d(TAG, "startVideo [" + this.hashCode() + "] "); initTextureView(); addTextureView(); - AudioManager mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE); + AudioManager mAudioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE); mAudioManager.requestAudioFocus(onAudioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); JZUtils.scanForActivity(getContext()).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); @@ -780,7 +780,7 @@ public void onCompletion() { JZMediaManager.instance().currentVideoWidth = 0; JZMediaManager.instance().currentVideoHeight = 0; - AudioManager mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE); + AudioManager mAudioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE); mAudioManager.abandonAudioFocus(onAudioFocusChangeListener); JZUtils.scanForActivity(getContext()).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); clearFullscreenLayout(); @@ -1187,4 +1187,14 @@ public void run() { } } + public Context getApplicationContext() { + Context context = getContext(); + if (context != null) { + Context applicationContext = context.getApplicationContext(); + if (applicationContext != null) { + return applicationContext; + } + } + return context; + } } From 8ed80fe865716bb2e8b5d7763a079bbd63227671 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Sat, 17 Nov 2018 18:54:24 +0800 Subject: [PATCH 36/36] v6.4.0 --- README-ZH.md | 8 ++++---- README.md | 8 ++++---- app/build.gradle | 4 ++-- gradle/maven_push.gradle | 2 +- jiaozivideoplayer/build.gradle | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README-ZH.md b/README-ZH.md index 9b5fd00c8..0b3f632c9 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -2,7 +2,7 @@ --

- +

@@ -29,7 +29,7 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd ## 使用步骤 1. 通读ReadMe -2. 下载安装demo apk [jiaozivideoplayer-6.3.1.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.3.1/jiaozivideoplayer-6.3.1.apk),各个页面都进入一次,各个按钮点一次 +2. 下载安装demo apk [jiaozivideoplayer-6.4.0.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.4.0/jiaozivideoplayer-6.4.0.apk),各个页面都进入一次,各个按钮点一次 3. 下载调试develop分支,有针对性的通过效果找到实现的源码 4. 看[自定义相关的WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),实现自己的需求 @@ -48,10 +48,10 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd 1.添加类库 ```gradle -compile 'cn.jzvd:jiaozivideoplayer:6.3.1' +compile 'cn.jzvd:jiaozivideoplayer:6.4.0' ``` -或直接下载 [jar包](https://github.com/lipangit/JiaoZiVideoPlayer/releases/tag/v6.3.1) (不建议) +或直接下载 [jar包](https://github.com/lipangit/JiaoZiVideoPlayer/releases/tag/v6.4.0) (不建议) 2.添加布局 ```xml diff --git a/README.md b/README.md index a2b110924..d52c2bed7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ --

- +

@@ -34,7 +34,7 @@ Q群: 490442439 2群: 761899104 验证信息:jzvd ## Steps for usage 1. Read through ReadMe -2. Download and install the demo apk[jiaozivideoplayer-6.3.1.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.3.1/jiaozivideoplayer-6.3.1.apk), each page enters once, each button clicks once +2. Download and install the demo apk[jiaozivideoplayer-6.4.0.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.4.0/jiaozivideoplayer-6.4.0.apk), each page enters once, each button clicks once 3. Download and debug the develop branch, and find the source code through the effect 4. See [custom-related WIKI](https://github.com/lipangit/JiaoZiVideoPlayer/wiki),Realize your own needs @@ -53,10 +53,10 @@ Only five steps to use the player: 1.Import library: ```gradle -implementation 'cn.jzvd:jiaozivideoplayer:6.3.1' +implementation 'cn.jzvd:jiaozivideoplayer:6.4.0' ``` -Or download [lib](https://github.com/lipangit/JiaoZiVideoPlayer/releases/tag/v6.3.1) (not recommended). +Or download [lib](https://github.com/lipangit/JiaoZiVideoPlayer/releases/tag/v6.4.0) (not recommended). 2.Add `JZVideoPlayer` in your layout: ```xml diff --git a/app/build.gradle b/app/build.gradle index fada9c7ed..e81a5f4b7 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "cn.jzvd.demo" minSdkVersion 16 targetSdkVersion 28 - versionCode 84 - versionName "6.3.1" + versionCode 85 + versionName "6.4.0" } signingConfigs { releaseConfig { diff --git a/gradle/maven_push.gradle b/gradle/maven_push.gradle index 12317bc31..4c8a5e4cf 100644 --- a/gradle/maven_push.gradle +++ b/gradle/maven_push.gradle @@ -22,7 +22,7 @@ signing { group = "cn.jzvd" archivesBaseName = "jiaozivideoplayer" -version = "6.3.1" +version = "6.4.0" uploadArchives { repositories { diff --git a/jiaozivideoplayer/build.gradle b/jiaozivideoplayer/build.gradle index 92d115991..3f2c21382 100644 --- a/jiaozivideoplayer/build.gradle +++ b/jiaozivideoplayer/build.gradle @@ -6,8 +6,8 @@ android { defaultConfig { minSdkVersion 16 targetSdkVersion 28 - versionCode 84 - versionName "6.3.1" + versionCode 85 + versionName "6.4.0" } buildTypes { release {