gTe~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-rlbwEI*;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 {