Skip to content

Commit

Permalink
add setVolume
Browse files Browse the repository at this point in the history
fix ListGSYVideoPlayer title null
  • Loading branch information
CarGuo committed Jul 30, 2020
1 parent 5388e3b commit bead1fe
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public interface IPlayerManager {
*/
void setNeedMute(boolean needMute);

/**
* 单独设置 setVolume ,和 setNeedMute 互斥 float 0.0 - 1.0
*/
void setVolume(float left, float right);

/**
* 释放渲染
*/
Expand Down
4 changes: 2 additions & 2 deletions gsyVideoPlayer-exo_player2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions gsyVideoPlayer-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected boolean setUp(List<GSYVideoModel> 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;
Expand Down Expand Up @@ -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());
}
}
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit bead1fe

Please sign in to comment.