diff --git a/README.md b/README.md
index 768e49b2..1ecb6816 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
--
-
+
@@ -23,7 +23,7 @@
## 文档
-- [文档 - API](https://github.com/Jzvd/JiaoZiVideoPlayer/wiki/%E6%96%87%E6%A1%A3-%E2%80%94-API),下载安装[Demo jiaozivideoplayer-7.4.2.apk](https://github.com/Jzvd/JiaoZiVideoPlayer/releases/download/v7.4.2/jiaozivideoplayer-7.4.2.apk),仔细过一遍Demo
+- [文档 - API](https://github.com/Jzvd/JiaoZiVideoPlayer/wiki/%E6%96%87%E6%A1%A3-%E2%80%94-API),下载安装[Demo jiaozivideoplayer-7.5.0.apk](https://github.com/Jzvd/JiaoZiVideoPlayer/releases/download/v7.5.0/jiaozivideoplayer-7.5.0.apk),仔细过一遍Demo
- [文档 - 自定义Jzvd](https://github.com/Jzvd/JiaoZiVideoPlayer/wiki/%E6%96%87%E6%A1%A3-%E2%80%94-%E8%87%AA%E5%AE%9A%E4%B9%89Jzvd),继承JzvdStd实现自己的播放器
- [文档 - 自定义播放内核](https://github.com/Jzvd/JiaoZiVideoPlayer/wiki/%E6%96%87%E6%A1%A3-%E2%80%94-%E8%87%AA%E5%AE%9A%E4%B9%89%E6%92%AD%E6%94%BE%E5%86%85%E6%A0%B8),测试哪个播放内核适合自己的项目
@@ -37,12 +37,12 @@
1.添加类库
```gradle
-implementation 'cn.jzvd:jiaozivideoplayer:7.4.2'
+implementation 'cn.jzvd:jiaozivideoplayer:7.5.0'
```
2.添加布局
```xml
-
diff --git a/build.gradle b/build.gradle
index a1e614b6..353dce49 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,12 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
+ ext.kotlin_version = '1.3.72'
repositories {
jcenter()
google()
+ maven { url 'https://maven.aliyun.com/repository/releases' }
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.0.0'
+ classpath 'com.android.tools.build:gradle:4.0.1'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -19,6 +22,7 @@ allprojects {
google()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
+ maven { url 'https://maven.aliyun.com/repository/releases' }
}
}
diff --git a/demo/build.gradle b/demo/build.gradle
index d5aa4e39..240a542d 100644
--- a/demo/build.gradle
+++ b/demo/build.gradle
@@ -1,15 +1,15 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 29
- buildToolsVersion = '29.0.3'
+ compileSdkVersion 30
+ buildToolsVersion "30.0.2"
defaultConfig {
applicationId "cn.jzvd.demo"
minSdkVersion 16
- targetSdkVersion 29
- versionCode 104
- versionName "7.4.2"
+ targetSdkVersion 30
+ versionCode 105
+ versionName "7.5.0"
ndk {
// add support lib
abiFilters 'armeabi-v7a' //, 'arm64-v8a'//, "mips" //,'armeabi''x86',, 'x86_64',
@@ -48,18 +48,20 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
- implementation 'androidx.appcompat:appcompat:1.1.0'
- implementation 'com.google.android.material:material:1.1.0'
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'com.google.android.material:material:1.2.0'
implementation project(':library')
implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.4'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.danikula:videocache:2.7.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
- implementation 'com.google.android.exoplayer:exoplayer:2.10.4'
+ implementation 'com.google.android.exoplayer:exoplayer:2.11.3'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.3'
- implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+ implementation 'com.android.support.constraint:constraint-layout:2.0.1'
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-core:1.0.15'
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-native:1.0.15'
implementation 'com.github.ittianyu:BottomNavigationViewEx:2.0.4'
+ implementation 'com.aliyun.sdk.android:AliyunPlayer:4.5.0-full'
+ implementation 'com.alivc.conan:AlivcConan:0.9.5'
}
diff --git a/demo/proguard-rules.pro b/demo/proguard-rules.pro
index 3e8b423e..88acd5d4 100644
--- a/demo/proguard-rules.pro
+++ b/demo/proguard-rules.pro
@@ -24,4 +24,12 @@
-keep class tv.danmaku.ijk.media.player.** {*; }
-dontwarn tv.danmaku.ijk.media.player.*
--keep interface tv.danmaku.ijk.media.player.** { *; }
\ No newline at end of file
+-keep interface tv.danmaku.ijk.media.player.** { *; }
+
+#aliyunplayer
+-keep class com.alivc.**{*;}
+-keep class com.aliyun.**{*;}
+-keep class com.cicada.**{*;}
+-dontwarn com.alivc.**
+-dontwarn com.aliyun.**
+-dontwarn com.cicada.**
\ No newline at end of file
diff --git a/demo/src/main/java/cn/jzvd/demo/CustomJzvd/JzvdStdTikTok.java b/demo/src/main/java/cn/jzvd/demo/CustomJzvd/JzvdStdTikTok.java
index d5102ab5..37113b0f 100644
--- a/demo/src/main/java/cn/jzvd/demo/CustomJzvd/JzvdStdTikTok.java
+++ b/demo/src/main/java/cn/jzvd/demo/CustomJzvd/JzvdStdTikTok.java
@@ -39,8 +39,8 @@ public void changeUiToNormal() {
@Override
public void setAllControlsVisiblity(int topCon, int bottomCon, int startBtn, int loadingPro,
int posterImg, int bottomPro, int retryLayout) {
- topContainer.setVisibility(topCon);
- bottomContainer.setVisibility(bottomCon);
+ topContainer.setVisibility(INVISIBLE);
+ bottomContainer.setVisibility(INVISIBLE);
startButton.setVisibility(startBtn);
loadingProgressBar.setVisibility(loadingPro);
posterImageView.setVisibility(posterImg);
diff --git a/demo/src/main/java/cn/jzvd/demo/CustomMedia/JZMediaAliyun.java b/demo/src/main/java/cn/jzvd/demo/CustomMedia/JZMediaAliyun.java
new file mode 100644
index 00000000..ade29941
--- /dev/null
+++ b/demo/src/main/java/cn/jzvd/demo/CustomMedia/JZMediaAliyun.java
@@ -0,0 +1,277 @@
+package cn.jzvd.demo.CustomMedia;
+
+import android.graphics.SurfaceTexture;
+import android.os.Handler;
+import android.util.Log;
+import android.view.Surface;
+
+import com.aliyun.player.AliPlayer;
+import com.aliyun.player.AliPlayerFactory;
+import com.aliyun.player.IPlayer;
+import com.aliyun.player.bean.ErrorInfo;
+import com.aliyun.player.bean.InfoBean;
+import com.aliyun.player.bean.InfoCode;
+import com.aliyun.player.nativeclass.PlayerConfig;
+import com.aliyun.player.source.UrlSource;
+
+import cn.jzvd.JZMediaInterface;
+import cn.jzvd.Jzvd;
+import cn.jzvd.demo.ApplicationDemo;
+
+/**
+ * usage: 阿里云播放器内核
+ * author: kHRYSTAL
+ * create time: 2020-09-01
+ * update time:
+ * email: 723526676@qq.com
+ */
+public class JZMediaAliyun extends JZMediaInterface implements IPlayer.OnPreparedListener, IPlayer.OnVideoSizeChangedListener, IPlayer.OnCompletionListener, IPlayer.OnErrorListener, IPlayer.OnInfoListener, IPlayer.OnSeekCompleteListener, IPlayer.OnRenderingStartListener, IPlayer.OnLoadingStatusListener {
+
+ private static final String TAG = JZMediaAliyun.class.getSimpleName();
+ private static final int FROM_ALIYUN_PLAYER_INFO = 0x1688;
+
+ AliPlayer aliyunMediaPlayer;
+ private boolean isPlaying;
+ private long mCurrentPosition;
+
+ public JZMediaAliyun(Jzvd jzvd) {
+ super(jzvd);
+ }
+
+ @Override
+ public void start() {
+ if (aliyunMediaPlayer != null) {
+ isPlaying = true;
+ aliyunMediaPlayer.start();
+ handler.post(() -> jzvd.onStatePlaying()); // 需要手动调用开始播放 改变ui播放状态
+ }
+ }
+
+ @Override
+ public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
+ if (SAVED_SURFACE == null) {
+ SAVED_SURFACE = surface;
+ prepare();
+ } else {
+ jzvd.textureView.setSurfaceTexture(SAVED_SURFACE);
+ }
+ }
+
+ @Override
+ public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
+ }
+
+ @Override
+ public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
+ return false;
+ }
+
+ @Override
+ public void onSurfaceTextureUpdated(SurfaceTexture surface) {
+
+ }
+
+ @Override
+ public void prepare() {
+ release();
+ mMediaHandler = new Handler();
+ handler = new Handler();
+ mMediaHandler.post(() -> {
+ aliyunMediaPlayer = AliPlayerFactory.createAliPlayer(jzvd.getContext());
+
+ //region 阿里云播放器基本设置 具体参考: {@link https://help.aliyun.com/document_detail/124714.html?spm=a2c4g.11186623.6.1083.2dbf2722XQM0Mr}
+ //先获取配置
+ PlayerConfig config = aliyunMediaPlayer.getConfig();
+ //设置网络超时时间,单位ms
+ config.mNetworkTimeout = 5000;
+ //设置超时重试次数。每次重试间隔为networkTimeout。networkRetryCount=0则表示不重试,重试策略app决定,默认值为2
+ config.mNetworkRetryCount = 2;
+ // 配置请求头 refer UA
+ //定义header
+// String[] headers = new String[1];
+// headers[0]="Host:xxx.com";//比如需要设置Host到header中。
+// config.setCustomHeaders(headers);
+// config.mUserAgent = "需要设置的UserAgent";
+ //最大延迟。注意:直播有效。当延时比较大时,播放器sdk内部会追帧等,保证播放器的延时在这个范围内。
+ config.mMaxDelayTime = 5000;
+ // 最大缓冲区时长。单位ms。播放器每次最多加载这么长时间的缓冲数据。
+ config.mMaxBufferDuration = 50000;
+ //高缓冲时长。单位ms。当网络不好导致加载数据时,如果加载的缓冲时长到达这个值,结束加载状态。
+ config.mHighBufferDuration = 3000;
+ // 起播缓冲区时长。单位ms。这个时间设置越短,起播越快。也可能会导致播放之后很快就会进入加载状态。
+ config.mStartBufferDuration = 500;
+ //设置配置给播放器
+ aliyunMediaPlayer.setConfig(config);
+ //endregion
+
+// aliyunMediaPlayer.setAutoPlay(true); // 是否自动播放
+// aliyunMediaPlayer.setLoop(true); // 是否循环播放
+
+ //region 监听
+ aliyunMediaPlayer.setOnPreparedListener(JZMediaAliyun.this); // 准备成功事件
+ aliyunMediaPlayer.setOnVideoSizeChangedListener(JZMediaAliyun.this); // 视频分辨率变化回调
+ aliyunMediaPlayer.setOnCompletionListener(JZMediaAliyun.this); // 播放完成事件
+ aliyunMediaPlayer.setOnErrorListener(JZMediaAliyun.this); // 出错事件
+ aliyunMediaPlayer.setOnInfoListener(JZMediaAliyun.this); //其他信息的事件,type包括了:循环播放开始,缓冲位置,当前播放位置,自动播放开始等
+ aliyunMediaPlayer.setOnSeekCompleteListener(JZMediaAliyun.this); // 拖动事件
+ aliyunMediaPlayer.setOnRenderingStartListener(JZMediaAliyun.this); // 首帧渲染显示事件
+ aliyunMediaPlayer.setOnLoadingStatusListener(JZMediaAliyun.this);
+ //endregion
+
+ //设置配置给播放器
+ try {
+ // 创建DataSource,准备播放 可通过jzDataSource区分是否加密
+ UrlSource urlSource = new UrlSource();
+ urlSource.setUri(jzvd.jzDataSource.getCurrentUrl().toString());
+// 加密播放配置 以下的key可以通过jzDataSource去获取
+// VidSts vidSts = new VidSts();
+// vidSts.setVid("videoId");
+// vidSts.setAccessKeyId("akId");
+// vidSts.setAccessKeySecret("akSecret");
+// vidSts.setSecurityToken("authToken");
+// vidSts.setRegion("cn-shanghai");
+ aliyunMediaPlayer.setDataSource(urlSource);
+ aliyunMediaPlayer.setSurface(new Surface(SAVED_SURFACE));
+ aliyunMediaPlayer.prepare();
+ } catch (Exception e) {
+ Log.e(TAG, e.getMessage());
+ }
+ });
+ }
+
+ @Override
+ public void pause() {
+ if (aliyunMediaPlayer != null) {
+ isPlaying = false;
+ aliyunMediaPlayer.pause();
+ }
+ }
+
+ @Override
+ public boolean isPlaying() {
+ return isPlaying;
+ }
+
+ @Override
+ public void seekTo(long time) {
+ if (aliyunMediaPlayer != null)
+ aliyunMediaPlayer.seekTo(time);
+ }
+
+ @Override
+ public void release() {
+ if (mMediaHandler != null && aliyunMediaPlayer != null) {
+ AliPlayer tmpMediaPlayer = aliyunMediaPlayer;
+ JZMediaInterface.SAVED_SURFACE = null;
+ isPlaying = false;
+ mCurrentPosition = 0L;
+ mMediaHandler.post(() -> {
+ tmpMediaPlayer.setSurface(null);
+ tmpMediaPlayer.release();
+ });
+ aliyunMediaPlayer = null;
+ }
+ }
+
+ @Override
+ public long getCurrentPosition() {
+ if (aliyunMediaPlayer != null) {
+ return mCurrentPosition;
+ }
+ return 0L;
+ }
+
+ @Override
+ public long getDuration() {
+ if (aliyunMediaPlayer != null) {
+ return aliyunMediaPlayer.getDuration();
+ }
+ return 0L;
+ }
+
+ @Override
+ public void setVolume(float leftVolume, float rightVolume) {
+ aliyunMediaPlayer.setVolume(Math.max(leftVolume, rightVolume));
+ }
+
+ @Override
+ public void setSpeed(float speed) {
+ if (aliyunMediaPlayer != null)
+ aliyunMediaPlayer.setSpeed(speed);
+ }
+
+ @Override
+ public void setSurface(Surface surface) {
+ if (aliyunMediaPlayer != null)
+ aliyunMediaPlayer.setSurface(surface);
+ }
+
+ @Override
+ public void onPrepared() {
+ handler.post(() -> jzvd.onPrepared());
+ }
+
+ @Override
+ public void onVideoSizeChanged(int i, int i1) {
+ handler.post(() -> jzvd.onVideoSizeChanged(aliyunMediaPlayer.getVideoWidth(), aliyunMediaPlayer.getVideoHeight()));
+ }
+
+ @Override
+ public void onCompletion() {
+ isPlaying = false;
+ mCurrentPosition = 0L;
+ handler.post(() -> jzvd.onCompletion());
+ }
+
+ @Override
+ public void onError(ErrorInfo errorInfo) {
+ isPlaying = false;
+ mCurrentPosition = 0L;
+ // 具体参考阿里云播放器错误码
+ handler.post(() -> jzvd.onError(errorInfo.getCode().getValue(), errorInfo.getCode().getValue()));
+ }
+
+ @Override
+ public void onInfo(InfoBean infoBean) {
+ if (infoBean.getCode() == InfoCode.AutoPlayStart) {
+ //自动播放开始,需要设置播放状态
+ isPlaying = true;
+ } else if (infoBean.getCode() == InfoCode.BufferedPosition) {
+ //更新bufferedPosition
+ long videoBufferedPosition = infoBean.getExtraValue();
+ handler.post(() -> jzvd.setBufferProgress((int) videoBufferedPosition));
+ } else if (infoBean.getCode() == InfoCode.CurrentPosition) {
+ //更新currentPosition
+ mCurrentPosition = infoBean.getExtraValue();
+ } else {
+ handler.post(() -> jzvd.onInfo(FROM_ALIYUN_PLAYER_INFO, infoBean.getCode().getValue()));
+ }
+ }
+
+ @Override
+ public void onSeekComplete() {
+ //拖动结束
+ handler.post(() -> jzvd.onSeekComplete());
+ }
+
+ @Override
+ public void onRenderingStart() {
+ // 首帧渲染回调
+ }
+
+ @Override
+ public void onLoadingBegin() {
+ //缓冲开始
+ }
+
+ @Override
+ public void onLoadingProgress(int percent, float kbps) {
+ // 正在缓冲进度 可配置ui 参数1显示secondary进度条 参数2控制显示kbp/s
+ handler.post(() -> jzvd.setBufferProgress(percent));
+ }
+
+ @Override
+ public void onLoadingEnd() {
+ //缓冲结束
+ }
+}
diff --git a/demo/src/main/java/cn/jzvd/demo/CustomMedia/JZMediaExo.java b/demo/src/main/java/cn/jzvd/demo/CustomMedia/JZMediaExo.java
index 3ec1d697..1a8431c4 100644
--- a/demo/src/main/java/cn/jzvd/demo/CustomMedia/JZMediaExo.java
+++ b/demo/src/main/java/cn/jzvd/demo/CustomMedia/JZMediaExo.java
@@ -12,15 +12,14 @@
import com.google.android.exoplayer2.DefaultLoadControl;
import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.ExoPlaybackException;
-import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.LoadControl;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.RenderersFactory;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
-import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
+import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.source.hls.HlsMediaSource;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
@@ -38,7 +37,6 @@
import cn.jzvd.JZMediaInterface;
import cn.jzvd.Jzvd;
-import cn.jzvd.demo.Tab_2_Custom.AGVideo.AGVideo;
import cn.jzvd.demo.R;
/**
@@ -70,21 +68,29 @@ public void prepare() {
mMediaHandler = new Handler(context.getMainLooper());//主线程还是非主线程,就在这里
handler = new Handler();
mMediaHandler.post(() -> {
- BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
+
TrackSelection.Factory videoTrackSelectionFactory =
- new AdaptiveTrackSelection.Factory(bandwidthMeter);
+ new AdaptiveTrackSelection.Factory();
TrackSelector trackSelector =
- new DefaultTrackSelector(videoTrackSelectionFactory);
+ new DefaultTrackSelector(context,videoTrackSelectionFactory);
+
+ LoadControl loadControl = new DefaultLoadControl.Builder()
+ .setAllocator(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE))
+ .setBufferDurationsMs( 360000, 600000, 1000, 5000)
+ .setPrioritizeTimeOverSizeThresholds(false)
+ .setTargetBufferBytes(C.LENGTH_UNSET)
+ .createDefaultLoadControl();
- LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE),
- 360000, 600000, 1000, 5000,
- C.LENGTH_UNSET,
- false);
+ BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter.Builder(context).build();
// 2. Create the player
RenderersFactory renderersFactory = new DefaultRenderersFactory(context);
- simpleExoPlayer = ExoPlayerFactory.newSimpleInstance(context, renderersFactory, trackSelector, loadControl);
+ simpleExoPlayer = new SimpleExoPlayer.Builder(context, renderersFactory)
+ .setTrackSelector(trackSelector)
+ .setLoadControl(loadControl)
+ .setBandwidthMeter(bandwidthMeter)
+ .build() ;
// Produces DataSource instances through which media data is loaded.
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context,
Util.getUserAgent(context, context.getResources().getString(R.string.app_name)));
@@ -93,9 +99,13 @@ public void prepare() {
MediaSource videoSource;
if (currUrl.contains(".m3u8")) {
videoSource = new HlsMediaSource.Factory(dataSourceFactory)
- .createMediaSource(Uri.parse(currUrl), handler, null);
+ .createMediaSource(Uri.parse(currUrl));
+ //addEventListener 这里只有两个参数都要传入值才可以成功设置
+ // 否者会被断言 Assertions.checkArgument(handler != null && eventListener != null);
+ // 并且报错 IllegalArgumentException() 所以不需要添加监听器时 注释掉
+ // videoSource .addEventListener( handler, null);
} else {
- videoSource = new ExtractorMediaSource.Factory(dataSourceFactory)
+ videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(Uri.parse(currUrl));
}
simpleExoPlayer.addVideoListener(this);
@@ -150,9 +160,7 @@ public void seekTo(long time) {
}
if (time != previousSeek) {
if (time >= simpleExoPlayer.getBufferedPosition()) {
- if (jzvd instanceof AGVideo) {
- ((AGVideo) jzvd).showProgress();
- }
+ jzvd.onStatePreparingPlaying();
}
simpleExoPlayer.seekTo(time);
previousSeek = time;
@@ -232,9 +240,7 @@ public void onPlayerStateChanged(final boolean playWhenReady, final int playback
}
break;
case Player.STATE_BUFFERING: {
- if (jzvd instanceof AGVideo) {
- ((AGVideo) jzvd).showProgress();
- }
+ jzvd.onStatePreparingPlaying();
handler.post(callback);
}
break;
diff --git a/demo/src/main/java/cn/jzvd/demo/Tab_1_Basic/CustomMediaActivity.java b/demo/src/main/java/cn/jzvd/demo/Tab_1_Basic/CustomMediaActivity.java
index e2bf3807..4fe9ddc4 100644
--- a/demo/src/main/java/cn/jzvd/demo/Tab_1_Basic/CustomMediaActivity.java
+++ b/demo/src/main/java/cn/jzvd/demo/Tab_1_Basic/CustomMediaActivity.java
@@ -13,6 +13,7 @@
import cn.jzvd.JZMediaSystem;
import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;
+import cn.jzvd.demo.CustomMedia.JZMediaAliyun;
import cn.jzvd.demo.CustomMedia.JZMediaExo;
import cn.jzvd.demo.CustomMedia.JZMediaIjk;
import cn.jzvd.demo.R;
@@ -70,6 +71,14 @@ public void clickChangeToExo(View view) {
Toast.makeText(this, "Change to ExoPlayer", Toast.LENGTH_SHORT).show();
}
+ public void clickChangeToAliyun(View view) {
+ Jzvd.releaseAllVideos();
+ jzvdStd.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
+ , "饺子梭哈", JzvdStd.SCREEN_NORMAL, JZMediaAliyun.class);
+ jzvdStd.startVideo();
+ Toast.makeText(this, "Change to AliyunPlayer", Toast.LENGTH_SHORT).show();
+ }
+
@Override
public void onBackPressed() {
diff --git a/demo/src/main/java/cn/jzvd/demo/Tab_2_Custom/AGVideo/AGVideo.java b/demo/src/main/java/cn/jzvd/demo/Tab_2_Custom/AGVideo/AGVideo.java
index bed2970e..c0ee7957 100644
--- a/demo/src/main/java/cn/jzvd/demo/Tab_2_Custom/AGVideo/AGVideo.java
+++ b/demo/src/main/java/cn/jzvd/demo/Tab_2_Custom/AGVideo/AGVideo.java
@@ -897,6 +897,12 @@ public void hideProgress() {
}
}
+ @Override
+ public void onStatePreparingPlaying() {
+ state = STATE_PREPARING_PLAYING;
+ showProgress();
+ }
+
public void showProgress() {
if (loadingView.getVisibility() != View.VISIBLE) {
loadingView.setVisibility(VISIBLE);
diff --git a/demo/src/main/java/cn/jzvd/demo/Tab_2_Custom/AGVideo/view/PlayAndPauseView.java b/demo/src/main/java/cn/jzvd/demo/Tab_2_Custom/AGVideo/view/PlayAndPauseView.java
index 1c7f1fbf..f8f4873e 100644
--- a/demo/src/main/java/cn/jzvd/demo/Tab_2_Custom/AGVideo/view/PlayAndPauseView.java
+++ b/demo/src/main/java/cn/jzvd/demo/Tab_2_Custom/AGVideo/view/PlayAndPauseView.java
@@ -26,7 +26,7 @@ public class PlayAndPauseView extends View {
private int animationStep = 1;
private int animationType = 2;
//左边动画时间
- private long leftDuration = 1000;
+ private long leftDuration = 300;
//右边动画时间
private long rightDuration = 2 * leftDuration / 3;
@@ -94,7 +94,7 @@ private void initOrderAnimation() {
final ObjectAnimator leftZoomHideAnimation = ObjectAnimator.ofFloat(this, "leftZoomValue", 0f, 1.0f);
//左边线条缩放动画
ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(this, "leftZoomValue", 0f, 0.2f);
- objectAnimator1.setDuration(500);
+ objectAnimator1.setDuration(200);
objectAnimator1.addListener(new Animator.AnimatorListener() {
public void onAnimationCancel(Animator param1Animator) {
}
@@ -141,7 +141,7 @@ public void onAnimationUpdate(ValueAnimator param1ValueAnimator) {
private void initReverseAnimation() {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(this, "leftZoomValue", 0.2f, 0f);
- objectAnimator.setDuration(1000);
+ objectAnimator.setDuration(200);
ValueAnimator valueAnimator1 = ValueAnimator.ofFloat(0f, 1.0f);
valueAnimator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator param1ValueAnimator) {
diff --git a/demo/src/main/java/cn/jzvd/demo/Tab_3_List/ListView/tiktok/ViewPagerLayoutManager.java b/demo/src/main/java/cn/jzvd/demo/Tab_3_List/ListView/tiktok/ViewPagerLayoutManager.java
index 401ea511..73ea3c0f 100644
--- a/demo/src/main/java/cn/jzvd/demo/Tab_3_List/ListView/tiktok/ViewPagerLayoutManager.java
+++ b/demo/src/main/java/cn/jzvd/demo/Tab_3_List/ListView/tiktok/ViewPagerLayoutManager.java
@@ -66,7 +66,6 @@ public void onAttachedToWindow(RecyclerView view) {
@Override
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
super.onLayoutChildren(recycler, state);
-//
}
/**
@@ -82,20 +81,13 @@ public void onScrollStateChanged(int state) {
switch (state) {
case RecyclerView.SCROLL_STATE_IDLE:
View viewIdle = mPagerSnapHelper.findSnapView(this);
- int positionIdle = getPosition(viewIdle);
- if (mOnViewPagerListener != null && getChildCount() == 1) {
- mOnViewPagerListener.onPageSelected(positionIdle, positionIdle == getItemCount() - 1);
+ if (viewIdle != null) {
+ int positionIdle = getPosition(viewIdle);
+ if (mOnViewPagerListener != null && getChildCount() == 1) {
+ mOnViewPagerListener.onPageSelected(positionIdle, positionIdle == getItemCount() - 1);
+ }
}
break;
- case RecyclerView.SCROLL_STATE_DRAGGING:
- View viewDrag = mPagerSnapHelper.findSnapView(this);
- int positionDrag = getPosition(viewDrag);
- break;
- case RecyclerView.SCROLL_STATE_SETTLING:
- View viewSettling = mPagerSnapHelper.findSnapView(this);
- int positionSettling = getPosition(viewSettling);
- break;
-
}
}
diff --git a/demo/src/main/res/layout/activity_api_custom_mediaplayer.xml b/demo/src/main/res/layout/activity_api_custom_mediaplayer.xml
index c78ecad2..2cf8aefc 100644
--- a/demo/src/main/res/layout/activity_api_custom_mediaplayer.xml
+++ b/demo/src/main/res/layout/activity_api_custom_mediaplayer.xml
@@ -36,4 +36,13 @@
android:layout_marginBottom="8dp"
android:onClick="clickChangeToExo"
android:text="@string/change_exo" />
+
+
\ No newline at end of file
diff --git a/demo/src/main/res/values-zh/strings.xml b/demo/src/main/res/values-zh/strings.xml
index 566ecbe6..a498a6d9 100644
--- a/demo/src/main/res/values-zh/strings.xml
+++ b/demo/src/main/res/values-zh/strings.xml
@@ -37,6 +37,7 @@
切换至Ijkplayer播放内核
切换至android.media.MediaPlayer播放内核
切换至Exoplayer播放内核
+ 切换至阿里云播放内核
开始预加载
预加载完播放
在列表中使用
diff --git a/demo/src/main/res/values/strings.xml b/demo/src/main/res/values/strings.xml
index 674bfbee..45e67445 100644
--- a/demo/src/main/res/values/strings.xml
+++ b/demo/src/main/res/values/strings.xml
@@ -36,6 +36,7 @@
Change to Ijkplayer
Change to android.media.MediaPlayer
Change to Exoplayer
+ Change to Aliyunplayer
start Preloading
start Video After Preloading
ListView
diff --git a/gradle/build_upload.gradle b/gradle/build_upload.gradle
index 12af1c07..25d725e0 100644
--- a/gradle/build_upload.gradle
+++ b/gradle/build_upload.gradle
@@ -8,7 +8,7 @@ signing {
group = "cn.jzvd"
archivesBaseName = "jiaozivideoplayer"
-version = "7.4.2"
+version = "7.5.0"
uploadArchives {
repositories {
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index b3709e28..4b061c11 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,4 +1,4 @@
-#Tue Jun 02 08:30:58 CST 2020
+#Tue Sep 01 17:04:16 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
diff --git a/library/build.gradle b/library/build.gradle
index 06ae721e..d809fca6 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,14 +1,15 @@
apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
android {
- compileSdkVersion 29
- buildToolsVersion = '29.0.3'
+ compileSdkVersion 30
+ buildToolsVersion = '30.0.2'
defaultConfig {
minSdkVersion 16
- targetSdkVersion 29
- versionCode 104
- versionName "7.4.2"
+ targetSdkVersion 30
+ versionCode 105
+ versionName "7.5.0"
}
compileOptions {
@@ -23,6 +24,11 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation "androidx.core:core-ktx:+"
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
apply from: '../gradle/build_upload.gradle'
+repositories {
+ mavenCentral()
+}
diff --git a/library/src/main/java/cn/jzvd/JzvdStd.java b/library/src/main/java/cn/jzvd/JzvdStd.java
index 93ec839d..a23f7af0 100644
--- a/library/src/main/java/cn/jzvd/JzvdStd.java
+++ b/library/src/main/java/cn/jzvd/JzvdStd.java
@@ -945,6 +945,7 @@ public void dissmissControlView() {
if (screen != SCREEN_TINY) {
bottomProgressBar.setVisibility(View.VISIBLE);
}
+ cancelProgressTimer();
});
}
}
diff --git a/library/src/main/java/org/jzvd/jzvideo/JZVideoA.kt b/library/src/main/java/org/jzvd/jzvideo/JZVideoA.kt
new file mode 100644
index 00000000..bdb5e4b6
--- /dev/null
+++ b/library/src/main/java/org/jzvd/jzvideo/JZVideoA.kt
@@ -0,0 +1,37 @@
+package org.jzvd.jzvideo
+
+import android.content.Context
+import android.util.AttributeSet
+import android.widget.RelativeLayout
+
+const val TAG = "JZVD"
+
+
+open class JZVideoA : RelativeLayout {
+
+ enum class State {
+ IDLE, NORMAL, PREPARING, PREPARING_CHANGE_URL, PREPARING_PLAYING,
+ PREPARED, PLAYING, PAUSE, COMPLETE, ERROR
+ }
+
+ enum class Screen {
+ NORMAL, FULLSCREEN, TINY
+ }
+
+ lateinit var state: State
+
+
+ constructor(ctx: Context) : super(ctx) {
+ }
+
+ constructor(ctx: Context, attrs: AttributeSet) : super(ctx, attrs) {
+ }
+
+ companion object {
+ @JvmStatic
+ fun releaseAllVideos() {
+
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/library/src/main/res/values/ids.xml b/library/src/main/res/values/ids.xml
new file mode 100644
index 00000000..3d0d301d
--- /dev/null
+++ b/library/src/main/res/values/ids.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file