优化room为空时开播的提示

This commit is contained in:
zlzw 2022-11-08 10:15:55 +08:00
parent 4a6bb9fd56
commit 7a01f62490

View File

@ -126,18 +126,18 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
public IRCRTCRoomEventsListener roomEventsListener = new IRCRTCRoomEventsListener() { public IRCRTCRoomEventsListener roomEventsListener = new IRCRTCRoomEventsListener() {
@Override @Override
public void onRemoteUserPublishResource(RCRTCRemoteUser rcrtcRemoteUser, List<RCRTCInputStream> list) { public void onRemoteUserPublishResource(RCRTCRemoteUser rcrtcRemoteUser, List<RCRTCInputStream> list) {
Log.e("ry","远端来了"+list.size()); Log.e("ry", "远端来了" + list.size());
//TODO 按需在此订阅远端用户发布的资源 //TODO 按需在此订阅远端用户发布的资源
rtcRoom.getLocalUser().subscribeStreams(list, new IRCRTCResultCallback() { rtcRoom.getLocalUser().subscribeStreams(list, new IRCRTCResultCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
Log.e("ry","远端成功"+list.size()); Log.e("ry", "远端成功" + list.size());
} }
@Override @Override
public void onFailed(RTCErrorCode rtcErrorCode) { public void onFailed(RTCErrorCode rtcErrorCode) {
Log.e("ry","远端失败"+list.size()); Log.e("ry", "远端失败" + list.size());
} }
}); });
} }
@ -191,7 +191,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
Log.e("ry", inviterRoomId+extra + "Request" ); Log.e("ry", inviterRoomId + extra + "Request");
UserBean userBean = new UserBean(); UserBean userBean = new UserBean();
userBean.setId(inviterRoomId); userBean.setId(inviterRoomId);
@ -204,11 +204,11 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
mLiveRyLinkMicPkPresenter.onLinkDRMicPkApply(userBean); mLiveRyLinkMicPkPresenter.onLinkDRMicPkApply(userBean);
} }
} else if (extra.equals("LiveDRPK1")) { } else if (extra.equals("LiveDRPK1")) {
Log.e("ry","LiveDRPK1"); Log.e("ry", "LiveDRPK1");
rtcRoom.getLocalUser().responseJoinOtherRoom(userBean.getId(), userBean.getId(), true, true, "LiveDRPK1", new IRCRTCResultCallback() { rtcRoom.getLocalUser().responseJoinOtherRoom(userBean.getId(), userBean.getId(), true, true, "LiveDRPK1", new IRCRTCResultCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
mLiveRyLinkMicPkPresenter.dRjoinOtherRoom(userBean.getId(),2); mLiveRyLinkMicPkPresenter.dRjoinOtherRoom(userBean.getId(), 2);
} }
@Override @Override
@ -217,7 +217,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
} }
}); });
} else { } else {
if(extra.contains("autoLivePK")) { if (extra.contains("autoLivePK")) {
UserBean userBean1 = new UserBean(); UserBean userBean1 = new UserBean();
if (!extra.equals("")) { if (!extra.equals("")) {
JSONObject map = JSONObject.parseObject(extra); JSONObject map = JSONObject.parseObject(extra);
@ -230,7 +230,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
userBean1.setAvatar("null"); userBean1.setAvatar("null");
} }
mLiveRyLinkMicPkPresenter.onLinkMicPkApply(userBean1, "", 1); mLiveRyLinkMicPkPresenter.onLinkMicPkApply(userBean1, "", 1);
}else { } else {
Log.e("ry", extra); Log.e("ry", extra);
UserBean userBean1 = new UserBean(); UserBean userBean1 = new UserBean();
if (!extra.equals("")) { if (!extra.equals("")) {
@ -244,7 +244,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
userBean1.setAvatar("null"); userBean1.setAvatar("null");
} }
//收到单人PK申请 //收到单人PK申请
mLiveRyLinkMicPkPresenter.onLinkMicPkApply(userBean1, "",0); mLiveRyLinkMicPkPresenter.onLinkMicPkApply(userBean1, "", 0);
} }
} }
} }
@ -284,13 +284,13 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
Log.e("ry", inviterRoomId+extra + "Response" + agree); Log.e("ry", inviterRoomId + extra + "Response" + agree);
if (agree == false) { if (agree == false) {
// ToastUtil.show(inviteeUserId+(agree?" 同意":" 拒绝")+"了你的邀请!"); // ToastUtil.show(inviteeUserId+(agree?" 同意":" 拒绝")+"了你的邀请!");
} else if (agree == true && extra.equals(SOCKET_LIVE_DRPK)) { } else if (agree == true && extra.equals(SOCKET_LIVE_DRPK)) {
mLiveRyLinkMicPkPresenter.onDRLinkMicToPk(inviteeRoomId); mLiveRyLinkMicPkPresenter.onDRLinkMicToPk(inviteeRoomId);
} else if (extra.equals("LiveDRPK1")) { } else if (extra.equals("LiveDRPK1")) {
mLiveRyLinkMicPkPresenter.dRjoinOtherRoom(inviteeRoomId,3); mLiveRyLinkMicPkPresenter.dRjoinOtherRoom(inviteeRoomId, 3);
} else { } else {
Log.e("ry", extra); Log.e("ry", extra);
UserBean userBean1 = new UserBean(); UserBean userBean1 = new UserBean();
@ -305,7 +305,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
userBean1.setAvatar("null"); userBean1.setAvatar("null");
} }
mLiveRyLinkMicPkPresenter.onLinkMicToPk(userBean1); mLiveRyLinkMicPkPresenter.onLinkMicToPk(userBean1);
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(inviteeRoomId,3); mLiveRyLinkMicPkPresenter.onLinkMicPkStart(inviteeRoomId, 3);
} }
} }
}); });
@ -528,10 +528,13 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
//加入房间成功后可以通过 RCRTCLocalUser 对象发布本地默认音视频流包括麦克风采集的音频和摄像头采集的视频 //加入房间成功后可以通过 RCRTCLocalUser 对象发布本地默认音视频流包括麦克风采集的音频和摄像头采集的视频
RCRTCEngine.getInstance().getDefaultVideoStream().setEncoderMirror(true); RCRTCEngine.getInstance().getDefaultVideoStream().setEncoderMirror(true);
if(rtcRoom==null||rtcRoom.getLocalUser()==null){ if (rtcRoom == null || rtcRoom.getLocalUser() == null) {
ToastUtil.show("开播失败 room为空"); if (room == null || room.getLocalUser() == null) {
((LiveRyAnchorActivity) mContext).endLives(); ToastUtil.show("开播失败 请稍后再试,错误代码:room is null");
return; ((LiveRyAnchorActivity) mContext).endLives();
return;
}
rtcRoom = room;
} }
rtcRoom.getLocalUser().publishDefaultLiveStreams(new IRCRTCResultDataCallback<RCRTCLiveInfo>() { rtcRoom.getLocalUser().publishDefaultLiveStreams(new IRCRTCResultDataCallback<RCRTCLiveInfo>() {
@Override @Override
@ -543,7 +546,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
//美颜 //美颜
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() { public void run() {
//旧美颜不需要了 //旧美颜不需要了
/*RCRTCEngine.getInstance().getDefaultVideoStream().setVideoFrameListener(new IRCRTCVideoOutputFrameListener() { /*RCRTCEngine.getInstance().getDefaultVideoStream().setVideoFrameListener(new IRCRTCVideoOutputFrameListener() {
@Override @Override
public RCRTCVideoFrame processVideoFrame(RCRTCVideoFrame rtcVideoFrame) { public RCRTCVideoFrame processVideoFrame(RCRTCVideoFrame rtcVideoFrame) {