update 清晰度切换
This commit is contained in:
parent
00c3e0cb77
commit
5db84c1e61
@ -127,8 +127,10 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.system_notice), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
// dismiss();
|
||||
|
||||
dismiss();
|
||||
if (callBack != null) {
|
||||
callBack.systemNotice();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -12,16 +12,28 @@ import com.yunbao.common.R;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
public class LiveClarityCustomPopup extends BottomPopupView implements View.OnClickListener {
|
||||
public static final int BAN_720 = 1;
|
||||
public static final int BAN_1080 = 2;
|
||||
private int selectClarity = 1;
|
||||
private RelativeLayout lineSd, lineHd, lineFhd;
|
||||
private ImageView iconSd, iconHd, iconFhd;
|
||||
private int banSelect;
|
||||
|
||||
public int getSelectClarity() {
|
||||
return selectClarity;
|
||||
}
|
||||
|
||||
public LiveClarityCustomPopup(@NonNull Context context, int selectClarity, int banSelect) {
|
||||
super(context);
|
||||
this.selectClarity = selectClarity;
|
||||
this.banSelect = banSelect;
|
||||
}
|
||||
|
||||
public LiveClarityCustomPopup(@NonNull Context context, int selectClarity) {
|
||||
super(context);
|
||||
if (selectClarity == -1) {
|
||||
selectClarity = 0;
|
||||
}
|
||||
this.selectClarity = selectClarity;
|
||||
}
|
||||
|
||||
@ -75,6 +87,12 @@ public class LiveClarityCustomPopup extends BottomPopupView implements View.OnCl
|
||||
selectClarity(selectClarity);
|
||||
dismiss();
|
||||
});
|
||||
if (banSelect == BAN_720) {
|
||||
lineFhd.setEnabled(false);
|
||||
lineHd.setEnabled(false);
|
||||
} else if (banSelect == BAN_1080) {
|
||||
lineFhd.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -864,7 +864,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
public void systemNotice() {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setBean(mLiveBean)
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.NOTICE));
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_VIDEO));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -256,7 +256,8 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
UP_PK_TWO(51, "PK头像信息"),
|
||||
CUSTOM_FULL_SERVICE_NOTIFY(51, "全服通知"),
|
||||
CHANGE_VIEW(52, "更改连胜位置"),
|
||||
UPDATA_ROBOT(53, "更新机器人消息");
|
||||
UPDATA_ROBOT(53, "更新机器人消息"),
|
||||
LIVE_VIDEO(54, "画质选择");
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
@ -134,6 +134,7 @@ public class LiveExoPlayerManager {
|
||||
}
|
||||
|
||||
public void switchUrl(String url) {
|
||||
Log.i(TAG, "switchUrl: "+url);
|
||||
isSwitchUrl = true;
|
||||
getNextPlayer().setMediaItem(createMediaItem(url));
|
||||
getNextPlayer().prepare();
|
||||
|
@ -30,9 +30,13 @@ import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.Timeline;
|
||||
import com.google.android.exoplayer2.Tracks;
|
||||
import com.google.android.exoplayer2.video.VideoSize;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BasePopupView;
|
||||
import com.lxj.xpopup.interfaces.XPopupCallback;
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
@ -40,9 +44,11 @@ import com.yunbao.common.utils.MicStatusManager;
|
||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.LiveClarityCustomPopup;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.utils.LiveExoPlayerManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@ -132,6 +138,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
@Override
|
||||
public void init() {
|
||||
EventBus.getDefault().register(this);
|
||||
Bus.getOn(this);
|
||||
mRoot = (ViewGroup) findViewById(R.id.root);
|
||||
mSmallContainer = (ViewGroup) findViewById(R.id.small_container);
|
||||
mLeftContainer = (ViewGroup) findViewById(R.id.left_container);
|
||||
@ -390,10 +397,10 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
});*/
|
||||
MediaItem item = createMediaItem(url);
|
||||
if (mPlayer.isPlaying()) {
|
||||
ToastUtil.show("set 2");
|
||||
ToastUtil.show("set 2 画质="+playModel);
|
||||
mPlayer.switchUrl(url);
|
||||
} else {
|
||||
ToastUtil.show("set 1");
|
||||
ToastUtil.show("set 1 画质="+playModel);
|
||||
mPlayer.startUrl(url);
|
||||
}
|
||||
/* if (mPlayer.isPlaying()) {
|
||||
@ -431,6 +438,8 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
mPlayer.stop();
|
||||
mPlayer.release();
|
||||
}
|
||||
Bus.getOff(this);
|
||||
EventBus.getDefault().unregister(this);
|
||||
L.e(TAG, "release------->");
|
||||
}
|
||||
|
||||
@ -782,6 +791,64 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onOpenDrawer(LiveAudienceEvent event) {
|
||||
if (event.getType() == LiveAudienceEvent.LiveAudienceType.LIVE_VIDEO) {
|
||||
int ban = PLAY_MODEL == PLAY_MODEL_720 ? LiveClarityCustomPopup.BAN_1080 : PLAY_MODEL == PLAY_MODEL_480 ? LiveClarityCustomPopup.BAN_720 : 0;
|
||||
LiveClarityCustomPopup liveClarityCustomPopup = new LiveClarityCustomPopup(mContext, PLAY_MODEL);
|
||||
new XPopup.Builder(mContext)
|
||||
.setPopupCallback(new XPopupCallback() {
|
||||
@Override
|
||||
public void onCreated(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeShow(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShow(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(BasePopupView popupView) {
|
||||
int selectClarity = liveClarityCustomPopup.getSelectClarity();
|
||||
play(srcUrl, selectClarity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeDismiss(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBackPressed(BasePopupView popupView) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyBoardStateChanged(BasePopupView popupView, int height) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrag(BasePopupView popupView, int value, float percent, boolean upOrLeft) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickOutside(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
})
|
||||
.asCustom(liveClarityCustomPopup)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 把观众转换成主播
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL
|
||||
public static int PLAY_MODEL = PLAY_MODEL_DEF;
|
||||
|
||||
public static final String[] videoRatioHorizontal = new String[]{"_640_480", "_1280_720", "_1920_1080", "_180_180"};
|
||||
public static final String[] videoRatioVertical = new String[]{"_480_640", "_1280_960", "_1080_1920", "_180_180"};
|
||||
public static final String[] videoRatioVertical = new String[]{"_480_640", "_720_1280", "_1080_1920", "_180_180"};
|
||||
public static final String[] videoFps = new String[]{"_24", "_30"};
|
||||
OnMicCallback onMicCallback;//连麦回调
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user