优化观众端选择分辨率弹框的代码可读性

This commit is contained in:
zlzw 2023-01-03 14:26:52 +08:00
parent 76055543c3
commit 1db24dae4b

View File

@ -686,7 +686,17 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
@Subscribe(threadMode = ThreadMode.MAIN)
public void onOpenDrawer(LiveAudienceEvent event) {
if (event.getType() == LiveAudienceEvent.LiveAudienceType.LIVE_VIDEO) {
int ban = roomModel.getClarityType() - 1 == PLAY_MODEL_720 ? LiveClarityCustomPopup.BAN_1080 : roomModel.getClarityType() - 1 == PLAY_MODEL_480 ? LiveClarityCustomPopup.BAN_720 : 0;
int ban = 0;//全模式都可以选择
switch (roomModel.getClarityType() - 1) {
case PLAY_MODEL_720://仅允许720高清ban掉1080超高清模式
ban = LiveClarityCustomPopup.BAN_1080;
break;
case -1://没有该字段
case PLAY_MODEL_480://仅允许480流畅ban掉1080超高清和720高清模式
ban = LiveClarityCustomPopup.BAN_720;
break;
}
LiveClarityCustomPopup liveClarityCustomPopup = new LiveClarityCustomPopup(mContext, PLAY_MODEL, ban);
new XPopup.Builder(mContext)
.setPopupCallback(new XPopupCallback() {
@ -1050,7 +1060,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("分辨率: width = " + videoSize.width + " height = " + videoSize.height);
// ToastUtil.show("分辨率: width = " + videoSize.width + " height = " + videoSize.height);
if (videoSize.height > videoSize.width) {
videoLandscape = VIDEO_VERTICAL;
} else {