diff --git a/app/src/main/java/com/example/gsyvideoplayer/adapter/ListNormalAdapter.java b/app/src/main/java/com/example/gsyvideoplayer/adapter/ListNormalAdapter.java index 972622ee8..da62af4ee 100644 --- a/app/src/main/java/com/example/gsyvideoplayer/adapter/ListNormalAdapter.java +++ b/app/src/main/java/com/example/gsyvideoplayer/adapter/ListNormalAdapter.java @@ -152,7 +152,7 @@ public void onClick(View v) { holder.gsyVideoPlayer.setRotateViewAuto(!getListNeedAutoLand()); holder.gsyVideoPlayer.setLockLand(!getListNeedAutoLand()); holder.gsyVideoPlayer.setPlayTag(TAG); - //holder.gsyVideoPlayer.setAutoFullWithSize(true); + //holder.gsyVideoPlayer.c(true); holder.gsyVideoPlayer.setReleaseWhenLossAudio(false); holder.gsyVideoPlayer.setShowFullAnimation(!getListNeedAutoLand()); holder.gsyVideoPlayer.setIsTouchWiget(false); 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 893167a1f..d2a95ba4c 100644 --- a/app/src/main/java/com/example/gsyvideoplayer/exo/GSYExoPlayerManager.java +++ b/app/src/main/java/com/example/gsyvideoplayer/exo/GSYExoPlayerManager.java @@ -91,6 +91,12 @@ public void setNeedMute(boolean needMute) { } } + @Override + public void setVolume(float left, float right) { + if (mediaPlayer != null) { + mediaPlayer.setVolume(left, right); + } + } @Override public void releaseSurface() { diff --git a/app/src/main/java/com/example/gsyvideoplayer/exosubtitle/GSYExoSubTitlePlayerManager.java b/app/src/main/java/com/example/gsyvideoplayer/exosubtitle/GSYExoSubTitlePlayerManager.java index 551841fca..f7c4a602d 100644 --- a/app/src/main/java/com/example/gsyvideoplayer/exosubtitle/GSYExoSubTitlePlayerManager.java +++ b/app/src/main/java/com/example/gsyvideoplayer/exosubtitle/GSYExoSubTitlePlayerManager.java @@ -119,6 +119,13 @@ public void setNeedMute(final boolean needMute) { } } + @Override + public void setVolume(float left, float right) { + if (mediaPlayer != null) { + mediaPlayer.setVolume(left, right); + } + } + @Override public void releaseSurface() { diff --git a/gsyVideoPlayer-base/src/main/java/com/shuyu/gsyvideoplayer/player/IPlayerManager.java b/gsyVideoPlayer-base/src/main/java/com/shuyu/gsyvideoplayer/player/IPlayerManager.java index 7df688988..6542d6ce7 100644 --- a/gsyVideoPlayer-base/src/main/java/com/shuyu/gsyvideoplayer/player/IPlayerManager.java +++ b/gsyVideoPlayer-base/src/main/java/com/shuyu/gsyvideoplayer/player/IPlayerManager.java @@ -38,6 +38,11 @@ public interface IPlayerManager { */ void setNeedMute(boolean needMute); + /** + * 单独设置 setVolume ,和 setNeedMute 互斥 float 0.0 - 1.0 + */ + void setVolume(float left, float right); + /** * 释放渲染 */ diff --git a/gsyVideoPlayer-exo_player2/build.gradle b/gsyVideoPlayer-exo_player2/build.gradle index 8e362fd42..5a563eade 100644 --- a/gsyVideoPlayer-exo_player2/build.gradle +++ b/gsyVideoPlayer-exo_player2/build.gradle @@ -33,8 +33,8 @@ dependencies { def viewDependencies = rootProject.ext.viewDependencies api viewDependencies.exo_player2 api viewDependencies.exo_player2_rtmp - //api project(':gsyVideoPlayer-base') - api "com.shuyu:gsyVideoPlayer-base:$gsyVideoVersion" + api project(':gsyVideoPlayer-base') + //api "com.shuyu:gsyVideoPlayer-base:$gsyVideoVersion" } diff --git a/gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/Exo2PlayerManager.java b/gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/Exo2PlayerManager.java index ceeac9fa5..f0dfee941 100644 --- a/gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/Exo2PlayerManager.java +++ b/gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/Exo2PlayerManager.java @@ -111,6 +111,12 @@ public void setNeedMute(final boolean needMute) { } } + @Override + public void setVolume(float left, float right) { + if (mediaPlayer != null) { + mediaPlayer.setVolume(left, right); + } + } @Override public void releaseSurface() { diff --git a/gsyVideoPlayer-java/build.gradle b/gsyVideoPlayer-java/build.gradle index d21e9c6a4..7afef8d67 100644 --- a/gsyVideoPlayer-java/build.gradle +++ b/gsyVideoPlayer-java/build.gradle @@ -41,8 +41,8 @@ dependencies { api viewDependencies.ijkplayer_exo api viewDependencies.transitionseverywhere //api project(':gsyVideoPlayer-proxy_cache') - //api project(':gsyVideoPlayer-base') - api "com.shuyu:gsyVideoPlayer-base:$gsyVideoVersion" + api project(':gsyVideoPlayer-base') + //api "com.shuyu:gsyVideoPlayer-base:$gsyVideoVersion" api "com.shuyu:gsyvideoplayer-androidvideocache:$gsyVideoVersion" } 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 9dabbdd38..5a8f25643 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 @@ -164,6 +164,12 @@ public void setNeedMute(boolean needMute) { } } + @Override + public void setVolume(float left, float right) { + if (mediaPlayer != null) { + mediaPlayer.setVolume(left, right); + } + } @Override public void releaseSurface() { 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 433ad9581..7dd093aa6 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 @@ -104,6 +104,13 @@ public void setNeedMute(boolean needMute) { } } + @Override + public void setVolume(float left, float right) { + if (mediaPlayer != null) { + mediaPlayer.setVolume(left, right); + } + } + @Override public void releaseSurface() { if (surface != null) { diff --git a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/ListGSYVideoPlayer.java b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/ListGSYVideoPlayer.java index d5bd323c1..00927deb9 100644 --- a/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/ListGSYVideoPlayer.java +++ b/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/ListGSYVideoPlayer.java @@ -100,7 +100,7 @@ protected boolean setUp(List url, boolean cacheWithPlay, int posi mMapHeadData = mapHeadData; GSYVideoModel gsyVideoModel = url.get(position); boolean set = setUp(gsyVideoModel.getUrl(), cacheWithPlay, cachePath, gsyVideoModel.getTitle(), changeState); - if (!TextUtils.isEmpty(gsyVideoModel.getTitle()) ) { + if (!TextUtils.isEmpty(gsyVideoModel.getTitle()) && mTitleTextView != null ) { mTitleTextView.setText(gsyVideoModel.getTitle()); } return set; @@ -134,7 +134,7 @@ protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gs if (gsyVideoPlayer != null) { ListGSYVideoPlayer listGSYVideoPlayer = (ListGSYVideoPlayer) gsyVideoPlayer; GSYVideoModel gsyVideoModel = mUriList.get(mPlayPosition); - if (!TextUtils.isEmpty(gsyVideoModel.getTitle())) { + if (!TextUtils.isEmpty(gsyVideoModel.getTitle()) && mTitleTextView != null) { mTitleTextView.setText(gsyVideoModel.getTitle()); } } @@ -207,7 +207,7 @@ public boolean playNext() { GSYVideoModel gsyVideoModel = mUriList.get(mPlayPosition); mSaveChangeViewTIme = 0; setUp(mUriList, mCache, mPlayPosition, null, mMapHeadData, false); - if (!TextUtils.isEmpty(gsyVideoModel.getTitle())) { + if (!TextUtils.isEmpty(gsyVideoModel.getTitle()) && mTitleTextView != null) { mTitleTextView.setText(gsyVideoModel.getTitle()); } startPlayLogic();