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
diff --git a/README-ZH.md b/README-ZH.md
index 7bdbe8ddd..0b3f632c9 100644
--- a/README-ZH.md
+++ b/README-ZH.md
@@ -2,11 +2,15 @@
--
-
+
+高度自定义的安卓视频播放器
+
+Q群: 490442439 2群: 761899104 验证信息:jzvd
+
## 主要特点
1. 可以完全自定义UI和任何功能
@@ -22,9 +26,17 @@
11. WebView嵌套本地视频控件
12. demo中添加视频缓存的例子
-## 效果
+## 使用步骤
-**[jiaozivideoplayer-6.3.1.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.3.1/jiaozivideoplayer-6.3.1.apk)**
+1. 通读ReadMe
+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),实现自己的需求
+
+* [入门文档 1](https://www.jianshu.com/p/4c187a09b838)
+* [入门文档 2](https://shimo.im/docs/xj5F85W1gqEEBXRJ)
+
+## 效果
![Demo Screenshot][1]
@@ -36,10 +48,10 @@
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
@@ -53,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 858181df3..d52c2bed7 100644
--- a/README.md
+++ b/README.md
@@ -2,19 +2,18 @@
--
-
+
-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)
+[中文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)
[Weibo](http://weibo.com/2342820395/profile?topnav=1&wvr=6&is_all=1)
## Features
@@ -32,22 +31,32 @@ Q群: 490442439 2群: 761899104 authentication information: 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.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
+
+* [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:
1.Import library:
```gradle
-compile '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
@@ -60,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");
```
diff --git a/app/build.gradle b/app/build.gradle
index f3ee433ce..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 {
@@ -25,6 +25,10 @@ android {
signingConfig signingConfigs.releaseConfig
}
}
+ compileOptions {
+ sourceCompatibility 1.8
+ targetCompatibility 1.8
+ }
lintOptions {
abortOnError false
}
@@ -33,12 +37,12 @@ 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-java:0.8.8'
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'
+ implementation 'com.google.android.exoplayer:exoplayer:2.9.0'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ade2f44c7..378af04d2 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -4,12 +4,12 @@
-
+
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/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/ActivityApiUISmallChange.java b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java
index 80a375856..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,19 +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
- );
+ 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);
+ 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/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 867128820..71e6085f4 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,16 +96,21 @@ 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();
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();
}
});
}
@@ -110,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;
@@ -159,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);
}
}
});
@@ -178,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 3b4dae111..04835f93a 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)));
@@ -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) {
@@ -194,18 +188,20 @@ 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");
-// JZMediaManager.instance().mainThreadHandler.post(new Runnable() {
-//
-// @Override
-// public void run() {
+// JZMediaManager.instance().mainThreadHandler.post(() -> {
// if (reason == 0) {
//
// JzvdMgr.getCurrentJzvd().onInfo(reason, timeline.getPeriodCount());
// }
-// }
// });
}
@@ -222,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;
}
}
});
@@ -264,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);
}
});
}
@@ -286,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 c060b8bc5..8f6c99dd3 100644
--- a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZMediaIjkplayer.java
+++ b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZMediaIjkplayer.java
@@ -97,16 +97,18 @@ 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();
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();
}
});
}
@@ -116,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;
@@ -153,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);
}
}
});
@@ -170,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/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 74c0266eb..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_standard_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..71d4fde32
--- /dev/null
+++ b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdSpeed.java
@@ -0,0 +1,94 @@
+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.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);
+ }
+
+ 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);
+ }
+ 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) {//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;
+ }
+ }
+
+ @Override
+ 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/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_standard_fresco.xml
deleted file mode 100755
index 3190dbf05..000000000
--- a/app/src/main/res/layout/layout_standard_fresco.xml
+++ /dev/null
@@ -1,138 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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/build.gradle b/build.gradle
index 55db43fb8..ae9fbafb9 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.1'
// 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/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/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index e2cc6cb34..812141942 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.10.2-all.zip
diff --git a/jiaozivideoplayer/build.gradle b/jiaozivideoplayer/build.gradle
index fbb65d916..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 {
@@ -15,6 +15,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
+ compileOptions {
+ sourceCompatibility 1.8
+ targetCompatibility 1.8
+ }
lintOptions {
abortOnError false
}
@@ -23,7 +27,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'
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..b267e2c8c 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,17 +103,22 @@ 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();
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();
}
});
}
@@ -118,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;
@@ -167,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);
}
}
});
@@ -189,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 ec47ae57a..2447352ff 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;
@@ -93,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;
@@ -431,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;
}
@@ -595,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);
@@ -779,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();
@@ -809,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());
}
@@ -892,10 +893,18 @@ 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 (progress != 0) progressBar.setProgress(progress);
+ if (seekToManulPosition != -1) {
+ if (seekToManulPosition > progress) {
+ return;
+ } else {
+ seekToManulPosition = -1;
+ }
+ } else {
+ if (progress != 0) progressBar.setProgress(progress);
+ }
}
if (position != 0) currentTimeTextView.setText(JZUtils.stringForTime(position));
totalTimeTextView.setText(JZUtils.stringForTime(duration));
@@ -964,10 +973,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) {
@@ -1165,17 +1177,24 @@ 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));
- setProgressAndText(progress, position, duration);
- }
+ post(() -> {
+ long position = getCurrentPositionWhenPlaying();
+ long duration = getDuration();
+ int progress = (int) (position * 100 / (duration == 0 ? 1 : duration));
+ onProgress(progress, position, duration);
});
}
}
}
+ public Context getApplicationContext() {
+ Context context = getContext();
+ if (context != null) {
+ Context applicationContext = context.getApplicationContext();
+ if (applicationContext != null) {
+ return applicationContext;
+ }
+ }
+ return context;
+ }
}
diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java
index e653d4cc7..37946468d 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
@@ -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() {
@@ -477,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);
}
@@ -820,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);
}
});
}
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 b6582c387..8b58353f6
Binary files a/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_back_normal.png and b/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_back_normal.png differ
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 aef045d79..82d2ba65f
Binary files a/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_back_pressed.png and b/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_back_pressed.png differ
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 190fc88bf..bf69e8bba
Binary files a/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_enlarge.png and b/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_enlarge.png differ
diff --git a/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_shrink.png b/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_shrink.png
old mode 100755
new mode 100644
index cfa8ced78..70bb00c8a
Binary files a/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_shrink.png and b/jiaozivideoplayer/src/main/res/drawable-xhdpi/jz_shrink.png differ
diff --git a/jiaozivideoplayer/src/main/res/layout/jz_layout_standard.xml b/jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml
similarity index 96%
rename from jiaozivideoplayer/src/main/res/layout/jz_layout_standard.xml
rename to jiaozivideoplayer/src/main/res/layout/jz_layout_std.xml
index 00de6d8fd..01e5e26e0 100644
--- a/jiaozivideoplayer/src/main/res/layout/jz_layout_standard.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" />
@@ -105,22 +105,23 @@
+ android:paddingStart="10dp">
@@ -130,11 +131,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 +230,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" />
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 @@
+
+
+
+