zouxuan 5 年之前
父节点
当前提交
74aabf9cca

+ 1 - 1
edu-im/edu-im-server/src/main/java/com/keao/edu/im/dao/RoomMemberDao.java

@@ -43,7 +43,7 @@ public interface RoomMemberDao extends JpaRepository<RoomMember, Long> {
 
     @Modifying
     @Query(value = "update rongyun_room_member set msid_flag=?3 where rid=?1 and uid=?2", nativeQuery = true)
-    public int updateMsidByRidAndUid(String rid, String uid,boolean msid);
+    public int updateMsidByRidAndUid(String rid, String uid,int msidFlag);
 
     @Modifying
     @Query(value = "update rongyun_room_member set role=?3 where rid=?1 and role=?2", nativeQuery = true)

+ 16 - 9
edu-im/edu-im-server/src/main/java/com/keao/edu/im/service/Impl/RoomServiceImpl.java

@@ -1258,18 +1258,25 @@ public class RoomServiceImpl implements RoomService {
     }
 
     public static void main(String[] args) {
-        String body = "{\"members\":[],\"appKey\":\"mgb7ka1nme0yg\",\"sessionId\":\"hjcKwEaRIm8scdSeDHgF7A\",\"event\":11,\"userId\":\"113\",\"channelId\":\"31\",\"timestamp\":1598235225551,\"token\":\"\"}";
+        String body = "{\"members\":[{\"data\":{\"uris\":\"[{\\\"mediaType\\\":0,\\\"msid\\\":\\\"113_RongCloudRTC\\\",\\\"uri\\\":\\\"{\\\\\\\"clusterId\\\\\\\":\\\\\\\"rtc-data-bdcbj.ronghub.com:80\\\\\\\",\\\\\\\"serverId\\\\\\\":\\\\\\\"172.28.76.221:40080\\\\\\\",\\\\\\\"resourceId\\\\\\\":\\\\\\\"113_RongCloudRTC_0\\\\\\\",\\\\\\\"connectionId\\\\\\\":\\\\\\\"AAcxMDczNjg5AAMxMTMAAjMxAA==\\\\\\\",\\\\\\\"ssrc\\\\\\\":1152580707,\\\\\\\"serviceProvider\\\\\\\":\\\\\\\"bdc\\\\\\\",\\\\\\\"userTimestamp\\\\\\\":1598241638662}\\\",\\\"tag\\\":\\\"RongCloudRTC\\\",\\\"state\\\":1},{\\\"mediaType\\\":1,\\\"msid\\\":\\\"113_RongCloudRTC\\\",\\\"uri\\\":\\\"{\\\\\\\"clusterId\\\\\\\":\\\\\\\"rtc-data-bdcbj.ronghub.com:80\\\\\\\",\\\\\\\"serverId\\\\\\\":\\\\\\\"172.28.76.221:40080\\\\\\\",\\\\\\\"resourceId\\\\\\\":\\\\\\\"113_RongCloudRTC_1\\\\\\\",\\\\\\\"connectionId\\\\\\\":\\\\\\\"AAcxMDczNjg5AAMxMTMAAjMxAA==\\\\\\\",\\\\\\\"ssrc\\\\\\\":1388804240,\\\\\\\"serviceProvider\\\\\\\":\\\\\\\"bdc\\\\\\\",\\\\\\\"userTimestamp\\\\\\\":1598241638662}\\\",\\\"tag\\\":\\\"RongCloudRTC\\\",\\\"state\\\":1}]\"},\"userId\":\"113\"}],\"appKey\":\"mgb7ka1nme0yg\",\"sessionId\":\"9XmxCXVZQkArdnxcMyFN98\",\"event\":20,\"userId\":\"113\",\"channelId\":\"31\",\"timestamp\":1598241638774,\"token\":\"\"}";
         ChannelStateNotify notify = JSONObject.parseObject(body, ChannelStateNotify.class);
-        String msidStr = null;
         boolean msidFlag = false;
+        Integer state = null;
         List<Member> members = notify.getMembers();
         if(members != null && members.size() != 0){
-            JSONArray jsonArray = JSONObject.parseArray(JSONObject.parseObject(members.get(0).getData().toJSONString()).get("uris").toString());
-            if(jsonArray != null && !jsonArray.isEmpty()){
-                Object msid = JSONObject.parseObject(jsonArray.get(0).toString()).get("msid");
-                if(msid != null){
-                    msidStr = msid.toString();
-                    msidFlag = true;
+            Object uris = JSONObject.parseObject(members.get(0).getData().toJSONString()).get("uris");
+            if(uris != null){
+                List<UrisDto> jsonArray = JSONObject.parseArray(uris.toString(),UrisDto.class);
+                for (UrisDto urisDto : jsonArray) {
+                    //视频流
+                    if(urisDto.getMediaType() == 1){
+                        state = urisDto.getState();
+                        if(state == 1){
+                            msidFlag = true;
+                        }
+                    }else {
+                        //音频流
+                    }
                 }
             }
         }
@@ -1328,7 +1335,7 @@ public class RoomServiceImpl implements RoomService {
             }
             //同步录制资源
             //资源发生变动
-            roomMemberDao.updateMsidByRidAndUid(roomId,userId,msidFlag);
+            roomMemberDao.updateMsidByRidAndUid(roomId,userId,state);
             if(state == null || state == 0 || !msidFlag){
                 if(roomMember.getExamRegistrationId() == null){
                     imHelper.configRecord(roomId);