From cf6094026ad9563a51561f1fc445225e635344de Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Fri, 20 Jul 2018 23:34:08 +0800 Subject: [PATCH 01/14] play mp3 ui --- .../jzvd/demo/ActivityApiUISmallChange.java | 10 + .../CustomView/JZVideoPlayerStandardMp3.java | 87 +++++++ .../CustomView/MyJZVideoPlayerStandard.java | 45 +++- .../res/layout/activity_ui_small_change.xml | 12 + .../res/layout/jz_layout_standard_mp3.xml | 244 ++++++++++++++++++ 5 files changed, 397 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardMp3.java create mode 100644 app/src/main/res/layout/jz_layout_standard_mp3.xml diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java index 5a59c17fa..085f22302 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java @@ -10,6 +10,7 @@ import cn.jzvd.JZVideoPlayer; import cn.jzvd.JZVideoPlayerStandard; import cn.jzvd.demo.CustomView.JZVideoPlayerStandardAutoCompleteAfterFullscreen; +import cn.jzvd.demo.CustomView.JZVideoPlayerStandardMp3; import cn.jzvd.demo.CustomView.JZVideoPlayerStandardShowShareButtonAfterFullscreen; import cn.jzvd.demo.CustomView.JZVideoPlayerStandardShowTextureViewAfterAutoComplete; import cn.jzvd.demo.CustomView.JZVideoPlayerStandardShowTitleAfterFullscreen; @@ -24,6 +25,7 @@ public class ActivityApiUISmallChange extends AppCompatActivity { JZVideoPlayerStandardShowTextureViewAfterAutoComplete jzVideoPlayerStandardShowTextureViewAfterAutoComplete; JZVideoPlayerStandardAutoCompleteAfterFullscreen jzVideoPlayerStandardAutoCompleteAfterFullscreen; JZVideoPlayerStandardVolumeAfterFullscreen jzVideoPlayerStandardVolumeAfterFullscreen; + JZVideoPlayerStandardMp3 jzVideoPlayerStandardMp3; JZVideoPlayerStandard jzVideoPlayerStandard_1_1, jzVideoPlayerStandard_16_9; @@ -91,6 +93,14 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { .load(VideoConstant.videoThumbs[0][1]) .into(jzVideoPlayerStandardVolumeAfterFullscreen.thumbImageView); + jzVideoPlayerStandardMp3 = findViewById(R.id.jz_videoplayer_mp3); + jzVideoPlayerStandardMp3.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", JZVideoPlayer.SCREEN_WINDOW_NORMAL + , "饺子摇摆"); + Glide.with(this) + .load(VideoConstant.videoThumbs[0][1]) + .into(jzVideoPlayerStandardMp3.thumbImageView); + + } @Override diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardMp3.java b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardMp3.java new file mode 100644 index 000000000..373dc3a38 --- /dev/null +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardMp3.java @@ -0,0 +1,87 @@ +package cn.jzvd.demo.CustomView; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.View; + +import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.demo.R; + +public class JZVideoPlayerStandardMp3 extends JZVideoPlayerStandard { + + public JZVideoPlayerStandardMp3(Context context) { + super(context); + } + + public JZVideoPlayerStandardMp3(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + public int getLayoutId() { + return R.layout.jz_layout_standard_mp3; + } + + @Override + public void onClick(View v) { + if (v.getId() == cn.jzvd.R.id.thumb && + (currentState == CURRENT_STATE_PLAYING || + currentState == CURRENT_STATE_PAUSE)) { + onClickUiToggle(); + } else if (v.getId() == R.id.fullscreen) { + + } else { + super.onClick(v); + } + } + + //changeUiTo 真能能修改ui的方法 + @Override + public void changeUiToNormal() { + super.changeUiToNormal(); + } + + @Override + public void changeUiToPreparing() { + super.changeUiToPreparing(); + } + + @Override + public void changeUiToPlayingShow() { + super.changeUiToPlayingShow(); + thumbImageView.setVisibility(View.VISIBLE); + + } + + @Override + public void changeUiToPlayingClear() { + super.changeUiToPlayingClear(); + thumbImageView.setVisibility(View.VISIBLE); + + } + + @Override + public void changeUiToPauseShow() { + super.changeUiToPauseShow(); + thumbImageView.setVisibility(View.VISIBLE); + + } + + @Override + public void changeUiToPauseClear() { + super.changeUiToPauseClear(); + thumbImageView.setVisibility(View.VISIBLE); + + } + + @Override + public void changeUiToComplete() { + super.changeUiToComplete(); + } + + @Override + public void changeUiToError() { + super.changeUiToError(); + } +} diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/MyJZVideoPlayerStandard.java b/app/src/main/java/cn/jzvd/demo/CustomView/MyJZVideoPlayerStandard.java index 0b2179e3b..8a4dd1bb2 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomView/MyJZVideoPlayerStandard.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/MyJZVideoPlayerStandard.java @@ -6,6 +6,7 @@ import android.view.View; import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.demo.R; /** * 这里可以监听到视频播放的生命周期和播放状态 @@ -41,7 +42,7 @@ public void onClick(View v) { @Override public int getLayoutId() { - return cn.jzvd.R.layout.jz_layout_standard; + return R.layout.jz_layout_standard; } @Override @@ -54,6 +55,7 @@ public void startVideo() { super.startVideo(); } + //onState 代表了播放器引擎的回调,播放视频各个过程的状态的回调 @Override public void onStateNormal() { super.onStateNormal(); @@ -84,6 +86,47 @@ public void onStateAutoComplete() { super.onStateAutoComplete(); } + //changeUiTo 真能能修改ui的方法 + @Override + public void changeUiToNormal() { + super.changeUiToNormal(); + } + + @Override + public void changeUiToPreparing() { + super.changeUiToPreparing(); + } + + @Override + public void changeUiToPlayingShow() { + super.changeUiToPlayingShow(); + } + + @Override + public void changeUiToPlayingClear() { + super.changeUiToPlayingClear(); + } + + @Override + public void changeUiToPauseShow() { + super.changeUiToPauseShow(); + } + + @Override + public void changeUiToPauseClear() { + super.changeUiToPauseClear(); + } + + @Override + public void changeUiToComplete() { + super.changeUiToComplete(); + } + + @Override + public void changeUiToError() { + super.changeUiToError(); + } + @Override public void onInfo(int what, int extra) { super.onInfo(what, extra); 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 0fd2b5622..8f43f9b43 100644 --- a/app/src/main/res/layout/activity_ui_small_change.xml +++ b/app/src/main/res/layout/activity_ui_small_change.xml @@ -96,6 +96,18 @@ android:id="@+id/jz_videoplayer_volume" android:layout_width="match_parent" android:layout_height="200dp" /> + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/jz_layout_standard_mp3.xml b/app/src/main/res/layout/jz_layout_standard_mp3.xml new file mode 100644 index 000000000..0d64af91c --- /dev/null +++ b/app/src/main/res/layout/jz_layout_standard_mp3.xml @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 72e20d73e6ce974e79e9e6f34be29f2900c70a7e Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Wed, 1 Aug 2018 22:33:46 +0800 Subject: [PATCH 02/14] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..c2772887c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,17 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +**什么jzvd版本 + +**是否和安卓版本有关系,什么版本 + +**是否和特定品牌的手机机型有关系,什么机型 + +**相关log是什么 + +**复现流程 + +**最好有截图或者视频说明情况 From a12e2ccbe36aba06ffff2382a667f81ff23c3588 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Wed, 1 Aug 2018 22:36:49 +0800 Subject: [PATCH 03/14] Update issue templates --- .github/ISSUE_TEMPLATE/-------.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/-------.md diff --git a/.github/ISSUE_TEMPLATE/-------.md b/.github/ISSUE_TEMPLATE/-------.md new file mode 100644 index 000000000..d9a342de7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/-------.md @@ -0,0 +1,11 @@ +--- +name: 此需求如何实现 +about: 需求描述 + +--- + +**需求描述 + +**其他app是否实现 + +**截图或者小视频说明 From 3a84ff1e52d8a4464ffee4578dd5c6a5dd8b8280 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Wed, 1 Aug 2018 22:37:46 +0800 Subject: [PATCH 04/14] Update issue templates --- .github/ISSUE_TEMPLATE/----.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/----.md diff --git a/.github/ISSUE_TEMPLATE/----.md b/.github/ISSUE_TEMPLATE/----.md new file mode 100644 index 000000000..c07162b13 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/----.md @@ -0,0 +1,11 @@ +--- +name: 我的需求 +about: 需求描述 + +--- + +**需求描述 + +**其他app是否实现 + +**截图或者小视频说明 From 93ebdb7aca99e1b584c8d642340234aa098bf2bc Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Wed, 8 Aug 2018 00:17:45 +0800 Subject: [PATCH 05/14] upgrade gradle --- app/src/main/java/cn/jzvd/demo/ActivityApi.java | 2 +- build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApi.java b/app/src/main/java/cn/jzvd/demo/ActivityApi.java index 4d3edcdb1..79e42d4e6 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApi.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApi.java @@ -68,7 +68,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { map.put("普清", VideoConstant.videoUrlList[0]); Object[] objects = new Object[3]; objects[0] = map; - objects[1] = false;//looping + objects[1] = true;//looping objects[2] = new HashMap<>(); ((HashMap) objects[2]).put("key", "value");//header mJzVideoPlayerStandard.setUp(objects, 2 diff --git a/build.gradle b/build.gradle index ad6a92810..55db43fb8 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.android.tools.build:gradle:3.1.4' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files From 1092b80f1071bf0e32fe31a928a6f8abd76ccd5a Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Thu, 23 Aug 2018 11:09:28 +0800 Subject: [PATCH 06/14] change url function --- jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java | 4 ++-- .../src/main/java/cn/jzvd/JZVideoPlayerStandard.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java index ad218a9e0..ba22a9802 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java @@ -630,7 +630,7 @@ public void setState(int state, int urlMapIndex, int seekToInAdvance) { onStatePreparing(); break; case CURRENT_STATE_PREPARING_CHANGING_URL: - onStatePreparingChangingUrl(urlMapIndex, seekToInAdvance); + changeUrl(urlMapIndex, seekToInAdvance); break; case CURRENT_STATE_PLAYING: onStatePlaying(); @@ -659,7 +659,7 @@ public void onStatePreparing() { resetProgressAndTime(); } - public void onStatePreparingChangingUrl(int urlMapIndex, long seekToInAdvance) { + public void changeUrl(int urlMapIndex, long seekToInAdvance) { currentState = CURRENT_STATE_PREPARING_CHANGING_URL; this.currentUrlMapIndex = urlMapIndex; this.seekToInAdvance = seekToInAdvance; diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java index a2b14ec87..c95da0356 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java @@ -181,8 +181,8 @@ public void onStatePreparing() { } @Override - public void onStatePreparingChangingUrl(int urlMapIndex, long seekToInAdvance) { - super.onStatePreparingChangingUrl(urlMapIndex, seekToInAdvance); + public void changeUrl(int urlMapIndex, long seekToInAdvance) { + super.changeUrl(urlMapIndex, seekToInAdvance); loadingProgressBar.setVisibility(VISIBLE); startButton.setVisibility(INVISIBLE); } @@ -288,7 +288,7 @@ public void onClick(View v) { OnClickListener mQualityListener = new OnClickListener() { public void onClick(View v) { int index = (int) v.getTag(); - onStatePreparingChangingUrl(index, getCurrentPositionWhenPlaying()); + changeUrl(index, getCurrentPositionWhenPlaying()); clarity.setText(JZUtils.getKeyFromDataSource(dataSourceObjects, currentUrlMapIndex)); for (int j = 0; j < layout.getChildCount(); j++) {//设置点击之后的颜色 if (j == currentUrlMapIndex) { From 5a996de6eecd0320391cdc6b47d012960646eb31 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Thu, 23 Aug 2018 18:04:06 +0800 Subject: [PATCH 07/14] jzdatasource --- .../src/main/java/cn/jzvd/JZDataSource.java | 21 +++++++++++++++++++ .../main/java/cn/jzvd/JZMediaInterface.java | 9 +------- 2 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java new file mode 100644 index 000000000..ec1af2037 --- /dev/null +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java @@ -0,0 +1,21 @@ +package cn.jzvd; + +import java.util.HashMap; +import java.util.LinkedHashMap; + +public class JZDataSource { + public Object currentDataSource;//正在播放的当前url或uri + + public LinkedHashMap urlsMap; + public HashMap headerMap; + public boolean looping = false; + public Object[] objects; + + /** + * 第一个是url的map + * 第二个是loop + * 第三个是header + * 第四个是context + */ + public Object[] dataSourceObjects;//包含了地址的map(多分辨率用),context,loop,header等 +} diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaInterface.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaInterface.java index 7a64abefe..c9bc3eb64 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaInterface.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaInterface.java @@ -8,14 +8,7 @@ */ public abstract class JZMediaInterface { - public Object currentDataSource;//正在播放的当前url或uri - /** - * 第一个是url的map - * 第二个是loop - * 第三个是header - * 第四个是context - */ - public Object[] dataSourceObjects;//包含了地址的map(多分辨率用),context,loop,header等 + public JZDataSource jzDataSource; public abstract void start(); From adfda5b4726185991dd01f11ff1447a18641a9a2 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Fri, 24 Aug 2018 18:33:44 +0800 Subject: [PATCH 08/14] jz data source --- .../main/java/cn/jzvd/demo/ActivityApi.java | 12 +-- .../demo/ActivityApiCustomMediaPlayer.java | 6 +- .../demo/ActivityListViewRecyclerView.java | 2 +- .../CustomMediaPlayerAssertFolder.java | 4 +- .../demo/CustomMediaPlayer/JZExoPlayer.java | 6 +- .../CustomMediaPlayer/JZMediaIjkplayer.java | 4 +- ...erStandardAutoCompleteAfterFullscreen.java | 3 +- .../src/main/java/cn/jzvd/JZDataSource.java | 71 ++++++++++++++--- .../src/main/java/cn/jzvd/JZMediaManager.java | 25 +++--- .../src/main/java/cn/jzvd/JZMediaSystem.java | 18 ++--- .../src/main/java/cn/jzvd/JZUtils.java | 68 +++++++--------- .../src/main/java/cn/jzvd/JZVideoPlayer.java | 79 ++++++++----------- .../java/cn/jzvd/JZVideoPlayerStandard.java | 37 +++++---- 13 files changed, 179 insertions(+), 156 deletions(-) diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApi.java b/app/src/main/java/cn/jzvd/demo/ActivityApi.java index 79e42d4e6..6624c6797 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApi.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApi.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.LinkedHashMap; +import cn.jzvd.JZDataSource; import cn.jzvd.JZVideoPlayer; import cn.jzvd.JZVideoPlayerStandard; @@ -66,12 +67,11 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { map.put("高清", proxyUrl); map.put("标清", VideoConstant.videoUrls[0][6]); map.put("普清", VideoConstant.videoUrlList[0]); - Object[] objects = new Object[3]; - objects[0] = map; - objects[1] = true;//looping - objects[2] = new HashMap<>(); - ((HashMap) objects[2]).put("key", "value");//header - mJzVideoPlayerStandard.setUp(objects, 2 + JZDataSource jzDataSource = new JZDataSource(map); + jzDataSource.looping = true; + jzDataSource.currentUrlIndex = 2; + jzDataSource.headerMap.put("key", "value");//header + mJzVideoPlayerStandard.setUp(jzDataSource, 2 , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子不信"); Glide.with(this).load(VideoConstant.videoThumbList[0]).into(mJzVideoPlayerStandard.thumbImageView); mJzVideoPlayerStandard.seekToInAdvance = 20000; diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java b/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java index 7fd2c073e..b9c7384e0 100755 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java @@ -14,6 +14,7 @@ import java.io.IOException; import java.util.LinkedHashMap; +import cn.jzvd.JZDataSource; import cn.jzvd.JZMediaSystem; import cn.jzvd.JZVideoPlayer; import cn.jzvd.JZVideoPlayerStandard; @@ -50,15 +51,16 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { mChangeToExo.setOnClickListener(this); LinkedHashMap map = new LinkedHashMap(); + JZDataSource jzDataSource = null; try { - map.put(JZVideoPlayer.URL_KEY_DEFAULT, getAssets().openFd("local_video.mp4")); + jzDataSource = new JZDataSource(getAssets().openFd("local_video.mp4")); } catch (IOException e) { e.printStackTrace(); } Object[] dataSourceObjects = new Object[2]; dataSourceObjects[0] = map; dataSourceObjects[1] = this; - jzVideoPlayerStandard.setUp(dataSourceObjects, 0, JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子快长大"); + jzVideoPlayerStandard.setUp(jzDataSource, JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子快长大"); Glide.with(this) .load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png") .into(jzVideoPlayerStandard.thumbImageView); diff --git a/app/src/main/java/cn/jzvd/demo/ActivityListViewRecyclerView.java b/app/src/main/java/cn/jzvd/demo/ActivityListViewRecyclerView.java index dd27af544..195779b5e 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityListViewRecyclerView.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityListViewRecyclerView.java @@ -44,7 +44,7 @@ public void onChildViewAttachedToWindow(View view) { @Override public void onChildViewDetachedFromWindow(View view) { JZVideoPlayer jzvd = view.findViewById(R.id.videoplayer); - if (jzvd != null && JZUtils.dataSourceObjectsContainsUri(jzvd.dataSourceObjects, JZMediaManager.getCurrentDataSource())) { + if (jzvd != null && jzvd.jzDataSource.containsTheUrl(JZMediaManager.getCurrentUrl())) { JZVideoPlayer currentJzvd = JZVideoPlayerManager.getCurrentJzvd(); if (currentJzvd != null && currentJzvd.currentScreen != JZVideoPlayer.SCREEN_WINDOW_FULLSCREEN) { JZVideoPlayer.releaseAllVideos(); 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 b04679276..1d6dfe678 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/CustomMediaPlayerAssertFolder.java +++ b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/CustomMediaPlayerAssertFolder.java @@ -35,7 +35,7 @@ public void prepare() { mediaPlayer.setOnInfoListener(CustomMediaPlayerAssertFolder.this); mediaPlayer.setOnVideoSizeChangedListener(CustomMediaPlayerAssertFolder.this); - AssetFileDescriptor assetFileDescriptor = (AssetFileDescriptor) currentDataSource; + AssetFileDescriptor assetFileDescriptor = (AssetFileDescriptor) jzDataSource.getCurrentUrl(); mediaPlayer.setDataSource(assetFileDescriptor.getFileDescriptor(), assetFileDescriptor.getStartOffset(), assetFileDescriptor.getLength()); mediaPlayer.prepareAsync(); @@ -96,7 +96,7 @@ public void setVolume(float leftVolume, float rightVolume) { @Override public void onPrepared(MediaPlayer mediaPlayer) { mediaPlayer.start(); - if (currentDataSource.toString().toLowerCase().contains("mp3")) { + if (jzDataSource.getCurrentUrl().toString().toLowerCase().contains("mp3")) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { 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 e88bbec1f..d7bab46ec 100755 --- a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java +++ b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java @@ -83,7 +83,7 @@ public void prepare() { DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context, Util.getUserAgent(context, context.getResources().getString(R.string.app_name))); - String currUrl = currentDataSource.toString(); + String currUrl = jzDataSource.getCurrentUrl().toString(); if (currUrl.contains(".m3u8")) { videoSource = new HlsMediaSource.Factory(dataSourceFactory) .createMediaSource(Uri.parse(currUrl), mainHandler, null); @@ -133,7 +133,7 @@ public void run() { } } }); - if(percent < 100) { + if (percent < 100) { mainHandler.postDelayed(callback, 300); } else { mainHandler.removeCallbacks(callback); @@ -153,7 +153,7 @@ public boolean isPlaying() { @Override public void seekTo(long time) { - if(time != previousSeek) { + if (time != previousSeek) { simpleExoPlayer.seekTo(time); previousSeek = time; JZVideoPlayerManager.getCurrentJzvd().seekToInAdvance = time; 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 89add52da..5c22175b3 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZMediaIjkplayer.java +++ b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZMediaIjkplayer.java @@ -47,7 +47,7 @@ public void prepare() { ijkMediaPlayer.setOnTimedTextListener(JZMediaIjkplayer.this); try { - ijkMediaPlayer.setDataSource(currentDataSource.toString()); + ijkMediaPlayer.setDataSource(jzDataSource.getCurrentUrl().toString()); ijkMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); ijkMediaPlayer.setScreenOnWhilePlaying(true); ijkMediaPlayer.prepareAsync(); @@ -100,7 +100,7 @@ public void setVolume(float leftVolume, float rightVolume) { @Override public void onPrepared(IMediaPlayer iMediaPlayer) { ijkMediaPlayer.start(); - if (currentDataSource.toString().toLowerCase().contains("mp3")) { + if (jzDataSource.getCurrentUrl().toString().toLowerCase().contains("mp3")) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardAutoCompleteAfterFullscreen.java b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardAutoCompleteAfterFullscreen.java index 8345395a8..5cf17efc9 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardAutoCompleteAfterFullscreen.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardAutoCompleteAfterFullscreen.java @@ -33,8 +33,7 @@ public void startVideo() { mAudioManager.requestAudioFocus(onAudioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); JZUtils.scanForActivity(getContext()).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - JZMediaManager.setDataSource(dataSourceObjects); - JZMediaManager.setCurrentDataSource(JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex)); + JZMediaManager.setDataSource(jzDataSource); JZMediaManager.instance().positionInList = positionInList; onStatePreparing(); } else { diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java index ec1af2037..7c730316b 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java @@ -4,18 +4,65 @@ import java.util.LinkedHashMap; public class JZDataSource { - public Object currentDataSource;//正在播放的当前url或uri - public LinkedHashMap urlsMap; - public HashMap headerMap; + public static final String URL_KEY_DEFAULT = "URL_KEY_DEFAULT"; + + public int currentUrlIndex; + public LinkedHashMap urlsMap = new LinkedHashMap(); + public HashMap headerMap = new HashMap(); public boolean looping = false; - public Object[] objects; - - /** - * 第一个是url的map - * 第二个是loop - * 第三个是header - * 第四个是context - */ - public Object[] dataSourceObjects;//包含了地址的map(多分辨率用),context,loop,header等 + public Object[] otherObjects; + + public JZDataSource(String url) { + urlsMap.put(URL_KEY_DEFAULT, url); + currentUrlIndex = 0; + } + + public JZDataSource(Object url) { + urlsMap.put(URL_KEY_DEFAULT, url); + currentUrlIndex = 0; + } + + public JZDataSource(LinkedHashMap urlsMap) { + this.urlsMap.clear(); + this.urlsMap.putAll(urlsMap); + currentUrlIndex = 0; + } + + public Object getCurrentUrl() { + return getValueFromLinkedMap(currentUrlIndex); + } + + public Object getCurrentKey() { + return getKeyFromDataSource(currentUrlIndex); + } + + public String getKeyFromDataSource(int index) { + int currentIndex = 0; + for (Object key : urlsMap.keySet()) { + if (currentIndex == index) { + return key.toString(); + } + currentIndex++; + } + return null; + } + + public Object getValueFromLinkedMap(int index) { + int currentIndex = 0; + for (Object key : urlsMap.keySet()) { + if (currentIndex == index) { + return urlsMap.get(key); + } + currentIndex++; + } + return null; + } + + public boolean containsTheUrl(Object object) { + if (object != null) { + return urlsMap.containsValue(object); + } + return false; + } } diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaManager.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaManager.java index a7df536a6..df8197801 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaManager.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaManager.java @@ -48,23 +48,24 @@ public static JZMediaManager instance() { return jzMediaManager; } - public static Object[] getDataSource() { - return instance().jzMediaInterface.dataSourceObjects; - } - //这几个方法是不是多余了,为了不让其他地方动MediaInterface的方法 - public static void setDataSource(Object[] dataSourceObjects) { - instance().jzMediaInterface.dataSourceObjects = dataSourceObjects; + public static void setDataSource(JZDataSource jzDataSource) { + instance().jzMediaInterface.jzDataSource = jzDataSource; } - //正在播放的url或者uri - public static Object getCurrentDataSource() { - return instance().jzMediaInterface.currentDataSource; + public static JZDataSource getDataSource() { + return instance().jzMediaInterface.jzDataSource; } - public static void setCurrentDataSource(Object currentDataSource) { - instance().jzMediaInterface.currentDataSource = currentDataSource; + + // //正在播放的url或者uri + public static Object getCurrentUrl() { + return instance().jzMediaInterface.jzDataSource == null ? null : instance().jzMediaInterface.jzDataSource.getCurrentUrl(); } +// +// public static void setCurrentDataSource(JZDataSource jzDataSource) { +// instance().jzMediaInterface.jzDataSource = jzDataSource; +// } public static long getCurrentPosition() { return instance().jzMediaInterface.getCurrentPosition(); @@ -106,7 +107,7 @@ public void prepare() { @Override public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) { - if(JZVideoPlayerManager.getCurrentJzvd() == null) return; + if (JZVideoPlayerManager.getCurrentJzvd() == null) return; Log.i(TAG, "onSurfaceTextureAvailable [" + JZVideoPlayerManager.getCurrentJzvd().hashCode() + "] "); if (savedSurfaceTexture == null) { savedSurfaceTexture = surfaceTexture; diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java index b9ed307e1..019fdfbde 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java @@ -25,9 +25,7 @@ public void prepare() { try { mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); - if (dataSourceObjects.length > 1) { - mediaPlayer.setLooping((boolean) dataSourceObjects[1]); - } + mediaPlayer.setLooping(jzDataSource.looping); mediaPlayer.setOnPreparedListener(JZMediaSystem.this); mediaPlayer.setOnCompletionListener(JZMediaSystem.this); mediaPlayer.setOnBufferingUpdateListener(JZMediaSystem.this); @@ -38,11 +36,11 @@ public void prepare() { mediaPlayer.setOnVideoSizeChangedListener(JZMediaSystem.this); Class clazz = MediaPlayer.class; Method method = clazz.getDeclaredMethod("setDataSource", String.class, Map.class); - if (dataSourceObjects.length > 2) { - method.invoke(mediaPlayer, currentDataSource.toString(), dataSourceObjects[2]); - } else { - method.invoke(mediaPlayer, currentDataSource.toString(), null); - } +// if (dataSourceObjects.length > 2) { + method.invoke(mediaPlayer, jzDataSource.getCurrentUrl().toString(), jzDataSource.headerMap); +// } else { +// method.invoke(mediaPlayer, currentDataSource.toString(), null); +// } mediaPlayer.prepareAsync(); } catch (Exception e) { e.printStackTrace(); @@ -105,8 +103,8 @@ public void setVolume(float leftVolume, float rightVolume) { @Override public void onPrepared(MediaPlayer mediaPlayer) { mediaPlayer.start(); - if (currentDataSource.toString().toLowerCase().contains("mp3") || - currentDataSource.toString().toLowerCase().contains("wav")) { + if (jzDataSource.getCurrentUrl().toString().toLowerCase().contains("mp3") || + jzDataSource.getCurrentUrl().toString().toLowerCase().contains("wav")) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java index b41a39379..12d9ebc22 100755 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java @@ -145,43 +145,35 @@ public static void clearSavedProgress(Context context, Object url) { } } - public static Object getCurrentFromDataSource(Object[] dataSourceObjects, int index) { - LinkedHashMap map = (LinkedHashMap) dataSourceObjects[0]; - if (map != null && map.size() > 0) { - return getValueFromLinkedMap(map, index); - } - return null; - } - - public static Object getValueFromLinkedMap(LinkedHashMap map, int index) { - int currentIndex = 0; - for (String key : map.keySet()) { - if (currentIndex == index) { - return map.get(key); - } - currentIndex++; - } - return null; - } - - public static boolean dataSourceObjectsContainsUri(Object[] dataSourceObjects, Object object) { - LinkedHashMap map = (LinkedHashMap) dataSourceObjects[0]; - if (map != null && object != null) { - return map.containsValue(object); - } - return false; - } - - public static String getKeyFromDataSource(Object[] dataSourceObjects, int index) { - LinkedHashMap map = (LinkedHashMap) dataSourceObjects[0]; - int currentIndex = 0; - for (String key : map.keySet()) { - if (currentIndex == index) { - return key; - } - currentIndex++; - } - return null; - } +// public static Object getCurrentFromDataSource(Object[] dataSourceObjects, int index) { +// LinkedHashMap map = (LinkedHashMap) dataSourceObjects[0]; +// if (map != null && map.size() > 0) { +// return getValueFromLinkedMap(map, index); +// } +// return null; +// } +// +// public static Object getValueFromLinkedMap(LinkedHashMap map, int index) { +// int currentIndex = 0; +// for (String key : map.keySet()) { +// if (currentIndex == index) { +// return map.get(key); +// } +// currentIndex++; +// } +// return null; +// } +// +// public static String getKeyFromDataSource(Object[] dataSourceObjects, int index) { +// LinkedHashMap map = (LinkedHashMap) dataSourceObjects[0]; +// int currentIndex = 0; +// for (String key : map.keySet()) { +// if (currentIndex == index) { +// return key; +// } +// currentIndex++; +// } +// return null; +// } } diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java index ba22a9802..812cd29be 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java @@ -28,7 +28,6 @@ import android.widget.Toast; import java.lang.reflect.Constructor; -import java.util.LinkedHashMap; import java.util.Timer; import java.util.TimerTask; @@ -54,7 +53,6 @@ public abstract class JZVideoPlayer extends FrameLayout implements View.OnClickL public static final int CURRENT_STATE_AUTO_COMPLETE = 6; public static final int CURRENT_STATE_ERROR = 7; - public static final String URL_KEY_DEFAULT = "URL_KEY_DEFAULT";//当播放的地址只有一个的时候的key public static final int VIDEO_IMAGE_DISPLAY_TYPE_ADAPTER = 0;//default public static final int VIDEO_IMAGE_DISPLAY_TYPE_FILL_PARENT = 1; public static final int VIDEO_IMAGE_DISPLAY_TYPE_FILL_SCROP = 2; @@ -108,8 +106,7 @@ public void onAudioFocusChange(int focusChange) { public ViewGroup topContainer, bottomContainer; public int widthRatio = 0; public int heightRatio = 0; - public Object[] dataSourceObjects;//这个参数原封不动直接通过JZMeidaManager传给JZMediaInterface。 - public int currentUrlMapIndex = 0; + public JZDataSource jzDataSource; public int positionInList = -1; public int videoRotation = 0; protected int mScreenWidth; @@ -148,14 +145,10 @@ public static void releaseAllVideos() { } public static void startFullscreen(Context context, Class _class, String url, Object... objects) { - LinkedHashMap map = new LinkedHashMap(); - map.put(URL_KEY_DEFAULT, url); - Object[] dataSourceObjects = new Object[1]; - dataSourceObjects[0] = map; - startFullscreen(context, _class, dataSourceObjects, 0, objects); + startFullscreen(context, _class, new JZDataSource(url), 0, objects); } - public static void startFullscreen(Context context, Class _class, Object[] dataSourceObjects, int defaultUrlMapIndex, Object... objects) { + public static void startFullscreen(Context context, Class _class, JZDataSource jzDataSource, int defaultUrlMapIndex, Object... objects) { hideSupportActionBar(context); JZUtils.setRequestedOrientation(context, FULLSCREEN_ORIENTATION); ViewGroup vp = (JZUtils.scanForActivity(context))//.getWindow().getDecorView(); @@ -173,7 +166,7 @@ public static void startFullscreen(Context context, Class _class, Object[] dataS vp.addView(jzVideoPlayer, lp); // final Animation ra = AnimationUtils.loadAnimation(context, R.anim.start_fullscreen); // jzVideoPlayer.setAnimation(ra); - jzVideoPlayer.setUp(dataSourceObjects, defaultUrlMapIndex, JZVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN, objects); + jzVideoPlayer.setUp(jzDataSource, defaultUrlMapIndex, JZVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN, objects); CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis(); jzVideoPlayer.startButton.performClick(); } catch (InstantiationException e) { @@ -190,7 +183,7 @@ public static boolean backPress() { if (JZVideoPlayerManager.getSecondFloor() != null) { CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis(); - if (JZUtils.dataSourceObjectsContainsUri(JZVideoPlayerManager.getFirstFloor().dataSourceObjects, JZMediaManager.getCurrentDataSource())) { + if (JZVideoPlayerManager.getFirstFloor().jzDataSource.containsTheUrl(JZMediaManager.getDataSource().getCurrentUrl())) { JZVideoPlayer jzVideoPlayer = JZVideoPlayerManager.getSecondFloor(); jzVideoPlayer.onEvent(jzVideoPlayer.currentScreen == JZVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN ? JZUserAction.ON_QUIT_FULLSCREEN : @@ -320,7 +313,7 @@ public static void onScrollReleaseAllVideos(AbsListView view, int firstVisibleIt public static void onChildViewAttachedToWindow(View view, int jzvdId) { if (JZVideoPlayerManager.getCurrentJzvd() != null && JZVideoPlayerManager.getCurrentJzvd().currentScreen == JZVideoPlayer.SCREEN_WINDOW_TINY) { JZVideoPlayer videoPlayer = view.findViewById(jzvdId); - if (videoPlayer != null && JZUtils.getCurrentFromDataSource(videoPlayer.dataSourceObjects, videoPlayer.currentUrlMapIndex).equals(JZMediaManager.getCurrentDataSource())) { + if (videoPlayer != null && videoPlayer.jzDataSource.containsTheUrl(JZMediaManager.getCurrentUrl())) { JZVideoPlayer.backPress(); } } @@ -353,7 +346,7 @@ public static void setVideoImageDisplayType(int type) { } public Object getCurrentUrl() { - return JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex); + return jzDataSource.getCurrentUrl(); } public abstract int getLayoutId(); @@ -390,19 +383,15 @@ public void init(Context context) { } public void setUp(String url, int screen, Object... objects) { - LinkedHashMap map = new LinkedHashMap(); - map.put(URL_KEY_DEFAULT, url); - Object[] dataSourceObjects = new Object[1]; - dataSourceObjects[0] = map; - setUp(dataSourceObjects, 0, screen, objects); + setUp(new JZDataSource(url), 0, screen, objects); } - public void setUp(Object[] dataSourceObjects, int defaultUrlMapIndex, int screen, Object... objects) { - if (this.dataSourceObjects != null && JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex) != null && - JZUtils.getCurrentFromDataSource(this.dataSourceObjects, currentUrlMapIndex).equals(JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex))) { + public void setUp(JZDataSource jzDataSource, int screen, Object... objects) { + if (this.jzDataSource != null && jzDataSource.getCurrentUrl() != null && + jzDataSource.containsTheUrl(jzDataSource.getCurrentUrl())) { return; } - if (isCurrentJZVD() && JZUtils.dataSourceObjectsContainsUri(dataSourceObjects, JZMediaManager.getCurrentDataSource())) { + if (isCurrentJZVD() && jzDataSource.containsTheUrl(JZMediaManager.getCurrentUrl())) { long position = 0; try { position = JZMediaManager.getCurrentPosition(); @@ -410,21 +399,20 @@ public void setUp(Object[] dataSourceObjects, int defaultUrlMapIndex, int screen e.printStackTrace(); } if (position != 0) { - JZUtils.saveProgress(getContext(), JZMediaManager.getCurrentDataSource(), position); + JZUtils.saveProgress(getContext(), JZMediaManager.getCurrentUrl(), position); } JZMediaManager.instance().releaseMediaPlayer(); - } else if (isCurrentJZVD() && !JZUtils.dataSourceObjectsContainsUri(dataSourceObjects, JZMediaManager.getCurrentDataSource())) { + } else if (isCurrentJZVD() && !jzDataSource.containsTheUrl(JZMediaManager.getCurrentUrl())) { startWindowTiny(); - } else if (!isCurrentJZVD() && JZUtils.dataSourceObjectsContainsUri(dataSourceObjects, JZMediaManager.getCurrentDataSource())) { + } else if (!isCurrentJZVD() && jzDataSource.containsTheUrl(JZMediaManager.getCurrentUrl())) { if (JZVideoPlayerManager.getCurrentJzvd() != null && JZVideoPlayerManager.getCurrentJzvd().currentScreen == JZVideoPlayer.SCREEN_WINDOW_TINY) { //需要退出小窗退到我这里,我这里是第一层级 tmp_test_back = true; } - } else if (!isCurrentJZVD() && !JZUtils.dataSourceObjectsContainsUri(dataSourceObjects, JZMediaManager.getCurrentDataSource())) { + } else if (!isCurrentJZVD() && !jzDataSource.containsTheUrl(JZMediaManager.getCurrentUrl())) { } - this.dataSourceObjects = dataSourceObjects; - this.currentUrlMapIndex = defaultUrlMapIndex; + this.jzDataSource = jzDataSource; this.currentScreen = screen; this.objects = objects; onStateNormal(); @@ -436,13 +424,13 @@ public void onClick(View v) { int i = v.getId(); if (i == R.id.start) { Log.i(TAG, "onClick start [" + this.hashCode() + "] "); - if (dataSourceObjects == null || JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex) == null) { + if (jzDataSource.urlsMap.isEmpty() || jzDataSource.getCurrentUrl() == null) { Toast.makeText(getContext(), getResources().getString(R.string.no_url), Toast.LENGTH_SHORT).show(); return; } if (currentState == CURRENT_STATE_NORMAL) { - if (!JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex).toString().startsWith("file") && ! - JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex).toString().startsWith("/") && + if (!jzDataSource.getCurrentUrl().toString().startsWith("file") && ! + jzDataSource.getCurrentUrl().toString().startsWith("/") && !JZUtils.isWifiConnected(getContext()) && !WIFI_TIP_DIALOG_SHOWED) { showWifiDialog(); return; @@ -604,8 +592,7 @@ public void startVideo() { mAudioManager.requestAudioFocus(onAudioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); JZUtils.scanForActivity(getContext()).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - JZMediaManager.setDataSource(dataSourceObjects); - JZMediaManager.setCurrentDataSource(JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex)); + JZMediaManager.setDataSource(jzDataSource); JZMediaManager.instance().positionInList = positionInList; onStatePreparing(); JZVideoPlayerManager.setFirstFloor(this); @@ -661,10 +648,9 @@ public void onStatePreparing() { public void changeUrl(int urlMapIndex, long seekToInAdvance) { currentState = CURRENT_STATE_PREPARING_CHANGING_URL; - this.currentUrlMapIndex = urlMapIndex; this.seekToInAdvance = seekToInAdvance; - JZMediaManager.setDataSource(dataSourceObjects); - JZMediaManager.setCurrentDataSource(JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex)); + jzDataSource.currentUrlIndex = urlMapIndex; + JZMediaManager.setDataSource(jzDataSource); JZMediaManager.instance().prepare(); } @@ -673,7 +659,7 @@ public void onStatePrepared() {//因为这个紧接着就会进入播放状态 JZMediaManager.seekTo(seekToInAdvance); seekToInAdvance = 0; } else { - long position = JZUtils.getSavedProgress(getContext(), JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex)); + long position = JZUtils.getSavedProgress(getContext(), jzDataSource.getCurrentUrl()); if (position != 0) { JZMediaManager.seekTo(position); } @@ -753,14 +739,14 @@ public void onAutoCompletion() { backPress(); } JZMediaManager.instance().releaseMediaPlayer(); - JZUtils.saveProgress(getContext(), JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex), 0); + JZUtils.saveProgress(getContext(), jzDataSource.getCurrentUrl(), 0); } public void onCompletion() { Log.i(TAG, "onCompletion " + " [" + this.hashCode() + "] "); if (currentState == CURRENT_STATE_PLAYING || currentState == CURRENT_STATE_PAUSE) { long position = getCurrentPositionWhenPlaying(); - JZUtils.saveProgress(getContext(), JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex), position); + JZUtils.saveProgress(getContext(), jzDataSource.getCurrentUrl(), position); } cancelProgressTimer(); dismissBrightnessDialog(); @@ -785,7 +771,7 @@ public void onCompletion() { } public void release() { - if (JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex).equals(JZMediaManager.getCurrentDataSource()) && + if (jzDataSource.getCurrentUrl().equals(JZMediaManager.getCurrentUrl()) && (System.currentTimeMillis() - CLICK_QUIT_FULLSCREEN_TIME) > FULL_SCREEN_NORMAL_DELAY) { //在非全屏的情况下只能backPress() if (JZVideoPlayerManager.getSecondFloor() != null && @@ -989,7 +975,7 @@ public void startWindowFullscreen() { vp.addView(jzVideoPlayer, lp); jzVideoPlayer.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_FULLSCREEN); - jzVideoPlayer.setUp(dataSourceObjects, currentUrlMapIndex, JZVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN, objects); + jzVideoPlayer.setUp(jzDataSource, JZVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN, objects); jzVideoPlayer.setState(currentState); jzVideoPlayer.addTextureView(); JZVideoPlayerManager.setSecondFloor(jzVideoPlayer); @@ -1027,7 +1013,7 @@ public void startWindowTiny() { FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(400, 400); lp.gravity = Gravity.RIGHT | Gravity.BOTTOM; vp.addView(jzVideoPlayer, lp); - jzVideoPlayer.setUp(dataSourceObjects, currentUrlMapIndex, JZVideoPlayerStandard.SCREEN_WINDOW_TINY, objects); + jzVideoPlayer.setUp(jzDataSource, JZVideoPlayerStandard.SCREEN_WINDOW_TINY, objects); jzVideoPlayer.setState(currentState); jzVideoPlayer.addTextureView(); JZVideoPlayerManager.setSecondFloor(jzVideoPlayer); @@ -1041,7 +1027,7 @@ public void startWindowTiny() { public boolean isCurrentPlay() { return isCurrentJZVD() - && JZUtils.dataSourceObjectsContainsUri(dataSourceObjects, JZMediaManager.getCurrentDataSource());//不仅正在播放的url不能一样,并且各个清晰度也不能一样 + && jzDataSource.containsTheUrl(JZMediaManager.getCurrentUrl());//不仅正在播放的url不能一样,并且各个清晰度也不能一样 } public boolean isCurrentJZVD() { @@ -1054,7 +1040,6 @@ public void playOnThisJzvd() { Log.i(TAG, "playOnThisJzvd " + " [" + this.hashCode() + "] "); //1.清空全屏和小窗的jzvd currentState = JZVideoPlayerManager.getSecondFloor().currentState; - currentUrlMapIndex = JZVideoPlayerManager.getSecondFloor().currentUrlMapIndex; clearFloatScreen(); //2.在本jzvd上播放 setState(currentState); @@ -1089,8 +1074,8 @@ && isCurrentPlay() } public void onEvent(int type) { - if (JZ_USER_EVENT != null && isCurrentPlay() && dataSourceObjects != null) { - JZ_USER_EVENT.onEvent(type, JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex), currentScreen, objects); + if (JZ_USER_EVENT != null && isCurrentPlay() && !jzDataSource.urlsMap.isEmpty()) { + JZ_USER_EVENT.onEvent(type, jzDataSource.getCurrentUrl(), currentScreen, objects); } } diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java index c95da0356..2b756f1fc 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java @@ -114,18 +114,18 @@ public void init(Context context) { mRetryBtn.setOnClickListener(this); } - public void setUp(Object[] dataSourceObjects, int defaultUrlMapIndex, int screen, Object... objects) { - super.setUp(dataSourceObjects, defaultUrlMapIndex, screen, objects); + public void setUp(JZDataSource jzDataSource, int screen, Object... objects) { + super.setUp(jzDataSource, screen, objects); if (objects.length != 0) titleTextView.setText(objects[0].toString()); if (currentScreen == SCREEN_WINDOW_FULLSCREEN) { fullscreenButton.setImageResource(R.drawable.jz_shrink); backButton.setVisibility(View.VISIBLE); tinyBackImageView.setVisibility(View.INVISIBLE); batteryTimeLayout.setVisibility(View.VISIBLE); - if (((LinkedHashMap) dataSourceObjects[0]).size() == 1) { + if (jzDataSource.urlsMap.size() == 1) { clarity.setVisibility(GONE); } else { - clarity.setText(JZUtils.getKeyFromDataSource(dataSourceObjects, currentUrlMapIndex)); + clarity.setText(jzDataSource.getCurrentKey().toString()); clarity.setVisibility(View.VISIBLE); } changeStartButtonSize((int) getResources().getDimension(R.dimen.jz_start_button_w_h_fullscreen)); @@ -254,13 +254,13 @@ public void onClick(View v) { super.onClick(v); int i = v.getId(); if (i == R.id.thumb) { - if (dataSourceObjects == null || JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex) == null) { + if (jzDataSource.urlsMap.isEmpty() || jzDataSource.getCurrentUrl() == null) { Toast.makeText(getContext(), getResources().getString(R.string.no_url), Toast.LENGTH_SHORT).show(); return; } if (currentState == CURRENT_STATE_NORMAL) { - if (!JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex).toString().startsWith("file") && - !JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex).toString().startsWith("/") && + if (!jzDataSource.getCurrentUrl().toString().startsWith("file") && + !jzDataSource.getCurrentUrl().toString().startsWith("/") && !JZUtils.isWifiConnected(getContext()) && !WIFI_TIP_DIALOG_SHOWED) { showWifiDialog(); return; @@ -289,9 +289,9 @@ public void onClick(View v) { public void onClick(View v) { int index = (int) v.getTag(); changeUrl(index, getCurrentPositionWhenPlaying()); - clarity.setText(JZUtils.getKeyFromDataSource(dataSourceObjects, currentUrlMapIndex)); + clarity.setText(jzDataSource.getCurrentKey().toString()); for (int j = 0; j < layout.getChildCount(); j++) {//设置点击之后的颜色 - if (j == currentUrlMapIndex) { + if (j == jzDataSource.currentUrlIndex) { ((TextView) layout.getChildAt(j)).setTextColor(Color.parseColor("#fff85959")); } else { ((TextView) layout.getChildAt(j)).setTextColor(Color.parseColor("#ffffff")); @@ -303,14 +303,14 @@ public void onClick(View v) { } }; - for (int j = 0; j < ((LinkedHashMap) dataSourceObjects[0]).size(); j++) { - String key = JZUtils.getKeyFromDataSource(dataSourceObjects, j); + for (int j = 0; j < jzDataSource.urlsMap.size(); j++) { + String key = jzDataSource.getKeyFromDataSource(j); TextView clarityItem = (TextView) View.inflate(getContext(), R.layout.jz_layout_clarity_item, null); clarityItem.setText(key); clarityItem.setTag(j); layout.addView(clarityItem, j); clarityItem.setOnClickListener(mQualityListener); - if (j == currentUrlMapIndex) { + if (j == jzDataSource.currentUrlIndex) { clarityItem.setTextColor(Color.parseColor("#fff85959")); } } @@ -321,22 +321,21 @@ public void onClick(View v) { layout.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); int offsetX = clarity.getMeasuredWidth() / 3; int offsetY = clarity.getMeasuredHeight() / 3; - clarityPopWindow.update(clarity, - offsetX, - offsetY, Math.round(layout.getMeasuredWidth() * 2), layout.getMeasuredHeight()); + clarityPopWindow.update(clarity, -offsetX, -offsetY, Math.round(layout.getMeasuredWidth() * 2), layout.getMeasuredHeight()); } else if (i == R.id.retry_btn) { - if (dataSourceObjects == null || JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex) == null) { + if (jzDataSource.urlsMap.isEmpty() || jzDataSource.getCurrentUrl() == null) { Toast.makeText(getContext(), getResources().getString(R.string.no_url), Toast.LENGTH_SHORT).show(); return; } - if (!JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex).toString().startsWith("file") && ! - JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex).toString().startsWith("/") && + if (!jzDataSource.getCurrentUrl().toString().startsWith("file") && ! + jzDataSource.getCurrentUrl().toString().startsWith("/") && !JZUtils.isWifiConnected(getContext()) && !WIFI_TIP_DIALOG_SHOWED) { showWifiDialog(); return; } initTextureView();//和开始播放的代码重复 addTextureView(); - JZMediaManager.setDataSource(dataSourceObjects); - JZMediaManager.setCurrentDataSource(JZUtils.getCurrentFromDataSource(dataSourceObjects, currentUrlMapIndex)); + JZMediaManager.setDataSource(jzDataSource); onStatePreparing(); onEvent(JZUserAction.ON_CLICK_START_ERROR); } @@ -391,7 +390,7 @@ public void onStopTrackingTouch(SeekBar seekBar) { public void onClickUiToggle() { if (bottomContainer.getVisibility() != View.VISIBLE) { setSystemTimeAndBattery(); - clarity.setText(JZUtils.getKeyFromDataSource(dataSourceObjects, currentUrlMapIndex)); + clarity.setText(jzDataSource.getCurrentKey().toString()); } if (currentState == CURRENT_STATE_PREPARING) { changeUiToPreparing(); From bde80c35fb7ddfe29e74214220d021fb858570cf Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Sun, 26 Aug 2018 16:25:52 +0800 Subject: [PATCH 09/14] fix params --- jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java index 812cd29be..6eb9abfce 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java @@ -383,7 +383,7 @@ public void init(Context context) { } public void setUp(String url, int screen, Object... objects) { - setUp(new JZDataSource(url), 0, screen, objects); + setUp(new JZDataSource(url), screen, objects); } public void setUp(JZDataSource jzDataSource, int screen, Object... objects) { From be0a4969be2de6d64ccf18aac836d94f2989aaac Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Mon, 27 Aug 2018 16:55:48 +0800 Subject: [PATCH 10/14] fix check url bug --- jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java index 6eb9abfce..c2f00725b 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java @@ -388,7 +388,7 @@ public void setUp(String url, int screen, Object... objects) { public void setUp(JZDataSource jzDataSource, int screen, Object... objects) { if (this.jzDataSource != null && jzDataSource.getCurrentUrl() != null && - jzDataSource.containsTheUrl(jzDataSource.getCurrentUrl())) { + this.jzDataSource.containsTheUrl(jzDataSource.getCurrentUrl())) { return; } if (isCurrentJZVD() && jzDataSource.containsTheUrl(JZMediaManager.getCurrentUrl())) { From 8d6b0fd292f2433762824370e6f91ef2e5147b72 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Tue, 28 Aug 2018 16:30:54 +0800 Subject: [PATCH 11/14] put title into JZDataSource --- .../main/java/cn/jzvd/demo/ActivityApi.java | 7 ++-- .../demo/ActivityApiCustomMediaPlayer.java | 7 ++-- .../jzvd/demo/ActivityApiExtendsNormal.java | 4 +-- .../cn/jzvd/demo/ActivityApiOrientation.java | 4 +-- .../demo/ActivityApiRotationVideoSize.java | 4 +-- .../jzvd/demo/ActivityApiUISmallChange.java | 32 +++++++++---------- .../demo/ActivityListViewMultiHolder.java | 4 +-- .../main/java/cn/jzvd/demo/ActivityMain.java | 2 +- .../java/cn/jzvd/demo/ActivityTinyWindow.java | 4 +-- ...ActivityTinyWindowListViewMultiHolder.java | 4 +-- ...ivityTinyWindowRecycleViewMultiHolder.java | 4 +-- .../java/cn/jzvd/demo/ActivityWebView.java | 8 ++--- .../jzvd/demo/AdapterRecyclerViewVideo.java | 4 +-- .../java/cn/jzvd/demo/AdapterVideoList.java | 4 +-- .../JZVideoPlayerStandardFresco.java | 10 +++--- ...tandardShowShareButtonAfterFullscreen.java | 5 +-- ...layerStandardShowTitleAfterFullscreen.java | 5 +-- .../src/main/java/cn/jzvd/JZDataSource.java | 16 +++++++++- .../src/main/java/cn/jzvd/JZVideoPlayer.java | 22 ++++++------- .../java/cn/jzvd/JZVideoPlayerStandard.java | 7 ++-- 20 files changed, 83 insertions(+), 74 deletions(-) diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApi.java b/app/src/main/java/cn/jzvd/demo/ActivityApi.java index 6624c6797..a1781437c 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApi.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApi.java @@ -18,7 +18,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.util.HashMap; import java.util.LinkedHashMap; import cn.jzvd.JZDataSource; @@ -67,12 +66,12 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { map.put("高清", proxyUrl); map.put("标清", VideoConstant.videoUrls[0][6]); map.put("普清", VideoConstant.videoUrlList[0]); - JZDataSource jzDataSource = new JZDataSource(map); + JZDataSource jzDataSource = new JZDataSource(map, "饺子不信"); jzDataSource.looping = true; jzDataSource.currentUrlIndex = 2; jzDataSource.headerMap.put("key", "value");//header - mJzVideoPlayerStandard.setUp(jzDataSource, 2 - , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子不信"); + mJzVideoPlayerStandard.setUp(jzDataSource + , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL); Glide.with(this).load(VideoConstant.videoThumbList[0]).into(mJzVideoPlayerStandard.thumbImageView); mJzVideoPlayerStandard.seekToInAdvance = 20000; //JZVideoPlayer.SAVE_PROGRESS = false; diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java b/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java index b9c7384e0..7d83a545f 100755 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java @@ -50,17 +50,14 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { mChangeToSystemMediaPlayer.setOnClickListener(this); mChangeToExo.setOnClickListener(this); - LinkedHashMap map = new LinkedHashMap(); JZDataSource jzDataSource = null; try { jzDataSource = new JZDataSource(getAssets().openFd("local_video.mp4")); + jzDataSource.title = "饺子快长大"; } catch (IOException e) { e.printStackTrace(); } - Object[] dataSourceObjects = new Object[2]; - dataSourceObjects[0] = map; - dataSourceObjects[1] = this; - jzVideoPlayerStandard.setUp(jzDataSource, JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子快长大"); + jzVideoPlayerStandard.setUp(jzDataSource, JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL); Glide.with(this) .load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png") .into(jzVideoPlayerStandard.thumbImageView); diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java b/app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java index 7030a1a15..e62df08f9 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java @@ -19,8 +19,8 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_extends_normal); JZVideoPlayerStandard jzVideoPlayerStandard = findViewById(R.id.videoplayer); - jzVideoPlayerStandard.setUp(VideoConstant.videoUrlList[0] - , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子不信"); + jzVideoPlayerStandard.setUp(VideoConstant.videoUrlList[0], "饺子不信" + , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL); Glide.with(this) .load(VideoConstant.videoThumbList[0]) .into(jzVideoPlayerStandard.thumbImageView); diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java b/app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java index 34f88228f..eaa0aa2f4 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java @@ -27,8 +27,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { getSupportActionBar().setTitle("Orientation"); setContentView(R.layout.activity_orientation); mJzVideoPlayerStandard = findViewById(R.id.jz_video); - mJzVideoPlayerStandard.setUp(VideoConstant.videoUrlList[0] - , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子不信"); + mJzVideoPlayerStandard.setUp(VideoConstant.videoUrlList[0], "饺子不信" + , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL); Glide.with(this) .load(VideoConstant.videoThumbList[0]) .into(mJzVideoPlayerStandard.thumbImageView); diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiRotationVideoSize.java b/app/src/main/java/cn/jzvd/demo/ActivityApiRotationVideoSize.java index c8bbe5fdd..8e8b775d7 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiRotationVideoSize.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiRotationVideoSize.java @@ -32,8 +32,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { setContentView(R.layout.activity_api_rotation_videosize); myJZVideoPlayerStandard = findViewById(R.id.jz_video); - myJZVideoPlayerStandard.setUp(VideoConstant.videoUrls[0][7] - , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, VideoConstant.videoTitles[0][7]); + myJZVideoPlayerStandard.setUp(VideoConstant.videoUrls[0][7], VideoConstant.videoTitles[0][7] + , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL); Glide.with(this) .load(VideoConstant.videoThumbs[0][7]) .into(myJZVideoPlayerStandard.thumbImageView); diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java index 085f22302..8637b104f 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java @@ -40,37 +40,37 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { setContentView(R.layout.activity_ui_small_change); jzVideoPlayerStandardWithShareButton = findViewById(R.id.custom_videoplayer_standard_with_share_button); - jzVideoPlayerStandardWithShareButton.setUp(VideoConstant.videoUrlList[3], JZVideoPlayer.SCREEN_WINDOW_NORMAL - , "饺子想呼吸"); + jzVideoPlayerStandardWithShareButton.setUp(VideoConstant.videoUrlList[3], "饺子想呼吸", JZVideoPlayer.SCREEN_WINDOW_NORMAL + ); Glide.with(this) .load(VideoConstant.videoThumbList[3]) .into(jzVideoPlayerStandardWithShareButton.thumbImageView); jzVideoPlayerStandardShowTitleAfterFullscreen = findViewById(R.id.custom_videoplayer_standard_show_title_after_fullscreen); - jzVideoPlayerStandardShowTitleAfterFullscreen.setUp(VideoConstant.videoUrlList[4], JZVideoPlayer.SCREEN_WINDOW_NORMAL - , "饺子想摇头"); + jzVideoPlayerStandardShowTitleAfterFullscreen.setUp(VideoConstant.videoUrlList[4], "饺子想摇头", JZVideoPlayer.SCREEN_WINDOW_NORMAL + ); Glide.with(this) .load(VideoConstant.videoThumbList[4]) .into(jzVideoPlayerStandardShowTitleAfterFullscreen.thumbImageView); jzVideoPlayerStandardShowTextureViewAfterAutoComplete = findViewById(R.id.custom_videoplayer_standard_show_textureview_aoto_complete); - jzVideoPlayerStandardShowTextureViewAfterAutoComplete.setUp(VideoConstant.videoUrlList[5], JZVideoPlayer.SCREEN_WINDOW_NORMAL - , "饺子想旅行"); + jzVideoPlayerStandardShowTextureViewAfterAutoComplete.setUp(VideoConstant.videoUrlList[5], "饺子想旅行", JZVideoPlayer.SCREEN_WINDOW_NORMAL + ); Glide.with(this) .load(VideoConstant.videoThumbList[5]) .into(jzVideoPlayerStandardShowTextureViewAfterAutoComplete.thumbImageView); jzVideoPlayerStandardAutoCompleteAfterFullscreen = findViewById(R.id.custom_videoplayer_standard_aoto_complete); - jzVideoPlayerStandardAutoCompleteAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], JZVideoPlayer.SCREEN_WINDOW_NORMAL - , "饺子没来"); + jzVideoPlayerStandardAutoCompleteAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], "饺子没来", JZVideoPlayer.SCREEN_WINDOW_NORMAL + ); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzVideoPlayerStandardAutoCompleteAfterFullscreen.thumbImageView); jzVideoPlayerStandard_1_1 = findViewById(R.id.jz_videoplayer_1_1); - jzVideoPlayerStandard_1_1.setUp(VideoConstant.videoUrls[0][1], JZVideoPlayer.SCREEN_WINDOW_NORMAL - , "饺子有事吗"); + jzVideoPlayerStandard_1_1.setUp(VideoConstant.videoUrls[0][1], "饺子有事吗", JZVideoPlayer.SCREEN_WINDOW_NORMAL + ); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzVideoPlayerStandard_1_1.thumbImageView); @@ -78,8 +78,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { jzVideoPlayerStandard_1_1.heightRatio = 1; jzVideoPlayerStandard_16_9 = findViewById(R.id.jz_videoplayer_16_9); - jzVideoPlayerStandard_16_9.setUp(VideoConstant.videoUrls[0][1], JZVideoPlayer.SCREEN_WINDOW_NORMAL - , "饺子来不了"); + jzVideoPlayerStandard_16_9.setUp(VideoConstant.videoUrls[0][1], "饺子来不了", JZVideoPlayer.SCREEN_WINDOW_NORMAL + ); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzVideoPlayerStandard_16_9.thumbImageView); @@ -87,15 +87,15 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { jzVideoPlayerStandard_16_9.heightRatio = 9; jzVideoPlayerStandardVolumeAfterFullscreen = findViewById(R.id.jz_videoplayer_volume); - jzVideoPlayerStandardVolumeAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], JZVideoPlayer.SCREEN_WINDOW_NORMAL - , "饺子摇摆"); + jzVideoPlayerStandardVolumeAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], "饺子摇摆", JZVideoPlayer.SCREEN_WINDOW_NORMAL + ); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzVideoPlayerStandardVolumeAfterFullscreen.thumbImageView); jzVideoPlayerStandardMp3 = findViewById(R.id.jz_videoplayer_mp3); - jzVideoPlayerStandardMp3.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", JZVideoPlayer.SCREEN_WINDOW_NORMAL - , "饺子摇摆"); + jzVideoPlayerStandardMp3.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", "饺子摇摆", JZVideoPlayer.SCREEN_WINDOW_NORMAL + ); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzVideoPlayerStandardMp3.thumbImageView); diff --git a/app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java b/app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java index 5c79de4d7..78fd3922d 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java @@ -118,8 +118,8 @@ public View getView(int position, View convertView, ViewGroup parent) { } viewHolder.jzVideoPlayer.setUp( - VideoConstant.videoUrls[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST, - VideoConstant.videoTitles[0][position]); + VideoConstant.videoUrls[0][position], + VideoConstant.videoTitles[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST); viewHolder.jzVideoPlayer.positionInList = position; Glide.with(ActivityListViewMultiHolder.this) .load(VideoConstant.videoThumbs[0][position]) diff --git a/app/src/main/java/cn/jzvd/demo/ActivityMain.java b/app/src/main/java/cn/jzvd/demo/ActivityMain.java index 0a7d59eb6..521a48b4a 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityMain.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityMain.java @@ -45,7 +45,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { myJZVideoPlayerStandard = findViewById(R.id.jz_video); myJZVideoPlayerStandard.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4" - , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子快长大"); + , "饺子快长大", JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL); Glide.with(this).load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png").into(myJZVideoPlayerStandard.thumbImageView); JZVideoPlayer.setJzUserAction(new MyUserActionStandard()); } diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java index 10772bb77..8b52130df 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java @@ -33,8 +33,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { setContentView(R.layout.activity_tiny_window); mJzVideoPlayerStandard = findViewById(R.id.jz_video); - mJzVideoPlayerStandard.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4" - , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子快长大"); + mJzVideoPlayerStandard.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4", "饺子快长大" + , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL); Glide.with(this) .load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png") .into(mJzVideoPlayerStandard.thumbImageView); diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java index dbe83486d..f34ead78c 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java @@ -118,8 +118,8 @@ public View getView(int position, View convertView, ViewGroup parent) { } viewHolder.jzVideoPlayer.setUp( - VideoConstant.videoUrls[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST, - VideoConstant.videoTitles[0][position]); + VideoConstant.videoUrls[0][position], + VideoConstant.videoTitles[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST); viewHolder.jzVideoPlayer.positionInList = position; Glide.with(ActivityTinyWindowListViewMultiHolder.this).load(VideoConstant.videoThumbs[0][position]).into(viewHolder.jzVideoPlayer.thumbImageView); } else { diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleViewMultiHolder.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleViewMultiHolder.java index dbf8a9ec6..d5a1fb35a 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleViewMultiHolder.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleViewMultiHolder.java @@ -107,8 +107,8 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } else { VideoHolder videoHolder = (VideoHolder) holder; videoHolder.jzVideoPlayer.setUp( - VideoConstant.videoUrls[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST, - VideoConstant.videoTitles[0][position]); + VideoConstant.videoUrls[0][position], + VideoConstant.videoTitles[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST); videoHolder.jzVideoPlayer.positionInList = position; Glide.with(ActivityTinyWindowRecycleViewMultiHolder.this).load(VideoConstant.videoThumbs[0][position]).into(videoHolder.jzVideoPlayer.thumbImageView); } diff --git a/app/src/main/java/cn/jzvd/demo/ActivityWebView.java b/app/src/main/java/cn/jzvd/demo/ActivityWebView.java index 7bea7c5d6..fd7889336 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityWebView.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityWebView.java @@ -71,8 +71,8 @@ public void adViewJiaoZiVideoPlayer(final int width, final int height, final int public void run() { if (index == 0) { JZVideoPlayerStandard webVieo = new JZVideoPlayerStandard(ActivityWebView.this); - webVieo.setUp(VideoConstant.videoUrlList[1], - JZVideoPlayer.SCREEN_WINDOW_LIST, "饺子骑大马"); + webVieo.setUp(VideoConstant.videoUrlList[1], "饺子骑大马", + JZVideoPlayer.SCREEN_WINDOW_LIST); Glide.with(ActivityWebView.this) .load(VideoConstant.videoThumbList[1]) .into(webVieo.thumbImageView); @@ -85,8 +85,8 @@ public void run() { mWebView.addView(webVieo, layoutParams); } else { JZVideoPlayerStandard webVieo = new JZVideoPlayerStandard(ActivityWebView.this); - webVieo.setUp(VideoConstant.videoUrlList[2], - JZVideoPlayer.SCREEN_WINDOW_LIST, "饺子失态了"); + webVieo.setUp(VideoConstant.videoUrlList[2], "饺子失态了", + JZVideoPlayer.SCREEN_WINDOW_LIST); Glide.with(ActivityWebView.this) .load(VideoConstant.videoThumbList[2]) .into(webVieo.thumbImageView); diff --git a/app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java b/app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java index 09ba42832..c25da2bf9 100644 --- a/app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java +++ b/app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java @@ -37,8 +37,8 @@ public void onBindViewHolder(MyViewHolder holder, int position) { Log.i(TAG, "onBindViewHolder [" + holder.jzVideoPlayer.hashCode() + "] position=" + position); holder.jzVideoPlayer.setUp( - VideoConstant.videoUrls[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST, - VideoConstant.videoTitles[0][position]); + VideoConstant.videoUrls[0][position], + VideoConstant.videoTitles[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST); Glide.with(holder.jzVideoPlayer.getContext()).load(VideoConstant.videoThumbs[0][position]).into(holder.jzVideoPlayer.thumbImageView); } diff --git a/app/src/main/java/cn/jzvd/demo/AdapterVideoList.java b/app/src/main/java/cn/jzvd/demo/AdapterVideoList.java index a9aa65906..071c610da 100644 --- a/app/src/main/java/cn/jzvd/demo/AdapterVideoList.java +++ b/app/src/main/java/cn/jzvd/demo/AdapterVideoList.java @@ -61,8 +61,8 @@ public View getView(int position, View convertView, ViewGroup parent) { } viewHolder.jzVideoPlayer = convertView.findViewById(R.id.videoplayer); viewHolder.jzVideoPlayer.setUp( - videoUrls[position], JZVideoPlayer.SCREEN_WINDOW_LIST, - videoTitles[position]); + videoUrls[position], + videoTitles[position], JZVideoPlayer.SCREEN_WINDOW_LIST); Glide.with(convertView.getContext()) .load(videoThumbs[position]) .into(viewHolder.jzVideoPlayer.thumbImageView); diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardFresco.java b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardFresco.java index 9cb55ba05..548324ba6 100755 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardFresco.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardFresco.java @@ -4,6 +4,7 @@ import android.util.AttributeSet; import android.view.View; +import cn.jzvd.JZDataSource; import cn.jzvd.JZVideoPlayerStandard; import cn.jzvd.demo.R; @@ -42,10 +43,9 @@ public void init(Context context) { } @Override - public void setUp(String url, int screen, Object... objects) { - super.setUp(url, screen, objects); - if (objects.length == 0) return; - titleTextView.setText(objects[0].toString()); + 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); @@ -57,7 +57,7 @@ public void setUp(String url, int screen, Object... objects) { } 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); + View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); } } diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowShareButtonAfterFullscreen.java b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowShareButtonAfterFullscreen.java index 90753c433..10943f803 100755 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowShareButtonAfterFullscreen.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowShareButtonAfterFullscreen.java @@ -6,6 +6,7 @@ import android.widget.ImageView; import android.widget.Toast; +import cn.jzvd.JZDataSource; import cn.jzvd.JZVideoPlayerStandard; import cn.jzvd.demo.R; @@ -47,8 +48,8 @@ public void onClick(View v) { } @Override - public void setUp(String url, int screen, Object... objects) { - super.setUp(url, screen, objects); + public void setUp(JZDataSource jzDataSource, int screen) { + super.setUp(jzDataSource, screen); if (currentScreen == SCREEN_WINDOW_FULLSCREEN) { shareButton.setVisibility(View.VISIBLE); } else { diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowTitleAfterFullscreen.java b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowTitleAfterFullscreen.java index f36beac3a..19116d06d 100755 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowTitleAfterFullscreen.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowTitleAfterFullscreen.java @@ -4,6 +4,7 @@ import android.util.AttributeSet; import android.view.View; +import cn.jzvd.JZDataSource; import cn.jzvd.JZVideoPlayerStandard; /** @@ -20,8 +21,8 @@ public JZVideoPlayerStandardShowTitleAfterFullscreen(Context context, AttributeS } @Override - public void setUp(String url, int screen, Object... objects) { - super.setUp(url, screen, objects); + public void setUp(JZDataSource jzDataSource, int screen) { + super.setUp(jzDataSource, screen); if (currentScreen == SCREEN_WINDOW_FULLSCREEN) { titleTextView.setVisibility(View.VISIBLE); } else { diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java index 7c730316b..7d392901d 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java @@ -9,15 +9,22 @@ public class JZDataSource { public int currentUrlIndex; public LinkedHashMap urlsMap = new LinkedHashMap(); + public String title = ""; public HashMap headerMap = new HashMap(); public boolean looping = false; - public Object[] otherObjects; + public Object[] objects; public JZDataSource(String url) { urlsMap.put(URL_KEY_DEFAULT, url); currentUrlIndex = 0; } + public JZDataSource(String url, String title) { + urlsMap.put(URL_KEY_DEFAULT, url); + this.title = title; + currentUrlIndex = 0; + } + public JZDataSource(Object url) { urlsMap.put(URL_KEY_DEFAULT, url); currentUrlIndex = 0; @@ -29,6 +36,13 @@ public JZDataSource(LinkedHashMap urlsMap) { currentUrlIndex = 0; } + public JZDataSource(LinkedHashMap urlsMap, String title) { + this.urlsMap.clear(); + this.urlsMap.putAll(urlsMap); + this.title = title; + currentUrlIndex = 0; + } + public Object getCurrentUrl() { return getValueFromLinkedMap(currentUrlIndex); } diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java index c2f00725b..85d410981 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java @@ -96,7 +96,6 @@ public void onAudioFocusChange(int focusChange) { protected static Timer UPDATE_PROGRESS_TIMER; public int currentState = -1; public int currentScreen = -1; - public Object[] objects = null; public long seekToInAdvance = 0; public ImageView startButton; public SeekBar progressBar; @@ -144,11 +143,11 @@ public static void releaseAllVideos() { } } - public static void startFullscreen(Context context, Class _class, String url, Object... objects) { - startFullscreen(context, _class, new JZDataSource(url), 0, objects); + public static void startFullscreen(Context context, Class _class, String url, String title) { + startFullscreen(context, _class, new JZDataSource(url, title)); } - public static void startFullscreen(Context context, Class _class, JZDataSource jzDataSource, int defaultUrlMapIndex, Object... objects) { + public static void startFullscreen(Context context, Class _class, JZDataSource jzDataSource) { hideSupportActionBar(context); JZUtils.setRequestedOrientation(context, FULLSCREEN_ORIENTATION); ViewGroup vp = (JZUtils.scanForActivity(context))//.getWindow().getDecorView(); @@ -166,7 +165,7 @@ public static void startFullscreen(Context context, Class _class, JZDataSource j vp.addView(jzVideoPlayer, lp); // final Animation ra = AnimationUtils.loadAnimation(context, R.anim.start_fullscreen); // jzVideoPlayer.setAnimation(ra); - jzVideoPlayer.setUp(jzDataSource, defaultUrlMapIndex, JZVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN, objects); + jzVideoPlayer.setUp(jzDataSource, JZVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN); CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis(); jzVideoPlayer.startButton.performClick(); } catch (InstantiationException e) { @@ -382,11 +381,11 @@ public void init(Context context) { } } - public void setUp(String url, int screen, Object... objects) { - setUp(new JZDataSource(url), screen, objects); + public void setUp(String url, String title, int screen) { + setUp(new JZDataSource(url, title), screen); } - public void setUp(JZDataSource jzDataSource, int screen, Object... objects) { + public void setUp(JZDataSource jzDataSource, int screen) { if (this.jzDataSource != null && jzDataSource.getCurrentUrl() != null && this.jzDataSource.containsTheUrl(jzDataSource.getCurrentUrl())) { return; @@ -414,7 +413,6 @@ public void setUp(JZDataSource jzDataSource, int screen, Object... objects) { } this.jzDataSource = jzDataSource; this.currentScreen = screen; - this.objects = objects; onStateNormal(); } @@ -975,7 +973,7 @@ public void startWindowFullscreen() { vp.addView(jzVideoPlayer, lp); jzVideoPlayer.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_FULLSCREEN); - jzVideoPlayer.setUp(jzDataSource, JZVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN, objects); + jzVideoPlayer.setUp(jzDataSource, JZVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN); jzVideoPlayer.setState(currentState); jzVideoPlayer.addTextureView(); JZVideoPlayerManager.setSecondFloor(jzVideoPlayer); @@ -1013,7 +1011,7 @@ public void startWindowTiny() { FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(400, 400); lp.gravity = Gravity.RIGHT | Gravity.BOTTOM; vp.addView(jzVideoPlayer, lp); - jzVideoPlayer.setUp(jzDataSource, JZVideoPlayerStandard.SCREEN_WINDOW_TINY, objects); + jzVideoPlayer.setUp(jzDataSource, JZVideoPlayerStandard.SCREEN_WINDOW_TINY); jzVideoPlayer.setState(currentState); jzVideoPlayer.addTextureView(); JZVideoPlayerManager.setSecondFloor(jzVideoPlayer); @@ -1075,7 +1073,7 @@ && isCurrentPlay() public void onEvent(int type) { if (JZ_USER_EVENT != null && isCurrentPlay() && !jzDataSource.urlsMap.isEmpty()) { - JZ_USER_EVENT.onEvent(type, jzDataSource.getCurrentUrl(), currentScreen, objects); + JZ_USER_EVENT.onEvent(type, jzDataSource.getCurrentUrl(), currentScreen); } } diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java index 2b756f1fc..6b0958352 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java @@ -26,7 +26,6 @@ import java.text.SimpleDateFormat; import java.util.Date; -import java.util.LinkedHashMap; import java.util.Timer; import java.util.TimerTask; @@ -114,9 +113,9 @@ public void init(Context context) { mRetryBtn.setOnClickListener(this); } - public void setUp(JZDataSource jzDataSource, int screen, Object... objects) { - super.setUp(jzDataSource, screen, objects); - if (objects.length != 0) titleTextView.setText(objects[0].toString()); + 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); From b542bbb10f5e0ad81e5f5bd2d9bfbd35e6ccf285 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Tue, 28 Aug 2018 20:41:17 +0800 Subject: [PATCH 12/14] fix on play resume bug --- .../src/main/java/cn/jzvd/JZVideoPlayer.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java index 85d410981..57724ca22 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java @@ -250,12 +250,20 @@ public static void goOnPlayOnResume() { if (JZVideoPlayerManager.getCurrentJzvd() != null) { JZVideoPlayer jzvd = JZVideoPlayerManager.getCurrentJzvd(); if (jzvd.currentState == JZVideoPlayer.CURRENT_STATE_PAUSE) { - jzvd.onStatePlaying(); - JZMediaManager.start(); + if (ON_PLAY_PAUSE_TMP_STATE == CURRENT_STATE_PAUSE) { + jzvd.onStatePause(); + JZMediaManager.pause(); + } else { + jzvd.onStatePlaying(); + JZMediaManager.start(); + } + ON_PLAY_PAUSE_TMP_STATE = 0; } } } + public static int ON_PLAY_PAUSE_TMP_STATE = 0; + public static void goOnPlayOnPause() { if (JZVideoPlayerManager.getCurrentJzvd() != null) { JZVideoPlayer jzvd = JZVideoPlayerManager.getCurrentJzvd(); @@ -264,6 +272,7 @@ public static void goOnPlayOnPause() { jzvd.currentState == JZVideoPlayer.CURRENT_STATE_ERROR) { // JZVideoPlayer.releaseAllVideos(); } else { + ON_PLAY_PAUSE_TMP_STATE = jzvd.currentState; jzvd.onStatePause(); JZMediaManager.pause(); } From 416dd309ee0e13fcc96107a4c0c2916dc462ae98 Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Thu, 30 Aug 2018 15:17:40 +0800 Subject: [PATCH 13/14] change main file name --- .../main/java/cn/jzvd/demo/ActivityApi.java | 28 +-- .../demo/ActivityApiCustomMediaPlayer.java | 39 ++-- .../jzvd/demo/ActivityApiExtendsNormal.java | 16 +- .../cn/jzvd/demo/ActivityApiOrientation.java | 26 +-- .../demo/ActivityApiRotationVideoSize.java | 30 ++-- .../cn/jzvd/demo/ActivityApiUIBigChange.java | 6 +- .../jzvd/demo/ActivityApiUISmallChange.java | 66 +++---- .../java/cn/jzvd/demo/ActivityDirectPlay.java | 10 +- .../ActivityListViewFragmentViewPager.java | 8 +- .../demo/ActivityListViewMultiHolder.java | 14 +- .../cn/jzvd/demo/ActivityListViewNormal.java | 12 +- .../demo/ActivityListViewRecyclerView.java | 17 +- .../main/java/cn/jzvd/demo/ActivityMain.java | 24 +-- .../java/cn/jzvd/demo/ActivityTinyWindow.java | 20 +-- ...ActivityTinyWindowListViewMultiHolder.java | 14 +- .../ActivityTinyWindowListViewNormal.java | 8 +- .../demo/ActivityTinyWindowRecycleView.java | 10 +- ...ivityTinyWindowRecycleViewMultiHolder.java | 16 +- .../java/cn/jzvd/demo/ActivityWebView.java | 16 +- .../jzvd/demo/AdapterRecyclerViewVideo.java | 8 +- .../java/cn/jzvd/demo/AdapterVideoList.java | 8 +- .../CustomMediaPlayerAssertFolder.java | 32 ++-- .../demo/CustomMediaPlayer/JZExoPlayer.java | 31 ++-- .../CustomMediaPlayer/JZMediaIjkplayer.java | 32 ++-- ...> JzvdStdAutoCompleteAfterFullscreen.java} | 8 +- ...StandardFresco.java => JzvdStdFresco.java} | 8 +- ...PlayerStandardMp3.java => JzvdStdMp3.java} | 9 +- ...zvdStdShowShareButtonAfterFullscreen.java} | 8 +- ...dStdShowTextureViewAfterAutoComplete.java} | 8 +- ...a => JzvdStdShowTitleAfterFullscreen.java} | 8 +- ...java => JzvdStdVolumeAfterFullscreen.java} | 8 +- ...ideoPlayerStandard.java => MyJzvdStd.java} | 8 +- .../main/java/cn/jzvd/demo/FragmentDemo.java | 4 +- app/src/main/res/layout/activity_api.xml | 2 +- .../activity_api_custom_mediaplayer.xml | 2 +- .../activity_api_rotation_videosize.xml | 2 +- .../res/layout/activity_extends_normal.xml | 2 +- app/src/main/res/layout/activity_main.xml | 2 +- .../main/res/layout/activity_orientation.xml | 2 +- .../main/res/layout/activity_tiny_window.xml | 2 +- .../res/layout/activity_ui_small_change.xml | 16 +- .../res/layout/header_auto_tiny_normal.xml | 2 +- app/src/main/res/layout/item_videoview.xml | 2 +- .../src/main/java/cn/jzvd/JZMediaManager.java | 6 +- .../src/main/java/cn/jzvd/JZMediaSystem.java | 34 ++-- ...izeTextureView.java => JZTextureView.java} | 12 +- ...tionStandard.java => JZUserActionStd.java} | 2 +- .../src/main/java/cn/jzvd/JZUtils.java | 5 +- .../cn/jzvd/{JZVideoPlayer.java => Jzvd.java} | 170 +++++++++--------- ...JZVideoPlayerManager.java => JzvdMgr.java} | 20 +-- ...ZVideoPlayerStandard.java => JzvdStd.java} | 16 +- 51 files changed, 427 insertions(+), 432 deletions(-) rename app/src/main/java/cn/jzvd/demo/CustomView/{JZVideoPlayerStandardAutoCompleteAfterFullscreen.java => JzvdStdAutoCompleteAfterFullscreen.java} (82%) rename app/src/main/java/cn/jzvd/demo/CustomView/{JZVideoPlayerStandardFresco.java => JzvdStdFresco.java} (89%) rename app/src/main/java/cn/jzvd/demo/CustomView/{JZVideoPlayerStandardMp3.java => JzvdStdMp3.java} (86%) rename app/src/main/java/cn/jzvd/demo/CustomView/{JZVideoPlayerStandardShowShareButtonAfterFullscreen.java => JzvdStdShowShareButtonAfterFullscreen.java} (79%) rename app/src/main/java/cn/jzvd/demo/CustomView/{JZVideoPlayerStandardShowTextureViewAfterAutoComplete.java => JzvdStdShowTextureViewAfterAutoComplete.java} (54%) rename app/src/main/java/cn/jzvd/demo/CustomView/{JZVideoPlayerStandardShowTitleAfterFullscreen.java => JzvdStdShowTitleAfterFullscreen.java} (66%) rename app/src/main/java/cn/jzvd/demo/CustomView/{JZVideoPlayerStandardVolumeAfterFullscreen.java => JzvdStdVolumeAfterFullscreen.java} (77%) rename app/src/main/java/cn/jzvd/demo/CustomView/{MyJZVideoPlayerStandard.java => MyJzvdStd.java} (92%) rename jiaozivideoplayer/src/main/java/cn/jzvd/{JZResizeTextureView.java => JZTextureView.java} (92%) rename jiaozivideoplayer/src/main/java/cn/jzvd/{JZUserActionStandard.java => JZUserActionStd.java} (74%) rename jiaozivideoplayer/src/main/java/cn/jzvd/{JZVideoPlayer.java => Jzvd.java} (86%) rename jiaozivideoplayer/src/main/java/cn/jzvd/{JZVideoPlayerManager.java => JzvdMgr.java} (57%) rename jiaozivideoplayer/src/main/java/cn/jzvd/{JZVideoPlayerStandard.java => JzvdStd.java} (98%) diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApi.java b/app/src/main/java/cn/jzvd/demo/ActivityApi.java index a1781437c..15d7a9b42 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApi.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApi.java @@ -21,16 +21,16 @@ import java.util.LinkedHashMap; import cn.jzvd.JZDataSource; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; /** * Created by Nathen on 16/7/31. */ public class ActivityApi extends AppCompatActivity implements View.OnClickListener { Button mSmallChange, mBigChange, mOrientation, mExtendsNormalActivity, mRationAndVideoSize, mCustomMediaPlayer; - JZVideoPlayerStandard mJzVideoPlayerStandard; - JZVideoPlayer.JZAutoFullscreenListener mSensorEventListener; + JzvdStd mJzvdStd; + Jzvd.JZAutoFullscreenListener mSensorEventListener; SensorManager mSensorManager; @Override @@ -58,7 +58,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { mCustomMediaPlayer.setOnClickListener(this); - mJzVideoPlayerStandard = findViewById(R.id.jz_video); + mJzvdStd = findViewById(R.id.jz_video); LinkedHashMap map = new LinkedHashMap(); String proxyUrl = ApplicationDemo.getProxy(this).getProxyUrl(VideoConstant.videoUrls[0][9]); @@ -70,10 +70,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { jzDataSource.looping = true; jzDataSource.currentUrlIndex = 2; jzDataSource.headerMap.put("key", "value");//header - mJzVideoPlayerStandard.setUp(jzDataSource - , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL); - Glide.with(this).load(VideoConstant.videoThumbList[0]).into(mJzVideoPlayerStandard.thumbImageView); - mJzVideoPlayerStandard.seekToInAdvance = 20000; + mJzvdStd.setUp(jzDataSource + , JzvdStd.SCREEN_WINDOW_NORMAL); + Glide.with(this).load(VideoConstant.videoThumbList[0]).into(mJzvdStd.thumbImageView); + mJzvdStd.seekToInAdvance = 20000; //JZVideoPlayer.SAVE_PROGRESS = false; /** Play video in local path, eg:record by system camera **/ @@ -85,7 +85,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { // videoController1.thumbImageView); /** volley Fresco omit **/ mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); - mSensorEventListener = new JZVideoPlayer.JZAutoFullscreenListener(); + mSensorEventListener = new Jzvd.JZAutoFullscreenListener(); } @Override @@ -119,21 +119,21 @@ protected void onResume() { Sensor accelerometerSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); mSensorManager.registerListener(mSensorEventListener, accelerometerSensor, SensorManager.SENSOR_DELAY_NORMAL); //home back - JZVideoPlayer.goOnPlayOnResume(); + Jzvd.goOnPlayOnResume(); } @Override protected void onPause() { super.onPause(); mSensorManager.unregisterListener(mSensorEventListener); - JZVideoPlayer.clearSavedProgress(this, null); + Jzvd.clearSavedProgress(this, null); //home back - JZVideoPlayer.goOnPlayOnPause(); + Jzvd.goOnPlayOnPause(); } @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java b/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java index 7d83a545f..41bc24294 100755 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiCustomMediaPlayer.java @@ -12,12 +12,11 @@ import com.bumptech.glide.Glide; import java.io.IOException; -import java.util.LinkedHashMap; import cn.jzvd.JZDataSource; import cn.jzvd.JZMediaSystem; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; import cn.jzvd.demo.CustomMediaPlayer.CustomMediaPlayerAssertFolder; import cn.jzvd.demo.CustomMediaPlayer.JZExoPlayer; import cn.jzvd.demo.CustomMediaPlayer.JZMediaIjkplayer; @@ -28,7 +27,7 @@ public class ActivityApiCustomMediaPlayer extends AppCompatActivity implements View.OnClickListener { Button mChangeToIjk, mChangeToSystemMediaPlayer, mChangeToExo; - JZVideoPlayerStandard jzVideoPlayerStandard; + JzvdStd jzvdStd; Handler handler = new Handler();//这里其实并不需要handler,为了防止播放中切换播放器引擎导致的崩溃,实际使用时一般不会遇到,可以随时调用JZVideoPlayer.setMediaInterface(); @Override @@ -41,7 +40,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { getSupportActionBar().setTitle("CustomMediaPlayer"); setContentView(R.layout.activity_api_custom_mediaplayer); - jzVideoPlayerStandard = findViewById(R.id.videoplayer); + jzvdStd = findViewById(R.id.videoplayer); mChangeToIjk = findViewById(R.id.change_to_ijkplayer); mChangeToSystemMediaPlayer = findViewById(R.id.change_to_system_mediaplayer); mChangeToExo = findViewById(R.id.change_to_exo); @@ -57,45 +56,45 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { } catch (IOException e) { e.printStackTrace(); } - jzVideoPlayerStandard.setUp(jzDataSource, JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL); + jzvdStd.setUp(jzDataSource, JzvdStd.SCREEN_WINDOW_NORMAL); Glide.with(this) .load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png") - .into(jzVideoPlayerStandard.thumbImageView); + .into(jzvdStd.thumbImageView); - JZVideoPlayer.setMediaInterface(new CustomMediaPlayerAssertFolder());//进入此页面修改MediaInterface,让此页面的jzvd正常工作 + Jzvd.setMediaInterface(new CustomMediaPlayerAssertFolder());//进入此页面修改MediaInterface,让此页面的jzvd正常工作 } @Override public void onClick(View view) { switch (view.getId()) { case R.id.change_to_ijkplayer: - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); handler.postDelayed(new Runnable() { @Override public void run() { - JZVideoPlayer.setMediaInterface(new JZMediaIjkplayer()); + 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: - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); handler.postDelayed(new Runnable() { @Override public void run() { - JZVideoPlayer.setMediaInterface(new JZMediaSystem()); + Jzvd.setMediaInterface(new JZMediaSystem()); } }, 1000); Toast.makeText(this, "Change to MediaPlayer", Toast.LENGTH_SHORT).show(); finish(); break; case R.id.change_to_exo: - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); handler.postDelayed(new Runnable() { @Override public void run() { - JZVideoPlayer.setMediaInterface(new JZExoPlayer()); + Jzvd.setMediaInterface(new JZExoPlayer()); } }, 1000); Toast.makeText(this, "Change to ExoPlayer", Toast.LENGTH_SHORT).show(); @@ -106,14 +105,14 @@ public void run() { @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); handler.postDelayed(new Runnable() { @Override public void run() { - JZVideoPlayer.setMediaInterface(new JZMediaSystem()); + Jzvd.setMediaInterface(new JZMediaSystem()); } }, 1000); super.onBackPressed(); @@ -122,18 +121,18 @@ public void run() { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); handler.postDelayed(new Runnable() { @Override public void run() { - JZVideoPlayer.setMediaInterface(new JZMediaSystem()); + Jzvd.setMediaInterface(new JZMediaSystem()); } }, 1000); finish(); diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java b/app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java index e62df08f9..6543181da 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java @@ -5,8 +5,8 @@ import com.bumptech.glide.Glide; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; /** * Created by Nathen on 2017/9/19. @@ -18,17 +18,17 @@ public class ActivityApiExtendsNormal extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_extends_normal); - JZVideoPlayerStandard jzVideoPlayerStandard = findViewById(R.id.videoplayer); - jzVideoPlayerStandard.setUp(VideoConstant.videoUrlList[0], "饺子不信" - , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL); + JzvdStd jzvdStd = findViewById(R.id.videoplayer); + jzvdStd.setUp(VideoConstant.videoUrlList[0], "饺子不信" + , JzvdStd.SCREEN_WINDOW_NORMAL); Glide.with(this) .load(VideoConstant.videoThumbList[0]) - .into(jzVideoPlayerStandard.thumbImageView); + .into(jzvdStd.thumbImageView); } @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); @@ -37,6 +37,6 @@ public void onBackPressed() { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } } diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java b/app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java index eaa0aa2f4..f343387e8 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java @@ -8,14 +8,14 @@ import com.bumptech.glide.Glide; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; /** * Created by Nathen on 2016/12/30. */ public class ActivityApiOrientation extends AppCompatActivity { - JZVideoPlayerStandard mJzVideoPlayerStandard; + JzvdStd mJzvdStd; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -26,21 +26,21 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { getSupportActionBar().setDisplayUseLogoEnabled(false); getSupportActionBar().setTitle("Orientation"); setContentView(R.layout.activity_orientation); - mJzVideoPlayerStandard = findViewById(R.id.jz_video); - mJzVideoPlayerStandard.setUp(VideoConstant.videoUrlList[0], "饺子不信" - , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL); + mJzvdStd = findViewById(R.id.jz_video); + mJzvdStd.setUp(VideoConstant.videoUrlList[0], "饺子不信" + , JzvdStd.SCREEN_WINDOW_NORMAL); Glide.with(this) .load(VideoConstant.videoThumbList[0]) - .into(mJzVideoPlayerStandard.thumbImageView); + .into(mJzvdStd.thumbImageView); - JZVideoPlayer.FULLSCREEN_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; - JZVideoPlayer.NORMAL_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; + Jzvd.FULLSCREEN_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; + Jzvd.NORMAL_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; } @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); @@ -49,11 +49,11 @@ public void onBackPressed() { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); //Change these two variables back - JZVideoPlayer.FULLSCREEN_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_SENSOR; - JZVideoPlayer.NORMAL_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; + Jzvd.FULLSCREEN_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_SENSOR; + Jzvd.NORMAL_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; } @Override diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiRotationVideoSize.java b/app/src/main/java/cn/jzvd/demo/ActivityApiRotationVideoSize.java index 8e8b775d7..bc761a45d 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiRotationVideoSize.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiRotationVideoSize.java @@ -9,8 +9,8 @@ import com.bumptech.glide.Glide; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; /** * Created by Nathen on 2017/11/2. @@ -18,7 +18,7 @@ public class ActivityApiRotationVideoSize extends AppCompatActivity implements View.OnClickListener { - JZVideoPlayerStandard myJZVideoPlayerStandard; + JzvdStd myJzvdStd; Button mBtnRotation, mBtnFillParent, mBtnFillCrop, mBtnOriginal; @Override @@ -31,14 +31,14 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { getSupportActionBar().setTitle("RotationAndVideoSize"); setContentView(R.layout.activity_api_rotation_videosize); - myJZVideoPlayerStandard = findViewById(R.id.jz_video); - myJZVideoPlayerStandard.setUp(VideoConstant.videoUrls[0][7], VideoConstant.videoTitles[0][7] - , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL); + myJzvdStd = findViewById(R.id.jz_video); + myJzvdStd.setUp(VideoConstant.videoUrls[0][7], VideoConstant.videoTitles[0][7] + , JzvdStd.SCREEN_WINDOW_NORMAL); Glide.with(this) .load(VideoConstant.videoThumbs[0][7]) - .into(myJZVideoPlayerStandard.thumbImageView); + .into(myJzvdStd.thumbImageView); // The Point IS - myJZVideoPlayerStandard.videoRotation = 180; + myJzvdStd.videoRotation = 180; mBtnRotation = findViewById(R.id.rotation_to_90); mBtnFillParent = findViewById(R.id.video_image_display_fill_parent); @@ -54,19 +54,19 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { public void onClick(View view) { switch (view.getId()) { case R.id.rotation_to_90: - JZVideoPlayer.setTextureViewRotation(90); + Jzvd.setTextureViewRotation(90); break; case R.id.video_image_display_fill_parent: - JZVideoPlayer.setVideoImageDisplayType(JZVideoPlayer.VIDEO_IMAGE_DISPLAY_TYPE_FILL_PARENT); + Jzvd.setVideoImageDisplayType(Jzvd.VIDEO_IMAGE_DISPLAY_TYPE_FILL_PARENT); break; case R.id.video_image_display_fill_crop: - JZVideoPlayer.setVideoImageDisplayType(JZVideoPlayer.VIDEO_IMAGE_DISPLAY_TYPE_FILL_SCROP); + Jzvd.setVideoImageDisplayType(Jzvd.VIDEO_IMAGE_DISPLAY_TYPE_FILL_SCROP); break; case R.id.video_image_diaplay_original: - JZVideoPlayer.setVideoImageDisplayType(JZVideoPlayer.VIDEO_IMAGE_DISPLAY_TYPE_ORIGINAL); + Jzvd.setVideoImageDisplayType(Jzvd.VIDEO_IMAGE_DISPLAY_TYPE_ORIGINAL); break; } @@ -75,13 +75,13 @@ public void onClick(View view) { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); - JZVideoPlayer.setVideoImageDisplayType(JZVideoPlayer.VIDEO_IMAGE_DISPLAY_TYPE_ADAPTER); + Jzvd.releaseAllVideos(); + Jzvd.setVideoImageDisplayType(Jzvd.VIDEO_IMAGE_DISPLAY_TYPE_ADAPTER); } @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiUIBigChange.java b/app/src/main/java/cn/jzvd/demo/ActivityApiUIBigChange.java index 62b5ebd8c..e53aad6a2 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiUIBigChange.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiUIBigChange.java @@ -5,7 +5,7 @@ import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; -import cn.jzvd.JZVideoPlayer; +import cn.jzvd.Jzvd; /** * Created by Nathen on 16/7/31. @@ -25,7 +25,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); @@ -34,7 +34,7 @@ public void onBackPressed() { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java index 8637b104f..ceab8ed19 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java @@ -7,27 +7,27 @@ import com.bumptech.glide.Glide; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; -import cn.jzvd.demo.CustomView.JZVideoPlayerStandardAutoCompleteAfterFullscreen; -import cn.jzvd.demo.CustomView.JZVideoPlayerStandardMp3; -import cn.jzvd.demo.CustomView.JZVideoPlayerStandardShowShareButtonAfterFullscreen; -import cn.jzvd.demo.CustomView.JZVideoPlayerStandardShowTextureViewAfterAutoComplete; -import cn.jzvd.demo.CustomView.JZVideoPlayerStandardShowTitleAfterFullscreen; -import cn.jzvd.demo.CustomView.JZVideoPlayerStandardVolumeAfterFullscreen; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; +import cn.jzvd.demo.CustomView.JzvdStdAutoCompleteAfterFullscreen; +import cn.jzvd.demo.CustomView.JzvdStdMp3; +import cn.jzvd.demo.CustomView.JzvdStdShowShareButtonAfterFullscreen; +import cn.jzvd.demo.CustomView.JzvdStdShowTextureViewAfterAutoComplete; +import cn.jzvd.demo.CustomView.JzvdStdShowTitleAfterFullscreen; +import cn.jzvd.demo.CustomView.JzvdStdVolumeAfterFullscreen; /** * Created by Nathen on 16/7/31. */ public class ActivityApiUISmallChange extends AppCompatActivity { - JZVideoPlayerStandardShowShareButtonAfterFullscreen jzVideoPlayerStandardWithShareButton; - JZVideoPlayerStandardShowTitleAfterFullscreen jzVideoPlayerStandardShowTitleAfterFullscreen; - JZVideoPlayerStandardShowTextureViewAfterAutoComplete jzVideoPlayerStandardShowTextureViewAfterAutoComplete; - JZVideoPlayerStandardAutoCompleteAfterFullscreen jzVideoPlayerStandardAutoCompleteAfterFullscreen; - JZVideoPlayerStandardVolumeAfterFullscreen jzVideoPlayerStandardVolumeAfterFullscreen; - JZVideoPlayerStandardMp3 jzVideoPlayerStandardMp3; + JzvdStdShowShareButtonAfterFullscreen jzVideoPlayerStandardWithShareButton; + JzvdStdShowTitleAfterFullscreen jzVideoPlayerStandardShowTitleAfterFullscreen; + JzvdStdShowTextureViewAfterAutoComplete jzVideoPlayerStandardShowTextureViewAfterAutoComplete; + JzvdStdAutoCompleteAfterFullscreen jzVideoPlayerStandardAutoCompleteAfterFullscreen; + JzvdStdVolumeAfterFullscreen jzVideoPlayerStandardVolumeAfterFullscreen; + JzvdStdMp3 jzVideoPlayerStandardMp3; - JZVideoPlayerStandard jzVideoPlayerStandard_1_1, jzVideoPlayerStandard_16_9; + JzvdStd jzvdStd_1_1, jzvdStd_16_9; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -40,7 +40,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { setContentView(R.layout.activity_ui_small_change); jzVideoPlayerStandardWithShareButton = findViewById(R.id.custom_videoplayer_standard_with_share_button); - jzVideoPlayerStandardWithShareButton.setUp(VideoConstant.videoUrlList[3], "饺子想呼吸", JZVideoPlayer.SCREEN_WINDOW_NORMAL + jzVideoPlayerStandardWithShareButton.setUp(VideoConstant.videoUrlList[3], "饺子想呼吸", Jzvd.SCREEN_WINDOW_NORMAL ); Glide.with(this) .load(VideoConstant.videoThumbList[3]) @@ -48,53 +48,53 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { jzVideoPlayerStandardShowTitleAfterFullscreen = findViewById(R.id.custom_videoplayer_standard_show_title_after_fullscreen); - jzVideoPlayerStandardShowTitleAfterFullscreen.setUp(VideoConstant.videoUrlList[4], "饺子想摇头", JZVideoPlayer.SCREEN_WINDOW_NORMAL + jzVideoPlayerStandardShowTitleAfterFullscreen.setUp(VideoConstant.videoUrlList[4], "饺子想摇头", Jzvd.SCREEN_WINDOW_NORMAL ); Glide.with(this) .load(VideoConstant.videoThumbList[4]) .into(jzVideoPlayerStandardShowTitleAfterFullscreen.thumbImageView); jzVideoPlayerStandardShowTextureViewAfterAutoComplete = findViewById(R.id.custom_videoplayer_standard_show_textureview_aoto_complete); - jzVideoPlayerStandardShowTextureViewAfterAutoComplete.setUp(VideoConstant.videoUrlList[5], "饺子想旅行", JZVideoPlayer.SCREEN_WINDOW_NORMAL + jzVideoPlayerStandardShowTextureViewAfterAutoComplete.setUp(VideoConstant.videoUrlList[5], "饺子想旅行", Jzvd.SCREEN_WINDOW_NORMAL ); Glide.with(this) .load(VideoConstant.videoThumbList[5]) .into(jzVideoPlayerStandardShowTextureViewAfterAutoComplete.thumbImageView); jzVideoPlayerStandardAutoCompleteAfterFullscreen = findViewById(R.id.custom_videoplayer_standard_aoto_complete); - jzVideoPlayerStandardAutoCompleteAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], "饺子没来", JZVideoPlayer.SCREEN_WINDOW_NORMAL + jzVideoPlayerStandardAutoCompleteAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], "饺子没来", Jzvd.SCREEN_WINDOW_NORMAL ); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzVideoPlayerStandardAutoCompleteAfterFullscreen.thumbImageView); - jzVideoPlayerStandard_1_1 = findViewById(R.id.jz_videoplayer_1_1); - jzVideoPlayerStandard_1_1.setUp(VideoConstant.videoUrls[0][1], "饺子有事吗", JZVideoPlayer.SCREEN_WINDOW_NORMAL + jzvdStd_1_1 = findViewById(R.id.jz_videoplayer_1_1); + jzvdStd_1_1.setUp(VideoConstant.videoUrls[0][1], "饺子有事吗", Jzvd.SCREEN_WINDOW_NORMAL ); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) - .into(jzVideoPlayerStandard_1_1.thumbImageView); - jzVideoPlayerStandard_1_1.widthRatio = 1; - jzVideoPlayerStandard_1_1.heightRatio = 1; + .into(jzvdStd_1_1.thumbImageView); + jzvdStd_1_1.widthRatio = 1; + jzvdStd_1_1.heightRatio = 1; - jzVideoPlayerStandard_16_9 = findViewById(R.id.jz_videoplayer_16_9); - jzVideoPlayerStandard_16_9.setUp(VideoConstant.videoUrls[0][1], "饺子来不了", JZVideoPlayer.SCREEN_WINDOW_NORMAL + jzvdStd_16_9 = findViewById(R.id.jz_videoplayer_16_9); + jzvdStd_16_9.setUp(VideoConstant.videoUrls[0][1], "饺子来不了", Jzvd.SCREEN_WINDOW_NORMAL ); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) - .into(jzVideoPlayerStandard_16_9.thumbImageView); - jzVideoPlayerStandard_16_9.widthRatio = 16; - jzVideoPlayerStandard_16_9.heightRatio = 9; + .into(jzvdStd_16_9.thumbImageView); + jzvdStd_16_9.widthRatio = 16; + jzvdStd_16_9.heightRatio = 9; jzVideoPlayerStandardVolumeAfterFullscreen = findViewById(R.id.jz_videoplayer_volume); - jzVideoPlayerStandardVolumeAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], "饺子摇摆", JZVideoPlayer.SCREEN_WINDOW_NORMAL + jzVideoPlayerStandardVolumeAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], "饺子摇摆", Jzvd.SCREEN_WINDOW_NORMAL ); Glide.with(this) .load(VideoConstant.videoThumbs[0][1]) .into(jzVideoPlayerStandardVolumeAfterFullscreen.thumbImageView); jzVideoPlayerStandardMp3 = findViewById(R.id.jz_videoplayer_mp3); - jzVideoPlayerStandardMp3.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", "饺子摇摆", JZVideoPlayer.SCREEN_WINDOW_NORMAL + jzVideoPlayerStandardMp3.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]) @@ -105,7 +105,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); @@ -114,7 +114,7 @@ public void onBackPressed() { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override diff --git a/app/src/main/java/cn/jzvd/demo/ActivityDirectPlay.java b/app/src/main/java/cn/jzvd/demo/ActivityDirectPlay.java index 5abe7e804..ddb46bde9 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityDirectPlay.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityDirectPlay.java @@ -8,8 +8,8 @@ import android.widget.Button; import android.widget.Toast; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; /** * Created by Nathen on 16/7/31. @@ -40,7 +40,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { public void onClick(View v) { switch (v.getId()) { case R.id.fullscreen: - JZVideoPlayerStandard.startFullscreen(this, JZVideoPlayerStandard.class, VideoConstant.videoUrlList[6], "饺子辛苦了"); + JzvdStd.startFullscreen(this, JzvdStd.class, VideoConstant.videoUrlList[6], "饺子辛苦了"); break; case R.id.tiny_window: Toast.makeText(ActivityDirectPlay.this, "Comming Soon", Toast.LENGTH_SHORT).show(); @@ -50,7 +50,7 @@ public void onClick(View v) { @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); @@ -59,7 +59,7 @@ public void onBackPressed() { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override diff --git a/app/src/main/java/cn/jzvd/demo/ActivityListViewFragmentViewPager.java b/app/src/main/java/cn/jzvd/demo/ActivityListViewFragmentViewPager.java index ca8aca8db..7648368ed 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityListViewFragmentViewPager.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityListViewFragmentViewPager.java @@ -11,7 +11,7 @@ import java.util.ArrayList; import java.util.List; -import cn.jzvd.JZVideoPlayer; +import cn.jzvd.Jzvd; /** * Created by Nathen @@ -43,7 +43,7 @@ protected void onCreate(Bundle savedInstanceState) { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override @@ -53,7 +53,7 @@ public void onPageScrolled(int position, float positionOffset, int positionOffse @Override public void onPageSelected(int position) { - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override @@ -63,7 +63,7 @@ public void onPageScrollStateChanged(int state) { @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); diff --git a/app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java b/app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java index 78fd3922d..50ea7be22 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java @@ -14,8 +14,8 @@ import com.bumptech.glide.Glide; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; /** * Created by Nathen @@ -48,14 +48,14 @@ public void onScrollStateChanged(AbsListView view, int scrollState) { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { - JZVideoPlayer.onScrollReleaseAllVideos(view, firstVisibleItem, visibleItemCount, totalItemCount); + Jzvd.onScrollReleaseAllVideos(view, firstVisibleItem, visibleItemCount, totalItemCount); } }); } @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); @@ -64,7 +64,7 @@ public void onBackPressed() { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override @@ -119,7 +119,7 @@ public View getView(int position, View convertView, ViewGroup parent) { viewHolder.jzVideoPlayer.setUp( VideoConstant.videoUrls[0][position], - VideoConstant.videoTitles[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST); + VideoConstant.videoTitles[0][position], Jzvd.SCREEN_WINDOW_LIST); viewHolder.jzVideoPlayer.positionInList = position; Glide.with(ActivityListViewMultiHolder.this) .load(VideoConstant.videoThumbs[0][position]) @@ -150,7 +150,7 @@ public int getViewTypeCount() { } class VideoHolder { - JZVideoPlayerStandard jzVideoPlayer; + JzvdStd jzVideoPlayer; } class TextViewHolder { diff --git a/app/src/main/java/cn/jzvd/demo/ActivityListViewNormal.java b/app/src/main/java/cn/jzvd/demo/ActivityListViewNormal.java index 55607084b..1ce009bef 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityListViewNormal.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityListViewNormal.java @@ -9,7 +9,7 @@ import android.widget.AbsListView; import android.widget.ListView; -import cn.jzvd.JZVideoPlayer; +import cn.jzvd.Jzvd; /** * Created by Nathen on 16/7/31. @@ -18,7 +18,7 @@ public class ActivityListViewNormal extends AppCompatActivity { ListView listView; SensorManager sensorManager; - JZVideoPlayer.JZAutoFullscreenListener sensorEventListener; + Jzvd.JZAutoFullscreenListener sensorEventListener; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -44,17 +44,17 @@ public void onScrollStateChanged(AbsListView view, int scrollState) { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { - JZVideoPlayer.onScrollReleaseAllVideos(view, firstVisibleItem, visibleItemCount, totalItemCount); + Jzvd.onScrollReleaseAllVideos(view, firstVisibleItem, visibleItemCount, totalItemCount); } }); sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); - sensorEventListener = new JZVideoPlayer.JZAutoFullscreenListener(); + sensorEventListener = new Jzvd.JZAutoFullscreenListener(); } @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); @@ -71,7 +71,7 @@ protected void onResume() { protected void onPause() { super.onPause(); sensorManager.unregisterListener(sensorEventListener); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override diff --git a/app/src/main/java/cn/jzvd/demo/ActivityListViewRecyclerView.java b/app/src/main/java/cn/jzvd/demo/ActivityListViewRecyclerView.java index 195779b5e..5230e9770 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityListViewRecyclerView.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityListViewRecyclerView.java @@ -9,9 +9,8 @@ import android.view.View; import cn.jzvd.JZMediaManager; -import cn.jzvd.JZUtils; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerManager; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdMgr; /** * Created by yujunkui on 16/8/29. @@ -43,11 +42,11 @@ public void onChildViewAttachedToWindow(View view) { @Override public void onChildViewDetachedFromWindow(View view) { - JZVideoPlayer jzvd = view.findViewById(R.id.videoplayer); + Jzvd jzvd = view.findViewById(R.id.videoplayer); if (jzvd != null && jzvd.jzDataSource.containsTheUrl(JZMediaManager.getCurrentUrl())) { - JZVideoPlayer currentJzvd = JZVideoPlayerManager.getCurrentJzvd(); - if (currentJzvd != null && currentJzvd.currentScreen != JZVideoPlayer.SCREEN_WINDOW_FULLSCREEN) { - JZVideoPlayer.releaseAllVideos(); + Jzvd currentJzvd = JzvdMgr.getCurrentJzvd(); + if (currentJzvd != null && currentJzvd.currentScreen != Jzvd.SCREEN_WINDOW_FULLSCREEN) { + Jzvd.releaseAllVideos(); } } } @@ -56,7 +55,7 @@ public void onChildViewDetachedFromWindow(View view) { @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); @@ -65,7 +64,7 @@ public void onBackPressed() { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override diff --git a/app/src/main/java/cn/jzvd/demo/ActivityMain.java b/app/src/main/java/cn/jzvd/demo/ActivityMain.java index 521a48b4a..dd71741d6 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityMain.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityMain.java @@ -11,10 +11,10 @@ import com.bumptech.glide.Glide; import cn.jzvd.JZUserAction; -import cn.jzvd.JZUserActionStandard; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; -import cn.jzvd.demo.CustomView.MyJZVideoPlayerStandard; +import cn.jzvd.JZUserActionStd; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; +import cn.jzvd.demo.CustomView.MyJzvdStd; /** * Created by Nathen on 16/7/22. @@ -22,7 +22,7 @@ public class ActivityMain extends AppCompatActivity implements View.OnClickListener { - MyJZVideoPlayerStandard myJZVideoPlayerStandard; + MyJzvdStd myJZVideoPlayerStandard; Button mTinyWindow, mListView, mDirectFullscreen, mApi, mWebView; @@ -45,20 +45,20 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { myJZVideoPlayerStandard = findViewById(R.id.jz_video); myJZVideoPlayerStandard.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4" - , "饺子快长大", JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL); + , "饺子快长大", JzvdStd.SCREEN_WINDOW_NORMAL); Glide.with(this).load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png").into(myJZVideoPlayerStandard.thumbImageView); - JZVideoPlayer.setJzUserAction(new MyUserActionStandard()); + Jzvd.setJzUserAction(new MyUserActionStd()); } @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); @@ -88,7 +88,7 @@ public void onClick(View v) { /** * 这只是给埋点统计用户数据用的,不能写和播放相关的逻辑,监听事件请参考MyJZVideoPlayerStandard,复写函数取得相应事件 */ - class MyUserActionStandard implements JZUserActionStandard { + class MyUserActionStd implements JZUserActionStd { @Override public void onEvent(int type, Object url, int screen, Object... objects) { @@ -133,10 +133,10 @@ public void onEvent(int type, Object url, int screen, Object... objects) { Log.i("USER_EVENT", "ON_TOUCH_SCREEN_SEEK_POSITION" + " title is : " + (objects.length == 0 ? "" : objects[0]) + " url is : " + url + " screen is : " + screen); break; - case JZUserActionStandard.ON_CLICK_START_THUMB: + case JZUserActionStd.ON_CLICK_START_THUMB: Log.i("USER_EVENT", "ON_CLICK_START_THUMB" + " title is : " + (objects.length == 0 ? "" : objects[0]) + " url is : " + url + " screen is : " + screen); break; - case JZUserActionStandard.ON_CLICK_BLANK: + case JZUserActionStd.ON_CLICK_BLANK: Log.i("USER_EVENT", "ON_CLICK_BLANK" + " title is : " + (objects.length == 0 ? "" : objects[0]) + " url is : " + url + " screen is : " + screen); break; default: diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java index 8b52130df..3ee20a63b 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java @@ -10,8 +10,8 @@ import com.bumptech.glide.Glide; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; /** * Created by Nathen on 2017/10/31. @@ -19,7 +19,7 @@ public class ActivityTinyWindow extends AppCompatActivity implements View.OnClickListener { - JZVideoPlayerStandard mJzVideoPlayerStandard; + JzvdStd mJzvdStd; Button mBtnTinyWindow, mBtnTinyWindowListView, mBtnTinyWindowListViewMultiHolder, mBtnTinyWindowRecycle, mBtnTinyWindowRecycleMultiHolder; @Override @@ -32,12 +32,12 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { getSupportActionBar().setTitle("TinyWindow"); setContentView(R.layout.activity_tiny_window); - mJzVideoPlayerStandard = findViewById(R.id.jz_video); - mJzVideoPlayerStandard.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4", "饺子快长大" - , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL); + mJzvdStd = findViewById(R.id.jz_video); + mJzvdStd.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4", "饺子快长大" + , JzvdStd.SCREEN_WINDOW_NORMAL); Glide.with(this) .load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png") - .into(mJzVideoPlayerStandard.thumbImageView); + .into(mJzvdStd.thumbImageView); mBtnTinyWindow = findViewById(R.id.tiny_window); mBtnTinyWindowListView = findViewById(R.id.auto_tiny_list_view); @@ -56,7 +56,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { public void onClick(View view) { switch (view.getId()) { case R.id.tiny_window: - mJzVideoPlayerStandard.startWindowTiny(); + mJzvdStd.startWindowTiny(); break; case R.id.auto_tiny_list_view: startActivity(new Intent(this, ActivityTinyWindowListViewNormal.class)); @@ -76,12 +76,12 @@ public void onClick(View view) { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java index f34ead78c..6c25ca04b 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java @@ -14,8 +14,8 @@ import com.bumptech.glide.Glide; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; /** * Created by Nathen on 2017/10/31. @@ -48,14 +48,14 @@ public void onScrollStateChanged(AbsListView view, int scrollState) { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { - JZVideoPlayer.onScrollAutoTiny(view, firstVisibleItem, visibleItemCount, totalItemCount); + Jzvd.onScrollAutoTiny(view, firstVisibleItem, visibleItemCount, totalItemCount); } }); } @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); @@ -64,7 +64,7 @@ public void onBackPressed() { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override @@ -119,7 +119,7 @@ public View getView(int position, View convertView, ViewGroup parent) { viewHolder.jzVideoPlayer.setUp( VideoConstant.videoUrls[0][position], - VideoConstant.videoTitles[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST); + VideoConstant.videoTitles[0][position], Jzvd.SCREEN_WINDOW_LIST); viewHolder.jzVideoPlayer.positionInList = position; Glide.with(ActivityTinyWindowListViewMultiHolder.this).load(VideoConstant.videoThumbs[0][position]).into(viewHolder.jzVideoPlayer.thumbImageView); } else { @@ -148,7 +148,7 @@ public int getViewTypeCount() { } class VideoHolder { - JZVideoPlayerStandard jzVideoPlayer; + JzvdStd jzVideoPlayer; } class TextViewHolder { diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewNormal.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewNormal.java index 003bb7468..83ff43f3c 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewNormal.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewNormal.java @@ -7,7 +7,7 @@ import android.widget.AbsListView; import android.widget.ListView; -import cn.jzvd.JZVideoPlayer; +import cn.jzvd.Jzvd; /** * Created by Nathen on 2017/10/22. @@ -41,14 +41,14 @@ public void onScrollStateChanged(AbsListView view, int scrollState) { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { - JZVideoPlayer.onScrollAutoTiny(view, firstVisibleItem, visibleItemCount, totalItemCount); + Jzvd.onScrollAutoTiny(view, firstVisibleItem, visibleItemCount, totalItemCount); } }); } @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); @@ -57,7 +57,7 @@ public void onBackPressed() { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleView.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleView.java index 6f45d1e8e..eb52e008a 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleView.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleView.java @@ -8,7 +8,7 @@ import android.view.MenuItem; import android.view.View; -import cn.jzvd.JZVideoPlayer; +import cn.jzvd.Jzvd; /** * Created by Nathen on 2017/11/1. @@ -36,12 +36,12 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { recyclerView.addOnChildAttachStateChangeListener(new RecyclerView.OnChildAttachStateChangeListener() { @Override public void onChildViewAttachedToWindow(View view) { - JZVideoPlayer.onChildViewAttachedToWindow(view, R.id.videoplayer); + Jzvd.onChildViewAttachedToWindow(view, R.id.videoplayer); } @Override public void onChildViewDetachedFromWindow(View view) { - JZVideoPlayer.onChildViewDetachedFromWindow(view); + Jzvd.onChildViewDetachedFromWindow(view); } }); @@ -49,7 +49,7 @@ public void onChildViewDetachedFromWindow(View view) { @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); @@ -58,7 +58,7 @@ public void onBackPressed() { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleViewMultiHolder.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleViewMultiHolder.java index d5a1fb35a..6e9fb9494 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleViewMultiHolder.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleViewMultiHolder.java @@ -13,8 +13,8 @@ import com.bumptech.glide.Glide; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; /** * Created by Nathen on 2017/11/1. @@ -43,12 +43,12 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { recyclerView.addOnChildAttachStateChangeListener(new RecyclerView.OnChildAttachStateChangeListener() { @Override public void onChildViewAttachedToWindow(View view) { - JZVideoPlayer.onChildViewAttachedToWindow(view, R.id.videoplayer); + Jzvd.onChildViewAttachedToWindow(view, R.id.videoplayer); } @Override public void onChildViewDetachedFromWindow(View view) { - JZVideoPlayer.onChildViewDetachedFromWindow(view); + Jzvd.onChildViewDetachedFromWindow(view); } }); @@ -57,12 +57,12 @@ public void onChildViewDetachedFromWindow(View view) { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); @@ -108,7 +108,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { VideoHolder videoHolder = (VideoHolder) holder; videoHolder.jzVideoPlayer.setUp( VideoConstant.videoUrls[0][position], - VideoConstant.videoTitles[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST); + VideoConstant.videoTitles[0][position], Jzvd.SCREEN_WINDOW_LIST); videoHolder.jzVideoPlayer.positionInList = position; Glide.with(ActivityTinyWindowRecycleViewMultiHolder.this).load(VideoConstant.videoThumbs[0][position]).into(videoHolder.jzVideoPlayer.thumbImageView); } @@ -120,7 +120,7 @@ public int getItemCount() { } class VideoHolder extends RecyclerView.ViewHolder { - JZVideoPlayerStandard jzVideoPlayer; + JzvdStd jzVideoPlayer; public VideoHolder(View itemView) { super(itemView); diff --git a/app/src/main/java/cn/jzvd/demo/ActivityWebView.java b/app/src/main/java/cn/jzvd/demo/ActivityWebView.java index fd7889336..619ebba57 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityWebView.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityWebView.java @@ -12,8 +12,8 @@ import com.bumptech.glide.Glide; import cn.jzvd.JZUtils; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; /** * Created by Nathen on 16/10/13. @@ -40,7 +40,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { @Override public void onBackPressed() { - if (JZVideoPlayer.backPress()) { + if (Jzvd.backPress()) { return; } super.onBackPressed(); @@ -49,7 +49,7 @@ public void onBackPressed() { @Override protected void onPause() { super.onPause(); - JZVideoPlayer.releaseAllVideos(); + Jzvd.releaseAllVideos(); } @Override @@ -70,9 +70,9 @@ public void adViewJiaoZiVideoPlayer(final int width, final int height, final int @Override public void run() { if (index == 0) { - JZVideoPlayerStandard webVieo = new JZVideoPlayerStandard(ActivityWebView.this); + JzvdStd webVieo = new JzvdStd(ActivityWebView.this); webVieo.setUp(VideoConstant.videoUrlList[1], "饺子骑大马", - JZVideoPlayer.SCREEN_WINDOW_LIST); + Jzvd.SCREEN_WINDOW_LIST); Glide.with(ActivityWebView.this) .load(VideoConstant.videoThumbList[1]) .into(webVieo.thumbImageView); @@ -84,9 +84,9 @@ public void run() { layoutParams.width = JZUtils.dip2px(ActivityWebView.this, width); mWebView.addView(webVieo, layoutParams); } else { - JZVideoPlayerStandard webVieo = new JZVideoPlayerStandard(ActivityWebView.this); + JzvdStd webVieo = new JzvdStd(ActivityWebView.this); webVieo.setUp(VideoConstant.videoUrlList[2], "饺子失态了", - JZVideoPlayer.SCREEN_WINDOW_LIST); + Jzvd.SCREEN_WINDOW_LIST); Glide.with(ActivityWebView.this) .load(VideoConstant.videoThumbList[2]) .into(webVieo.thumbImageView); diff --git a/app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java b/app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java index c25da2bf9..d452eba02 100644 --- a/app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java +++ b/app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java @@ -10,8 +10,8 @@ import com.bumptech.glide.Glide; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; public class AdapterRecyclerViewVideo extends RecyclerView.Adapter { @@ -38,7 +38,7 @@ public void onBindViewHolder(MyViewHolder holder, int position) { holder.jzVideoPlayer.setUp( VideoConstant.videoUrls[0][position], - VideoConstant.videoTitles[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST); + VideoConstant.videoTitles[0][position], Jzvd.SCREEN_WINDOW_LIST); Glide.with(holder.jzVideoPlayer.getContext()).load(VideoConstant.videoThumbs[0][position]).into(holder.jzVideoPlayer.thumbImageView); } @@ -48,7 +48,7 @@ public int getItemCount() { } class MyViewHolder extends RecyclerView.ViewHolder { - JZVideoPlayerStandard jzVideoPlayer; + JzvdStd jzVideoPlayer; public MyViewHolder(View itemView) { super(itemView); diff --git a/app/src/main/java/cn/jzvd/demo/AdapterVideoList.java b/app/src/main/java/cn/jzvd/demo/AdapterVideoList.java index 071c610da..8e92ee722 100644 --- a/app/src/main/java/cn/jzvd/demo/AdapterVideoList.java +++ b/app/src/main/java/cn/jzvd/demo/AdapterVideoList.java @@ -8,8 +8,8 @@ import com.bumptech.glide.Glide; -import cn.jzvd.JZVideoPlayer; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.Jzvd; +import cn.jzvd.JzvdStd; /** * Created by Nathen @@ -62,7 +62,7 @@ public View getView(int position, View convertView, ViewGroup parent) { viewHolder.jzVideoPlayer = convertView.findViewById(R.id.videoplayer); viewHolder.jzVideoPlayer.setUp( videoUrls[position], - videoTitles[position], JZVideoPlayer.SCREEN_WINDOW_LIST); + videoTitles[position], Jzvd.SCREEN_WINDOW_LIST); Glide.with(convertView.getContext()) .load(videoThumbs[position]) .into(viewHolder.jzVideoPlayer.thumbImageView); @@ -71,6 +71,6 @@ public View getView(int position, View convertView, ViewGroup parent) { } class ViewHolder { - JZVideoPlayerStandard jzVideoPlayer; + JzvdStd jzVideoPlayer; } } 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 1d6dfe678..867128820 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/CustomMediaPlayerAssertFolder.java +++ b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/CustomMediaPlayerAssertFolder.java @@ -7,7 +7,7 @@ import cn.jzvd.JZMediaInterface; import cn.jzvd.JZMediaManager; -import cn.jzvd.JZVideoPlayerManager; +import cn.jzvd.JzvdMgr; /** * Created by Nathen on 2017/11/23. @@ -100,8 +100,8 @@ public void onPrepared(MediaPlayer mediaPlayer) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onPrepared(); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onPrepared(); } } }); @@ -113,8 +113,8 @@ public void onCompletion(MediaPlayer mediaPlayer) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onAutoCompletion(); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onAutoCompletion(); } } }); @@ -125,8 +125,8 @@ public void onBufferingUpdate(MediaPlayer mediaPlayer, final int percent) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().setBufferProgress(percent); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().setBufferProgress(percent); } } }); @@ -137,8 +137,8 @@ public void onSeekComplete(MediaPlayer mediaPlayer) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onSeekComplete(); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onSeekComplete(); } } }); @@ -149,8 +149,8 @@ public boolean onError(MediaPlayer mediaPlayer, final int what, final int extra) JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onError(what, extra); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onError(what, extra); } } }); @@ -162,11 +162,11 @@ public boolean onInfo(MediaPlayer mediaPlayer, final int what, final int extra) JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { + if (JzvdMgr.getCurrentJzvd() != null) { if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { - JZVideoPlayerManager.getCurrentJzvd().onPrepared(); + JzvdMgr.getCurrentJzvd().onPrepared(); } else { - JZVideoPlayerManager.getCurrentJzvd().onInfo(what, extra); + JzvdMgr.getCurrentJzvd().onInfo(what, extra); } } } @@ -181,8 +181,8 @@ public void onVideoSizeChanged(MediaPlayer mediaPlayer, int width, int height) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onVideoSizeChanged(); + 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 d7bab46ec..3b4dae111 100755 --- a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java +++ b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZExoPlayer.java @@ -36,8 +36,7 @@ import cn.jzvd.JZMediaInterface; import cn.jzvd.JZMediaManager; -import cn.jzvd.JZUtils; -import cn.jzvd.JZVideoPlayerManager; +import cn.jzvd.JzvdMgr; import cn.jzvd.demo.R; /** @@ -62,7 +61,7 @@ public void start() { public void prepare() { Log.e(TAG, "prepare"); mainHandler = new Handler(); - Context context = JZVideoPlayerManager.getCurrentJzvd().getContext(); + Context context = JzvdMgr.getCurrentJzvd().getContext(); BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(); TrackSelection.Factory videoTrackSelectionFactory = @@ -109,8 +108,8 @@ public void onVideoSizeChanged(int width, int height, int unappliedRotationDegre JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onVideoSizeChanged(); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onVideoSizeChanged(); } } }); @@ -128,8 +127,8 @@ public void run() { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().setBufferProgress(percent); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().setBufferProgress(percent); } } }); @@ -156,7 +155,7 @@ public void seekTo(long time) { if (time != previousSeek) { simpleExoPlayer.seekTo(time); previousSeek = time; - JZVideoPlayerManager.getCurrentJzvd().seekToInAdvance = time; + JzvdMgr.getCurrentJzvd().seekToInAdvance = time; } } @@ -204,7 +203,7 @@ public void onTimelineChanged(final Timeline timeline, Object manifest, final in // public void run() { // if (reason == 0) { // -// JZVideoPlayerManager.getCurrentJzvd().onInfo(reason, timeline.getPeriodCount()); +// JzvdMgr.getCurrentJzvd().onInfo(reason, timeline.getPeriodCount()); // } // } // }); @@ -226,7 +225,7 @@ public void onPlayerStateChanged(final boolean playWhenReady, final int playback JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { + if (JzvdMgr.getCurrentJzvd() != null) { switch (playbackState) { case Player.STATE_IDLE: { } @@ -237,13 +236,13 @@ public void run() { break; case Player.STATE_READY: { if (playWhenReady) { - JZVideoPlayerManager.getCurrentJzvd().onPrepared(); + JzvdMgr.getCurrentJzvd().onPrepared(); } else { } } break; case Player.STATE_ENDED: { - JZVideoPlayerManager.getCurrentJzvd().onAutoCompletion(); + JzvdMgr.getCurrentJzvd().onAutoCompletion(); } break; } @@ -268,8 +267,8 @@ public void onPlayerError(ExoPlaybackException error) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onError(1000, 1000); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onError(1000, 1000); } } }); @@ -290,8 +289,8 @@ public void onSeekProcessed() { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onSeekComplete(); + 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 5c22175b3..c060b8bc5 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZMediaIjkplayer.java +++ b/app/src/main/java/cn/jzvd/demo/CustomMediaPlayer/JZMediaIjkplayer.java @@ -8,7 +8,7 @@ import cn.jzvd.JZMediaInterface; import cn.jzvd.JZMediaManager; -import cn.jzvd.JZVideoPlayerManager; +import cn.jzvd.JzvdMgr; import tv.danmaku.ijk.media.player.IMediaPlayer; import tv.danmaku.ijk.media.player.IjkMediaPlayer; import tv.danmaku.ijk.media.player.IjkTimedText; @@ -104,8 +104,8 @@ public void onPrepared(IMediaPlayer iMediaPlayer) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onPrepared(); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onPrepared(); } } }); @@ -119,8 +119,8 @@ public void onVideoSizeChanged(IMediaPlayer iMediaPlayer, int i, int i1, int i2, JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onVideoSizeChanged(); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onVideoSizeChanged(); } } }); @@ -131,8 +131,8 @@ public void onCompletion(IMediaPlayer iMediaPlayer) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onAutoCompletion(); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onAutoCompletion(); } } }); @@ -143,8 +143,8 @@ public boolean onError(IMediaPlayer iMediaPlayer, final int what, final int extr JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onError(what, extra); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onError(what, extra); } } }); @@ -156,11 +156,11 @@ public boolean onInfo(IMediaPlayer iMediaPlayer, final int what, final int extra JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { + if (JzvdMgr.getCurrentJzvd() != null) { if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { - JZVideoPlayerManager.getCurrentJzvd().onPrepared(); + JzvdMgr.getCurrentJzvd().onPrepared(); } else { - JZVideoPlayerManager.getCurrentJzvd().onInfo(what, extra); + JzvdMgr.getCurrentJzvd().onInfo(what, extra); } } } @@ -173,8 +173,8 @@ public void onBufferingUpdate(IMediaPlayer iMediaPlayer, final int percent) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().setBufferProgress(percent); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().setBufferProgress(percent); } } }); @@ -185,8 +185,8 @@ public void onSeekComplete(IMediaPlayer iMediaPlayer) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onSeekComplete(); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onSeekComplete(); } } }); diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardAutoCompleteAfterFullscreen.java b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdAutoCompleteAfterFullscreen.java similarity index 82% rename from app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardAutoCompleteAfterFullscreen.java rename to app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdAutoCompleteAfterFullscreen.java index 5cf17efc9..725ab50a7 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardAutoCompleteAfterFullscreen.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdAutoCompleteAfterFullscreen.java @@ -8,18 +8,18 @@ import cn.jzvd.JZMediaManager; import cn.jzvd.JZUtils; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.JzvdStd; /** * 全屏状态播放完成,不退出全屏 * Created by Nathen on 2016/11/26. */ -public class JZVideoPlayerStandardAutoCompleteAfterFullscreen extends JZVideoPlayerStandard { - public JZVideoPlayerStandardAutoCompleteAfterFullscreen(Context context) { +public class JzvdStdAutoCompleteAfterFullscreen extends JzvdStd { + public JzvdStdAutoCompleteAfterFullscreen(Context context) { super(context); } - public JZVideoPlayerStandardAutoCompleteAfterFullscreen(Context context, AttributeSet attrs) { + public JzvdStdAutoCompleteAfterFullscreen(Context context, AttributeSet attrs) { super(context, attrs); } diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardFresco.java b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdFresco.java similarity index 89% rename from app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardFresco.java rename to app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdFresco.java index 548324ba6..74c0266eb 100755 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardFresco.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdFresco.java @@ -5,7 +5,7 @@ import android.view.View; import cn.jzvd.JZDataSource; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.JzvdStd; import cn.jzvd.demo.R; //import com.facebook.drawee.view.SimpleDraweeView; @@ -15,14 +15,14 @@ * Created by Nathen * On 2016/05/01 22:59 */ -public class JZVideoPlayerStandardFresco extends JZVideoPlayerStandard { +public class JzvdStdFresco extends JzvdStd { // public SimpleDraweeView thumbImageView; - public JZVideoPlayerStandardFresco(Context context) { + public JzvdStdFresco(Context context) { super(context); } - public JZVideoPlayerStandardFresco(Context context, AttributeSet attrs) { + public JzvdStdFresco(Context context, AttributeSet attrs) { super(context, attrs); } diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardMp3.java b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdMp3.java similarity index 86% rename from app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardMp3.java rename to app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdMp3.java index 373dc3a38..b111a3dab 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardMp3.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdMp3.java @@ -2,19 +2,18 @@ import android.content.Context; import android.util.AttributeSet; -import android.view.MotionEvent; import android.view.View; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.JzvdStd; import cn.jzvd.demo.R; -public class JZVideoPlayerStandardMp3 extends JZVideoPlayerStandard { +public class JzvdStdMp3 extends JzvdStd { - public JZVideoPlayerStandardMp3(Context context) { + public JzvdStdMp3(Context context) { super(context); } - public JZVideoPlayerStandardMp3(Context context, AttributeSet attrs) { + public JzvdStdMp3(Context context, AttributeSet attrs) { super(context, attrs); } diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowShareButtonAfterFullscreen.java b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdShowShareButtonAfterFullscreen.java similarity index 79% rename from app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowShareButtonAfterFullscreen.java rename to app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdShowShareButtonAfterFullscreen.java index 10943f803..5d9f11648 100755 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowShareButtonAfterFullscreen.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdShowShareButtonAfterFullscreen.java @@ -7,22 +7,22 @@ import android.widget.Toast; import cn.jzvd.JZDataSource; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.JzvdStd; import cn.jzvd.demo.R; /** * Created by Nathen * On 2016/04/22 00:54 */ -public class JZVideoPlayerStandardShowShareButtonAfterFullscreen extends JZVideoPlayerStandard { +public class JzvdStdShowShareButtonAfterFullscreen extends JzvdStd { public ImageView shareButton; - public JZVideoPlayerStandardShowShareButtonAfterFullscreen(Context context) { + public JzvdStdShowShareButtonAfterFullscreen(Context context) { super(context); } - public JZVideoPlayerStandardShowShareButtonAfterFullscreen(Context context, AttributeSet attrs) { + public JzvdStdShowShareButtonAfterFullscreen(Context context, AttributeSet attrs) { super(context, attrs); } diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowTextureViewAfterAutoComplete.java b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdShowTextureViewAfterAutoComplete.java similarity index 54% rename from app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowTextureViewAfterAutoComplete.java rename to app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdShowTextureViewAfterAutoComplete.java index b78e3bcbc..f7ac9894b 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowTextureViewAfterAutoComplete.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdShowTextureViewAfterAutoComplete.java @@ -4,18 +4,18 @@ import android.util.AttributeSet; import android.view.View; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.JzvdStd; /** * Created by Nathen on 2016/11/6. */ -public class JZVideoPlayerStandardShowTextureViewAfterAutoComplete extends JZVideoPlayerStandard { - public JZVideoPlayerStandardShowTextureViewAfterAutoComplete(Context context) { +public class JzvdStdShowTextureViewAfterAutoComplete extends JzvdStd { + public JzvdStdShowTextureViewAfterAutoComplete(Context context) { super(context); } - public JZVideoPlayerStandardShowTextureViewAfterAutoComplete(Context context, AttributeSet attrs) { + public JzvdStdShowTextureViewAfterAutoComplete(Context context, AttributeSet attrs) { super(context, attrs); } diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowTitleAfterFullscreen.java b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdShowTitleAfterFullscreen.java similarity index 66% rename from app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowTitleAfterFullscreen.java rename to app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdShowTitleAfterFullscreen.java index 19116d06d..8662e21fe 100755 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowTitleAfterFullscreen.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdShowTitleAfterFullscreen.java @@ -5,18 +5,18 @@ import android.view.View; import cn.jzvd.JZDataSource; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.JzvdStd; /** * Created by Nathen * On 2016/04/27 10:49 */ -public class JZVideoPlayerStandardShowTitleAfterFullscreen extends JZVideoPlayerStandard { - public JZVideoPlayerStandardShowTitleAfterFullscreen(Context context) { +public class JzvdStdShowTitleAfterFullscreen extends JzvdStd { + public JzvdStdShowTitleAfterFullscreen(Context context) { super(context); } - public JZVideoPlayerStandardShowTitleAfterFullscreen(Context context, AttributeSet attrs) { + public JzvdStdShowTitleAfterFullscreen(Context context, AttributeSet attrs) { super(context, attrs); } diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardVolumeAfterFullscreen.java b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdVolumeAfterFullscreen.java similarity index 77% rename from app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardVolumeAfterFullscreen.java rename to app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdVolumeAfterFullscreen.java index b9ad1c6c8..b7919259f 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardVolumeAfterFullscreen.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/JzvdStdVolumeAfterFullscreen.java @@ -4,18 +4,18 @@ import android.util.AttributeSet; import cn.jzvd.JZMediaManager; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.JzvdStd; /** * Created by pc on 2018/1/17. */ -public class JZVideoPlayerStandardVolumeAfterFullscreen extends JZVideoPlayerStandard { - public JZVideoPlayerStandardVolumeAfterFullscreen(Context context) { +public class JzvdStdVolumeAfterFullscreen extends JzvdStd { + public JzvdStdVolumeAfterFullscreen(Context context) { super(context); } - public JZVideoPlayerStandardVolumeAfterFullscreen(Context context, AttributeSet attrs) { + public JzvdStdVolumeAfterFullscreen(Context context, AttributeSet attrs) { super(context, attrs); } diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/MyJZVideoPlayerStandard.java b/app/src/main/java/cn/jzvd/demo/CustomView/MyJzvdStd.java similarity index 92% rename from app/src/main/java/cn/jzvd/demo/CustomView/MyJZVideoPlayerStandard.java rename to app/src/main/java/cn/jzvd/demo/CustomView/MyJzvdStd.java index 8a4dd1bb2..64d5e5ad8 100644 --- a/app/src/main/java/cn/jzvd/demo/CustomView/MyJZVideoPlayerStandard.java +++ b/app/src/main/java/cn/jzvd/demo/CustomView/MyJzvdStd.java @@ -5,7 +5,7 @@ import android.view.MotionEvent; import android.view.View; -import cn.jzvd.JZVideoPlayerStandard; +import cn.jzvd.JzvdStd; import cn.jzvd.demo.R; /** @@ -13,12 +13,12 @@ * 所有关于视频的逻辑都应该写在这里 * Created by Nathen on 2017/7/2. */ -public class MyJZVideoPlayerStandard extends JZVideoPlayerStandard { - public MyJZVideoPlayerStandard(Context context) { +public class MyJzvdStd extends JzvdStd { + public MyJzvdStd(Context context) { super(context); } - public MyJZVideoPlayerStandard(Context context, AttributeSet attrs) { + public MyJzvdStd(Context context, AttributeSet attrs) { super(context, attrs); } diff --git a/app/src/main/java/cn/jzvd/demo/FragmentDemo.java b/app/src/main/java/cn/jzvd/demo/FragmentDemo.java index c9f1832ae..0f4a0018a 100644 --- a/app/src/main/java/cn/jzvd/demo/FragmentDemo.java +++ b/app/src/main/java/cn/jzvd/demo/FragmentDemo.java @@ -9,7 +9,7 @@ import android.widget.AbsListView; import android.widget.ListView; -import cn.jzvd.JZVideoPlayer; +import cn.jzvd.Jzvd; /** * Created by Nathen on 2017/6/9. @@ -45,7 +45,7 @@ public void onScrollStateChanged(AbsListView view, int scrollState) { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { - JZVideoPlayer.onScrollReleaseAllVideos(view, firstVisibleItem, visibleItemCount, totalItemCount); + Jzvd.onScrollReleaseAllVideos(view, firstVisibleItem, visibleItemCount, totalItemCount); } }); return listView; diff --git a/app/src/main/res/layout/activity_api.xml b/app/src/main/res/layout/activity_api.xml index 7e0070162..6424d9b6d 100644 --- a/app/src/main/res/layout/activity_api.xml +++ b/app/src/main/res/layout/activity_api.xml @@ -14,7 +14,7 @@ android:layout_height="wrap_content" android:orientation="vertical"> - - diff --git a/app/src/main/res/layout/activity_api_rotation_videosize.xml b/app/src/main/res/layout/activity_api_rotation_videosize.xml index a8354dbee..417073d72 100644 --- a/app/src/main/res/layout/activity_api_rotation_videosize.xml +++ b/app/src/main/res/layout/activity_api_rotation_videosize.xml @@ -4,7 +4,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - - diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 17c635215..e8aa607bd 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -14,7 +14,7 @@ android:layout_height="wrap_content" android:orientation="vertical"> - diff --git a/app/src/main/res/layout/activity_orientation.xml b/app/src/main/res/layout/activity_orientation.xml index 314d46ba0..042a0efe1 100644 --- a/app/src/main/res/layout/activity_orientation.xml +++ b/app/src/main/res/layout/activity_orientation.xml @@ -4,7 +4,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - diff --git a/app/src/main/res/layout/activity_tiny_window.xml b/app/src/main/res/layout/activity_tiny_window.xml index a0d3e97c3..91e4eaf1f 100644 --- a/app/src/main/res/layout/activity_tiny_window.xml +++ b/app/src/main/res/layout/activity_tiny_window.xml @@ -14,7 +14,7 @@ android:layout_height="wrap_content" android:orientation="vertical"> - 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 8f43f9b43..ee7909082 100644 --- a/app/src/main/res/layout/activity_ui_small_change.xml +++ b/app/src/main/res/layout/activity_ui_small_change.xml @@ -20,7 +20,7 @@ android:layout_marginTop="18dp" android:text="Standard ui with share button, visible after fullscreen" /> - @@ -32,7 +32,7 @@ android:layout_marginTop="18dp" android:text="Standard ui show title after fullscreen" /> - @@ -44,7 +44,7 @@ android:layout_marginTop="18dp" android:text="Standard ui show textureview after auto complete" /> - @@ -56,7 +56,7 @@ android:layout_marginTop="18dp" android:text="Standard ui auto complete after fullscreen" /> - @@ -68,7 +68,7 @@ android:layout_marginTop="18dp" android:text="Standard ui 1:1" /> - @@ -80,7 +80,7 @@ android:layout_marginTop="18dp" android:text="Standard ui 16:9" /> - @@ -92,7 +92,7 @@ android:layout_marginTop="18dp" android:text="Volume after fullscreen" /> - @@ -104,7 +104,7 @@ android:layout_marginTop="18dp" android:text="Play Mp3" /> - diff --git a/app/src/main/res/layout/header_auto_tiny_normal.xml b/app/src/main/res/layout/header_auto_tiny_normal.xml index aa793bd40..4393fd9ae 100644 --- a/app/src/main/res/layout/header_auto_tiny_normal.xml +++ b/app/src/main/res/layout/header_auto_tiny_normal.xml @@ -4,7 +4,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - diff --git a/app/src/main/res/layout/item_videoview.xml b/app/src/main/res/layout/item_videoview.xml index 1ec354ddd..ad8ae790c 100755 --- a/app/src/main/res/layout/item_videoview.xml +++ b/app/src/main/res/layout/item_videoview.xml @@ -4,7 +4,7 @@ android:layout_height="wrap_content" android:orientation="vertical"> - diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaManager.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaManager.java index df8197801..7aab14afe 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaManager.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaManager.java @@ -19,7 +19,7 @@ public class JZMediaManager implements TextureView.SurfaceTextureListener { public static final int HANDLER_PREPARE = 0; public static final int HANDLER_RELEASE = 2; - public static JZResizeTextureView textureView; + public static JZTextureView textureView; public static SurfaceTexture savedSurfaceTexture; public static Surface surface; public static JZMediaManager jzMediaManager; @@ -107,8 +107,8 @@ public void prepare() { @Override public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) { - if (JZVideoPlayerManager.getCurrentJzvd() == null) return; - Log.i(TAG, "onSurfaceTextureAvailable [" + JZVideoPlayerManager.getCurrentJzvd().hashCode() + "] "); + if (JzvdMgr.getCurrentJzvd() == null) return; + Log.i(TAG, "onSurfaceTextureAvailable [" + JzvdMgr.getCurrentJzvd().hashCode() + "] "); if (savedSurfaceTexture == null) { savedSurfaceTexture = surfaceTexture; prepare(); diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java index 019fdfbde..b31a8b78c 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java @@ -108,8 +108,8 @@ public void onPrepared(MediaPlayer mediaPlayer) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onPrepared(); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onPrepared(); } } }); @@ -121,8 +121,8 @@ public void onCompletion(MediaPlayer mediaPlayer) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onAutoCompletion(); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onAutoCompletion(); } } }); @@ -133,8 +133,8 @@ public void onBufferingUpdate(MediaPlayer mediaPlayer, final int percent) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().setBufferProgress(percent); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().setBufferProgress(percent); } } }); @@ -145,8 +145,8 @@ public void onSeekComplete(MediaPlayer mediaPlayer) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onSeekComplete(); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onSeekComplete(); } } }); @@ -157,8 +157,8 @@ public boolean onError(MediaPlayer mediaPlayer, final int what, final int extra) JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onError(what, extra); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onError(what, extra); } } }); @@ -170,14 +170,14 @@ public boolean onInfo(MediaPlayer mediaPlayer, final int what, final int extra) JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { + if (JzvdMgr.getCurrentJzvd() != null) { if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { - if (JZVideoPlayerManager.getCurrentJzvd().currentState == JZVideoPlayer.CURRENT_STATE_PREPARING - || JZVideoPlayerManager.getCurrentJzvd().currentState == JZVideoPlayer.CURRENT_STATE_PREPARING_CHANGING_URL) { - JZVideoPlayerManager.getCurrentJzvd().onPrepared(); + if (JzvdMgr.getCurrentJzvd().currentState == Jzvd.CURRENT_STATE_PREPARING + || JzvdMgr.getCurrentJzvd().currentState == Jzvd.CURRENT_STATE_PREPARING_CHANGING_URL) { + JzvdMgr.getCurrentJzvd().onPrepared(); } } else { - JZVideoPlayerManager.getCurrentJzvd().onInfo(what, extra); + JzvdMgr.getCurrentJzvd().onInfo(what, extra); } } } @@ -192,8 +192,8 @@ public void onVideoSizeChanged(MediaPlayer mediaPlayer, int width, int height) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().onVideoSizeChanged(); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().onVideoSizeChanged(); } } }); diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZResizeTextureView.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZTextureView.java similarity index 92% rename from jiaozivideoplayer/src/main/java/cn/jzvd/JZResizeTextureView.java rename to jiaozivideoplayer/src/main/java/cn/jzvd/JZTextureView.java index 7d1695346..0e850c152 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZResizeTextureView.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZTextureView.java @@ -14,19 +14,19 @@ * Created by Nathen * On 2016/06/02 00:01 */ -public class JZResizeTextureView extends TextureView { +public class JZTextureView extends TextureView { protected static final String TAG = "JZResizeTextureView"; public int currentVideoWidth = 0; public int currentVideoHeight = 0; - public JZResizeTextureView(Context context) { + public JZTextureView(Context context) { super(context); currentVideoWidth = 0; currentVideoHeight = 0; } - public JZResizeTextureView(Context context, AttributeSet attrs) { + public JZTextureView(Context context, AttributeSet attrs) { super(context, attrs); currentVideoWidth = 0; currentVideoHeight = 0; @@ -59,7 +59,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int parentHeight = ((View) getParent()).getMeasuredHeight(); int parentWidth = ((View) getParent()).getMeasuredWidth(); if (parentWidth != 0 && parentHeight != 0 && videoWidth != 0 && videoHeight != 0) { - if (JZVideoPlayer.VIDEO_IMAGE_DISPLAY_TYPE == JZVideoPlayer.VIDEO_IMAGE_DISPLAY_TYPE_FILL_PARENT) { + if (Jzvd.VIDEO_IMAGE_DISPLAY_TYPE == Jzvd.VIDEO_IMAGE_DISPLAY_TYPE_FILL_PARENT) { if (viewRotation == 90 || viewRotation == 270) { int tempSize = parentWidth; parentWidth = parentHeight; @@ -136,11 +136,11 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // no size yet, just adopt the given spec sizes } if (parentWidth != 0 && parentHeight != 0 && videoWidth != 0 && videoHeight != 0) { - if (JZVideoPlayer.VIDEO_IMAGE_DISPLAY_TYPE == JZVideoPlayer.VIDEO_IMAGE_DISPLAY_TYPE_ORIGINAL) { + if (Jzvd.VIDEO_IMAGE_DISPLAY_TYPE == Jzvd.VIDEO_IMAGE_DISPLAY_TYPE_ORIGINAL) { /**原图**/ height = videoHeight; width = videoWidth; - } else if (JZVideoPlayer.VIDEO_IMAGE_DISPLAY_TYPE == JZVideoPlayer.VIDEO_IMAGE_DISPLAY_TYPE_FILL_SCROP) { + } else if (Jzvd.VIDEO_IMAGE_DISPLAY_TYPE == Jzvd.VIDEO_IMAGE_DISPLAY_TYPE_FILL_SCROP) { if (viewRotation == 90 || viewRotation == 270) { int tempSize = parentWidth; parentWidth = parentHeight; diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZUserActionStandard.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZUserActionStd.java similarity index 74% rename from jiaozivideoplayer/src/main/java/cn/jzvd/JZUserActionStandard.java rename to jiaozivideoplayer/src/main/java/cn/jzvd/JZUserActionStd.java index 7a12c99ac..7da7c7eeb 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZUserActionStandard.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZUserActionStd.java @@ -4,7 +4,7 @@ * Created by Nathen * On 2016/04/26 20:53 */ -public interface JZUserActionStandard extends JZUserAction { +public interface JZUserActionStd extends JZUserAction { int ON_CLICK_START_THUMB = 101; int ON_CLICK_BLANK = 102; diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java index 12d9ebc22..5d75d7f6b 100755 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java @@ -12,7 +12,6 @@ import android.view.Window; import java.util.Formatter; -import java.util.LinkedHashMap; import java.util.Locale; /** @@ -109,7 +108,7 @@ public static int dip2px(Context context, float dpValue) { } public static void saveProgress(Context context, Object url, long progress) { - if (!JZVideoPlayer.SAVE_PROGRESS) return; + if (!Jzvd.SAVE_PROGRESS) return; Log.i(TAG, "saveProgress: " + progress); if (progress < 5000) { progress = 0; @@ -121,7 +120,7 @@ public static void saveProgress(Context context, Object url, long progress) { } public static long getSavedProgress(Context context, Object url) { - if (!JZVideoPlayer.SAVE_PROGRESS) return 0; + if (!Jzvd.SAVE_PROGRESS) return 0; SharedPreferences spn = context.getSharedPreferences("JZVD_PROGRESS", Context.MODE_PRIVATE); return spn.getLong("newVersion:" + url.toString(), 0); diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java similarity index 86% rename from jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java rename to jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java index 57724ca22..a91b295e7 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java @@ -34,7 +34,7 @@ /** * Created by Nathen on 16/7/30. */ -public abstract class JZVideoPlayer extends FrameLayout implements View.OnClickListener, SeekBar.OnSeekBarChangeListener, View.OnTouchListener { +public abstract class Jzvd extends FrameLayout implements View.OnClickListener, SeekBar.OnSeekBarChangeListener, View.OnTouchListener { public static final String TAG = "JiaoZiVideoPlayer"; public static final int THRESHOLD = 80; @@ -78,8 +78,8 @@ public void onAudioFocusChange(int focusChange) { break; case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT: try { - JZVideoPlayer player = JZVideoPlayerManager.getCurrentJzvd(); - if (player != null && player.currentState == JZVideoPlayer.CURRENT_STATE_PLAYING) { + Jzvd player = JzvdMgr.getCurrentJzvd(); + if (player != null && player.currentState == Jzvd.CURRENT_STATE_PLAYING) { player.startButton.performClick(); } } catch (IllegalStateException e) { @@ -124,12 +124,12 @@ public void onAudioFocusChange(int focusChange) { protected long mSeekTimePosition; boolean tmp_test_back = false; - public JZVideoPlayer(Context context) { + public Jzvd(Context context) { super(context); init(context); } - public JZVideoPlayer(Context context, AttributeSet attrs) { + public Jzvd(Context context, AttributeSet attrs) { super(context, attrs); init(context); } @@ -137,7 +137,7 @@ public JZVideoPlayer(Context context, AttributeSet attrs) { public static void releaseAllVideos() { if ((System.currentTimeMillis() - CLICK_QUIT_FULLSCREEN_TIME) > FULL_SCREEN_NORMAL_DELAY) { Log.d(TAG, "releaseAllVideos"); - JZVideoPlayerManager.completeAll(); + JzvdMgr.completeAll(); JZMediaManager.instance().positionInList = -1; JZMediaManager.instance().releaseMediaPlayer(); } @@ -157,17 +157,17 @@ public static void startFullscreen(Context context, Class _class, JZDataSource j vp.removeView(old); } try { - Constructor constructor = _class.getConstructor(Context.class); - final JZVideoPlayer jzVideoPlayer = constructor.newInstance(context); - jzVideoPlayer.setId(R.id.jz_fullscreen_id); + Constructor constructor = _class.getConstructor(Context.class); + final Jzvd jzvd = constructor.newInstance(context); + jzvd.setId(R.id.jz_fullscreen_id); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); - vp.addView(jzVideoPlayer, lp); + vp.addView(jzvd, lp); // final Animation ra = AnimationUtils.loadAnimation(context, R.anim.start_fullscreen); // jzVideoPlayer.setAnimation(ra); - jzVideoPlayer.setUp(jzDataSource, JZVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN); + jzvd.setUp(jzDataSource, JzvdStd.SCREEN_WINDOW_FULLSCREEN); CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis(); - jzVideoPlayer.startButton.performClick(); + jzvd.startButton.performClick(); } catch (InstantiationException e) { e.printStackTrace(); } catch (Exception e) { @@ -180,21 +180,21 @@ public static boolean backPress() { if ((System.currentTimeMillis() - CLICK_QUIT_FULLSCREEN_TIME) < FULL_SCREEN_NORMAL_DELAY) return false; - if (JZVideoPlayerManager.getSecondFloor() != null) { + if (JzvdMgr.getSecondFloor() != null) { CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis(); - if (JZVideoPlayerManager.getFirstFloor().jzDataSource.containsTheUrl(JZMediaManager.getDataSource().getCurrentUrl())) { - JZVideoPlayer jzVideoPlayer = JZVideoPlayerManager.getSecondFloor(); - jzVideoPlayer.onEvent(jzVideoPlayer.currentScreen == JZVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN ? + if (JzvdMgr.getFirstFloor().jzDataSource.containsTheUrl(JZMediaManager.getDataSource().getCurrentUrl())) { + Jzvd jzvd = JzvdMgr.getSecondFloor(); + jzvd.onEvent(jzvd.currentScreen == JzvdStd.SCREEN_WINDOW_FULLSCREEN ? JZUserAction.ON_QUIT_FULLSCREEN : JZUserAction.ON_QUIT_TINYSCREEN); - JZVideoPlayerManager.getFirstFloor().playOnThisJzvd(); + JzvdMgr.getFirstFloor().playOnThisJzvd(); } else { quitFullscreenOrTinyWindow(); } return true; - } else if (JZVideoPlayerManager.getFirstFloor() != null && - (JZVideoPlayerManager.getFirstFloor().currentScreen == SCREEN_WINDOW_FULLSCREEN || - JZVideoPlayerManager.getFirstFloor().currentScreen == SCREEN_WINDOW_TINY)) {//以前我总想把这两个判断写到一起,这分明是两个独立是逻辑 + } else if (JzvdMgr.getFirstFloor() != null && + (JzvdMgr.getFirstFloor().currentScreen == SCREEN_WINDOW_FULLSCREEN || + JzvdMgr.getFirstFloor().currentScreen == SCREEN_WINDOW_TINY)) {//以前我总想把这两个判断写到一起,这分明是两个独立是逻辑 CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis(); quitFullscreenOrTinyWindow(); return true; @@ -204,9 +204,9 @@ public static boolean backPress() { public static void quitFullscreenOrTinyWindow() { //直接退出全屏和小窗 - JZVideoPlayerManager.getFirstFloor().clearFloatScreen(); + JzvdMgr.getFirstFloor().clearFloatScreen(); JZMediaManager.instance().releaseMediaPlayer(); - JZVideoPlayerManager.completeAll(); + JzvdMgr.completeAll(); } @SuppressLint("RestrictedApi") @@ -247,9 +247,9 @@ public static void setJzUserAction(JZUserAction jzUserEvent) { } public static void goOnPlayOnResume() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayer jzvd = JZVideoPlayerManager.getCurrentJzvd(); - if (jzvd.currentState == JZVideoPlayer.CURRENT_STATE_PAUSE) { + if (JzvdMgr.getCurrentJzvd() != null) { + Jzvd jzvd = JzvdMgr.getCurrentJzvd(); + if (jzvd.currentState == Jzvd.CURRENT_STATE_PAUSE) { if (ON_PLAY_PAUSE_TMP_STATE == CURRENT_STATE_PAUSE) { jzvd.onStatePause(); JZMediaManager.pause(); @@ -265,11 +265,11 @@ public static void goOnPlayOnResume() { public static int ON_PLAY_PAUSE_TMP_STATE = 0; public static void goOnPlayOnPause() { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayer jzvd = JZVideoPlayerManager.getCurrentJzvd(); - if (jzvd.currentState == JZVideoPlayer.CURRENT_STATE_AUTO_COMPLETE || - jzvd.currentState == JZVideoPlayer.CURRENT_STATE_NORMAL || - jzvd.currentState == JZVideoPlayer.CURRENT_STATE_ERROR) { + if (JzvdMgr.getCurrentJzvd() != null) { + Jzvd jzvd = JzvdMgr.getCurrentJzvd(); + if (jzvd.currentState == Jzvd.CURRENT_STATE_AUTO_COMPLETE || + jzvd.currentState == Jzvd.CURRENT_STATE_NORMAL || + jzvd.currentState == Jzvd.CURRENT_STATE_ERROR) { // JZVideoPlayer.releaseAllVideos(); } else { ON_PLAY_PAUSE_TMP_STATE = jzvd.currentState; @@ -284,21 +284,21 @@ public static void onScrollAutoTiny(AbsListView view, int firstVisibleItem, int int currentPlayPosition = JZMediaManager.instance().positionInList; if (currentPlayPosition >= 0) { if ((currentPlayPosition < firstVisibleItem || currentPlayPosition > (lastVisibleItem - 1))) { - if (JZVideoPlayerManager.getCurrentJzvd() != null && - JZVideoPlayerManager.getCurrentJzvd().currentScreen != JZVideoPlayer.SCREEN_WINDOW_TINY && - JZVideoPlayerManager.getCurrentJzvd().currentScreen != JZVideoPlayer.SCREEN_WINDOW_FULLSCREEN) { - if (JZVideoPlayerManager.getCurrentJzvd().currentState == JZVideoPlayer.CURRENT_STATE_PAUSE) { - JZVideoPlayer.releaseAllVideos(); + if (JzvdMgr.getCurrentJzvd() != null && + JzvdMgr.getCurrentJzvd().currentScreen != Jzvd.SCREEN_WINDOW_TINY && + JzvdMgr.getCurrentJzvd().currentScreen != Jzvd.SCREEN_WINDOW_FULLSCREEN) { + if (JzvdMgr.getCurrentJzvd().currentState == Jzvd.CURRENT_STATE_PAUSE) { + Jzvd.releaseAllVideos(); } else { Log.e(TAG, "onScroll: out screen"); - JZVideoPlayerManager.getCurrentJzvd().startWindowTiny(); + JzvdMgr.getCurrentJzvd().startWindowTiny(); } } } else { - if (JZVideoPlayerManager.getCurrentJzvd() != null && - JZVideoPlayerManager.getCurrentJzvd().currentScreen == JZVideoPlayer.SCREEN_WINDOW_TINY) { + if (JzvdMgr.getCurrentJzvd() != null && + JzvdMgr.getCurrentJzvd().currentScreen == Jzvd.SCREEN_WINDOW_TINY) { Log.e(TAG, "onScroll: into screen"); - JZVideoPlayer.backPress(); + Jzvd.backPress(); } } } @@ -311,28 +311,28 @@ public static void onScrollReleaseAllVideos(AbsListView view, int firstVisibleIt currentPlayPosition + " " + firstVisibleItem + " " + currentPlayPosition + " " + lastVisibleItem); if (currentPlayPosition >= 0) { if ((currentPlayPosition < firstVisibleItem || currentPlayPosition > (lastVisibleItem - 1))) { - if (JZVideoPlayerManager.getCurrentJzvd().currentScreen != JZVideoPlayer.SCREEN_WINDOW_FULLSCREEN) { - JZVideoPlayer.releaseAllVideos();//为什么最后一个视频横屏会调用这个,其他地方不会 + if (JzvdMgr.getCurrentJzvd().currentScreen != Jzvd.SCREEN_WINDOW_FULLSCREEN) { + Jzvd.releaseAllVideos();//为什么最后一个视频横屏会调用这个,其他地方不会 } } } } public static void onChildViewAttachedToWindow(View view, int jzvdId) { - if (JZVideoPlayerManager.getCurrentJzvd() != null && JZVideoPlayerManager.getCurrentJzvd().currentScreen == JZVideoPlayer.SCREEN_WINDOW_TINY) { - JZVideoPlayer videoPlayer = view.findViewById(jzvdId); + if (JzvdMgr.getCurrentJzvd() != null && JzvdMgr.getCurrentJzvd().currentScreen == Jzvd.SCREEN_WINDOW_TINY) { + Jzvd videoPlayer = view.findViewById(jzvdId); if (videoPlayer != null && videoPlayer.jzDataSource.containsTheUrl(JZMediaManager.getCurrentUrl())) { - JZVideoPlayer.backPress(); + Jzvd.backPress(); } } } public static void onChildViewDetachedFromWindow(View view) { - if (JZVideoPlayerManager.getCurrentJzvd() != null && JZVideoPlayerManager.getCurrentJzvd().currentScreen != JZVideoPlayer.SCREEN_WINDOW_TINY) { - JZVideoPlayer videoPlayer = JZVideoPlayerManager.getCurrentJzvd(); + if (JzvdMgr.getCurrentJzvd() != null && JzvdMgr.getCurrentJzvd().currentScreen != Jzvd.SCREEN_WINDOW_TINY) { + Jzvd videoPlayer = JzvdMgr.getCurrentJzvd(); if (((ViewGroup) view).indexOfChild(videoPlayer) != -1) { - if (videoPlayer.currentState == JZVideoPlayer.CURRENT_STATE_PAUSE) { - JZVideoPlayer.releaseAllVideos(); + if (videoPlayer.currentState == Jzvd.CURRENT_STATE_PAUSE) { + Jzvd.releaseAllVideos(); } else { videoPlayer.startWindowTiny(); } @@ -347,7 +347,7 @@ public static void setTextureViewRotation(int rotation) { } public static void setVideoImageDisplayType(int type) { - JZVideoPlayer.VIDEO_IMAGE_DISPLAY_TYPE = type; + Jzvd.VIDEO_IMAGE_DISPLAY_TYPE = type; if (JZMediaManager.textureView != null) { JZMediaManager.textureView.requestLayout(); } @@ -413,8 +413,8 @@ public void setUp(JZDataSource jzDataSource, int screen) { } else if (isCurrentJZVD() && !jzDataSource.containsTheUrl(JZMediaManager.getCurrentUrl())) { startWindowTiny(); } else if (!isCurrentJZVD() && jzDataSource.containsTheUrl(JZMediaManager.getCurrentUrl())) { - if (JZVideoPlayerManager.getCurrentJzvd() != null && - JZVideoPlayerManager.getCurrentJzvd().currentScreen == JZVideoPlayer.SCREEN_WINDOW_TINY) { + if (JzvdMgr.getCurrentJzvd() != null && + JzvdMgr.getCurrentJzvd().currentScreen == Jzvd.SCREEN_WINDOW_TINY) { //需要退出小窗退到我这里,我这里是第一层级 tmp_test_back = true; } @@ -591,7 +591,7 @@ public boolean onTouch(View v, MotionEvent event) { } public void startVideo() { - JZVideoPlayerManager.completeAll(); + JzvdMgr.completeAll(); Log.d(TAG, "startVideo [" + this.hashCode() + "] "); initTextureView(); addTextureView(); @@ -602,7 +602,7 @@ public void startVideo() { JZMediaManager.setDataSource(jzDataSource); JZMediaManager.instance().positionInList = positionInList; onStatePreparing(); - JZVideoPlayerManager.setFirstFloor(this); + JzvdMgr.setFirstFloor(this); } public void onPrepared() { @@ -781,10 +781,10 @@ public void release() { if (jzDataSource.getCurrentUrl().equals(JZMediaManager.getCurrentUrl()) && (System.currentTimeMillis() - CLICK_QUIT_FULLSCREEN_TIME) > FULL_SCREEN_NORMAL_DELAY) { //在非全屏的情况下只能backPress() - if (JZVideoPlayerManager.getSecondFloor() != null && - JZVideoPlayerManager.getSecondFloor().currentScreen == SCREEN_WINDOW_FULLSCREEN) {//点击全屏 - } else if (JZVideoPlayerManager.getSecondFloor() == null && JZVideoPlayerManager.getFirstFloor() != null && - JZVideoPlayerManager.getFirstFloor().currentScreen == SCREEN_WINDOW_FULLSCREEN) {//直接全屏 + if (JzvdMgr.getSecondFloor() != null && + JzvdMgr.getSecondFloor().currentScreen == SCREEN_WINDOW_FULLSCREEN) {//点击全屏 + } else if (JzvdMgr.getSecondFloor() == null && JzvdMgr.getFirstFloor() != null && + JzvdMgr.getFirstFloor().currentScreen == SCREEN_WINDOW_FULLSCREEN) {//直接全屏 } else { Log.d(TAG, "releaseMediaPlayer [" + this.hashCode() + "]"); releaseAllVideos(); @@ -794,7 +794,7 @@ public void release() { public void initTextureView() { removeTextureView(); - JZMediaManager.textureView = new JZResizeTextureView(getContext()); + JZMediaManager.textureView = new JZTextureView(getContext()); JZMediaManager.textureView.setSurfaceTextureListener(JZMediaManager.instance()); } @@ -834,8 +834,8 @@ public void clearFloatScreen() { showSupportActionBar(getContext()); ViewGroup vp = (JZUtils.scanForActivity(getContext()))//.getWindow().getDecorView(); .findViewById(Window.ID_ANDROID_CONTENT); - JZVideoPlayer fullJzvd = vp.findViewById(R.id.jz_fullscreen_id); - JZVideoPlayer tinyJzvd = vp.findViewById(R.id.jz_tiny_id); + Jzvd fullJzvd = vp.findViewById(R.id.jz_fullscreen_id); + Jzvd tinyJzvd = vp.findViewById(R.id.jz_tiny_id); if (fullJzvd != null) { vp.removeView(fullJzvd); @@ -847,7 +847,7 @@ public void clearFloatScreen() { if (tinyJzvd.textureViewContainer != null) tinyJzvd.textureViewContainer.removeView(JZMediaManager.textureView); } - JZVideoPlayerManager.setSecondFloor(null); + JzvdMgr.setSecondFloor(null); } public void onVideoSizeChanged() { @@ -974,25 +974,25 @@ public void startWindowFullscreen() { } textureViewContainer.removeView(JZMediaManager.textureView); try { - Constructor constructor = (Constructor) JZVideoPlayer.this.getClass().getConstructor(Context.class); - JZVideoPlayer jzVideoPlayer = constructor.newInstance(getContext()); - jzVideoPlayer.setId(R.id.jz_fullscreen_id); + Constructor constructor = (Constructor) Jzvd.this.getClass().getConstructor(Context.class); + Jzvd jzvd = constructor.newInstance(getContext()); + jzvd.setId(R.id.jz_fullscreen_id); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); - vp.addView(jzVideoPlayer, lp); - jzVideoPlayer.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + vp.addView(jzvd, lp); + jzvd.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_FULLSCREEN); - jzVideoPlayer.setUp(jzDataSource, JZVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN); - jzVideoPlayer.setState(currentState); - jzVideoPlayer.addTextureView(); - JZVideoPlayerManager.setSecondFloor(jzVideoPlayer); + jzvd.setUp(jzDataSource, JzvdStd.SCREEN_WINDOW_FULLSCREEN); + jzvd.setState(currentState); + jzvd.addTextureView(); + JzvdMgr.setSecondFloor(jzvd); // final Animation ra = AnimationUtils.loadAnimation(getContext(), R.anim.start_fullscreen); // jzVideoPlayer.setAnimation(ra); JZUtils.setRequestedOrientation(getContext(), FULLSCREEN_ORIENTATION); onStateNormal(); - jzVideoPlayer.progressBar.setSecondaryProgress(progressBar.getSecondaryProgress()); - jzVideoPlayer.startProgressTimer(); + jzvd.progressBar.setSecondaryProgress(progressBar.getSecondaryProgress()); + jzvd.startProgressTimer(); CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis(); } catch (Exception e) { e.printStackTrace(); @@ -1014,16 +1014,16 @@ public void startWindowTiny() { textureViewContainer.removeView(JZMediaManager.textureView); try { - Constructor constructor = (Constructor) JZVideoPlayer.this.getClass().getConstructor(Context.class); - JZVideoPlayer jzVideoPlayer = constructor.newInstance(getContext()); - jzVideoPlayer.setId(R.id.jz_tiny_id); + Constructor constructor = (Constructor) Jzvd.this.getClass().getConstructor(Context.class); + Jzvd jzvd = constructor.newInstance(getContext()); + jzvd.setId(R.id.jz_tiny_id); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(400, 400); lp.gravity = Gravity.RIGHT | Gravity.BOTTOM; - vp.addView(jzVideoPlayer, lp); - jzVideoPlayer.setUp(jzDataSource, JZVideoPlayerStandard.SCREEN_WINDOW_TINY); - jzVideoPlayer.setState(currentState); - jzVideoPlayer.addTextureView(); - JZVideoPlayerManager.setSecondFloor(jzVideoPlayer); + vp.addView(jzvd, lp); + jzvd.setUp(jzDataSource, JzvdStd.SCREEN_WINDOW_TINY); + jzvd.setState(currentState); + jzvd.addTextureView(); + JzvdMgr.setSecondFloor(jzvd); onStateNormal(); } catch (InstantiationException e) { e.printStackTrace(); @@ -1038,15 +1038,15 @@ public boolean isCurrentPlay() { } public boolean isCurrentJZVD() { - return JZVideoPlayerManager.getCurrentJzvd() != null - && JZVideoPlayerManager.getCurrentJzvd() == this; + return JzvdMgr.getCurrentJzvd() != null + && JzvdMgr.getCurrentJzvd() == this; } //退出全屏和小窗的方法 public void playOnThisJzvd() { Log.i(TAG, "playOnThisJzvd " + " [" + this.hashCode() + "] "); //1.清空全屏和小窗的jzvd - currentState = JZVideoPlayerManager.getSecondFloor().currentState; + currentState = JzvdMgr.getSecondFloor().currentState; clearFloatScreen(); //2.在本jzvd上播放 setState(currentState); @@ -1132,8 +1132,8 @@ public void onSensorChanged(SensorEvent event) {//可以得到传感器实时测 //过滤掉用力过猛会有一个反向的大数值 if (x < -12 || x > 12) { if ((System.currentTimeMillis() - lastAutoFullscreenTime) > 2000) { - if (JZVideoPlayerManager.getCurrentJzvd() != null) { - JZVideoPlayerManager.getCurrentJzvd().autoFullscreen(x); + if (JzvdMgr.getCurrentJzvd() != null) { + JzvdMgr.getCurrentJzvd().autoFullscreen(x); } lastAutoFullscreenTime = System.currentTimeMillis(); } diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerManager.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdMgr.java similarity index 57% rename from jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerManager.java rename to jiaozivideoplayer/src/main/java/cn/jzvd/JzvdMgr.java index abe743381..89c7cf70b 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerManager.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdMgr.java @@ -5,28 +5,28 @@ * From a JZVideoPlayer to another JZVideoPlayer * Created by Nathen on 16/7/26. */ -public class JZVideoPlayerManager { +public class JzvdMgr { - public static JZVideoPlayer FIRST_FLOOR_JZVD; - public static JZVideoPlayer SECOND_FLOOR_JZVD; + public static Jzvd FIRST_FLOOR_JZVD; + public static Jzvd SECOND_FLOOR_JZVD; - public static JZVideoPlayer getFirstFloor() { + public static Jzvd getFirstFloor() { return FIRST_FLOOR_JZVD; } - public static void setFirstFloor(JZVideoPlayer jzVideoPlayer) { - FIRST_FLOOR_JZVD = jzVideoPlayer; + public static void setFirstFloor(Jzvd jzvd) { + FIRST_FLOOR_JZVD = jzvd; } - public static JZVideoPlayer getSecondFloor() { + public static Jzvd getSecondFloor() { return SECOND_FLOOR_JZVD; } - public static void setSecondFloor(JZVideoPlayer jzVideoPlayer) { - SECOND_FLOOR_JZVD = jzVideoPlayer; + public static void setSecondFloor(Jzvd jzvd) { + SECOND_FLOOR_JZVD = jzvd; } - public static JZVideoPlayer getCurrentJzvd() { + public static Jzvd getCurrentJzvd() { if (getSecondFloor() != null) { return getSecondFloor(); } diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java similarity index 98% rename from jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java rename to jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java index 6b0958352..bc54f0dc3 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JzvdStd.java @@ -33,7 +33,7 @@ * Created by Nathen * On 2016/04/18 16:15 */ -public class JZVideoPlayerStandard extends JZVideoPlayer { +public class JzvdStd extends Jzvd { protected static Timer DISMISS_CONTROL_VIEW_TIMER; @@ -81,11 +81,11 @@ public void onReceive(Context context, Intent intent) { } }; - public JZVideoPlayerStandard(Context context) { + public JzvdStd(Context context) { super(context); } - public JZVideoPlayerStandard(Context context, AttributeSet attrs) { + public JzvdStd(Context context, AttributeSet attrs) { super(context, attrs); } @@ -148,7 +148,7 @@ public void setUp(JZDataSource jzDataSource, int screen) { if (tmp_test_back) { tmp_test_back = false; - JZVideoPlayerManager.setFirstFloor(this); + JzvdMgr.setFirstFloor(this); backPress(); } } @@ -230,7 +230,7 @@ public boolean onTouch(View v, MotionEvent event) { bottomProgressBar.setProgress(progress); } if (!mChangePosition && !mChangeVolume) { - onEvent(JZUserActionStandard.ON_CLICK_BLANK); + onEvent(JZUserActionStd.ON_CLICK_BLANK); onClickUiToggle(); } break; @@ -265,7 +265,7 @@ public void onClick(View v) { return; } startVideo(); - onEvent(JZUserActionStandard.ON_CLICK_START_THUMB);//开始的事件应该在播放之后,此处特殊 + onEvent(JZUserActionStd.ON_CLICK_START_THUMB);//开始的事件应该在播放之后,此处特殊 } else if (currentState == CURRENT_STATE_AUTO_COMPLETE) { onClickUiToggle(); } @@ -274,7 +274,7 @@ public void onClick(View v) { } else if (i == R.id.back) { backPress(); } else if (i == R.id.back_tiny) { - if (JZVideoPlayerManager.getFirstFloor().currentScreen == JZVideoPlayer.SCREEN_WINDOW_LIST) { + if (JzvdMgr.getFirstFloor().currentScreen == Jzvd.SCREEN_WINDOW_LIST) { quitFullscreenOrTinyWindow(); } else { backPress(); @@ -349,7 +349,7 @@ public void showWifiDialog() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); - onEvent(JZUserActionStandard.ON_CLICK_START_WIFIDIALOG); + onEvent(JZUserActionStd.ON_CLICK_START_WIFIDIALOG); startVideo(); WIFI_TIP_DIALOG_SHOWED = true; } From 9badb5228bf4f42b8301042ff202e6ee586ebabf Mon Sep 17 00:00:00 2001 From: Nathen <821537155@qq.com> Date: Sun, 2 Sep 2018 14:48:15 +0800 Subject: [PATCH 14/14] v6.3_preview --- 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 4828d5815..5d46bd69c 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -2,7 +2,7 @@ --

- +

@@ -24,7 +24,7 @@ ## 效果 -**[jiaozivideoplayer-6.2.12.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.2.12/jiaozivideoplayer-6.2.12.apk)** +**[jiaozivideoplayer-6.3_preview.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.3_preview/jiaozivideoplayer-6.3_preview.apk)** ![Demo Screenshot][1] @@ -36,10 +36,10 @@ 1.添加类库 ```gradle -compile 'cn.jzvd:jiaozivideoplayer:6.2.12' +compile 'cn.jzvd:jiaozivideoplayer:6.3_preview' ``` -或直接下载 [jar包](https://github.com/lipangit/JiaoZiVideoPlayer/releases/tag/v6.2.12) (不建议) +或直接下载 [jar包](https://github.com/lipangit/JiaoZiVideoPlayer/releases/tag/v6.3_preview) (不建议) 2.添加布局 ```xml diff --git a/README.md b/README.md index df966f887..ffebf3b33 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ --

- +

@@ -34,7 +34,7 @@ Group Q: 490442439 (group 1 full) 761899104 (group 2) authentication information ## Demo apk -A demo apk [jiaozivideoplayer-6.2.12.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.2.12/jiaozivideoplayer-6.2.12.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). +A demo apk [jiaozivideoplayer-6.3_preview.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.3_preview/jiaozivideoplayer-6.3_preview.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). ![Demo screenshot][1] @@ -44,10 +44,10 @@ Only five steps to use the player: 1.Import library: ```gradle -compile 'cn.jzvd:jiaozivideoplayer:6.2.12' +compile 'cn.jzvd:jiaozivideoplayer:6.3_preview' ``` -Or download [lib](https://github.com/lipangit/JiaoZiVideoPlayer/releases/tag/v6.2.12) (not recommended). +Or download [lib](https://github.com/lipangit/JiaoZiVideoPlayer/releases/tag/v6.3_preview) (not recommended). 2.Add `JZVideoPlayer` in your layout: ```xml diff --git a/app/build.gradle b/app/build.gradle index 2659d2a53..d98bddcaa 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "cn.jzvd.demo" minSdkVersion 16 targetSdkVersion 27 - versionCode 82 - versionName "6.2.12" + versionCode 83 + versionName "6.3_preview" } signingConfigs { releaseConfig { diff --git a/gradle/maven_push.gradle b/gradle/maven_push.gradle index 7bfdaac75..79e2c2253 100644 --- a/gradle/maven_push.gradle +++ b/gradle/maven_push.gradle @@ -22,7 +22,7 @@ signing { group = "cn.jzvd" archivesBaseName = "jiaozivideoplayer" -version = "6.2.12" +version = "6.3_preview" uploadArchives { repositories { diff --git a/jiaozivideoplayer/build.gradle b/jiaozivideoplayer/build.gradle index 3ae65e3ce..59b1be76e 100644 --- a/jiaozivideoplayer/build.gradle +++ b/jiaozivideoplayer/build.gradle @@ -7,8 +7,8 @@ android { defaultConfig { minSdkVersion 16 targetSdkVersion 27 - versionCode 82 - versionName "6.2.12" + versionCode 83 + versionName "6.3_preview" } buildTypes { release {