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