Fix webrtc
authorgparant <g.parant@thecodingmachine.com>
Sun, 19 Apr 2020 23:10:47 +0000 (01:10 +0200)
committergparant <g.parant@thecodingmachine.com>
Sun, 19 Apr 2020 23:10:47 +0000 (01:10 +0200)
back/src/Controller/IoSocketController.ts
front/src/WebRtc/WebRtcEventManager.ts

index 88af801ad20d354a64f8ccbaf6b7d2249acf31d9..ff844358112af1d91d969bb751bca0f71fbabb4e 100644 (file)
@@ -71,7 +71,10 @@ export class IoSocketController{
                 this.saveUserInformation((socket as ExSocketInterface), messageUserPosition);
 
                 //refresh position of all user in all rooms in real time
-                let rooms = (this.Io.sockets.adapter.rooms as ExtRoomsInterface)
+                let rooms = (this.Io.sockets.adapter.rooms as ExtRoomsInterface);
+                if(!rooms.refreshUserPosition){
+                    rooms.refreshUserPosition = RefreshUserPositionFunction;
+                }
                 rooms.refreshUserPosition(rooms, this.Io);
             });
 
index 19c4670164265211fda43a777e6015fe90962c36..28c6acfc19fc3c9df7bc9ea4f3d6132d3407b612 100644 (file)
@@ -16,8 +16,9 @@ export class WebRtcEventManager {
         this.eventVideoAnswer();
         this.eventIceCandidate();
 
-        //connect on the room to create a meet
-        Connexion.socket.emit('webrtc-room', JSON.stringify({roomId: roomId}));
+        //start to connect on event
+        //TODO test 
+        this.emitWebRtcRoom();
     }
 
     /**
@@ -69,6 +70,11 @@ export class WebRtcEventManager {
         });
     }
 
+    emitWebRtcRoom(){
+        //connect on the room to create a meet
+        this.Connexion.socket.emit('webrtc-room', JSON.stringify({roomId: this.RoomId}));
+    }
+
     emitIceCandidate(message : any){
         message.roomId = this.RoomId;
         this.Connexion.socket.emit('ice-candidate', JSON.stringify(message));