From a5b5072de17e5459b9fccd6ed20c542f22c6a9ef Mon Sep 17 00:00:00 2001 From: gparant Date: Mon, 20 Apr 2020 01:10:47 +0200 Subject: [PATCH] Fix webrtc --- back/src/Controller/IoSocketController.ts | 5 ++++- front/src/WebRtc/WebRtcEventManager.ts | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/back/src/Controller/IoSocketController.ts b/back/src/Controller/IoSocketController.ts index 88af801..ff84435 100644 --- a/back/src/Controller/IoSocketController.ts +++ b/back/src/Controller/IoSocketController.ts @@ -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); }); diff --git a/front/src/WebRtc/WebRtcEventManager.ts b/front/src/WebRtc/WebRtcEventManager.ts index 19c4670..28c6acf 100644 --- a/front/src/WebRtc/WebRtcEventManager.ts +++ b/front/src/WebRtc/WebRtcEventManager.ts @@ -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)); -- 2.25.1