Commit 40660135 by Иван Кубота

change format of message. Send message to every esteblished connection

parent e5b61a04
......@@ -294,14 +294,14 @@ var RTC = function(parent, canvas, devname, id) {
callApp.___id = id;
this.id = id;
}
let instance1, instance2;
store.sub('appLoaded', function(loaded) {
if(!loaded)
return;
let instance = new RTC(document.querySelector("#videoinputapp1"), camera1canvas, 'canvas1', 1);
instance.mUiRemoteVideoParent = remoteVideoEl;
instance1 = new RTC(document.querySelector("#videoinputapp1"), camera1canvas, 'canvas1', 1);
instance1.mUiRemoteVideoParent = remoteVideoEl;
let instance2 = new RTC(document.querySelector("#videoinputapp1"), camera2canvas, 'canvas2', 2);
instance2 = new RTC(document.querySelector("#videoinputapp1"), camera2canvas, 'canvas2', 2);
instance2.mUiRemoteVideoParent = remoteVideoEl;
const selfieSegmentation1 = new SelfieSegmentation( {
......
......@@ -201,17 +201,24 @@ export class VideoInputApp {
}
else if (args.Type == awrtc.CallEventType.Message) {
//no ui for this yet. simply echo messages for testing
let messageArgs = args as awrtc.MessageEventArgs;
this.mCall.Send(messageArgs.Content, messageArgs.Reliable, messageArgs.ConnectionId);
/*let messageArgs = args as awrtc.MessageEventArgs;
this.mCall.Send(messageArgs.Content, messageArgs.Reliable, messageArgs.ConnectionId);*/
}
else if (args.Type == awrtc.CallEventType.DataMessage) {
//no ui for this yet. simply echo messages for testing
let messageArgs = args as awrtc.DataMessageEventArgs;
this.mCall.SendData(messageArgs.Content, messageArgs.Reliable, messageArgs.ConnectionId);
//let messageArgs = args as awrtc.DataMessageEventArgs;
//this.mCall.SendData(messageArgs.Content, messageArgs.Reliable, messageArgs.ConnectionId);
}
else if (args.Type == awrtc.CallEventType.CallAccepted) {
let arg = args as awrtc.CallAcceptedEventArgs;
console.log("New call accepted id: " + arg.ConnectionId.id);
let messageArgs = args as awrtc.MessageEventArgs;
this.mCall.Send(JSON.stringify({
userId: store.get('userRole'+this.___id),
webCam: store.get('webcam'+this.___id)
}), messageArgs.Reliable, messageArgs.ConnectionId);
}
else if (args.Type == awrtc.CallEventType.WaitForIncomingCall) {
console.log("Waiting for incoming call ...");
......@@ -325,12 +332,6 @@ export class VideoInputApp {
this.Stop();
} else {
this.Start(this.mAddress, this.mAudio, this.mVideo);
setTimeout(() => {
this.mCall.Send(`"userData": `+JSON.stringify({
userId: store.get('userRole'+this.___id),
webCam: store.get('webcam'+this.___id)
}, null, 2), true);
}, 2000);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment