diff --git a/README.md b/README.md index e98714b3d..ffcd58914 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,13 @@ IJK编码格式|**[--- 项目支持视频格式(如果遇上黑屏,没声音 ## 五、近期版本 +### 5.0.1(2018-xx-xx 未发布) +* Update ListGSYVideoPlayer +* ijkPlayer的ex_so增加avi支持 +* update ExoPlayer to 2.8.1 +* ExoPlayer模式的问题修复 + + ### 5.0.0-beta(2018-05-24) * 调整cache机制,抽离cache管理器。 * update ExoPlayer to 2.8.0,全面针对ExoPlayer进行优化 diff --git a/app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java b/app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java index adc005fbb..a297ae189 100644 --- a/app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java +++ b/app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java @@ -239,6 +239,7 @@ private String getUrl() { //String url = "ijkhttphook:https://res.exexm.com/cw_145225549855002"; String url = "http://7xjmzj.com1.z0.glb.clouddn.com/20171026175005_JObCxCE2.mp4"; + //String url = "http://223.110.243.138/PLTV/2510088/224/3221227177/index.m3u8"; //String url = "http://qiniu.carmmi.com/image/132451525666042.mp4"; //String url = "http://ucp.wn.sunmath.cn/file-upload/gYQJHxK9iNQKJeWyS/V80418-103803.mp4?rc_uid=7sCFCGoaF2iTc9vH9&rc_token=prJK-xGutKmy2LDQO-OZASjob0o1u_s3e5SgMHmgjtn"; //String url = "http://7xse1z.com1.z0.glb.clouddn.com/1491813192"; diff --git a/app/src/main/java/com/example/gsyvideoplayer/GSYApplication.java b/app/src/main/java/com/example/gsyvideoplayer/GSYApplication.java index 1173674f2..cb3eddcc4 100644 --- a/app/src/main/java/com/example/gsyvideoplayer/GSYApplication.java +++ b/app/src/main/java/com/example/gsyvideoplayer/GSYApplication.java @@ -29,7 +29,7 @@ public void onCreate() { //GSYVideoType.enableMediaCodecTexture(); //GSYVideoManager.instance().setVideoType(this, GSYVideoType.IJKEXOPLAYER); //EXO 1 播放内核,弃用 - //GSYVideoManager.instance().setVideoType(this, GSYVideoType.IJKEXOPLAYER2); //EXO 2 播放内核 + GSYVideoManager.instance().setVideoType(this, GSYVideoType.IJKEXOPLAYER2); //EXO 2 播放内核 //GSYVideoManager.instance().setVideoType(this, GSYVideoType.SYSTEMPLAYER); //系统播放器 //GSYVideoType.setShowType(GSYVideoType.SCREEN_MATCH_FULL); diff --git a/app/src/main/java/com/example/gsyvideoplayer/exo/GSYExoPlayerManager.java b/app/src/main/java/com/example/gsyvideoplayer/exo/GSYExoPlayerManager.java index cb0f210aa..93fc1bb51 100644 --- a/app/src/main/java/com/example/gsyvideoplayer/exo/GSYExoPlayerManager.java +++ b/app/src/main/java/com/example/gsyvideoplayer/exo/GSYExoPlayerManager.java @@ -228,4 +228,8 @@ public int getVideoSarDen() { return 1; } + @Override + public boolean isSurfaceSupportLockCanvas() { + return false; + } } diff --git a/dependencies.gradle b/dependencies.gradle index 5f39ec21e..6d0f3ccf3 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -31,7 +31,7 @@ ext { gsyVideoVersion = '5.0.0-beta' - exo_player2 = '2.8.0' + exo_player2 = '2.8.1' permissionsdispatcher = '3.2.0' diff --git a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/GSYVideoBaseManager.java b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/GSYVideoBaseManager.java index 4d0fced22..d30817455 100644 --- a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/GSYVideoBaseManager.java +++ b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/GSYVideoBaseManager.java @@ -1,6 +1,7 @@ package com.shuyu.gsyvideoplayer; import android.content.Context; +import android.content.Intent; import android.media.MediaPlayer; import android.os.Handler; import android.os.HandlerThread; @@ -533,6 +534,15 @@ public int getRotateInfoFlag() { return IMediaPlayer.MEDIA_INFO_VIDEO_ROTATION_CHANGED; } + + @Override + public boolean isSurfaceSupportLockCanvas() { + if (playerManager != null) { + return playerManager.isSurfaceSupportLockCanvas(); + } + return false; + } + protected void sendMessage(Message message) { mMediaHandler.sendMessage(message); } diff --git a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/Exo2PlayerManager.java b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/Exo2PlayerManager.java index 42e341e3e..afec9efda 100644 --- a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/Exo2PlayerManager.java +++ b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/Exo2PlayerManager.java @@ -227,4 +227,8 @@ public int getVideoSarDen() { return 1; } + @Override + public boolean isSurfaceSupportLockCanvas() { + return false; + } } diff --git a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/IPlayerManager.java b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/IPlayerManager.java index cb81843df..7df72eeaa 100644 --- a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/IPlayerManager.java +++ b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/IPlayerManager.java @@ -63,6 +63,12 @@ public interface IPlayerManager { */ void setSpeedPlaying(float speed, boolean soundTouch); + /** + * Surface是否支持外部lockCanvas,来自定义暂停时的绘制画面 + * exoplayer目前不支持,因为外部lock后,切换surface会导致异常 + */ + boolean isSurfaceSupportLockCanvas(); + void setSpeed(float speed, boolean soundTouch); void start(); diff --git a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/IjkPlayerManager.java b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/IjkPlayerManager.java index ce4499bfa..7e90ac4ea 100644 --- a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/IjkPlayerManager.java +++ b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/IjkPlayerManager.java @@ -272,6 +272,12 @@ public int getVideoSarDen() { return 1; } + + @Override + public boolean isSurfaceSupportLockCanvas() { + return true; + } + private void initIJKOption(IjkMediaPlayer ijkMediaPlayer, List optionModelList) { if (optionModelList != null && optionModelList.size() > 0) { for (VideoOptionModel videoOptionModel : optionModelList) { diff --git a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/SystemPlayerManager.java b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/SystemPlayerManager.java index 665735944..7fd9f4504 100644 --- a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/SystemPlayerManager.java +++ b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/SystemPlayerManager.java @@ -209,6 +209,10 @@ public int getVideoSarDen() { return 1; } + @Override + public boolean isSurfaceSupportLockCanvas() { + return false; + } private void setSpeed(float speed) { if (release) { diff --git a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/base/GSYVideoView.java b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/base/GSYVideoView.java index 860aa8ebb..d2840c87b 100644 --- a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/base/GSYVideoView.java +++ b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/base/GSYVideoView.java @@ -177,15 +177,17 @@ protected void showPauseCover() { if (mCurrentState == CURRENT_STATE_PAUSE && mFullPauseBitmap != null && !mFullPauseBitmap.isRecycled() && mShowPauseCover && mSurface != null && mSurface.isValid()) { - try { - RectF rectF = new RectF(0, 0, mTextureView.getWidth(), mTextureView.getHeight()); - Canvas canvas = mSurface.lockCanvas(new Rect(0, 0, mTextureView.getWidth(), mTextureView.getHeight())); - if (canvas != null) { - canvas.drawBitmap(mFullPauseBitmap, null, rectF, null); - mSurface.unlockCanvasAndPost(canvas); + if (getGSYVideoManager().isSurfaceSupportLockCanvas()) { + try { + RectF rectF = new RectF(0, 0, mTextureView.getWidth(), mTextureView.getHeight()); + Canvas canvas = mSurface.lockCanvas(new Rect(0, 0, mTextureView.getWidth(), mTextureView.getHeight())); + if (canvas != null) { + canvas.drawBitmap(mFullPauseBitmap, null, rectF, null); + mSurface.unlockCanvasAndPost(canvas); + } + } catch (Exception e) { + e.printStackTrace(); } - } catch (Exception e) { - e.printStackTrace(); } } diff --git a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/base/GSYVideoViewBridge.java b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/base/GSYVideoViewBridge.java index c556f72c9..2c63b39c2 100644 --- a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/base/GSYVideoViewBridge.java +++ b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/base/GSYVideoViewBridge.java @@ -145,4 +145,10 @@ public interface GSYVideoViewBridge { int getVideoSarNum(); int getVideoSarDen(); + + /** + * Surface是否支持外部lockCanvas,来自定义暂停时的绘制画面 + * exoplayer目前不支持,因为外部lock后,切换surface会导致异常 + */ + boolean isSurfaceSupportLockCanvas(); } diff --git a/module-lite-more.sh b/module-lite-more.sh index 3dafacd61..f2e2be341 100644 --- a/module-lite-more.sh +++ b/module-lite-more.sh @@ -110,6 +110,7 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=webm_dash_mani export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=mpeg4" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=rtsp" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=mjpeg" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=avi" # ./configure --list-parsers export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-parsers"