podchat-browser 11.2.4 → 11.3.1-snapshot.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/podchat-11.2.3.js +55921 -55921
- package/dist/podchat-11.2.4.js +55921 -55921
- package/examples/index.html +86 -1
- package/package.json +2 -2
- package/src/call.module.js +746 -748
- package/src/chat.js +1 -0
- package/src/events.module.js +1 -0
package/src/call.module.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
var Utility = params.Utility,
|
|
20
|
-
|
|
20
|
+
currentModuleInstance = this,
|
|
21
21
|
Sentry = params.Sentry,
|
|
22
22
|
asyncClient = params.asyncClient,
|
|
23
23
|
chatEvents = params.chatEvents,
|
|
@@ -130,6 +130,7 @@
|
|
|
130
130
|
START_SCREEN_SHARE: 123,
|
|
131
131
|
END_SCREEN_SHARE: 124,
|
|
132
132
|
DELETE_FROM_CALL_HISTORY: 125,
|
|
133
|
+
DESTINATED_RECORD_CALL: 126,
|
|
133
134
|
MUTUAL_GROUPS: 130,
|
|
134
135
|
CREATE_TAG: 140,
|
|
135
136
|
EDIT_TAG: 141,
|
|
@@ -138,6 +139,7 @@
|
|
|
138
139
|
REMOVE_TAG_PARTICIPANT: 144,
|
|
139
140
|
GET_TAG_LIST: 145,
|
|
140
141
|
DELETE_MESSAGE_THREAD: 151,
|
|
142
|
+
EXPORT_CHAT: 152,
|
|
141
143
|
ERROR: 999
|
|
142
144
|
},
|
|
143
145
|
inviteeVOidTypes = {
|
|
@@ -189,20 +191,25 @@
|
|
|
189
191
|
currentCallId = null,
|
|
190
192
|
shouldReconnectCallTimeout = null,
|
|
191
193
|
callTopics = {},
|
|
194
|
+
screenShareState = {
|
|
195
|
+
started: false,
|
|
196
|
+
imOwner: false
|
|
197
|
+
},
|
|
192
198
|
callClientType = {
|
|
193
199
|
WEB: 1,
|
|
194
200
|
ANDROID: 2,
|
|
195
201
|
DESKTOP: 3
|
|
196
202
|
},
|
|
197
203
|
webpeers = {},
|
|
204
|
+
callUsers = {},
|
|
198
205
|
webpeersMetadata = {},
|
|
199
206
|
callRequestController = {
|
|
200
207
|
callRequestReceived: false,
|
|
201
208
|
callEstablishedInMySide: false,
|
|
202
209
|
iCanAcceptTheCall: function () {
|
|
203
210
|
return callRequestController.callRequestReceived && callRequestController.callEstablishedInMySide;
|
|
204
|
-
|
|
205
|
-
|
|
211
|
+
},
|
|
212
|
+
cameraPaused: true
|
|
206
213
|
},
|
|
207
214
|
uiRemoteMedias = {},
|
|
208
215
|
callStopQueue = {
|
|
@@ -436,7 +443,7 @@
|
|
|
436
443
|
},
|
|
437
444
|
|
|
438
445
|
endCall = function (params, callback) {
|
|
439
|
-
consoleLogging && console.log('endCall called...');
|
|
446
|
+
consoleLogging && console.log('[SDK][endCall] called...');
|
|
440
447
|
|
|
441
448
|
var endCallData = {
|
|
442
449
|
chatMessageVOType: chatMessageVOTypes.END_CALL_REQUEST,
|
|
@@ -475,6 +482,7 @@
|
|
|
475
482
|
}
|
|
476
483
|
});
|
|
477
484
|
},
|
|
485
|
+
|
|
478
486
|
/*
|
|
479
487
|
* Call Functionalities
|
|
480
488
|
*/
|
|
@@ -482,21 +490,31 @@
|
|
|
482
490
|
if (callDivId) {
|
|
483
491
|
var callParentDiv,
|
|
484
492
|
callVideo = (typeof params.video === 'boolean') ? params.video : true,
|
|
485
|
-
callMute = (typeof params.mute === 'boolean') ? params.mute : false
|
|
486
|
-
sendingTopic = params.sendingTopic,
|
|
487
|
-
receiveTopic = params.receiveTopic;
|
|
493
|
+
callMute = (typeof params.mute === 'boolean') ? params.mute : false;
|
|
494
|
+
//sendingTopic = params.sendingTopic,
|
|
495
|
+
//receiveTopic = params.receiveTopic;
|
|
496
|
+
|
|
497
|
+
if(params.clientsList && params.clientsList.length) {
|
|
498
|
+
for(var i in params.clientsList) {
|
|
499
|
+
callStateController.setupCallParticipant(params.clientsList[i]);
|
|
500
|
+
//callStateController.callUsers.push(params.clientsList[i]);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
callStateController.setupScreenSharingObject(params.screenShare);
|
|
488
505
|
|
|
489
|
-
callTopics['sendVideoTopic'] = 'Vi-' + sendingTopic;
|
|
506
|
+
/*callTopics['sendVideoTopic'] = 'Vi-' + sendingTopic;
|
|
490
507
|
callTopics['sendAudioTopic'] = 'Vo-' + sendingTopic;
|
|
508
|
+
callTopics['screenShare'] = params.screenShare;
|
|
491
509
|
//callTopics['receiveVideoTopic'] = 'Vi-' + receiveTopic;
|
|
492
510
|
//callTopics['receiveAudioTopic'] = 'Vo-' + receiveTopic;
|
|
493
511
|
callTopics['receive'] = [];
|
|
494
512
|
callTopics['receive'].push({
|
|
495
513
|
"VideoTopic": 'Vi-' + receiveTopic,
|
|
496
514
|
"AudioTopic": 'Vo-' + receiveTopic
|
|
497
|
-
})
|
|
515
|
+
});*/
|
|
498
516
|
|
|
499
|
-
webpeersMetadata[callTopics['sendVideoTopic']] = {
|
|
517
|
+
/*webpeersMetadata[callTopics['sendVideoTopic']] = {
|
|
500
518
|
interval: null,
|
|
501
519
|
receivedSdpAnswer: false,
|
|
502
520
|
connectionQualityInterval: null,
|
|
@@ -512,6 +530,14 @@
|
|
|
512
530
|
poorConnectionResolvedCount: 0,
|
|
513
531
|
isConnectionPoor: false
|
|
514
532
|
};
|
|
533
|
+
webpeersMetadata[callTopics['screenShare']] = {
|
|
534
|
+
interval: null,
|
|
535
|
+
receivedSdpAnswer: false,
|
|
536
|
+
connectionQualityInterval: null,
|
|
537
|
+
poorConnectionCount: 0,
|
|
538
|
+
poorConnectionResolvedCount: 0,
|
|
539
|
+
isConnectionPoor: false
|
|
540
|
+
};
|
|
515
541
|
|
|
516
542
|
for(var i in callTopics['receive']) {
|
|
517
543
|
webpeersMetadata[callTopics['receive'][i]['VideoTopic']] = {
|
|
@@ -522,11 +548,11 @@
|
|
|
522
548
|
interval: null,
|
|
523
549
|
receivedSdpAnswer: false
|
|
524
550
|
};
|
|
525
|
-
}
|
|
551
|
+
}*/
|
|
526
552
|
|
|
527
|
-
callParentDiv = document.getElementById(callDivId);
|
|
553
|
+
//callParentDiv = document.getElementById(callDivId);
|
|
528
554
|
|
|
529
|
-
|
|
555
|
+
/*// Local Video Tag
|
|
530
556
|
if (callVideo && !uiRemoteMedias[callTopics['sendVideoTopic']]) {
|
|
531
557
|
uiRemoteMedias[callTopics['sendVideoTopic']] = document.createElement('video');
|
|
532
558
|
var el = uiRemoteMedias[callTopics['sendVideoTopic']];
|
|
@@ -572,19 +598,13 @@
|
|
|
572
598
|
callMute && el.setAttribute('muted', '');
|
|
573
599
|
el.setAttribute('controls', '');
|
|
574
600
|
}
|
|
575
|
-
}
|
|
601
|
+
}*/
|
|
576
602
|
|
|
577
|
-
|
|
578
|
-
for(var i in callTopics['receive']) {
|
|
579
|
-
/*uiRemoteElements.push(uiRemoteMedias[callTopics['receive'][i]['AudioTopic']])
|
|
580
|
-
callVideo && uiRemoteElements.push(uiRemoteMedias[callTopics['receive'][i]['VideoTopic']])*/
|
|
603
|
+
callback && callback(generateCallUIList());
|
|
581
604
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
uiRemoteVideo: callVideo && uiRemoteMedias[callTopics['receive'][i]['VideoTopic']]
|
|
586
|
-
}
|
|
587
|
-
)
|
|
605
|
+
/*for(var i in callTopics['receive']) {
|
|
606
|
+
uiRemoteElements.push(uiRemoteMedias[callTopics['receive'][i]['AudioTopic']])
|
|
607
|
+
callVideo && uiRemoteElements.push(uiRemoteMedias[callTopics['receive'][i]['VideoTopic']])
|
|
588
608
|
}
|
|
589
609
|
|
|
590
610
|
if (callParentDiv) {
|
|
@@ -603,18 +623,19 @@
|
|
|
603
623
|
'uiLocalVideo': uiRemoteMedias[callTopics['sendVideoTopic']],
|
|
604
624
|
'uiLocalAudio': uiRemoteMedias[callTopics['sendAudioTopic']],
|
|
605
625
|
uiRemoteElements: uiRemoteElements
|
|
606
|
-
|
|
607
|
-
'uiRemoteAudio': uiRemoteMedias[callTopics['receiveAudioTopic']]
|
|
626
|
+
/!* 'uiRemoteVideo': uiRemoteMedias[callTopics['receiveVideoTopic']],
|
|
627
|
+
'uiRemoteAudio': uiRemoteMedias[callTopics['receiveAudioTopic']]*!/
|
|
608
628
|
});
|
|
609
629
|
} else {
|
|
610
630
|
callback && callback({
|
|
611
631
|
'uiLocalVideo': uiRemoteMedias[callTopics['sendVideoTopic']],
|
|
612
632
|
'uiLocalAudio': uiRemoteMedias[callTopics['sendAudioTopic']],
|
|
613
633
|
uiRemoteElements: uiRemoteElements
|
|
614
|
-
|
|
615
|
-
'uiRemoteAudio': uiRemoteMedias[callTopics['receiveAudioTopic']]
|
|
634
|
+
/!*'uiRemoteVideo': uiRemoteMedias[callTopics['receiveVideoTopic']],
|
|
635
|
+
'uiRemoteAudio': uiRemoteMedias[callTopics['receiveAudioTopic']]*!/
|
|
616
636
|
});
|
|
617
|
-
}
|
|
637
|
+
}*/
|
|
638
|
+
|
|
618
639
|
|
|
619
640
|
callStateController.createSessionInChat(Object.assign(params, {
|
|
620
641
|
callVideo: callVideo,
|
|
@@ -639,6 +660,26 @@
|
|
|
639
660
|
}
|
|
640
661
|
},
|
|
641
662
|
|
|
663
|
+
generateCallUIList = function () {
|
|
664
|
+
var me = chatMessaging.userInfo.Id;
|
|
665
|
+
var callUIElements = {};
|
|
666
|
+
for(var i in callUsers) {
|
|
667
|
+
callUIElements[i] = {
|
|
668
|
+
container: callUsers[i].htmlElements.container,
|
|
669
|
+
video: callUsers[i].htmlElements[callUsers[i].videoTopicName],
|
|
670
|
+
audio: callUsers[i].htmlElements[callUsers[i].audioTopicName]
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/* callUIElements[i].container = callUsers[i].htmlElements.container;
|
|
674
|
+
callUIElements[i].video = callUsers[i].htmlElements[callUsers[i].videoTopicName];
|
|
675
|
+
callUIElements[i].audio = callUsers[i].htmlElements[callUsers[i].audioTopicName];
|
|
676
|
+
*/
|
|
677
|
+
//callUIElements[i] = callUsers[i].htmlElements;
|
|
678
|
+
}
|
|
679
|
+
return {
|
|
680
|
+
uiElements: callUIElements,
|
|
681
|
+
};
|
|
682
|
+
},
|
|
642
683
|
|
|
643
684
|
/*handleCallSocketOpen = function (params) {
|
|
644
685
|
currentCallParams = params;
|
|
@@ -673,7 +714,6 @@
|
|
|
673
714
|
brokerAddress: params.brokerAddress,
|
|
674
715
|
turnAddress: params.turnAddress.split(',')[0]
|
|
675
716
|
}, function (res) {
|
|
676
|
-
consoleLogging && console.log("createSessionInChat:onresult", res)
|
|
677
717
|
if (res.done === 'TRUE') {
|
|
678
718
|
callStopQueue.callStarted = true;
|
|
679
719
|
callController.startCall(params);
|
|
@@ -695,19 +735,139 @@
|
|
|
695
735
|
*/
|
|
696
736
|
startCall: function (params) {
|
|
697
737
|
var callController = this;
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
}, 2000)
|
|
738
|
+
for(var i in callUsers) {
|
|
739
|
+
if(i === 'screenShare')
|
|
740
|
+
continue;
|
|
741
|
+
|
|
742
|
+
if (params.callVideo) {
|
|
743
|
+
callController.startParticipantVideo(i);
|
|
744
|
+
}
|
|
745
|
+
if(params.callAudio) {
|
|
746
|
+
callController.startParticipantAudio(i);
|
|
747
|
+
}
|
|
709
748
|
}
|
|
710
749
|
},
|
|
750
|
+
setupCallParticipant: function (participant) {
|
|
751
|
+
var user = participant;
|
|
752
|
+
user.topicMetaData = {};
|
|
753
|
+
user.peers = {};
|
|
754
|
+
if(user.userId === chatMessaging.userInfo.id) {
|
|
755
|
+
user.direction = 'send';
|
|
756
|
+
} else {
|
|
757
|
+
user.direction = 'receive';
|
|
758
|
+
}
|
|
759
|
+
user.videoTopicName = 'Vi-' + user.topicSend;
|
|
760
|
+
user.audioTopicName = 'Vo-' + user.topicSend;
|
|
761
|
+
user.topicMetaData[user.videoTopicName] = {
|
|
762
|
+
interval: null,
|
|
763
|
+
receivedSdpAnswer: false,
|
|
764
|
+
connectionQualityInterval: null,
|
|
765
|
+
poorConnectionCount: 0,
|
|
766
|
+
poorConnectionResolvedCount: 0,
|
|
767
|
+
isConnectionPoor: false
|
|
768
|
+
};
|
|
769
|
+
user.topicMetaData[user.audioTopicName] = {
|
|
770
|
+
interval: null,
|
|
771
|
+
receivedSdpAnswer: false,
|
|
772
|
+
connectionQualityInterval: null,
|
|
773
|
+
poorConnectionCount: 0,
|
|
774
|
+
poorConnectionResolvedCount: 0,
|
|
775
|
+
isConnectionPoor: false
|
|
776
|
+
};
|
|
777
|
+
callUsers[user.userId] = user;
|
|
778
|
+
this.appendUserToCallDiv(user.userId, this.generateHTMLElements(user.userId));
|
|
779
|
+
},
|
|
780
|
+
setupScreenSharingObject: function (topic) {
|
|
781
|
+
var obj = {
|
|
782
|
+
video: true,
|
|
783
|
+
};
|
|
784
|
+
obj.topicMetaData = {};
|
|
785
|
+
obj.peers = {};
|
|
786
|
+
if(screenShareState.imOwner) {
|
|
787
|
+
obj.direction = 'send';
|
|
788
|
+
} else {
|
|
789
|
+
obj.direction = 'receive'
|
|
790
|
+
}
|
|
791
|
+
obj.videoTopicName = topic;
|
|
792
|
+
obj.topicMetaData[obj.videoTopicName] = {
|
|
793
|
+
interval: null,
|
|
794
|
+
receivedSdpAnswer: false,
|
|
795
|
+
connectionQualityInterval: null,
|
|
796
|
+
poorConnectionCount: 0,
|
|
797
|
+
poorConnectionResolvedCount: 0,
|
|
798
|
+
isConnectionPoor: false
|
|
799
|
+
};
|
|
800
|
+
callUsers['screenShare'] = obj;
|
|
801
|
+
this.generateHTMLElements('screenShare')
|
|
802
|
+
},
|
|
803
|
+
appendUserToCallDiv: function (userId) {
|
|
804
|
+
if(!callDivId) {
|
|
805
|
+
consoleLogging && console.log('No Call DIV has been declared!');
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
var user = callUsers[userId]
|
|
809
|
+
var callParentDiv = document.getElementById(callDivId);
|
|
810
|
+
if(user.video) {
|
|
811
|
+
console.log("appendUserToCallDiv1", user, document.getElementById("callParticipantWrapper-" + userId), document.getElementById("uiRemoteVideo-" + user.videoTopicName))
|
|
812
|
+
if(!document.getElementById("callParticipantWrapper-" + userId)) {
|
|
813
|
+
if (!document.getElementById("uiRemoteVideo-" + user.videoTopicName)) {
|
|
814
|
+
user.htmlElements.container.appendChild(user.htmlElements[user.videoTopicName])
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
else {
|
|
818
|
+
document.getElementById("callParticipantWrapper-" + userId).append(user.htmlElements[user.videoTopicName])
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
if(typeof user.mute !== "undefined" && !user.mute){
|
|
822
|
+
if(!document.getElementById("callParticipantWrapper-" + userId)) {
|
|
823
|
+
if(!document.getElementById("uiRemoteAudio-" + user.videoTopicName)) {
|
|
824
|
+
user.htmlElements.container.appendChild(user.htmlElements[user.audioTopicName])
|
|
825
|
+
}
|
|
826
|
+
} else {
|
|
827
|
+
document.getElementById("callParticipantWrapper-" + userId).append(user.htmlElements[user.audioTopicName])
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
if(!document.getElementById("callParticipantWrapper-" + userId))
|
|
832
|
+
callParentDiv.appendChild(user.htmlElements.container);
|
|
833
|
+
},
|
|
834
|
+
generateHTMLElements: function (userId) {
|
|
835
|
+
var user = callUsers[userId]
|
|
836
|
+
if(!user.htmlElements) {
|
|
837
|
+
user.htmlElements = {
|
|
838
|
+
container: document.createElement('div')
|
|
839
|
+
};
|
|
840
|
+
var el = user.htmlElements.container;
|
|
841
|
+
el.setAttribute('id', 'callParticipantWrapper-' + userId);
|
|
842
|
+
el.classList.add('participant');
|
|
843
|
+
el.classList.add('wrapper');
|
|
844
|
+
el.classList.add('user-' + userId);
|
|
845
|
+
el.classList.add((userId === chatMessaging.userInfo.id ? 'local' : 'remote'));
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
if (user.video && !user.htmlElements[user.videoTopicName]) {
|
|
849
|
+
user.htmlElements[user.videoTopicName] = document.createElement('video');
|
|
850
|
+
var el = user.htmlElements[user.videoTopicName];
|
|
851
|
+
el.setAttribute('id', 'uiRemoteVideo-' + user.videoTopicName);
|
|
852
|
+
el.setAttribute('class', callVideoTagClassName);
|
|
853
|
+
el.setAttribute('playsinline', '');
|
|
854
|
+
el.setAttribute('muted', '');
|
|
855
|
+
el.setAttribute('width', callVideoMinWidth + 'px');
|
|
856
|
+
el.setAttribute('height', callVideoMinHeight + 'px');
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
if (typeof user.mute !== 'undefined' && !user.mute && !user.htmlElements[user.audioTopicName]) {
|
|
860
|
+
user.htmlElements[user.audioTopicName] = document.createElement('audio');
|
|
861
|
+
var el = user.htmlElements[user.audioTopicName];
|
|
862
|
+
el.setAttribute('id', 'uiRemoteAudio-' + user.audioTopicName);
|
|
863
|
+
el.setAttribute('class', callAudioTagClassName);
|
|
864
|
+
el.setAttribute('autoplay', '');
|
|
865
|
+
el.setAttribute('muted', '');
|
|
866
|
+
el.setAttribute('controls', '');
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
return user.htmlElements;
|
|
870
|
+
},
|
|
711
871
|
/**
|
|
712
872
|
* When call started we can add participants
|
|
713
873
|
*
|
|
@@ -732,50 +892,39 @@
|
|
|
732
892
|
return;
|
|
733
893
|
}
|
|
734
894
|
},
|
|
735
|
-
|
|
736
|
-
this.removeTopic(
|
|
895
|
+
stopParticipantAudio: function (userId) {
|
|
896
|
+
this.removeTopic(userId, callUsers[userId].peers[userId].audioTopicName);
|
|
737
897
|
},
|
|
738
|
-
|
|
739
|
-
this.createTopic(
|
|
898
|
+
startParticipantAudio: function (userId) {
|
|
899
|
+
this.createTopic(userId, callUsers[userId].audioTopicName, 'audio', callUsers[userId].direction);
|
|
740
900
|
},
|
|
741
|
-
|
|
742
|
-
this.removeTopic(
|
|
901
|
+
stopParticipantVideo: function (userId) {
|
|
902
|
+
this.removeTopic(userId, callUsers[userId].peers[userId].videoTopicName);
|
|
743
903
|
},
|
|
744
|
-
|
|
745
|
-
this.createTopic(
|
|
904
|
+
startParticipantVideo: function (userId) {
|
|
905
|
+
this.createTopic(userId, callUsers[userId].videoTopicName, 'video', callUsers[userId].direction);
|
|
746
906
|
},
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
this.createTopic(callTopics['sendVideoTopic'], 'video','send');
|
|
752
|
-
},
|
|
753
|
-
stopParticipantVideo: function (topic) {
|
|
754
|
-
this.removeTopic(topic);
|
|
755
|
-
},
|
|
756
|
-
startParticipantVideo: function (topic) {
|
|
757
|
-
this.createTopic(topic, 'video', 'receive');
|
|
758
|
-
},
|
|
759
|
-
createTopic: function (topic, mediaType, direction, shareScreen) {
|
|
907
|
+
createTopic: function (userId, topic, mediaType, direction, shareScreen) {
|
|
908
|
+
if(callUsers[userId] && callUsers[userId].peers[topic]) {
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
760
911
|
shareScreen = typeof shareScreen !== 'undefined' ? shareScreen : false;
|
|
761
|
-
this.getSdpOfferOptions(topic, mediaType, direction, shareScreen).then(function (options){
|
|
762
|
-
callStateController.generateTopicPeer(topic, mediaType, direction, options);
|
|
912
|
+
this.getSdpOfferOptions(userId, topic, mediaType, direction, shareScreen).then(function (options){
|
|
913
|
+
callStateController.generateTopicPeer(userId, topic, mediaType, direction, options);
|
|
763
914
|
});
|
|
764
915
|
},
|
|
765
|
-
removeTopic: function (topic) {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
webpeers[i] = null;
|
|
771
|
-
}
|
|
916
|
+
removeTopic: function (userId, topic) {
|
|
917
|
+
if(callUsers[userId].peers[topic]) {
|
|
918
|
+
callUsers[userId].peers[topic].dispose();
|
|
919
|
+
this.removeConnectionQualityInterval(userId, topic);
|
|
920
|
+
callUsers[userId].peers[topic] = null;
|
|
772
921
|
}
|
|
773
922
|
},
|
|
774
|
-
getSdpOfferOptions: function (topic, mediaType, direction, shareScreen) {
|
|
923
|
+
getSdpOfferOptions: function (userId, topic, mediaType, direction, shareScreen) {
|
|
775
924
|
return new Promise(function (resolve, reject) {
|
|
776
925
|
var mediaConstraints = {audio: (mediaType === 'audio'), video: (mediaType === 'video')};
|
|
777
926
|
|
|
778
|
-
if(direction === 'send') {
|
|
927
|
+
if(direction === 'send' && mediaType === 'video') {
|
|
779
928
|
mediaConstraints.video = {
|
|
780
929
|
width: callVideoMinWidth,
|
|
781
930
|
height: callVideoMinHeight,
|
|
@@ -787,13 +936,13 @@
|
|
|
787
936
|
mediaConstraints: mediaConstraints,
|
|
788
937
|
iceTransportPolicy: 'relay',
|
|
789
938
|
onicecandidate: (candidate) => {
|
|
790
|
-
if (
|
|
791
|
-
clearInterval(
|
|
939
|
+
if (callUsers[userId].topicMetaData[topic].interval !== null) {
|
|
940
|
+
clearInterval(callUsers[userId].topicMetaData[topic].interval);
|
|
792
941
|
}
|
|
793
|
-
|
|
794
|
-
if (
|
|
795
|
-
|
|
796
|
-
clearInterval(
|
|
942
|
+
callUsers[userId].topicMetaData[topic].interval = setInterval(function () {
|
|
943
|
+
if (callUsers[userId].topicMetaData[topic].sdpAnswerReceived === true) {
|
|
944
|
+
callUsers[userId].topicMetaData[topic].sdpAnswerReceived = false;
|
|
945
|
+
clearInterval(callUsers[userId].topicMetaData[topic].interval);
|
|
797
946
|
sendCallMessage({
|
|
798
947
|
id: 'ADD_ICE_CANDIDATE',
|
|
799
948
|
topic: topic,
|
|
@@ -806,7 +955,8 @@
|
|
|
806
955
|
iceServers: callStateController.getTurnServer(currentCallParams)
|
|
807
956
|
}
|
|
808
957
|
};
|
|
809
|
-
|
|
958
|
+
|
|
959
|
+
options[(direction === 'send' ? 'localVideo' : 'remoteVideo')] = callUsers[userId].htmlElements[topic];
|
|
810
960
|
|
|
811
961
|
if(direction === 'send' && mediaType === 'video' && shareScreen) {
|
|
812
962
|
navigator.mediaDevices.getDisplayMedia().then(function (result) {
|
|
@@ -815,9 +965,9 @@
|
|
|
815
965
|
// options[(direction === 'send' ? 'localVideo' : 'remoteVideo')] = uiRemoteMedias[topic];
|
|
816
966
|
resolve(options);
|
|
817
967
|
}).catch(function (error) {
|
|
818
|
-
console.
|
|
968
|
+
console.error("[SDK][navigator.mediaDevices.getDisplayMedia]", error);
|
|
819
969
|
explainUserMediaError(error, 'video', 'screen');
|
|
820
|
-
resolve(options);
|
|
970
|
+
//resolve(options);
|
|
821
971
|
});
|
|
822
972
|
} else {
|
|
823
973
|
resolve(options);
|
|
@@ -846,100 +996,26 @@
|
|
|
846
996
|
];
|
|
847
997
|
}
|
|
848
998
|
},
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
webpeers[topic].peerConnection.onconnectionstatechange = function () {
|
|
854
|
-
console.log("on connection state change, ", "peer: ", topic, "peerConnection.connectionState: ", webpeers[topic].peerConnection.connectionState);
|
|
855
|
-
if (webpeers[topic].peerConnection.connectionState === 'disconnected') {
|
|
856
|
-
console.log(topic, 'peerConnection.onconnectionstatechange: disconnected');
|
|
857
|
-
|
|
858
|
-
callController.removeConnectionQualityInterval(topic);
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
if (webpeers[topic].peerConnection.connectionState === "failed") {
|
|
862
|
-
chatEvents.fireEvent('callEvents', {
|
|
863
|
-
type: 'CALL_STATUS',
|
|
864
|
-
errorCode: 7000,
|
|
865
|
-
errorMessage: `Call Peer (${topic}) has failed!`,
|
|
866
|
-
errorInfo: webpeers[topic]
|
|
867
|
-
});
|
|
868
|
-
setTimeout(function () {
|
|
869
|
-
if(chatMessaging.chatState) {
|
|
870
|
-
callController.shouldReconnectTopic(topic, mediaType, direction);
|
|
871
|
-
}
|
|
872
|
-
}, 7000);
|
|
873
|
-
|
|
874
|
-
callController.removeConnectionQualityInterval(topic);
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
if(webpeers[topic].peerConnection.connectionState === 'connected') {
|
|
878
|
-
if(mediaType === 'video' && direction === 'send') {
|
|
879
|
-
webpeersMetadata[topic]['connectionQualityInterval'] = setInterval(function() {
|
|
880
|
-
callController.checkConnectionQuality(topic, mediaType, direction)
|
|
881
|
-
}, 1000);
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
webpeers[topic].peerConnection.oniceconnectionstatechange = function () {
|
|
887
|
-
console.log("on ice connection state change: ", topic, webpeers[topic].peerConnection.iceConnectionState);
|
|
888
|
-
if (webpeers[topic].peerConnection.iceConnectionState === 'disconnected') {
|
|
889
|
-
console.log(topic, 'peerConnection.oniceconnectionstatechange disconnected');
|
|
890
|
-
chatEvents.fireEvent('callEvents', {
|
|
891
|
-
type: 'CALL_STATUS',
|
|
892
|
-
errorCode: 7000,
|
|
893
|
-
errorMessage: `Call Peer (${topic}) is disconnected!`,
|
|
894
|
-
errorInfo: webpeers[topic]
|
|
895
|
-
});
|
|
896
|
-
|
|
897
|
-
console.log('Internet connection failed, Reconnect your call, topic:', topic);
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
if (webpeers[topic].peerConnection.iceConnectionState === "failed") {
|
|
901
|
-
chatEvents.fireEvent('callEvents', {
|
|
902
|
-
type: 'CALL_STATUS',
|
|
903
|
-
errorCode: 7000,
|
|
904
|
-
errorMessage: `Call Peer (${topic}) has failed!`,
|
|
905
|
-
errorInfo: webpeers[topic]
|
|
906
|
-
});
|
|
907
|
-
if(chatMessaging.chatState) {
|
|
908
|
-
callController.shouldReconnectTopic(topic, mediaType, direction);
|
|
909
|
-
} else {
|
|
910
|
-
setTimeout(function () {
|
|
911
|
-
if(chatMessaging.chatState) {
|
|
912
|
-
callController.shouldReconnectTopic(topic, mediaType, direction);
|
|
913
|
-
}
|
|
914
|
-
}, 7000);
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
if (webpeers[topic].peerConnection.iceConnectionState === "connected") {
|
|
919
|
-
callRequestController.callEstablishedInMySide = true;
|
|
920
|
-
chatEvents.fireEvent('callEvents', {
|
|
921
|
-
type: 'CALL_STATUS',
|
|
922
|
-
errorCode: 7000,
|
|
923
|
-
errorMessage: `Call Peer (${topic}) has connected!`,
|
|
924
|
-
errorInfo: webpeers[topic]
|
|
925
|
-
});
|
|
926
|
-
}
|
|
999
|
+
checkConnectionQuality: function (userId, topic) {
|
|
1000
|
+
if(!callUsers[userId] || !callUsers[userId].peers[topic] || !callUsers[userId].peers[topic].peerConnection) {
|
|
1001
|
+
callStateController.removeConnectionQualityInterval(userId, topic);
|
|
1002
|
+
return;
|
|
927
1003
|
}
|
|
928
|
-
|
|
929
|
-
checkConnectionQuality: function (topic) {
|
|
930
|
-
webpeers[topic].peerConnection.getStats(null).then(stats => {
|
|
1004
|
+
callUsers[userId].peers[topic].peerConnection.getStats(null).then(stats => {
|
|
931
1005
|
//console.log(' watchRTCPeerConnection:: window.setInterval then(stats:', stats)
|
|
932
1006
|
//let statsOutput = "";
|
|
1007
|
+
var user = callUsers[userId],
|
|
1008
|
+
userMetadata = user.topicMetaData[topic]
|
|
933
1009
|
|
|
934
1010
|
stats.forEach(report => {
|
|
935
1011
|
if(report && report.type && report.type === 'remote-inbound-rtp') {
|
|
936
|
-
|
|
937
|
-
|
|
1012
|
+
/*statsOutput += `<h2>Report: ${report.type}</h2>\n<strong>ID:</strong> ${report.id}<br>\n` +
|
|
1013
|
+
`<strong>Timestamp:</strong> ${report.timestamp}<br>\n`;*/
|
|
938
1014
|
|
|
939
1015
|
// Now the statistics for this report; we intentially drop the ones we
|
|
940
1016
|
// sorted to the top above
|
|
941
1017
|
if(!report['roundTripTime'] || report['roundTripTime'] > 1) {
|
|
942
|
-
if(
|
|
1018
|
+
if(userMetadata.poorConnectionCount === 10) {
|
|
943
1019
|
chatEvents.fireEvent('callEvents', {
|
|
944
1020
|
type: 'POOR_VIDEO_CONNECTION',
|
|
945
1021
|
subType: 'LONG_TIME',
|
|
@@ -950,29 +1026,30 @@
|
|
|
950
1026
|
}
|
|
951
1027
|
});
|
|
952
1028
|
}
|
|
953
|
-
if(
|
|
1029
|
+
if(userMetadata.poorConnectionCount > 3 && !userMetadata.isConnectionPoor) {
|
|
954
1030
|
//alert('Poor connection detected...');
|
|
955
|
-
consoleLogging && console.log('Poor connection detected...');
|
|
1031
|
+
consoleLogging && console.log('[SDK][checkConnectionQuality] Poor connection detected...');
|
|
956
1032
|
chatEvents.fireEvent('callEvents', {
|
|
957
1033
|
type: 'POOR_VIDEO_CONNECTION',
|
|
958
1034
|
subType: 'SHORT_TIME',
|
|
959
1035
|
message: 'Poor connection detected',
|
|
960
1036
|
metadata: {
|
|
961
1037
|
elementId: "uiRemoteVideo-" + topic,
|
|
962
|
-
topic: topic
|
|
1038
|
+
topic: topic,
|
|
1039
|
+
userId: userId
|
|
963
1040
|
}
|
|
964
1041
|
});
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1042
|
+
userMetadata.isConnectionPoor = true;
|
|
1043
|
+
userMetadata.poorConnectionCount = 0;
|
|
1044
|
+
userMetadata.poorConnectionResolvedCount = 0;
|
|
968
1045
|
} else {
|
|
969
|
-
|
|
1046
|
+
callUsers[userId].topicMetaData[topic].poorConnectionCount++;
|
|
970
1047
|
}
|
|
971
1048
|
} else if(report['roundTripTime'] || report['roundTripTime'] < 1) {
|
|
972
|
-
if(
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1049
|
+
if(userMetadata.poorConnectionResolvedCount > 3 && userMetadata.isConnectionPoor) {
|
|
1050
|
+
userMetadata.poorConnectionResolvedCount = 0;
|
|
1051
|
+
userMetadata.poorConnectionCount = 0;
|
|
1052
|
+
userMetadata.isConnectionPoor = false;
|
|
976
1053
|
chatEvents.fireEvent('callEvents', {
|
|
977
1054
|
type: 'POOR_VIDEO_CONNECTION_RESOLVED',
|
|
978
1055
|
message: 'Poor connection resolved',
|
|
@@ -982,7 +1059,7 @@
|
|
|
982
1059
|
}
|
|
983
1060
|
});
|
|
984
1061
|
} else {
|
|
985
|
-
|
|
1062
|
+
userMetadata.poorConnectionResolvedCount++;
|
|
986
1063
|
}
|
|
987
1064
|
}
|
|
988
1065
|
|
|
@@ -997,72 +1074,35 @@
|
|
|
997
1074
|
//document.querySelector(".stats-box").innerHTML = statsOutput;
|
|
998
1075
|
});
|
|
999
1076
|
},
|
|
1000
|
-
|
|
1001
|
-
//isConnectionPoor
|
|
1002
|
-
webpeersMetadata[topic]['poorConnectionCount'] = 0;
|
|
1003
|
-
clearInterval(webpeersMetadata[topic]['connectionQualityInterval']);
|
|
1004
|
-
},
|
|
1005
|
-
shouldReconnectTopic: function (topic, mediaType, direction) {
|
|
1006
|
-
var callController = this;
|
|
1007
|
-
if (currentCallParams && Object.keys(currentCallParams).length) {
|
|
1008
|
-
if (webpeers[topic].peerConnection.iceConnectionState != 'connected') {
|
|
1009
|
-
chatEvents.fireEvent('callEvents', {
|
|
1010
|
-
type: 'CALL_STATUS',
|
|
1011
|
-
errorCode: 7000,
|
|
1012
|
-
errorMessage: `Call Peer (${topic}) is not in connected state, Restarting call in progress ...!`,
|
|
1013
|
-
errorInfo: webpeers[topic]
|
|
1014
|
-
});
|
|
1015
|
-
|
|
1016
|
-
sendCallMessage({
|
|
1017
|
-
id: 'STOP',
|
|
1018
|
-
topic: topic
|
|
1019
|
-
}, function (result) {
|
|
1020
|
-
if (result.done === 'TRUE') {
|
|
1021
|
-
//handleCallSocketOpen(currentCallParams);
|
|
1022
|
-
/*webpeers[topic].dispose();
|
|
1023
|
-
webpeers[topic] = null;*/
|
|
1024
|
-
callController.removeTopic(topic);
|
|
1025
|
-
callController.createTopic(topic, mediaType, direction);
|
|
1026
|
-
//generateAndSendSdpOffers(currentCallParams, [topicName]);
|
|
1027
|
-
} else if (result.done === 'SKIP') {
|
|
1028
|
-
//handleCallSocketOpen(currentCallParams);
|
|
1029
|
-
/*webpeers[topic].dispose();
|
|
1030
|
-
webpeers[topic] = null;*/
|
|
1031
|
-
callController.removeTopic(topic);
|
|
1032
|
-
callController.createTopic(topic, mediaType, direction);
|
|
1033
|
-
//generateAndSendSdpOffers(currentCallParams, [topicName]);
|
|
1034
|
-
} else {
|
|
1035
|
-
consoleLogging && console.log('STOP topic faced a problem', result);
|
|
1036
|
-
endCall({
|
|
1037
|
-
callId: currentCallId
|
|
1038
|
-
});
|
|
1039
|
-
callStop();
|
|
1040
|
-
}
|
|
1041
|
-
});
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
},
|
|
1045
|
-
generateTopicPeer: function (topic, mediaType, direction, options) {
|
|
1077
|
+
generateTopicPeer: function (userId, topic, mediaType, direction, options) {
|
|
1046
1078
|
var WebRtcFunction = direction === 'send' ? 'WebRtcPeerSendonly' : 'WebRtcPeerRecvonly',
|
|
1047
|
-
|
|
1079
|
+
callController = this,
|
|
1080
|
+
user = callUsers[userId],
|
|
1081
|
+
topicElement = user.htmlElements[topic],
|
|
1082
|
+
topicMetaData = user.topicMetaData[topic];
|
|
1048
1083
|
|
|
1049
|
-
|
|
1084
|
+
callUsers[userId].peers[topic] = new KurentoUtils.WebRtcPeer[WebRtcFunction](options, function (err) {
|
|
1050
1085
|
if (err) {
|
|
1051
1086
|
console.error("[SDK][start/webRtc " + direction + " " + mediaType + " Peer] Error: " + explainUserMediaError(err, mediaType));
|
|
1052
1087
|
return;
|
|
1053
1088
|
}
|
|
1054
1089
|
|
|
1055
|
-
callController.watchRTCPeerConnection(topic, mediaType, direction);
|
|
1090
|
+
callController.watchRTCPeerConnection(userId, topic, mediaType, direction);
|
|
1056
1091
|
|
|
1057
|
-
if(direction === 'send')
|
|
1058
|
-
startMedia(
|
|
1092
|
+
if(direction === 'send') {
|
|
1093
|
+
startMedia(topicElement);
|
|
1094
|
+
if(callRequestController.cameraPaused) {
|
|
1095
|
+
currentModuleInstance.pauseCamera();
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1059
1098
|
|
|
1060
|
-
|
|
1099
|
+
callUsers[userId].peers[topic].generateOffer((err, sdpOffer) => {
|
|
1061
1100
|
if (err) {
|
|
1062
1101
|
console.error("[SDK][start/WebRc " + direction + " " + mediaType + " Peer/generateOffer] " + err);
|
|
1063
1102
|
return;
|
|
1064
1103
|
}
|
|
1065
1104
|
|
|
1105
|
+
sdpOffer = callController.setMediaBitrates(sdpOffer);
|
|
1066
1106
|
sendCallMessage({
|
|
1067
1107
|
id: (direction === 'send' ? 'SEND_SDP_OFFER' : 'RECIVE_SDP_OFFER'),
|
|
1068
1108
|
sdpOffer: sdpOffer,
|
|
@@ -1073,456 +1113,300 @@
|
|
|
1073
1113
|
});
|
|
1074
1114
|
});
|
|
1075
1115
|
});
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
if (currentCallParams && Object.keys(currentCallParams).length) {
|
|
1082
|
-
if (webpeers[topic] && webpeers[topic].peerConnection.iceConnectionState != 'connected') {
|
|
1083
|
-
|
|
1084
|
-
chatEvents.fireEvent('callEvents', {
|
|
1085
|
-
type: 'CALL_STATUS',
|
|
1086
|
-
errorCode: 7000,
|
|
1087
|
-
errorMessage: `Call Peer (${topic}) is not in connected state, Restarting call in progress ...!`,
|
|
1088
|
-
errorInfo: webpeers[topic]
|
|
1089
|
-
});
|
|
1090
|
-
|
|
1091
|
-
sendCallMessage({
|
|
1092
|
-
id: 'STOP',
|
|
1093
|
-
topic: topic
|
|
1094
|
-
}, function (result) {
|
|
1095
|
-
if (result.done === 'TRUE') {
|
|
1096
|
-
//handleCallSocketOpen(currentCallParams);
|
|
1097
|
-
/!*webpeers[topic].dispose();
|
|
1098
|
-
webpeers[topic] = null;*!/
|
|
1099
|
-
generateAndSendSdpOffers(currentCallParams, [topic]);
|
|
1100
|
-
|
|
1101
|
-
} else if (result.done === 'SKIP') {
|
|
1102
|
-
//handleCallSocketOpen(currentCallParams);
|
|
1103
|
-
/!*webpeers[topic].dispose();
|
|
1104
|
-
webpeers[topic] = null;*!/
|
|
1105
|
-
generateAndSendSdpOffers(currentCallParams, [topic]);
|
|
1106
|
-
} else {
|
|
1107
|
-
consoleLogging && console.log('STOP topic faced a problem', result);
|
|
1108
|
-
endCall({
|
|
1109
|
-
callId: currentCallId
|
|
1110
|
-
});
|
|
1111
|
-
callStop();
|
|
1112
|
-
}
|
|
1113
|
-
});
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
},
|
|
1117
|
-
|
|
1118
|
-
generateAndSendSdpOffers = function (params, topics) {
|
|
1119
|
-
var turnServers = [];
|
|
1116
|
+
},
|
|
1117
|
+
watchRTCPeerConnection: function (userId, topic, mediaType, direction) {
|
|
1118
|
+
consoleLogging && console.log("[SDK][watchRTCPeerConnection] called with: ", userId, topic, mediaType, direction);
|
|
1119
|
+
var callController = this,
|
|
1120
|
+
user = callUsers[userId];
|
|
1120
1121
|
|
|
1121
|
-
|
|
1122
|
-
var serversTemp = params.turnAddress.split(',');
|
|
1122
|
+
consoleLogging && console.log("[SDK][watchRTCPeerConnection] called with: ", callUsers, user);
|
|
1123
1123
|
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
"urls": "turn:" + serversTemp[0],
|
|
1128
|
-
"username": "mkhorrami",
|
|
1129
|
-
"credential": "mkh_123456"
|
|
1124
|
+
user.peers[topic].peerConnection.onconnectionstatechange = function () {
|
|
1125
|
+
if(!user || !user.peers || !user.peers[topic]) {
|
|
1126
|
+
return; //avoid log errors
|
|
1130
1127
|
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
//{"urls": "stun:" + callTurnIp + ":3478"},
|
|
1135
|
-
{
|
|
1136
|
-
"urls": "turn:" + callTurnIp + ":3478",
|
|
1137
|
-
"username": "mkhorrami",
|
|
1138
|
-
"credential": "mkh_123456"
|
|
1128
|
+
consoleLogging && console.log("[SDK][peerConnection.onconnectionstatechange] ", "peer: ", topic, " peerConnection.connectionState: ", user.peers[topic].peerConnection.connectionState);
|
|
1129
|
+
if (user.peers[topic].peerConnection.connectionState === 'disconnected') {
|
|
1130
|
+
callController.removeConnectionQualityInterval(userId, topic);
|
|
1139
1131
|
}
|
|
1140
|
-
];
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
// Video Topics
|
|
1144
|
-
if (params.callVideo) {
|
|
1145
|
-
if(topics.indexOf(callTopics['receiveVideoTopic']) !== -1) {
|
|
1146
|
-
const receiveVideoOptions = {
|
|
1147
|
-
remoteVideo: uiRemoteMedias[callTopics['receiveVideoTopic']],
|
|
1148
|
-
mediaConstraints: {audio: false, video: true},
|
|
1149
|
-
iceTransportPolicy: 'relay',
|
|
1150
|
-
onicecandidate: (candidate) => {
|
|
1151
|
-
if (webpeersMetadata[callTopics['receiveVideoTopic']].interval !== null) {
|
|
1152
|
-
clearInterval(webpeersMetadata[callTopics['receiveVideoTopic']].interval);
|
|
1153
|
-
}
|
|
1154
|
-
webpeersMetadata[callTopics['receiveVideoTopic']].interval = setInterval(function () {
|
|
1155
|
-
if (webpeersMetadata[callTopics['receiveVideoTopic']].sdpAnswerReceived === true) {
|
|
1156
|
-
webpeersMetadata[callTopics['receiveVideoTopic']].sdpAnswerReceived = false;
|
|
1157
|
-
clearInterval(webpeersMetadata[callTopics['receiveVideoTopic']].interval);
|
|
1158
|
-
sendCallMessage({
|
|
1159
|
-
id: 'ADD_ICE_CANDIDATE',
|
|
1160
|
-
topic: callTopics['receiveVideoTopic'],
|
|
1161
|
-
candidateDto: candidate
|
|
1162
|
-
})
|
|
1163
|
-
}
|
|
1164
|
-
}, 500, {candidate: candidate});
|
|
1165
|
-
},
|
|
1166
|
-
configuration: {
|
|
1167
|
-
iceServers: turnServers
|
|
1168
|
-
}
|
|
1169
|
-
};
|
|
1170
|
-
|
|
1171
|
-
webpeers[callTopics['receiveVideoTopic']] = new KurentoUtils.WebRtcPeer.WebRtcPeerRecvonly(receiveVideoOptions, function (err) {
|
|
1172
|
-
if (err) {
|
|
1173
|
-
console.error("[start/webRtcReceiveVideoPeer] Error: " + explainUserMediaError(err, 'video'));
|
|
1174
|
-
return;
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
watchRTCPeerConnection(callTopics['receiveVideoTopic']);
|
|
1178
|
-
|
|
1179
|
-
webpeers[callTopics['receiveVideoTopic']].generateOffer((err, sdpOffer) => {
|
|
1180
|
-
if (err) {
|
|
1181
|
-
console.error("[start/WebRtcVideoPeerReceiveOnly/generateOffer] " + err);
|
|
1182
|
-
return;
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
sendCallMessage({
|
|
1186
|
-
id: 'RECIVE_SDP_OFFER',
|
|
1187
|
-
sdpOffer: sdpOffer,
|
|
1188
|
-
useComedia: true,
|
|
1189
|
-
useSrtp: false,
|
|
1190
|
-
topic: callTopics['receiveVideoTopic'],
|
|
1191
|
-
mediaType: 2
|
|
1192
|
-
});
|
|
1193
|
-
});
|
|
1194
|
-
});
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
if(topics.indexOf(callTopics['sendVideoTopic']) !== -1) {
|
|
1198
|
-
const sendVideoOptions = {
|
|
1199
|
-
localVideo: uiRemoteMedias[callTopics['sendVideoTopic']],
|
|
1200
|
-
mediaConstraints: {
|
|
1201
|
-
audio: false,
|
|
1202
|
-
video: {
|
|
1203
|
-
width: callVideoMinWidth,
|
|
1204
|
-
height: callVideoMinHeight,
|
|
1205
|
-
framerate: 15
|
|
1206
|
-
}
|
|
1207
|
-
},
|
|
1208
|
-
iceTransportPolicy: 'relay',
|
|
1209
|
-
onicecandidate: (candidate) => {
|
|
1210
|
-
if (webpeersMetadata[callTopics['sendVideoTopic']].interval !== null) {
|
|
1211
|
-
clearInterval(webpeersMetadata[callTopics['sendVideoTopic']].interval);
|
|
1212
|
-
}
|
|
1213
|
-
webpeersMetadata[callTopics['sendVideoTopic']].interval = setInterval(function () {
|
|
1214
|
-
if (webpeersMetadata[callTopics['sendVideoTopic']].sdpAnswerReceived === true) {
|
|
1215
|
-
webpeersMetadata[callTopics['sendVideoTopic']].sdpAnswerReceived = false;
|
|
1216
|
-
clearInterval(webpeersMetadata[callTopics['sendVideoTopic']].interval);
|
|
1217
|
-
sendCallMessage({
|
|
1218
|
-
id: 'ADD_ICE_CANDIDATE',
|
|
1219
|
-
topic: callTopics['sendVideoTopic'],
|
|
1220
|
-
candidateDto: candidate
|
|
1221
|
-
})
|
|
1222
|
-
}
|
|
1223
|
-
}, 500, {candidate: candidate});
|
|
1224
|
-
|
|
1225
|
-
},
|
|
1226
|
-
configuration: {
|
|
1227
|
-
iceServers: turnServers
|
|
1228
|
-
}
|
|
1229
|
-
};
|
|
1230
|
-
|
|
1231
|
-
setTimeout(function () {
|
|
1232
|
-
webpeers[callTopics['sendVideoTopic']] = new KurentoUtils.WebRtcPeer.WebRtcPeerSendonly(sendVideoOptions, function (err) {
|
|
1233
|
-
if (err) {
|
|
1234
|
-
sendCallSocketError("[start/WebRtcVideoPeerSendOnly] Error: " + explainUserMediaError(err, 'video'));
|
|
1235
|
-
//callStop();
|
|
1236
|
-
return;
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
watchRTCPeerConnection(callTopics['sendVideoTopic']);
|
|
1240
|
-
startMedia(uiRemoteMedias[callTopics['sendVideoTopic']]);
|
|
1241
|
-
|
|
1242
|
-
webpeers[callTopics['sendVideoTopic']].generateOffer((err, sdpOffer) => {
|
|
1243
|
-
if (err) {
|
|
1244
|
-
sendCallSocketError("[start/WebRtcVideoPeerSendOnly/generateOffer] Error: " + err);
|
|
1245
|
-
//callStop();
|
|
1246
|
-
return;
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
sendCallMessage({
|
|
1250
|
-
id: 'SEND_SDP_OFFER',
|
|
1251
|
-
topic: callTopics['sendVideoTopic'],
|
|
1252
|
-
sdpOffer: sdpOffer,
|
|
1253
|
-
mediaType: 2
|
|
1254
|
-
});
|
|
1255
|
-
});
|
|
1256
|
-
});
|
|
1257
|
-
}, 2000);
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
// Audio Topics
|
|
1262
|
-
if (params.callAudio) {
|
|
1263
|
-
if(topics.indexOf(callTopics['receiveAudioTopic']) !== -1) {
|
|
1264
|
-
const receiveAudioOptions = {
|
|
1265
|
-
remoteVideo: uiRemoteMedias[callTopics['receiveAudioTopic']],
|
|
1266
|
-
mediaConstraints: {audio: true, video: false},
|
|
1267
|
-
iceTransportPolicy: 'relay',
|
|
1268
|
-
onicecandidate: (candidate) => {
|
|
1269
|
-
if (webpeersMetadata[callTopics['receiveAudioTopic']].interval !== null) {
|
|
1270
|
-
clearInterval(webpeersMetadata[callTopics['receiveAudioTopic']].interval);
|
|
1271
|
-
}
|
|
1272
|
-
webpeersMetadata[callTopics['receiveAudioTopic']].interval = setInterval(function () {
|
|
1273
|
-
if (webpeersMetadata[callTopics['receiveAudioTopic']].sdpAnswerReceived === true) {
|
|
1274
|
-
webpeersMetadata[callTopics['receiveAudioTopic']].sdpAnswerReceived = false;
|
|
1275
|
-
clearInterval(webpeersMetadata[callTopics['receiveAudioTopic']].interval);
|
|
1276
|
-
sendCallMessage({
|
|
1277
|
-
id: 'ADD_ICE_CANDIDATE',
|
|
1278
|
-
topic: callTopics['receiveAudioTopic'],
|
|
1279
|
-
candidateDto: candidate,
|
|
1280
|
-
})
|
|
1281
|
-
}
|
|
1282
|
-
}, 500, {candidate: candidate});
|
|
1283
|
-
},
|
|
1284
|
-
configuration: {
|
|
1285
|
-
iceServers: turnServers
|
|
1286
|
-
}
|
|
1287
|
-
};
|
|
1288
|
-
|
|
1289
|
-
webpeers[callTopics['receiveAudioTopic']] = new KurentoUtils.WebRtcPeer.WebRtcPeerRecvonly(receiveAudioOptions, function (err) {
|
|
1290
|
-
if (err) {
|
|
1291
|
-
console.error("[start/WebRtcAudioPeerReceiveOnly] Error: " + explainUserMediaError(err, 'audio'));
|
|
1292
|
-
return;
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
watchRTCPeerConnection(callTopics['receiveAudioTopic']);
|
|
1296
|
-
|
|
1297
|
-
webpeers[callTopics['receiveAudioTopic']].generateOffer((err, sdpOffer) => {
|
|
1298
|
-
if (err) {
|
|
1299
|
-
console.error("[start/WebRtcAudioPeerReceiveOnly/generateOffer] " + err);
|
|
1300
|
-
return;
|
|
1301
|
-
}
|
|
1302
|
-
sendCallMessage({
|
|
1303
|
-
id: 'RECIVE_SDP_OFFER',
|
|
1304
|
-
sdpOffer: sdpOffer,
|
|
1305
|
-
useComedia: false,
|
|
1306
|
-
useSrtp: false,
|
|
1307
|
-
mediaType: 1,
|
|
1308
|
-
topic: callTopics['receiveAudioTopic']
|
|
1309
|
-
});
|
|
1310
|
-
});
|
|
1311
|
-
});
|
|
1312
|
-
}
|
|
1313
1132
|
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
if (webpeersMetadata[callTopics['sendAudioTopic']].interval !== null) {
|
|
1321
|
-
clearInterval(webpeersMetadata[callTopics['sendAudioTopic']].interval);
|
|
1322
|
-
}
|
|
1323
|
-
webpeersMetadata[callTopics['sendAudioTopic']].interval = setInterval(function () {
|
|
1324
|
-
if (webpeersMetadata[callTopics['sendAudioTopic']].sdpAnswerReceived === true) {
|
|
1325
|
-
webpeersMetadata[callTopics['sendAudioTopic']].sdpAnswerReceived = false;
|
|
1326
|
-
clearInterval(webpeersMetadata[callTopics['sendAudioTopic']].interval);
|
|
1327
|
-
sendCallMessage({
|
|
1328
|
-
id: 'ADD_ICE_CANDIDATE',
|
|
1329
|
-
topic: callTopics['sendAudioTopic'],
|
|
1330
|
-
candidateDto: candidate,
|
|
1331
|
-
})
|
|
1332
|
-
}
|
|
1333
|
-
}, 500, {candidate: candidate});
|
|
1334
|
-
},
|
|
1335
|
-
configuration: {
|
|
1336
|
-
iceServers: turnServers
|
|
1337
|
-
}
|
|
1338
|
-
};
|
|
1339
|
-
|
|
1340
|
-
setTimeout(function () {
|
|
1341
|
-
webpeers[callTopics['sendAudioTopic']] = new KurentoUtils.WebRtcPeer.WebRtcPeerSendonly(sendAudioOptions, function (err) {
|
|
1342
|
-
if (err) {
|
|
1343
|
-
sendCallSocketError("[start/WebRtcAudioPeerSendOnly] Error: " + explainUserMediaError(err, 'audio'));
|
|
1344
|
-
//callStop();
|
|
1345
|
-
return;
|
|
1346
|
-
}
|
|
1347
|
-
watchRTCPeerConnection(callTopics['sendAudioTopic']);
|
|
1348
|
-
startMedia(uiRemoteMedias[callTopics['sendAudioTopic']]);
|
|
1349
|
-
|
|
1350
|
-
webpeers[callTopics['sendAudioTopic']].generateOffer((err, sdpOffer) => {
|
|
1351
|
-
if (err) {
|
|
1352
|
-
sendCallSocketError("[start/WebRtcAudioPeerSendOnly/generateOffer] Error: " + err);
|
|
1353
|
-
//callStop();
|
|
1354
|
-
return;
|
|
1355
|
-
}
|
|
1356
|
-
sendCallMessage({
|
|
1357
|
-
id: 'SEND_SDP_OFFER',
|
|
1358
|
-
topic: callTopics['sendAudioTopic'],
|
|
1359
|
-
sdpOffer: sdpOffer,
|
|
1360
|
-
mediaType: 1
|
|
1361
|
-
});
|
|
1362
|
-
});
|
|
1133
|
+
if (user.peers[topic].peerConnection.connectionState === "failed") {
|
|
1134
|
+
chatEvents.fireEvent('callEvents', {
|
|
1135
|
+
type: 'CALL_STATUS',
|
|
1136
|
+
errorCode: 7000,
|
|
1137
|
+
errorMessage: `Call Peer (${topic}) has failed!`,
|
|
1138
|
+
errorInfo: user.peers[topic]
|
|
1363
1139
|
});
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
/!*setTimeout(function () {
|
|
1369
|
-
for (var peer in webpeers) {
|
|
1370
|
-
console.log("set callback on webpeers: ", peer);
|
|
1371
|
-
if (webpeers[peer]) {
|
|
1372
|
-
webpeers[peer].peerConnection.onconnectionstatechange = function () {
|
|
1373
|
-
console.log("on connection state change, ", "peer: ", peer, "peerConnection.connectionState: ", webpeers[peer].peerConnection.connectionState);
|
|
1374
|
-
if (webpeers[peer].peerConnection.connectionState == 'disconnected') {
|
|
1375
|
-
console.log(peer, 'peerConnection.onconnectionstatechange: disconnected');
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
webpeers[peer].peerConnection.oniceconnectionstatechange = function () {
|
|
1380
|
-
console.log("on ice connection state change: ", peer, webpeers[peer].peerConnection.connectionState);
|
|
1381
|
-
if (webpeers[peer].peerConnection.iceConnectionState == 'disconnected') {
|
|
1382
|
-
console.log( peer , '>>>>>>>>>>>>> disconnected');
|
|
1383
|
-
chatEvents.fireEvent('callEvents', {
|
|
1384
|
-
type: 'CALL_STATUS',
|
|
1385
|
-
errorCode: 7000,
|
|
1386
|
-
errorMessage: `Call Peer (${peer}) is disconnected!`,
|
|
1387
|
-
errorInfo: webpeers[peer]
|
|
1388
|
-
});
|
|
1389
|
-
|
|
1390
|
-
setTimeout(function () {
|
|
1391
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
1392
|
-
}, 2000);
|
|
1393
|
-
|
|
1394
|
-
setTimeout(function () {
|
|
1395
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
1396
|
-
}, 6000);
|
|
1397
|
-
|
|
1398
|
-
alert('Internet connection failed, Reconnect your call');
|
|
1399
|
-
/!*shouldReconnectCallTimeout && clearTimeout(shouldReconnectCallTimeout);
|
|
1400
|
-
shouldReconnectCallTimeout = setTimeout(function () {
|
|
1401
|
-
shouldReconnectCall();
|
|
1402
|
-
}, 7000);*!/
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
if (webpeers[peer].peerConnection.iceConnectionState === "failed") {
|
|
1406
|
-
chatEvents.fireEvent('callEvents', {
|
|
1407
|
-
type: 'CALL_STATUS',
|
|
1408
|
-
errorCode: 7000,
|
|
1409
|
-
errorMessage: `Call Peer (${peer}) has failed!`,
|
|
1410
|
-
errorInfo: webpeers[peer]
|
|
1411
|
-
});
|
|
1140
|
+
// setTimeout(function () {
|
|
1141
|
+
if(chatMessaging.chatState) {
|
|
1142
|
+
callController.shouldReconnectTopic(userId, topic, mediaType, direction);
|
|
1412
1143
|
}
|
|
1144
|
+
// }, 7000);
|
|
1413
1145
|
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
type: 'CALL_STATUS',
|
|
1417
|
-
errorCode: 7000,
|
|
1418
|
-
errorMessage: `Call Peer (${peer}) has connected!`,
|
|
1419
|
-
errorInfo: webpeers[peer]
|
|
1420
|
-
});
|
|
1421
|
-
|
|
1422
|
-
setTimeout(function () {
|
|
1423
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
1424
|
-
}, 2000);
|
|
1146
|
+
callController.removeConnectionQualityInterval(userId, topic);
|
|
1147
|
+
}
|
|
1425
1148
|
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1149
|
+
if(user.peers[topic].peerConnection.connectionState === 'connected') {
|
|
1150
|
+
if(mediaType === 'video' && direction === 'send') {
|
|
1151
|
+
user.topicMetaData[topic].connectionQualityInterval = setInterval(function() {
|
|
1152
|
+
callController.checkConnectionQuality(userId, topic, mediaType, direction)
|
|
1153
|
+
}, 1000);
|
|
1430
1154
|
}
|
|
1431
1155
|
}
|
|
1432
1156
|
}
|
|
1433
|
-
}, 6000);*!/
|
|
1434
|
-
|
|
1435
|
-
setTimeout(function () {
|
|
1436
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
1437
|
-
}, 4000);
|
|
1438
|
-
setTimeout(function () {
|
|
1439
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
1440
|
-
}, 8000);
|
|
1441
|
-
setTimeout(function () {
|
|
1442
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
1443
|
-
}, 12000);
|
|
1444
|
-
setTimeout(function () {
|
|
1445
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
1446
|
-
}, 20000);
|
|
1447
|
-
},
|
|
1448
1157
|
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
webpeers[topic].peerConnection.onconnectionstatechange = function () {
|
|
1453
|
-
console.log("on connection state change, ", "peer: ", topic, "peerConnection.connectionState: ", webpeers[topic].peerConnection.connectionState);
|
|
1454
|
-
if (webpeers[topic].peerConnection.connectionState == 'disconnected') {
|
|
1455
|
-
console.log(topic, 'peerConnection.onconnectionstatechange: disconnected');
|
|
1158
|
+
user.peers[topic].peerConnection.oniceconnectionstatechange = function () {
|
|
1159
|
+
if(!user || !user.peers || !user.peers[topic]) {
|
|
1160
|
+
return; //avoid log errors
|
|
1456
1161
|
}
|
|
1457
|
-
}
|
|
1458
1162
|
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
if (webpeers[topic].peerConnection.iceConnectionState == 'disconnected') {
|
|
1462
|
-
console.log(topic, 'peerConnection.oniceconnectionstatechange disconnected');
|
|
1163
|
+
consoleLogging && console.log("[SDK][oniceconnectionstatechange] ", "peer: ", topic, " peerConnection.connectionState: ", user.peers[topic].peerConnection.iceConnectionState);
|
|
1164
|
+
if (user.peers[topic].peerConnection.iceConnectionState === 'disconnected') {
|
|
1463
1165
|
chatEvents.fireEvent('callEvents', {
|
|
1464
1166
|
type: 'CALL_STATUS',
|
|
1465
1167
|
errorCode: 7000,
|
|
1466
1168
|
errorMessage: `Call Peer (${topic}) is disconnected!`,
|
|
1467
|
-
errorInfo:
|
|
1169
|
+
errorInfo: user.peers[topic]
|
|
1468
1170
|
});
|
|
1469
1171
|
|
|
1470
|
-
|
|
1471
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
1472
|
-
}, 2000);*!/
|
|
1473
|
-
|
|
1474
|
-
/!*setTimeout(function () {
|
|
1475
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
1476
|
-
}, 6000);*!/
|
|
1477
|
-
|
|
1478
|
-
console.log('Internet connection failed, Reconnect your call, topic:', topic);
|
|
1479
|
-
//shouldReconnectCallTimeout && clearTimeout(shouldReconnectCallTimeout);
|
|
1480
|
-
/!*shouldReconnectCallTimeout = setTimeout(function () {
|
|
1481
|
-
shouldReconnectCall(topic);
|
|
1482
|
-
}, 7000);*!/
|
|
1172
|
+
consoleLogging && console.log('[SDK][oniceconnectionstatechange]:[disconnected] Internet connection failed, Reconnect your call, topic:', topic);
|
|
1483
1173
|
}
|
|
1484
1174
|
|
|
1485
|
-
if (
|
|
1175
|
+
if (user.peers[topic].peerConnection.iceConnectionState === "failed") {
|
|
1486
1176
|
chatEvents.fireEvent('callEvents', {
|
|
1487
1177
|
type: 'CALL_STATUS',
|
|
1488
1178
|
errorCode: 7000,
|
|
1489
1179
|
errorMessage: `Call Peer (${topic}) has failed!`,
|
|
1490
|
-
errorInfo:
|
|
1180
|
+
errorInfo: user.peers[topic]
|
|
1491
1181
|
});
|
|
1492
|
-
|
|
1493
1182
|
if(chatMessaging.chatState) {
|
|
1494
|
-
|
|
1495
|
-
} else {
|
|
1496
|
-
setTimeout(function () {
|
|
1497
|
-
if(chatMessaging.chatState) {
|
|
1498
|
-
shouldReconnectCall(topic);
|
|
1499
|
-
}
|
|
1500
|
-
}, 5000);
|
|
1183
|
+
callController.shouldReconnectTopic(userId, topic, mediaType, direction);
|
|
1501
1184
|
}
|
|
1185
|
+
// } else {
|
|
1186
|
+
// setTimeout(function () {
|
|
1187
|
+
// if(chatMessaging.chatState) {
|
|
1188
|
+
// callController.shouldReconnectTopic(userId, topic, mediaType, direction);
|
|
1189
|
+
// }
|
|
1190
|
+
// }, 7000);
|
|
1191
|
+
// }
|
|
1502
1192
|
}
|
|
1503
1193
|
|
|
1504
|
-
if (
|
|
1194
|
+
if (user.peers[topic].peerConnection.iceConnectionState === "connected") {
|
|
1505
1195
|
callRequestController.callEstablishedInMySide = true;
|
|
1506
1196
|
chatEvents.fireEvent('callEvents', {
|
|
1507
1197
|
type: 'CALL_STATUS',
|
|
1508
1198
|
errorCode: 7000,
|
|
1509
1199
|
errorMessage: `Call Peer (${topic}) has connected!`,
|
|
1510
|
-
errorInfo:
|
|
1200
|
+
errorInfo: user.peers[topic]
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
},
|
|
1205
|
+
shouldReconnectTopic: function (userId, topic, mediaType, direction) {
|
|
1206
|
+
var callController = this, iceConnectionState = callUsers[userId].peers[topic].peerConnection.iceConnectionState;
|
|
1207
|
+
if (currentCallParams && Object.keys(currentCallParams).length) {
|
|
1208
|
+
if (callUsers[userId]
|
|
1209
|
+
&& callUsers[userId].peers[topic]
|
|
1210
|
+
&& iceConnectionState != 'connected') {
|
|
1211
|
+
chatEvents.fireEvent('callEvents', {
|
|
1212
|
+
type: 'CALL_STATUS',
|
|
1213
|
+
errorCode: 7000,
|
|
1214
|
+
errorMessage: `Call Peer (${topic}) is not in connected state, Restarting call in progress ...!`,
|
|
1215
|
+
errorInfo: callUsers[userId].peers[topic]
|
|
1216
|
+
});
|
|
1217
|
+
|
|
1218
|
+
sendCallMessage({
|
|
1219
|
+
id: 'STOP',
|
|
1220
|
+
topic: topic
|
|
1221
|
+
}, function (result) {
|
|
1222
|
+
if (result.done === 'TRUE') {
|
|
1223
|
+
callController.removeTopic(userId, topic);
|
|
1224
|
+
callController.createTopic(userId, topic, mediaType, direction, userId === 'screenShare');
|
|
1225
|
+
} else if (result.done === 'SKIP') {
|
|
1226
|
+
callController.removeTopic(userId, topic);
|
|
1227
|
+
callController.createTopic(userId, topic, mediaType, direction, userId === 'screenShare');
|
|
1228
|
+
//generateAndSendSdpOffers(currentCallParams, [topicName]);
|
|
1229
|
+
} else {
|
|
1230
|
+
consoleLogging && console.log('STOP topic faced a problem', result);
|
|
1231
|
+
endCall({
|
|
1232
|
+
callId: currentCallId
|
|
1233
|
+
});
|
|
1234
|
+
callStop();
|
|
1235
|
+
}
|
|
1511
1236
|
});
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
},
|
|
1240
|
+
maybeReconnectAllTopics: function (){
|
|
1241
|
+
if(!callUsers || !Object.keys(callUsers).length || !callRequestController.callEstablishedInMySide)
|
|
1242
|
+
return;
|
|
1512
1243
|
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1244
|
+
for(var i in callUsers) {
|
|
1245
|
+
var videoTopic = callUsers[i].videoTopicName, audioTopic = callUsers[i].audioTopicName;
|
|
1246
|
+
if(callUsers[i] && callUsers[i].peers[videoTopic] && callUsers[i].peers[videoTopic].peerConnection.connectionState === 'failed'){
|
|
1247
|
+
this.shouldReconnectTopic(i, videoTopic, 'video', callUsers[i].direction)
|
|
1248
|
+
}
|
|
1249
|
+
if(callUsers[i] && callUsers[i].peers[audioTopic] && callUsers[i].peers[videoTopic].peerConnection.connectionState === 'failed'){
|
|
1250
|
+
this.shouldReconnectTopic(i, audioTopic, 'audio', callUsers[i].direction)
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
},
|
|
1254
|
+
removeConnectionQualityInterval: function (userId, topic) {
|
|
1255
|
+
callUsers[userId].topicMetaData[topic]['poorConnectionCount'] = 0;
|
|
1256
|
+
clearInterval(callUsers[userId].topicMetaData[topic]['connectionQualityInterval']);
|
|
1257
|
+
},
|
|
1258
|
+
removeStreamFromWebRTC : function (userId, topic) {
|
|
1259
|
+
if(callUsers[userId].htmlElements[topic]){
|
|
1260
|
+
const stream = callUsers[userId].htmlElements[topic].srcObject;
|
|
1261
|
+
if (!!stream) {
|
|
1262
|
+
const tracks = stream.getTracks();
|
|
1263
|
+
|
|
1264
|
+
if (!!tracks) {
|
|
1265
|
+
tracks.forEach(function (track) {
|
|
1266
|
+
track.stop();
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1516
1269
|
|
|
1517
|
-
|
|
1518
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
1519
|
-
}, 6000);*!/
|
|
1270
|
+
callUsers[userId].htmlElements[topic].srcObject = null;
|
|
1520
1271
|
}
|
|
1272
|
+
|
|
1273
|
+
callUsers[userId].htmlElements[topic].remove();
|
|
1274
|
+
delete (callUsers[userId].htmlElements[topic]);
|
|
1521
1275
|
}
|
|
1522
|
-
}
|
|
1276
|
+
},
|
|
1277
|
+
addScreenShareToCall: function (direction, shareScreen) {
|
|
1278
|
+
if(direction !== callUsers["screenShare"].direction) {
|
|
1279
|
+
callUsers['screenShare'].direction = direction
|
|
1280
|
+
}
|
|
1281
|
+
var callController = this,
|
|
1282
|
+
screenShare = callUsers["screenShare"];
|
|
1283
|
+
if(!screenShare.peers[screenShare.videoTopicName]) {
|
|
1284
|
+
// Local Video Tag
|
|
1285
|
+
if(!screenShare.htmlElements[screenShare.videoTopicName]) {
|
|
1286
|
+
callStateController.generateHTMLElements('screenShare');
|
|
1287
|
+
}
|
|
1288
|
+
setTimeout(function () {
|
|
1289
|
+
callStateController.appendUserToCallDiv('screenShare');
|
|
1290
|
+
callStateController.createTopic('screenShare', screenShare.videoTopicName, "video", direction, shareScreen);
|
|
1291
|
+
});
|
|
1292
|
+
chatEvents.fireEvent('callEvents', {
|
|
1293
|
+
type: 'CALL_DIVS',
|
|
1294
|
+
result: generateCallUIList()
|
|
1295
|
+
});
|
|
1296
|
+
} else {
|
|
1297
|
+
callStateController.removeTopic('screenShare', screenShare.videoTopicName);
|
|
1298
|
+
callStateController.createTopic('screenShare', screenShare.videoTopicName, "video", direction, shareScreen);
|
|
1299
|
+
startMedia(screenShare.htmlElements[screenShare.videoTopicName])
|
|
1300
|
+
}
|
|
1301
|
+
},
|
|
1302
|
+
removeScreenShareFromCall: function (topic) {
|
|
1303
|
+
var callController = this,
|
|
1304
|
+
screenShare = callUsers["screenShare"];
|
|
1305
|
+
if(screenShare.peers[screenShare.videoTopicName]) {
|
|
1306
|
+
// Local Video Tag
|
|
1307
|
+
|
|
1308
|
+
//removeStreamFromWebRTC(callTopics['screenShare']);
|
|
1309
|
+
callStateController.removeStreamFromWebRTC('screenShare', screenShare.videoTopicName)
|
|
1310
|
+
callStateController.removeTopic('screenShare', screenShare.videoTopicName);
|
|
1311
|
+
chatEvents.fireEvent('callEvents', {
|
|
1312
|
+
type: 'CALL_DIVS',
|
|
1313
|
+
result: generateCallUIList()
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
},
|
|
1317
|
+
removeAllCallParticipants: function () {
|
|
1318
|
+
for (var i in callUsers) {
|
|
1319
|
+
var user = callUsers[i];
|
|
1320
|
+
if (user) {
|
|
1321
|
+
if(user.videoTopicName && user.peers[user.videoTopicName]) {
|
|
1322
|
+
callStateController.removeConnectionQualityInterval(i, user.videoTopicName);
|
|
1323
|
+
callStateController.removeStreamFromWebRTC(i, user.videoTopicName);
|
|
1324
|
+
callUsers[i].peers[user.videoTopicName].dispose();
|
|
1325
|
+
delete callUsers[i].peers[user.videoTopicName];
|
|
1326
|
+
|
|
1327
|
+
}
|
|
1328
|
+
if(user.audioTopicName && user.peers[user.audioTopicName]) {
|
|
1329
|
+
callStateController.removeConnectionQualityInterval(i, user.audioTopicName);
|
|
1330
|
+
callStateController.removeStreamFromWebRTC(i, user.audioTopicName);
|
|
1331
|
+
|
|
1332
|
+
callUsers[i].peers[user.audioTopicName].dispose();
|
|
1333
|
+
delete callUsers[i].peers[user.audioTopicName];
|
|
1334
|
+
}
|
|
1335
|
+
setTimeout(function (){
|
|
1336
|
+
if(callUsers[i]){
|
|
1337
|
+
callUsers[i].peers = {};
|
|
1338
|
+
callUsers[i].topicMetaData = {};
|
|
1339
|
+
callUsers[i].htmlElements = {};
|
|
1340
|
+
callUsers[i] = null;
|
|
1341
|
+
}
|
|
1342
|
+
}, 200);
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
},
|
|
1346
|
+
removeFromCallUI: function (topic) {
|
|
1347
|
+
var videoElement = 'Vi-' + topic,
|
|
1348
|
+
audioElement = 'Vo-' + topic,
|
|
1349
|
+
userId = this.findUserIdByTopic(videoElement);
|
|
1350
|
+
|
|
1351
|
+
if (topic.length > 0 && callUsers[userId].htmlElements[videoElement]) {
|
|
1352
|
+
this.removeStreamFromWebRTC(userId,videoElement);
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
if (topic.length > 0 && callUsers[userId].htmlElements[videoElement]) {
|
|
1356
|
+
this.removeStreamFromWebRTC(userId, audioElement);
|
|
1357
|
+
}
|
|
1358
|
+
},
|
|
1359
|
+
findUserIdByTopic: function (topic) {
|
|
1360
|
+
for(var i in callUsers) {
|
|
1361
|
+
if (callUsers[i].videoTopicName === topic || callUsers[i].audioTopicName === topic) {
|
|
1362
|
+
//peer = callUsers[i].peers[jsonMessage.topic];
|
|
1363
|
+
return i;
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
},
|
|
1367
|
+
|
|
1368
|
+
setMediaBitrates: function (sdp) {
|
|
1369
|
+
return this.setMediaBitrate(this.setMediaBitrate(sdp, "video", 400), "audio", 50);
|
|
1370
|
+
},
|
|
1371
|
+
setMediaBitrate: function (sdp, media, bitrate) {
|
|
1372
|
+
var lines = sdp.split("\n");
|
|
1373
|
+
var line = -1;
|
|
1374
|
+
for (var i = 0; i < lines.length; i++) {
|
|
1375
|
+
if (lines[i].indexOf("m=" + media) === 0) {
|
|
1376
|
+
line = i;
|
|
1377
|
+
break;
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
if (line === -1) {
|
|
1381
|
+
consoleLogging && console.debug("[SDK][setMediaBitrate] Could not find the m line for", media);
|
|
1382
|
+
return sdp;
|
|
1383
|
+
}
|
|
1384
|
+
consoleLogging && console.debug("[SDK][setMediaBitrate] Found the m line for", media, "at line", line);
|
|
1523
1385
|
|
|
1386
|
+
// Pass the m line
|
|
1387
|
+
line++;
|
|
1388
|
+
|
|
1389
|
+
// Skip i and c lines
|
|
1390
|
+
/* while (lines[line].indexOf("i=") === 0 || lines[line].indexOf("c=") === 0) {
|
|
1391
|
+
line++;
|
|
1392
|
+
}*/
|
|
1393
|
+
|
|
1394
|
+
// If we're on a b line, replace it
|
|
1395
|
+
if (lines[line].indexOf("b") === 0) {
|
|
1396
|
+
consoleLogging && console.debug("[SDK][setMediaBitrate] Replaced b line at line", line);
|
|
1397
|
+
lines[line] = "b=AS:" + bitrate;
|
|
1398
|
+
return lines.join("\n");
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
// Add a new b line
|
|
1402
|
+
consoleLogging && console.debug("[SDK][setMediaBitrate] Adding new b line before line", line);
|
|
1403
|
+
var newLines = lines.slice(0, line);
|
|
1404
|
+
newLines.push("b=AS:" + bitrate + "\r");
|
|
1405
|
+
newLines = newLines.concat(lines.slice(line, lines.length));
|
|
1406
|
+
consoleLogging && console.debug("[SDK][setMediaBitrate] output: ", newLines.join("\n"));
|
|
1407
|
+
return newLines.join("\n")
|
|
1408
|
+
}
|
|
1524
1409
|
},
|
|
1525
|
-
*/
|
|
1526
1410
|
|
|
1527
1411
|
sendCallSocketError = function (message) {
|
|
1528
1412
|
chatEvents.fireEvent('callEvents', {
|
|
@@ -1602,19 +1486,19 @@
|
|
|
1602
1486
|
},
|
|
1603
1487
|
|
|
1604
1488
|
startMedia = function (media) {
|
|
1605
|
-
consoleLogging && console.log("startMedia
|
|
1489
|
+
consoleLogging && console.log("[SDK][startMedia] called with: ", media);
|
|
1606
1490
|
media.play().catch((err) => {
|
|
1607
1491
|
if (err.name === 'NotAllowedError') {
|
|
1608
1492
|
chatEvents.fireEvent('callEvents', {
|
|
1609
1493
|
type: 'CALL_ERROR',
|
|
1610
1494
|
code: 7000,
|
|
1611
|
-
message: "[
|
|
1495
|
+
message: "[startMedia] Browser doesn't allow playing media: " + err
|
|
1612
1496
|
});
|
|
1613
1497
|
} else {
|
|
1614
1498
|
chatEvents.fireEvent('callEvents', {
|
|
1615
1499
|
type: 'CALL_ERROR',
|
|
1616
1500
|
code: 7000,
|
|
1617
|
-
message: "[
|
|
1501
|
+
message: "[startMedia] Error in media.play(): " + err
|
|
1618
1502
|
});
|
|
1619
1503
|
}
|
|
1620
1504
|
});
|
|
@@ -1622,9 +1506,9 @@
|
|
|
1622
1506
|
|
|
1623
1507
|
restartMedia = function (videoTopicParam) {
|
|
1624
1508
|
if (currentCallParams && Object.keys(currentCallParams).length) {
|
|
1625
|
-
consoleLogging && console.log('Sending Key Frame ...');
|
|
1509
|
+
consoleLogging && console.log('[SDK] Sending Key Frame ...');
|
|
1626
1510
|
|
|
1627
|
-
var videoTopic = !!videoTopicParam ? videoTopicParam : callTopics['sendVideoTopic'];
|
|
1511
|
+
var videoTopic = !!videoTopicParam ? videoTopicParam : callUsers[chatMessaging.userInfo.id].videoTopicName;//callTopics['sendVideoTopic'];
|
|
1628
1512
|
let videoElement = document.getElementById(`uiRemoteVideo-${videoTopic}`);
|
|
1629
1513
|
|
|
1630
1514
|
if (videoElement) {
|
|
@@ -1678,19 +1562,20 @@
|
|
|
1678
1562
|
},
|
|
1679
1563
|
|
|
1680
1564
|
handleProcessSdpAnswer = function (jsonMessage) {
|
|
1681
|
-
|
|
1565
|
+
var userId = callStateController.findUserIdByTopic(jsonMessage.topic),
|
|
1566
|
+
peer = callUsers[userId].peers[jsonMessage.topic];
|
|
1682
1567
|
|
|
1683
|
-
if (
|
|
1568
|
+
if (peer == null) {
|
|
1684
1569
|
chatEvents.fireEvent('callEvents', {
|
|
1685
1570
|
type: 'CALL_ERROR',
|
|
1686
1571
|
code: 7000,
|
|
1687
1572
|
message: "[handleProcessSdpAnswer] Skip, no WebRTC Peer",
|
|
1688
|
-
error:
|
|
1573
|
+
error: peer
|
|
1689
1574
|
});
|
|
1690
1575
|
return;
|
|
1691
1576
|
}
|
|
1692
1577
|
|
|
1693
|
-
|
|
1578
|
+
peer.processAnswer(jsonMessage.sdpAnswer, (err) => {
|
|
1694
1579
|
if (err) {
|
|
1695
1580
|
sendCallSocketError("[handleProcessSdpAnswer] Error: " + err);
|
|
1696
1581
|
|
|
@@ -1703,26 +1588,29 @@
|
|
|
1703
1588
|
return;
|
|
1704
1589
|
}
|
|
1705
1590
|
|
|
1706
|
-
if (
|
|
1707
|
-
|
|
1591
|
+
if (callUsers[userId].topicMetaData[jsonMessage.topic].interval !== null) {
|
|
1592
|
+
callUsers[userId].topicMetaData[jsonMessage.topic].sdpAnswerReceived = true;
|
|
1708
1593
|
}
|
|
1709
|
-
|
|
1594
|
+
consoleLogging && console.log("[SDK][handleProcessSdpAnswer]", jsonMessage, jsonMessage.topic)
|
|
1595
|
+
startMedia(callUsers[userId].htmlElements[jsonMessage.topic]);
|
|
1710
1596
|
});
|
|
1711
1597
|
},
|
|
1712
1598
|
|
|
1713
1599
|
handleAddIceCandidate = function (jsonMessage) {
|
|
1714
|
-
|
|
1715
|
-
|
|
1600
|
+
var userId = callStateController.findUserIdByTopic(jsonMessage.topic);
|
|
1601
|
+
|
|
1602
|
+
let peer = callUsers[userId].peers[jsonMessage.topic];
|
|
1603
|
+
if (peer == null) {
|
|
1716
1604
|
chatEvents.fireEvent('callEvents', {
|
|
1717
1605
|
type: 'CALL_ERROR',
|
|
1718
1606
|
code: 7000,
|
|
1719
1607
|
message: "[handleAddIceCandidate] Skip, no WebRTC Peer",
|
|
1720
|
-
error: JSON.stringify(
|
|
1608
|
+
error: JSON.stringify(peer)
|
|
1721
1609
|
});
|
|
1722
1610
|
return;
|
|
1723
1611
|
}
|
|
1724
1612
|
|
|
1725
|
-
|
|
1613
|
+
peer.addIceCandidate(jsonMessage.candidate, (err) => {
|
|
1726
1614
|
if (err) {
|
|
1727
1615
|
console.error("[handleAddIceCandidate] " + err);
|
|
1728
1616
|
|
|
@@ -1761,19 +1649,7 @@
|
|
|
1761
1649
|
},
|
|
1762
1650
|
|
|
1763
1651
|
callStop = function () {
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
for (var media in uiRemoteMedias) {
|
|
1767
|
-
removeStreamFromWebRTC(media);
|
|
1768
|
-
}
|
|
1769
|
-
|
|
1770
|
-
for (var i in webpeers) {
|
|
1771
|
-
if (webpeers[i]) {
|
|
1772
|
-
callStateController.removeConnectionQualityInterval(i);
|
|
1773
|
-
webpeers[i].dispose();
|
|
1774
|
-
webpeers[i] = null;
|
|
1775
|
-
}
|
|
1776
|
-
}
|
|
1652
|
+
callStateController.removeAllCallParticipants();
|
|
1777
1653
|
|
|
1778
1654
|
if (callStopQueue.callStarted) {
|
|
1779
1655
|
sendCallMessage({
|
|
@@ -1782,6 +1658,7 @@
|
|
|
1782
1658
|
callStopQueue.callStarted = false;
|
|
1783
1659
|
}
|
|
1784
1660
|
|
|
1661
|
+
callRequestController.cameraPaused = false;
|
|
1785
1662
|
callRequestController.callEstablishedInMySide = false;
|
|
1786
1663
|
callRequestController.callRequestReceived = false;
|
|
1787
1664
|
currentCallParams = {};
|
|
@@ -1847,16 +1724,16 @@
|
|
|
1847
1724
|
|
|
1848
1725
|
case 'GET_KEY_FRAME':
|
|
1849
1726
|
setTimeout(function () {
|
|
1850
|
-
restartMedia(
|
|
1727
|
+
restartMedia(callUsers[chatMessaging.userInfo.id].videoTopicName);
|
|
1851
1728
|
}, 2000);
|
|
1852
1729
|
setTimeout(function () {
|
|
1853
|
-
restartMedia(
|
|
1730
|
+
restartMedia(callUsers[chatMessaging.userInfo.id].videoTopicName);
|
|
1854
1731
|
}, 4000);
|
|
1855
1732
|
setTimeout(function () {
|
|
1856
|
-
restartMedia(
|
|
1733
|
+
restartMedia(callUsers[chatMessaging.userInfo.id].videoTopicName);
|
|
1857
1734
|
}, 8000);
|
|
1858
1735
|
setTimeout(function () {
|
|
1859
|
-
restartMedia(
|
|
1736
|
+
restartMedia(callUsers[chatMessaging.userInfo.id].videoTopicName);
|
|
1860
1737
|
}, 12000);
|
|
1861
1738
|
break;
|
|
1862
1739
|
|
|
@@ -1897,7 +1774,7 @@
|
|
|
1897
1774
|
break;
|
|
1898
1775
|
|
|
1899
1776
|
default:
|
|
1900
|
-
console.warn("[onmessage] Invalid message, id: " + jsonMessage.id, jsonMessage);
|
|
1777
|
+
console.warn("[SDK][onmessage] Invalid message, id: " + jsonMessage.id, jsonMessage);
|
|
1901
1778
|
if (jsonMessage.match(/NOT CREATE SESSION/g)) {
|
|
1902
1779
|
if (currentCallParams && Object.keys(currentCallParams)) {
|
|
1903
1780
|
//handleCallSocketOpen(currentCallParams);
|
|
@@ -1909,7 +1786,11 @@
|
|
|
1909
1786
|
};
|
|
1910
1787
|
|
|
1911
1788
|
this.asyncInitialized = function (async) {
|
|
1912
|
-
asyncClient = async
|
|
1789
|
+
asyncClient = async;
|
|
1790
|
+
|
|
1791
|
+
asyncClient.on('asyncReady', function (){
|
|
1792
|
+
callStateController.maybeReconnectAllTopics();
|
|
1793
|
+
})
|
|
1913
1794
|
};
|
|
1914
1795
|
|
|
1915
1796
|
this.handleChatMessages = function(type, chatMessageVOTypes, messageContent, contentCount, threadId, uniqueId) {
|
|
@@ -2013,13 +1894,7 @@
|
|
|
2013
1894
|
result: messageContent
|
|
2014
1895
|
});
|
|
2015
1896
|
|
|
2016
|
-
|
|
2017
|
-
if (webpeers[peer]) {
|
|
2018
|
-
webpeers[peer].dispose();
|
|
2019
|
-
delete webpeers[peer];
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
webpeers = {};
|
|
1897
|
+
//callStateController.removeAllCallParticipants();
|
|
2023
1898
|
|
|
2024
1899
|
if (typeof messageContent === 'object'
|
|
2025
1900
|
&& messageContent.hasOwnProperty('chatDataDto')
|
|
@@ -2032,8 +1907,10 @@
|
|
|
2032
1907
|
mute: messageContent.clientDTO.mute,
|
|
2033
1908
|
sendingTopic: messageContent.clientDTO.topicSend,
|
|
2034
1909
|
receiveTopic: messageContent.clientDTO.topicReceive,
|
|
1910
|
+
screenShare: messageContent.chatDataDto.screenShare,
|
|
2035
1911
|
brokerAddress: messageContent.chatDataDto.brokerAddressWeb,
|
|
2036
1912
|
turnAddress: messageContent.chatDataDto.turnAddress,
|
|
1913
|
+
clientsList: messageContent.otherClientDtoList
|
|
2037
1914
|
}, function (callDivs) {
|
|
2038
1915
|
chatEvents.fireEvent('callEvents', {
|
|
2039
1916
|
type: 'CALL_DIVS',
|
|
@@ -2171,7 +2048,8 @@
|
|
|
2171
2048
|
});
|
|
2172
2049
|
|
|
2173
2050
|
if (!!messageContent[0].sendTopic) {
|
|
2174
|
-
removeFromCallUI(messageContent[0].sendTopic);
|
|
2051
|
+
//removeFromCallUI(messageContent[0].sendTopic);
|
|
2052
|
+
callStateController.removeFromCallUI(messageContent[0].sendTopic)
|
|
2175
2053
|
}
|
|
2176
2054
|
|
|
2177
2055
|
break;
|
|
@@ -2242,6 +2120,19 @@
|
|
|
2242
2120
|
case chatMessageVOTypes.MUTE_CALL_PARTICIPANT:
|
|
2243
2121
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
2244
2122
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
2123
|
+
} else {
|
|
2124
|
+
if(Array.isArray(messageContent)){
|
|
2125
|
+
for(var i in messageContent) {
|
|
2126
|
+
if(callUsers[messageContent[i].userId]) {
|
|
2127
|
+
callUsers[messageContent[i].userId].mute = true;
|
|
2128
|
+
|
|
2129
|
+
var user = callUsers[messageContent[i].userId];
|
|
2130
|
+
clearInterval(callUsers[messageContent[i].userId].topicMetaData[user.audioTopicName].interval)
|
|
2131
|
+
callStateController.removeTopic(messageContent[i].userId, user.audioTopicName);
|
|
2132
|
+
callStateController.removeStreamFromWebRTC(messageContent[i].userId, user.audioTopicName);
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2245
2136
|
}
|
|
2246
2137
|
|
|
2247
2138
|
chatEvents.fireEvent('callEvents', {
|
|
@@ -2257,6 +2148,22 @@
|
|
|
2257
2148
|
case chatMessageVOTypes.UNMUTE_CALL_PARTICIPANT:
|
|
2258
2149
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
2259
2150
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
2151
|
+
} else {
|
|
2152
|
+
if(Array.isArray(messageContent)) {
|
|
2153
|
+
for(var i in messageContent) {
|
|
2154
|
+
if(callUsers[messageContent[i].userId]) {
|
|
2155
|
+
callUsers[messageContent[i].userId].mute = false;
|
|
2156
|
+
callUsers[messageContent[i].userId].audioTopicName = 'Vo-' + messageContent[i].sendTopic;
|
|
2157
|
+
|
|
2158
|
+
var user = callUsers[messageContent[i].userId];
|
|
2159
|
+
callStateController.appendUserToCallDiv(messageContent[i].userId, callStateController.generateHTMLElements(messageContent[i].userId));
|
|
2160
|
+
setTimeout(function () {
|
|
2161
|
+
callStateController.createTopic(messageContent[i].userId, user.audioTopicName, 'audio', 'receive');
|
|
2162
|
+
|
|
2163
|
+
})
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2260
2167
|
}
|
|
2261
2168
|
|
|
2262
2169
|
chatEvents.fireEvent('callEvents', {
|
|
@@ -2297,8 +2204,30 @@
|
|
|
2297
2204
|
case chatMessageVOTypes.TURN_ON_VIDEO_CALL:
|
|
2298
2205
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
2299
2206
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
2207
|
+
} else {
|
|
2208
|
+
if(Array.isArray(messageContent)) {
|
|
2209
|
+
for(var i in messageContent) {
|
|
2210
|
+
if(callUsers[messageContent[i].userId]) {
|
|
2211
|
+
callUsers[messageContent[i].userId].video = true;
|
|
2212
|
+
callUsers[messageContent[i].userId].videoTopicName = 'Vi-' + messageContent[i].sendTopic;
|
|
2213
|
+
|
|
2214
|
+
var user = callUsers[messageContent[i].userId];
|
|
2215
|
+
callStateController.appendUserToCallDiv(messageContent[i].userId, callStateController.generateHTMLElements(messageContent[i].userId));
|
|
2216
|
+
setTimeout(function () {
|
|
2217
|
+
callStateController.createTopic(messageContent[i].userId, user.videoTopicName, 'video', 'receive');
|
|
2218
|
+
})
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2300
2222
|
}
|
|
2301
2223
|
|
|
2224
|
+
setTimeout(function () {
|
|
2225
|
+
chatEvents.fireEvent('callEvents', {
|
|
2226
|
+
type: 'CALL_DIVS',
|
|
2227
|
+
result: generateCallUIList()
|
|
2228
|
+
});
|
|
2229
|
+
})
|
|
2230
|
+
|
|
2302
2231
|
chatEvents.fireEvent('callEvents', {
|
|
2303
2232
|
type: 'TURN_ON_VIDEO_CALL',
|
|
2304
2233
|
result: messageContent
|
|
@@ -2312,8 +2241,27 @@
|
|
|
2312
2241
|
case chatMessageVOTypes.TURN_OFF_VIDEO_CALL:
|
|
2313
2242
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
2314
2243
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
2244
|
+
} else {
|
|
2245
|
+
if(Array.isArray(messageContent)){
|
|
2246
|
+
for(var i in messageContent) {
|
|
2247
|
+
if(callUsers[messageContent[i].userId]) {
|
|
2248
|
+
callUsers[messageContent[i].userId].video = false;
|
|
2249
|
+
var user = callUsers[messageContent[i].userId];
|
|
2250
|
+
clearInterval(callUsers[messageContent[i].userId].topicMetaData[user.videoTopicName].interval)
|
|
2251
|
+
callStateController.removeTopic(messageContent[i].userId, user.videoTopicName);
|
|
2252
|
+
callStateController.removeStreamFromWebRTC(messageContent[i].userId, user.videoTopicName);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2315
2256
|
}
|
|
2316
2257
|
|
|
2258
|
+
setTimeout(function () {
|
|
2259
|
+
chatEvents.fireEvent('callEvents', {
|
|
2260
|
+
type: 'CALL_DIVS',
|
|
2261
|
+
result: generateCallUIList()
|
|
2262
|
+
});
|
|
2263
|
+
})
|
|
2264
|
+
|
|
2317
2265
|
chatEvents.fireEvent('callEvents', {
|
|
2318
2266
|
type: 'TURN_OFF_VIDEO_CALL',
|
|
2319
2267
|
result: messageContent
|
|
@@ -2357,8 +2305,20 @@
|
|
|
2357
2305
|
* Type 123 Start Screen Share
|
|
2358
2306
|
*/
|
|
2359
2307
|
case chatMessageVOTypes.START_SCREEN_SHARE:
|
|
2308
|
+
if(!callRequestController.callEstablishedInMySide)
|
|
2309
|
+
return;
|
|
2310
|
+
|
|
2311
|
+
screenShareState.started = true;
|
|
2312
|
+
if(messageContent.screenOwner.id === chatMessaging.userInfo.id) {
|
|
2313
|
+
screenShareState.imOwner = true;
|
|
2314
|
+
} else {
|
|
2315
|
+
screenShareState.imOwner = false;
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2360
2318
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
2361
2319
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
2320
|
+
} else if(!screenShareState.imOwner) {
|
|
2321
|
+
callStateController.addScreenShareToCall("receive", false)
|
|
2362
2322
|
}
|
|
2363
2323
|
|
|
2364
2324
|
chatEvents.fireEvent('callEvents', {
|
|
@@ -2372,8 +2332,14 @@
|
|
|
2372
2332
|
* Type 124 End Screen Share
|
|
2373
2333
|
*/
|
|
2374
2334
|
case chatMessageVOTypes.END_SCREEN_SHARE:
|
|
2335
|
+
screenShareState.imOwner = false;
|
|
2336
|
+
screenShareState.started = false;
|
|
2337
|
+
|
|
2375
2338
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
2376
2339
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
2340
|
+
} else if (!screenShareState.imOwner) {
|
|
2341
|
+
consoleLogging && console.log("[SDK][END_SCREEN_SHARE], im not owner of screen");
|
|
2342
|
+
callStateController.removeScreenShareFromCall();
|
|
2377
2343
|
}
|
|
2378
2344
|
|
|
2379
2345
|
chatEvents.fireEvent('callEvents', {
|
|
@@ -2396,6 +2362,25 @@
|
|
|
2396
2362
|
result: messageContent
|
|
2397
2363
|
});
|
|
2398
2364
|
|
|
2365
|
+
break;
|
|
2366
|
+
/**
|
|
2367
|
+
* Type 126 Destinated Record Call Request
|
|
2368
|
+
*/
|
|
2369
|
+
case chatMessageVOTypes.DESTINATED_RECORD_CALL:
|
|
2370
|
+
if(!callRequestController.callEstablishedInMySide)
|
|
2371
|
+
return;
|
|
2372
|
+
|
|
2373
|
+
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
2374
|
+
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
chatEvents.fireEvent('callEvents', {
|
|
2378
|
+
type: 'START_RECORDING_CALL',
|
|
2379
|
+
result: messageContent
|
|
2380
|
+
});
|
|
2381
|
+
|
|
2382
|
+
restartMedia(callTopics['sendVideoTopic']);
|
|
2383
|
+
|
|
2399
2384
|
break;
|
|
2400
2385
|
}
|
|
2401
2386
|
}
|
|
@@ -2458,6 +2443,7 @@
|
|
|
2458
2443
|
return;
|
|
2459
2444
|
}
|
|
2460
2445
|
|
|
2446
|
+
callRequestController.cameraPaused = (typeof params.cameraPaused === 'boolean') ? params.cameraPaused : false;
|
|
2461
2447
|
callRequestController.callRequestReceived = true;
|
|
2462
2448
|
callRequestController.callEstablishedInMySide = true;
|
|
2463
2449
|
|
|
@@ -2591,6 +2577,8 @@
|
|
|
2591
2577
|
|
|
2592
2578
|
content.videoCall = content.video;
|
|
2593
2579
|
|
|
2580
|
+
callRequestController.cameraPaused = (typeof params.cameraPaused === 'boolean') ? params.cameraPaused : callRequestController.cameraPaused;
|
|
2581
|
+
|
|
2594
2582
|
if (params.clientType && typeof params.clientType === 'string' && callClientTypes[params.clientType.toUpperCase()] > 0) {
|
|
2595
2583
|
content.clientType = callClientTypes[params.clientType.toUpperCase()];
|
|
2596
2584
|
} else {
|
|
@@ -2653,7 +2641,8 @@
|
|
|
2653
2641
|
chatMessageVOType: chatMessageVOTypes.RECORD_CALL,
|
|
2654
2642
|
typeCode: params.typeCode,
|
|
2655
2643
|
pushMsgType: 3,
|
|
2656
|
-
token: token
|
|
2644
|
+
token: token,
|
|
2645
|
+
content: {}
|
|
2657
2646
|
};
|
|
2658
2647
|
|
|
2659
2648
|
if (params) {
|
|
@@ -2666,6 +2655,13 @@
|
|
|
2666
2655
|
});
|
|
2667
2656
|
return;
|
|
2668
2657
|
}
|
|
2658
|
+
|
|
2659
|
+
if(params.destinated === true) {
|
|
2660
|
+
recordCallData.chatMessageVOType = chatMessageVOTypes.DESTINATED_RECORD_CALL;
|
|
2661
|
+
recordCallData.content.recordType = typeof +params.recordType === 'number' ? params.recordType : 1;
|
|
2662
|
+
recordCallData.content.tags = Array.isArray(params.tags) ? params.tags : null;
|
|
2663
|
+
recordCallData.content.threadId = typeof +params.threadId === 'number' ? params.threadId : null;
|
|
2664
|
+
}
|
|
2669
2665
|
} else {
|
|
2670
2666
|
chatEvents.fireEvent('error', {
|
|
2671
2667
|
code: 999,
|
|
@@ -2723,35 +2719,6 @@
|
|
|
2723
2719
|
token: token
|
|
2724
2720
|
};
|
|
2725
2721
|
|
|
2726
|
-
if(!webpeers[callTopics['sendVideoTopic']]) {
|
|
2727
|
-
console.log('[SDK][startScreenShare] No video send connection available');
|
|
2728
|
-
} else {
|
|
2729
|
-
callStateController.removeTopic(callTopics['sendVideoTopic']);
|
|
2730
|
-
callStateController.createTopic(callTopics['sendVideoTopic'], "video", "send", true);
|
|
2731
|
-
/*if (!displayMediaStream) {
|
|
2732
|
-
webpeers[callTopics['sendVideoTopic']].getLocalStream().getTracks()[0].enabled = false;
|
|
2733
|
-
|
|
2734
|
-
navigator.mediaDevices.getDisplayMedia().then(function (result) {
|
|
2735
|
-
console.log("webpeers[callTopics['sendVideoTopic']]", webpeers[callTopics['sendVideoTopic']].getLocalStream());
|
|
2736
|
-
/!*webpeers[callTopics['sendVideoTopic']].replaceTrack(result.getTracks()[0]).then(function (replacedPeer){
|
|
2737
|
-
});*!/
|
|
2738
|
-
uiRemoteMedias[callTopics["sendVideoTopic"]].srcObject = result;
|
|
2739
|
-
var localStream = result;
|
|
2740
|
-
webpeers[callTopics['sendVideoTopic']].getLocalStream().getTracks().forEach(track => {
|
|
2741
|
-
webpeers[callTopics['sendVideoTopic']].remove
|
|
2742
|
-
});
|
|
2743
|
-
setTimeout(function() {
|
|
2744
|
-
localStream.getTracks().forEach(function (track) {
|
|
2745
|
-
webpeers[callTopics['sendVideoTopic']].peerConnection.addTrack(track, localStream);
|
|
2746
|
-
});
|
|
2747
|
-
webpeers[callTopics['sendVideoTopic']].getLocalStream().getTracks()[0].enabled = true;
|
|
2748
|
-
restartMedia(uiRemoteMedias[callTopics["sendVideoTopic"]])
|
|
2749
|
-
}, 2000);
|
|
2750
|
-
startMedia(uiRemoteMedias[callTopics["sendVideoTopic"]]);
|
|
2751
|
-
});
|
|
2752
|
-
}*/
|
|
2753
|
-
}
|
|
2754
|
-
|
|
2755
2722
|
if (params) {
|
|
2756
2723
|
if (typeof +params.callId === 'number' && params.callId > 0) {
|
|
2757
2724
|
sendData.subjectId = +params.callId;
|
|
@@ -2770,8 +2737,26 @@
|
|
|
2770
2737
|
return;
|
|
2771
2738
|
}
|
|
2772
2739
|
|
|
2740
|
+
/*if(screenShareState.started) {
|
|
2741
|
+
chatEvents.fireEvent('error', {
|
|
2742
|
+
code: 999,
|
|
2743
|
+
message: "ScreenShare has already started"
|
|
2744
|
+
});
|
|
2745
|
+
console.log("ScreenShare has already started");
|
|
2746
|
+
return
|
|
2747
|
+
}*/
|
|
2748
|
+
|
|
2773
2749
|
return chatMessaging.sendMessage(sendData, {
|
|
2774
2750
|
onResult: function (result) {
|
|
2751
|
+
consoleLogging && console.log("[sdk][startScreenShare][onResult]: ", result);
|
|
2752
|
+
if(!result.hasError) {
|
|
2753
|
+
var direction = 'send', shareScreen = true;
|
|
2754
|
+
if(screenShareState.started && !screenShareState.imOwner) {
|
|
2755
|
+
direction = 'receive';
|
|
2756
|
+
shareScreen = false;
|
|
2757
|
+
}
|
|
2758
|
+
callStateController.addScreenShareToCall(direction, shareScreen);
|
|
2759
|
+
}
|
|
2775
2760
|
callback && callback(result);
|
|
2776
2761
|
}
|
|
2777
2762
|
});
|
|
@@ -2803,35 +2788,18 @@
|
|
|
2803
2788
|
return;
|
|
2804
2789
|
}
|
|
2805
2790
|
|
|
2806
|
-
if(!
|
|
2807
|
-
|
|
2791
|
+
if(!screenShareState.imOwner) {
|
|
2792
|
+
chatEvents.fireEvent('error', {
|
|
2793
|
+
code: 999,
|
|
2794
|
+
message: 'You can not end others screen sharing!'
|
|
2795
|
+
});
|
|
2796
|
+
return;
|
|
2797
|
+
}
|
|
2798
|
+
|
|
2799
|
+
if(!callUsers['screenShare'].peers[callUsers['screenShare'].videoTopicName]) {
|
|
2800
|
+
consoleLogging && console.log('[SDK][endScreenShare] No screenShare connection available');
|
|
2808
2801
|
} else {
|
|
2809
|
-
|
|
2810
|
-
callStateController.removeTopic(callTopics['sendVideoTopic']);
|
|
2811
|
-
if(startCamera)
|
|
2812
|
-
callStateController.createTopic(callTopics['sendVideoTopic'], "video", "send");
|
|
2813
|
-
/*if (!displayMediaStream) {
|
|
2814
|
-
webpeers[callTopics['sendVideoTopic']].getLocalStream().getTracks()[0].enabled = false;
|
|
2815
|
-
|
|
2816
|
-
navigator.mediaDevices.getDisplayMedia().then(function (result) {
|
|
2817
|
-
console.log("webpeers[callTopics['sendVideoTopic']]", webpeers[callTopics['sendVideoTopic']].getLocalStream());
|
|
2818
|
-
/!*webpeers[callTopics['sendVideoTopic']].replaceTrack(result.getTracks()[0]).then(function (replacedPeer){
|
|
2819
|
-
});*!/
|
|
2820
|
-
uiRemoteMedias[callTopics["sendVideoTopic"]].srcObject = result;
|
|
2821
|
-
var localStream = result;
|
|
2822
|
-
webpeers[callTopics['sendVideoTopic']].getLocalStream().getTracks().forEach(track => {
|
|
2823
|
-
webpeers[callTopics['sendVideoTopic']].remove
|
|
2824
|
-
});
|
|
2825
|
-
setTimeout(function() {
|
|
2826
|
-
localStream.getTracks().forEach(function (track) {
|
|
2827
|
-
webpeers[callTopics['sendVideoTopic']].peerConnection.addTrack(track, localStream);
|
|
2828
|
-
});
|
|
2829
|
-
webpeers[callTopics['sendVideoTopic']].getLocalStream().getTracks()[0].enabled = true;
|
|
2830
|
-
restartMedia(uiRemoteMedias[callTopics["sendVideoTopic"]])
|
|
2831
|
-
}, 2000);
|
|
2832
|
-
startMedia(uiRemoteMedias[callTopics["sendVideoTopic"]]);
|
|
2833
|
-
});
|
|
2834
|
-
}*/
|
|
2802
|
+
callStateController.removeScreenShareFromCall();
|
|
2835
2803
|
}
|
|
2836
2804
|
|
|
2837
2805
|
return chatMessaging.sendMessage(sendData, {
|
|
@@ -3153,6 +3121,8 @@
|
|
|
3153
3121
|
sendMessageParams.content = params.userIds;
|
|
3154
3122
|
}
|
|
3155
3123
|
}
|
|
3124
|
+
callStateController.removeTopic(chatMessaging.userInfo.id, callUsers[chatMessaging.userInfo.id].audioTopicName)
|
|
3125
|
+
callStateController.removeStreamFromWebRTC(chatMessaging.userInfo.id, callUsers[chatMessaging.userInfo.id].audioTopicName)
|
|
3156
3126
|
|
|
3157
3127
|
return chatMessaging.sendMessage(sendMessageParams, {
|
|
3158
3128
|
onResult: function (result) {
|
|
@@ -3241,6 +3211,21 @@
|
|
|
3241
3211
|
|
|
3242
3212
|
return chatMessaging.sendMessage(turnOnVideoData, {
|
|
3243
3213
|
onResult: function (result) {
|
|
3214
|
+
if(!result.hasError && Array.isArray(result.result)) {
|
|
3215
|
+
for(var i in result.result) {
|
|
3216
|
+
if(callUsers[result.result[i].userId]) {
|
|
3217
|
+
callUsers[result.result[i].userId].video = true;
|
|
3218
|
+
callUsers[result.result[i].userId].mute = result.result[i].mute;
|
|
3219
|
+
callUsers[result.result[i].userId].videoTopicName = 'Vi-' + result.result[i].sendTopic;
|
|
3220
|
+
|
|
3221
|
+
var user = callUsers[result.result[i].userId];
|
|
3222
|
+
callStateController.appendUserToCallDiv(result.result[i].userId, callStateController.generateHTMLElements(result.result[i].userId));
|
|
3223
|
+
setTimeout(function () {
|
|
3224
|
+
callStateController.createTopic(result.result[i].userId, user.videoTopicName, 'video', 'send');
|
|
3225
|
+
})
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3244
3229
|
callback && callback(result);
|
|
3245
3230
|
}
|
|
3246
3231
|
});
|
|
@@ -3271,6 +3256,8 @@
|
|
|
3271
3256
|
});
|
|
3272
3257
|
return;
|
|
3273
3258
|
}
|
|
3259
|
+
callStateController.removeTopic(chatMessaging.userInfo.id, callUsers[chatMessaging.userInfo.id].videoTopicName)
|
|
3260
|
+
callStateController.removeStreamFromWebRTC(chatMessaging.userInfo.id, callUsers[chatMessaging.userInfo.id].videoTopicName)
|
|
3274
3261
|
|
|
3275
3262
|
return chatMessaging.sendMessage(turnOffVideoData, {
|
|
3276
3263
|
onResult: function (result) {
|
|
@@ -3285,18 +3272,21 @@
|
|
|
3285
3272
|
* @param callback
|
|
3286
3273
|
*/
|
|
3287
3274
|
this.pauseCamera = function (params, callback) {
|
|
3288
|
-
|
|
3275
|
+
var me = callUsers[chatMessaging.userInfo.id];
|
|
3276
|
+
|
|
3277
|
+
if(!Object.keys(callUsers).length || !me.videoTopicName || !me.peers[me.videoTopicName])
|
|
3289
3278
|
return;
|
|
3290
3279
|
|
|
3291
|
-
|
|
3280
|
+
me.peers[me.videoTopicName].getLocalStream().getTracks()[0].enabled = false;
|
|
3292
3281
|
callback && callback();
|
|
3293
3282
|
};
|
|
3294
3283
|
|
|
3295
3284
|
this.resumeCamera = function (params, callback) {
|
|
3296
|
-
|
|
3285
|
+
var me = callUsers[chatMessaging.userInfo.id]
|
|
3286
|
+
if(!Object.keys(callUsers).length || !me.videoTopicName || !me.peers[me.videoTopicName])
|
|
3297
3287
|
return;
|
|
3298
3288
|
|
|
3299
|
-
|
|
3289
|
+
me.peers[me.videoTopicName].getLocalStream().getTracks()[0].enabled = true;
|
|
3300
3290
|
callback && callback();
|
|
3301
3291
|
};
|
|
3302
3292
|
|
|
@@ -3306,18 +3296,20 @@
|
|
|
3306
3296
|
* @param callback
|
|
3307
3297
|
*/
|
|
3308
3298
|
this.pauseMice = function (params, callback) {
|
|
3309
|
-
|
|
3299
|
+
var me = callUsers[chatMessaging.userInfo.id];
|
|
3300
|
+
if(!Object.keys(callUsers).length || !me.audioTopicName || !me.peers[me.audioTopicName])
|
|
3310
3301
|
return;
|
|
3311
3302
|
|
|
3312
|
-
|
|
3303
|
+
me.peers[me.audioTopicName].getLocalStream().getTracks()[0].enabled = false;
|
|
3313
3304
|
callback && callback();
|
|
3314
3305
|
};
|
|
3315
3306
|
|
|
3316
3307
|
this.resumeMice = function (params, callback) {
|
|
3317
|
-
|
|
3308
|
+
var me = callUsers[chatMessaging.userInfo.id];
|
|
3309
|
+
if(!Object.keys(callUsers).length || !me.audioTopicName || !me.peers[me.audioTopicName])
|
|
3318
3310
|
return;
|
|
3319
3311
|
|
|
3320
|
-
|
|
3312
|
+
me.peers[me.audioTopicName].getLocalStream().getTracks()[0].enabled = true;
|
|
3321
3313
|
callback && callback();
|
|
3322
3314
|
};
|
|
3323
3315
|
|
|
@@ -3331,13 +3323,19 @@
|
|
|
3331
3323
|
callVideoMinHeight = +params.height;
|
|
3332
3324
|
}
|
|
3333
3325
|
|
|
3334
|
-
|
|
3326
|
+
if(!callUsers[chatMessaging.userInfo.id]){
|
|
3327
|
+
consoleLogging && console.log("Error in resizeCallVideo(), call not started ");
|
|
3328
|
+
return;
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
var userObject = callUsers[chatMessaging.userInfo.id]
|
|
3332
|
+
userObject.peers[userObject.videoTopicName].getLocalStream().getTracks()[0].applyConstraints({
|
|
3335
3333
|
"width": callVideoMinWidth,
|
|
3336
3334
|
"height": callVideoMinHeight
|
|
3337
3335
|
})
|
|
3338
3336
|
.then((res) => {
|
|
3339
|
-
|
|
3340
|
-
|
|
3337
|
+
userObject.htmlElements[userObject.videoTopicName].style.width = callVideoMinWidth + 'px';
|
|
3338
|
+
userObject.htmlElements[userObject.videoTopicName].style.height = callVideoMinHeight + 'px';
|
|
3341
3339
|
callback && callback();
|
|
3342
3340
|
})
|
|
3343
3341
|
.catch((e) => {
|