修復在手机直播的直播间PK时切换分辨率会拉升问题

This commit is contained in:
zlzw 2023-01-09 14:47:23 +08:00
parent 8730a6396f
commit 207811c41d
4 changed files with 28 additions and 7 deletions

View File

@ -684,6 +684,10 @@ public class LiveAudienceActivity extends LiveActivity {
}
}
public boolean isPkStatus() {
return isPk;
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveRoomChangeEvent(LiveRoomChangeEvent e) {
if (verticalViewPager.ismEnableScroll()) {

View File

@ -278,15 +278,15 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
public void play(String url, int playModel) {
srcUrl = url;
PLAY_MODEL = playModel;
Log.i(TAG, "play" + " url:" + url + " playModel: " + playModel + " landscape: " + videoLandscape);
if (playModel != PLAY_MODEL_DEF) {
Log.i(TAG, "play" + " url:" + url + " playModel: " + playModel + " landscape: " + landscape + " videoLandscape" + videoLandscape);
if (playModel != PLAY_MODEL_DEF && !url.contains(videoFps[0] + ".flv")) {
mPlayer.setViewResizeMode(landscape == VIDEO_VERTICAL);
if (landscape == VIDEO_VERTICAL) {
url = url.replace(".flv", videoRatioVertical[playModel] + videoFps[0] + ".flv");
} else if (landscape == VIDEO_HORIZONTAL) {
url = url.replace(".flv", videoRatioHorizontal[playModel] + videoFps[0] + ".flv");
}
} else {
} else if(!url.contains(videoFps[0] + ".flv")){
mPlayer.setViewResizeMode(false);
}
Log.e("purl121", url);
@ -311,14 +311,14 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
srcUrl = url;
PLAY_MODEL = playModel;
Log.i(TAG, "switchStream: " + " url:" + url + " playModel: " + playModel + " landscape: " + landscape + " videoLandscape = " + videoLandscape);
if (playModel != PLAY_MODEL_DEF) {
if (playModel != PLAY_MODEL_DEF && !url.contains(videoFps[0] + ".flv")) {
mPlayer.setViewResizeMode(landscape == VIDEO_VERTICAL);
if (landscape == VIDEO_VERTICAL) {
url = url.replace(".flv", videoRatioVertical[playModel] + videoFps[0] + ".flv");
} else if (landscape == VIDEO_HORIZONTAL) {
url = url.replace(".flv", videoRatioHorizontal[playModel] + videoFps[0] + ".flv");
}
} else {
} else if(!url.contains(videoFps[0] + ".flv")){
mPlayer.setViewResizeMode(false);
}
Log.e("purl121", url);
@ -335,6 +335,16 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
purl = url;
}
@Override
public void switchStreamPk(boolean isPk) {
super.switchStreamPk(isPk);
if (isPk && !srcUrl.contains(videoFps[0] + ".flv")) {
mPlayer.setViewResizeMode(false);
String url = srcUrl.replace(".flv", videoRatioHorizontal[PLAY_MODEL] + videoFps[0] + ".flv");
switchStream(url,PLAY_MODEL);
}
}
@Override
public void release() {
mEnd = true;
@ -1111,7 +1121,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
public void onVideoSizeChanged(VideoSize videoSize) {
Player.Listener.super.onVideoSizeChanged(videoSize);
Log.i(TAG, "onVideoSizeChanged: width = " + videoSize.width + " height = " + videoSize.height);
// ToastUtil.show("分辨率: 宽 = " + videoSize.width + " 高 = " + videoSize.height);
// ToastUtil.show("分辨率: 宽 = " + videoSize.width + " 高 = " + videoSize.height);
if (videoSize.height > videoSize.width) {
videoLandscape = VIDEO_VERTICAL;
} else {

View File

@ -94,6 +94,9 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL
this.loadingListener = listener;
}
public void switchStreamPk(boolean isPk) {
}
public interface OnMicCallback {
void onMikUpdate();

View File

@ -1302,8 +1302,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
* @param isPk
*/
public void setPkStatus(boolean isPk) {
if (mLiveRoomViewHolder != null)
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.hotAddVisibility(isPk);
}
if(mLivePlayViewHolder!=null){
mLivePlayViewHolder.switchStreamPk(isPk);
}
}
@Override