|
@@ -23,8 +23,13 @@ import com.rong.io.live.callback.IRoomCallBack;
|
|
import com.rong.io.live.helper.LiveEventHelper;
|
|
import com.rong.io.live.helper.LiveEventHelper;
|
|
import com.rong.io.live.helper.LiveRTCEngineInitHelper;
|
|
import com.rong.io.live.helper.LiveRTCEngineInitHelper;
|
|
import com.rong.io.live.manager.RCChatRoomMessageManager;
|
|
import com.rong.io.live.manager.RCChatRoomMessageManager;
|
|
|
|
+import com.rong.io.live.message.RCChatJoinRoomMessage;
|
|
|
|
+import com.rong.io.live.message.RCChatRoomMemberNumMessage;
|
|
import com.rong.io.live.message.RCChatroomLocationMessage;
|
|
import com.rong.io.live.message.RCChatroomLocationMessage;
|
|
|
|
+import com.rong.io.live.message.RCOnSnappingUpMessage;
|
|
import com.rong.io.live.message.RCPauseLiveMessage;
|
|
import com.rong.io.live.message.RCPauseLiveMessage;
|
|
|
|
+import com.rong.io.live.message.RCUserAddLikeMessage;
|
|
|
|
+import com.rong.io.live.message.RCUserSeatApplyMessage;
|
|
import com.rong.io.live.message.RCUserSeatResponseMessage;
|
|
import com.rong.io.live.message.RCUserSeatResponseMessage;
|
|
import com.rong.io.live.message.RCUserSyncAddLikeCountMessage;
|
|
import com.rong.io.live.message.RCUserSyncAddLikeCountMessage;
|
|
|
|
|
|
@@ -38,6 +43,7 @@ import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
|
import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
|
|
import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
|
|
import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener;
|
|
import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener;
|
|
import cn.rongcloud.rtc.api.stream.RCRTCAudioInputStream;
|
|
import cn.rongcloud.rtc.api.stream.RCRTCAudioInputStream;
|
|
|
|
+import cn.rongcloud.rtc.api.stream.RCRTCCameraOutputStream;
|
|
import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
|
|
import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
|
|
import cn.rongcloud.rtc.api.stream.RCRTCLiveInfo;
|
|
import cn.rongcloud.rtc.api.stream.RCRTCLiveInfo;
|
|
import cn.rongcloud.rtc.api.stream.RCRTCOutputStream;
|
|
import cn.rongcloud.rtc.api.stream.RCRTCOutputStream;
|
|
@@ -274,6 +280,10 @@ public class LiveRoomPresenter extends BasePresenter<LiveRoomContract.LiveRoomVi
|
|
private void startVideoPreview() {
|
|
private void startVideoPreview() {
|
|
// 创建本地视频显示视图
|
|
// 创建本地视频显示视图
|
|
RCRTCVideoView rcrtcVideoView = new RCRTCVideoView(Utils.getApp().getApplicationContext());
|
|
RCRTCVideoView rcrtcVideoView = new RCRTCVideoView(Utils.getApp().getApplicationContext());
|
|
|
|
+ RCRTCCameraOutputStream rcrtcCameraOutputStream = RCRTCEngine.getInstance().getDefaultVideoStream();
|
|
|
|
+ if (rcrtcCameraOutputStream == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoView(rcrtcVideoView);
|
|
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoView(rcrtcVideoView);
|
|
if (getView() != null) {
|
|
if (getView() != null) {
|
|
getView().addVideoPreview(rcrtcVideoView);
|
|
getView().addVideoPreview(rcrtcVideoView);
|
|
@@ -538,7 +548,66 @@ public class LiveRoomPresenter extends BasePresenter<LiveRoomContract.LiveRoomVi
|
|
.subscribe(new Consumer<Message>() {
|
|
.subscribe(new Consumer<Message>() {
|
|
@Override
|
|
@Override
|
|
public void accept(Message message) {
|
|
public void accept(Message message) {
|
|
|
|
+ //将消息显示到列表上
|
|
|
|
+ if (LiveEventHelper.getInstance().isShowingMessage(message.getContent())) {
|
|
|
|
+ if (null != getView()) {
|
|
|
|
+ getView().addMessageContent(message, false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_ENTER)) {
|
|
|
|
+ //加入房间消息
|
|
|
|
+ if (null != getView() && message.getContent() != null) {
|
|
|
|
+ RCChatJoinRoomMessage joinRoomMessage = (RCChatJoinRoomMessage) message.getContent();
|
|
|
|
+ getView().receiveJoinMessage(joinRoomMessage);
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_ON_SNAP_UP)) {
|
|
|
|
+ //抢购消息
|
|
|
|
+ if (null != getView() && message.getContent() != null) {
|
|
|
|
+ RCOnSnappingUpMessage rcOnSnappingUpMessage = (RCOnSnappingUpMessage) message.getContent();
|
|
|
|
+ getView().receiveSnapUpMessage(rcOnSnappingUpMessage);
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_ADD_LIKE)) {
|
|
|
|
+ if (message.getContent() != null) {
|
|
|
|
+ RCUserAddLikeMessage addLikeMessage = (RCUserAddLikeMessage) message.getContent();
|
|
|
|
+ if (getView() != null) {
|
|
|
|
+ getView().onAddLikeMessage(addLikeMessage);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_APPLY)) {
|
|
|
|
+ //学生连麦申请
|
|
|
|
+ if (message.getContent() != null) {
|
|
|
|
+ RCUserSeatApplyMessage rcUserSeatApplyMessage = (RCUserSeatApplyMessage) message.getContent();
|
|
|
|
+ if (getView() != null) {
|
|
|
|
+ getView().onSeatApplyMessage(rcUserSeatApplyMessage);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_MEMBER_COUNT_SYNC)) {
|
|
|
|
+ //同步成员数量
|
|
|
|
+ if (message.getContent() != null && null != getView()) {
|
|
|
|
+ RCChatRoomMemberNumMessage rcChatRoomMemberNumMessage = (RCChatRoomMemberNumMessage) message.getContent();
|
|
|
|
+ getView().syncMemberCount(rcChatRoomMemberNumMessage.getCount());
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_FINISH_MSG)) {
|
|
|
|
+ //关闭直播间
|
|
|
|
+ if (null != getView()) {
|
|
|
|
+ getView().liveRoomOffline();
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
disposablesManager.add(subscribe);
|
|
disposablesManager.add(subscribe);
|
|
@@ -648,7 +717,7 @@ public class LiveRoomPresenter extends BasePresenter<LiveRoomContract.LiveRoomVi
|
|
* @param userId
|
|
* @param userId
|
|
*/
|
|
*/
|
|
public void notifyOpenOpsLiveVideoAction(String roomId, String type, String userId) {
|
|
public void notifyOpenOpsLiveVideoAction(String roomId, String type, String userId) {
|
|
- addSubscribe(create(APIService.class).notifyOpenOpsLiveVideoAction(roomId, type, userId,"1080x1920"), new DisposableObserver() {
|
|
|
|
|
|
+ addSubscribe(create(APIService.class).notifyOpenOpsLiveVideoAction(roomId, type, userId, "1080x1920"), new DisposableObserver() {
|
|
@Override
|
|
@Override
|
|
public void onNext(Object o) {
|
|
public void onNext(Object o) {
|
|
//通知服务端加入成功即可,无须关注结果
|
|
//通知服务端加入成功即可,无须关注结果
|