合并接口第八次上传,直播間切換直播

This commit is contained in:
18401019693 2022-11-26 17:12:02 +08:00
parent 96eee88c82
commit 249d251708
3 changed files with 36 additions and 25 deletions

View File

@ -94,6 +94,7 @@ import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.views.LiveRoomPlayViewHolder;
import com.yunbao.live.views.PortraitLiveManager;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@ -727,7 +728,18 @@ public class LiveAudienceActivity extends LiveActivity {
@Override
public void goToLive(AnchorRecommendItemModel model) {
//获取直播间状态
// LiveHttpUtil.getLiveInfo(model.getUid(), liveInfo);
LiveHttpUtil.getLiveInfo(model.getUid(), new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), (liveUid, stream, liveType, liveTypeVal, liveSdk) -> {
if (liveBean == null) {
return;
}
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
});
}
});
customDrawerPopupView.dismiss();
}

View File

@ -323,18 +323,17 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (liveBean == null) {
return;
}
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal).setLiveEnd(true));
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
}
});
Bus.get().post(new CloseEvent());
mCheckLivePresenter.checkLive(liveBean);
} else {
Bus.get().post(new CloseEvent());
RouteUtil.forwardUserHome(mContext, String.valueOf(event.getModel().getId()), 0);

View File

@ -3557,27 +3557,27 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> {
if (liveBean1 == null) {
return;
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (liveBean == null) {
return;
}
if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI)
.setMicIng(1)
.setBean(liveBean).setLiveType(liveType).setLiveTypeVal(Integer.parseInt(liveTypeVal)));
} else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI)
.setMicIng(2)
.setBean(liveBean).setLiveType(liveType).setLiveTypeVal(Integer.parseInt(liveTypeVal)));
} else {
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
}
}
if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI)
.setMicIng(1)
.setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal));
} else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI)
.setMicIng(2)
.setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal));
} else {
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal));
}
});
mCheckLivePresenter.checkLive(liveBean);
} else {
RouteUtil.forwardUserHome(mContext, liveId, 0);
}