aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/webcam/DashWebRTC.ts
diff options
context:
space:
mode:
authorMohammad Amoush <muhammedamoush@gmail.com>2019-11-06 19:20:45 -0500
committerMohammad Amoush <muhammedamoush@gmail.com>2019-11-06 19:20:45 -0500
commit76bc6041ddbbda7ba4c1560199acc08324648e99 (patch)
tree73a46e7226158ffdd999c4fc902af19239d14c7d /src/client/views/webcam/DashWebRTC.ts
parent822e9094d195b6c42160370ad304144b2474d24e (diff)
2 person call done
Diffstat (limited to 'src/client/views/webcam/DashWebRTC.ts')
-rw-r--r--src/client/views/webcam/DashWebRTC.ts26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/client/views/webcam/DashWebRTC.ts b/src/client/views/webcam/DashWebRTC.ts
index bd0bd7f9a..846de4115 100644
--- a/src/client/views/webcam/DashWebRTC.ts
+++ b/src/client/views/webcam/DashWebRTC.ts
@@ -1,4 +1,7 @@
import { DocServer } from '../../DocServer';
+import { Utils } from '../../../Utils';
+import { MessageStore } from '../../../server/Message';
+
/**
@@ -30,8 +33,7 @@ export namespace DashWebRTC {
offerToReceiveVideo: true
};
- export function init() {
- let room = 'test';
+ export function init(room: string) {
if (room !== '') {
DocServer._socket.emit('create or join', room);
@@ -68,20 +70,21 @@ export namespace DashWebRTC {
// This client receives a message
DocServer._socket.on('message', function (message: any) {
console.log('Client received message:', message);
- if (message === 'got user media') {
+ if (message.message === 'got user media') {
maybeStart();
- } else if (message.type === 'offer') {
+ } else if (message.message.type === 'offer') {
+ console.log("I have entered here bro!!!");
if (!isInitiator && !isStarted) {
maybeStart();
}
- pc.setRemoteDescription(new RTCSessionDescription(message));
+ pc.setRemoteDescription(new RTCSessionDescription(message.message));
doAnswer();
- } else if (message.type === 'answer' && isStarted) {
- pc.setRemoteDescription(new RTCSessionDescription(message));
- } else if (message.type === 'candidate' && isStarted) {
+ } else if (message.message.type === 'answer' && isStarted) {
+ pc.setRemoteDescription(new RTCSessionDescription(message.message));
+ } else if (message.message.type === 'candidate' && isStarted) {
var candidate = new RTCIceCandidate({
- sdpMLineIndex: message.label,
- candidate: message.candidate
+ sdpMLineIndex: message.message.label,
+ candidate: message.message.candidate
});
pc.addIceCandidate(candidate);
} else if (message === 'bye' && isStarted) {
@@ -120,7 +123,8 @@ export namespace DashWebRTC {
function sendMessage(message: any) {
console.log('Client sending message: ', message);
- DocServer._socket.emit('message', message);
+ Utils.Emit(DocServer._socket, MessageStore.NotifyRoommates, { message: message, room: "" });
+ //DocServer._socket.emit('message', message);
}