podchat-browser 11.3.4 → 11.4.3
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/changelog.md +25 -2
- package/dist/podchat-11.3.4.js +55921 -55921
- package/dist/podchat-11.4.1.js +74643 -0
- package/dist/podchat-11.4.2.js +74696 -0
- package/dist/podchat-11.4.3.js +74696 -0
- package/examples/index.html +2 -2
- package/package.json +3 -3
- package/src/call.module.js +223 -254
- package/src/chat.js +60 -20
package/src/call.module.js
CHANGED
|
@@ -191,6 +191,10 @@
|
|
|
191
191
|
currentCallId = null,
|
|
192
192
|
shouldReconnectCallTimeout = null,
|
|
193
193
|
callTopics = {},
|
|
194
|
+
callMetaDataTypes = {
|
|
195
|
+
POORCONNECTION: 1,
|
|
196
|
+
POORCONNECTIONRESOLVED: 2
|
|
197
|
+
},
|
|
194
198
|
screenShareState = {
|
|
195
199
|
started: false,
|
|
196
200
|
imOwner: false
|
|
@@ -488,172 +492,29 @@
|
|
|
488
492
|
*/
|
|
489
493
|
startCallWebRTCFunctions = function (params, callback) {
|
|
490
494
|
if (callDivId) {
|
|
491
|
-
var
|
|
492
|
-
callVideo = (typeof params.video === 'boolean') ? params.video : true,
|
|
495
|
+
var callVideo = (typeof params.video === 'boolean') ? params.video : true,
|
|
493
496
|
callMute = (typeof params.mute === 'boolean') ? params.mute : false;
|
|
494
|
-
|
|
495
|
-
|
|
497
|
+
|
|
498
|
+
if(params.selfData) {
|
|
499
|
+
callStateController.setupCallParticipant(params.selfData);
|
|
500
|
+
}
|
|
496
501
|
|
|
497
502
|
if(params.clientsList && params.clientsList.length) {
|
|
498
503
|
for(var i in params.clientsList) {
|
|
499
|
-
|
|
500
|
-
|
|
504
|
+
if(params.clientsList[i].userId !== chatMessaging.userInfo.id)
|
|
505
|
+
callStateController.setupCallParticipant(params.clientsList[i]);
|
|
501
506
|
}
|
|
502
507
|
}
|
|
503
508
|
|
|
504
509
|
callStateController.setupScreenSharingObject(params.screenShare);
|
|
505
510
|
|
|
506
|
-
/*callTopics['sendVideoTopic'] = 'Vi-' + sendingTopic;
|
|
507
|
-
callTopics['sendAudioTopic'] = 'Vo-' + sendingTopic;
|
|
508
|
-
callTopics['screenShare'] = params.screenShare;
|
|
509
|
-
//callTopics['receiveVideoTopic'] = 'Vi-' + receiveTopic;
|
|
510
|
-
//callTopics['receiveAudioTopic'] = 'Vo-' + receiveTopic;
|
|
511
|
-
callTopics['receive'] = [];
|
|
512
|
-
callTopics['receive'].push({
|
|
513
|
-
"VideoTopic": 'Vi-' + receiveTopic,
|
|
514
|
-
"AudioTopic": 'Vo-' + receiveTopic
|
|
515
|
-
});*/
|
|
516
|
-
|
|
517
|
-
/*webpeersMetadata[callTopics['sendVideoTopic']] = {
|
|
518
|
-
interval: null,
|
|
519
|
-
receivedSdpAnswer: false,
|
|
520
|
-
connectionQualityInterval: null,
|
|
521
|
-
poorConnectionCount: 0,
|
|
522
|
-
poorConnectionResolvedCount: 0,
|
|
523
|
-
isConnectionPoor: false
|
|
524
|
-
};
|
|
525
|
-
webpeersMetadata[callTopics['sendAudioTopic']] = {
|
|
526
|
-
interval: null,
|
|
527
|
-
receivedSdpAnswer: false,
|
|
528
|
-
connectionQualityInterval: null,
|
|
529
|
-
poorConnectionCount: 0,
|
|
530
|
-
poorConnectionResolvedCount: 0,
|
|
531
|
-
isConnectionPoor: false
|
|
532
|
-
};
|
|
533
|
-
webpeersMetadata[callTopics['screenShare']] = {
|
|
534
|
-
interval: null,
|
|
535
|
-
receivedSdpAnswer: false,
|
|
536
|
-
connectionQualityInterval: null,
|
|
537
|
-
poorConnectionCount: 0,
|
|
538
|
-
poorConnectionResolvedCount: 0,
|
|
539
|
-
isConnectionPoor: false
|
|
540
|
-
};
|
|
541
|
-
|
|
542
|
-
for(var i in callTopics['receive']) {
|
|
543
|
-
webpeersMetadata[callTopics['receive'][i]['VideoTopic']] = {
|
|
544
|
-
interval: null,
|
|
545
|
-
receivedSdpAnswer: false
|
|
546
|
-
};
|
|
547
|
-
webpeersMetadata[callTopics['receive'][i]['AudioTopic']] = {
|
|
548
|
-
interval: null,
|
|
549
|
-
receivedSdpAnswer: false
|
|
550
|
-
};
|
|
551
|
-
}*/
|
|
552
|
-
|
|
553
|
-
//callParentDiv = document.getElementById(callDivId);
|
|
554
|
-
|
|
555
|
-
/*// Local Video Tag
|
|
556
|
-
if (callVideo && !uiRemoteMedias[callTopics['sendVideoTopic']]) {
|
|
557
|
-
uiRemoteMedias[callTopics['sendVideoTopic']] = document.createElement('video');
|
|
558
|
-
var el = uiRemoteMedias[callTopics['sendVideoTopic']];
|
|
559
|
-
el.setAttribute('id', 'uiRemoteVideo-' + callTopics['sendVideoTopic']);
|
|
560
|
-
el.setAttribute('class', callVideoTagClassName);
|
|
561
|
-
el.setAttribute('playsinline', '');
|
|
562
|
-
el.setAttribute('muted', '');
|
|
563
|
-
el.setAttribute('width', callVideoMinWidth + 'px');
|
|
564
|
-
el.setAttribute('height', callVideoMinHeight + 'px');
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
// Local Audio Tag
|
|
568
|
-
if (!uiRemoteMedias[callTopics['sendAudioTopic']]) {
|
|
569
|
-
uiRemoteMedias[callTopics['sendAudioTopic']] = document.createElement('audio');
|
|
570
|
-
var el = uiRemoteMedias[callTopics['sendAudioTopic']];
|
|
571
|
-
el.setAttribute('id', 'uiRemoteAudio-' + callTopics['sendAudioTopic']);
|
|
572
|
-
el.setAttribute('class', callAudioTagClassName);
|
|
573
|
-
el.setAttribute('autoplay', '');
|
|
574
|
-
el.setAttribute('muted', '');
|
|
575
|
-
el.setAttribute('controls', '');
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
for(var i in callTopics['receive']){
|
|
579
|
-
// Remote Video Tag
|
|
580
|
-
if (callVideo && !uiRemoteMedias[callTopics['receive'][i]['VideoTopic']]) {
|
|
581
|
-
uiRemoteMedias[callTopics['receive'][i]['VideoTopic']] = document.createElement('video');
|
|
582
|
-
var el = uiRemoteMedias[callTopics['receive'][i]['VideoTopic']];
|
|
583
|
-
el.setAttribute('id', 'uiRemoteVideo-' + callTopics['receive'][i]['VideoTopic']);
|
|
584
|
-
el.setAttribute('class', callVideoTagClassName);
|
|
585
|
-
el.setAttribute('playsinline', '');
|
|
586
|
-
el.setAttribute('muted', '');
|
|
587
|
-
el.setAttribute('width', callVideoMinWidth + 'px');
|
|
588
|
-
el.setAttribute('height', callVideoMinHeight + 'px');
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
// Remote Audio Tag
|
|
592
|
-
if (!uiRemoteMedias[callTopics['receive'][i]['AudioTopic']]) {
|
|
593
|
-
uiRemoteMedias[callTopics['receive'][i]['AudioTopic']] = document.createElement('audio');
|
|
594
|
-
var el = uiRemoteMedias[callTopics['receive'][i]['AudioTopic']];
|
|
595
|
-
el.setAttribute('id', 'uiRemoteAudio-' + callTopics['receive'][i]['AudioTopic']);
|
|
596
|
-
el.setAttribute('class', callAudioTagClassName);
|
|
597
|
-
el.setAttribute('autoplay', '');
|
|
598
|
-
callMute && el.setAttribute('muted', '');
|
|
599
|
-
el.setAttribute('controls', '');
|
|
600
|
-
}
|
|
601
|
-
}*/
|
|
602
|
-
|
|
603
511
|
callback && callback(generateCallUIList());
|
|
604
512
|
|
|
605
|
-
/*for(var i in callTopics['receive']) {
|
|
606
|
-
uiRemoteElements.push(uiRemoteMedias[callTopics['receive'][i]['AudioTopic']])
|
|
607
|
-
callVideo && uiRemoteElements.push(uiRemoteMedias[callTopics['receive'][i]['VideoTopic']])
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
if (callParentDiv) {
|
|
611
|
-
callVideo && callParentDiv.appendChild(uiRemoteMedias[callTopics['sendVideoTopic']]);
|
|
612
|
-
callParentDiv.appendChild(uiRemoteMedias[callTopics['sendAudioTopic']]);
|
|
613
|
-
if(callVideo) {
|
|
614
|
-
for(var i in callTopics['receive']) {
|
|
615
|
-
callParentDiv.appendChild(uiRemoteMedias[callTopics['receive'][i]['VideoTopic']])
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
for(var i in callTopics['receive']) {
|
|
619
|
-
callParentDiv.appendChild(uiRemoteMedias[callTopics['receive'][i]['AudioTopic']]);
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
callback && callback({
|
|
623
|
-
'uiLocalVideo': uiRemoteMedias[callTopics['sendVideoTopic']],
|
|
624
|
-
'uiLocalAudio': uiRemoteMedias[callTopics['sendAudioTopic']],
|
|
625
|
-
uiRemoteElements: uiRemoteElements
|
|
626
|
-
/!* 'uiRemoteVideo': uiRemoteMedias[callTopics['receiveVideoTopic']],
|
|
627
|
-
'uiRemoteAudio': uiRemoteMedias[callTopics['receiveAudioTopic']]*!/
|
|
628
|
-
});
|
|
629
|
-
} else {
|
|
630
|
-
callback && callback({
|
|
631
|
-
'uiLocalVideo': uiRemoteMedias[callTopics['sendVideoTopic']],
|
|
632
|
-
'uiLocalAudio': uiRemoteMedias[callTopics['sendAudioTopic']],
|
|
633
|
-
uiRemoteElements: uiRemoteElements
|
|
634
|
-
/!*'uiRemoteVideo': uiRemoteMedias[callTopics['receiveVideoTopic']],
|
|
635
|
-
'uiRemoteAudio': uiRemoteMedias[callTopics['receiveAudioTopic']]*!/
|
|
636
|
-
});
|
|
637
|
-
}*/
|
|
638
|
-
|
|
639
|
-
|
|
640
513
|
callStateController.createSessionInChat(Object.assign(params, {
|
|
641
514
|
callVideo: callVideo,
|
|
642
515
|
callAudio: !callMute,
|
|
643
516
|
}));
|
|
644
517
|
|
|
645
|
-
/*sendCallMessage({
|
|
646
|
-
id: 'STOPALL'
|
|
647
|
-
}, function (result) {*/
|
|
648
|
-
|
|
649
|
-
/*handleCallSocketOpen({
|
|
650
|
-
brokerAddress: params.brokerAddress,
|
|
651
|
-
turnAddress: params.turnAddress,
|
|
652
|
-
callVideo: callVideo,
|
|
653
|
-
callAudio: !callMute,
|
|
654
|
-
});*/
|
|
655
|
-
|
|
656
|
-
/* });*/
|
|
657
518
|
} else {
|
|
658
519
|
consoleLogging && console.log('No Call DIV has been declared!');
|
|
659
520
|
return;
|
|
@@ -868,11 +729,33 @@
|
|
|
868
729
|
* @param params
|
|
869
730
|
* @param direction
|
|
870
731
|
*/
|
|
871
|
-
removeParticipant: function (
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
callStop();
|
|
732
|
+
removeParticipant: function (userId) {
|
|
733
|
+
var user = callUsers[userId];
|
|
734
|
+
if(!user)
|
|
875
735
|
return;
|
|
736
|
+
|
|
737
|
+
if(user.videoTopicName && user.peers[user.videoTopicName]) {
|
|
738
|
+
clearInterval(callUsers[userId].topicMetaData[user.videoTopicName].interval);
|
|
739
|
+
callStateController.removeConnectionQualityInterval(userId, user.videoTopicName);
|
|
740
|
+
callStateController.removeStreamFromWebRTC(userId, user.videoTopicName);
|
|
741
|
+
callUsers[userId].peers[user.videoTopicName].dispose();
|
|
742
|
+
delete callUsers[userId].peers[user.videoTopicName];
|
|
743
|
+
|
|
744
|
+
}
|
|
745
|
+
if(user.audioTopicName && user.peers[user.audioTopicName]) {
|
|
746
|
+
clearInterval(callUsers[userId].topicMetaData[user.audioTopicName].interval);
|
|
747
|
+
callStateController.removeConnectionQualityInterval(userId, user.audioTopicName);
|
|
748
|
+
callStateController.removeStreamFromWebRTC(userId, user.audioTopicName);
|
|
749
|
+
|
|
750
|
+
callUsers[userId].peers[user.audioTopicName].dispose();
|
|
751
|
+
delete callUsers[userId].peers[user.audioTopicName];
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
if(callUsers[userId]){
|
|
755
|
+
callUsers[userId].peers = {};
|
|
756
|
+
callUsers[userId].topicMetaData = {};
|
|
757
|
+
callUsers[userId].htmlElements = {};
|
|
758
|
+
callUsers[userId] = null;
|
|
876
759
|
}
|
|
877
760
|
},
|
|
878
761
|
stopParticipantAudio: function (userId) {
|
|
@@ -1005,7 +888,8 @@
|
|
|
1005
888
|
message: 'Poor connection for a long time',
|
|
1006
889
|
metadata: {
|
|
1007
890
|
elementId: "uiRemoteVideo-" + topic,
|
|
1008
|
-
topic: topic
|
|
891
|
+
topic: topic,
|
|
892
|
+
userId: userId
|
|
1009
893
|
}
|
|
1010
894
|
});
|
|
1011
895
|
}
|
|
@@ -1025,6 +909,13 @@
|
|
|
1025
909
|
userMetadata.isConnectionPoor = true;
|
|
1026
910
|
userMetadata.poorConnectionCount = 0;
|
|
1027
911
|
userMetadata.poorConnectionResolvedCount = 0;
|
|
912
|
+
|
|
913
|
+
sendCallMetaData({
|
|
914
|
+
id: callMetaDataTypes.POORCONNECTION,
|
|
915
|
+
userid: userId,
|
|
916
|
+
title: 'Poor Connection',
|
|
917
|
+
description: topic
|
|
918
|
+
});
|
|
1028
919
|
} else {
|
|
1029
920
|
callUsers[userId].topicMetaData[topic].poorConnectionCount++;
|
|
1030
921
|
}
|
|
@@ -1038,9 +929,17 @@
|
|
|
1038
929
|
message: 'Poor connection resolved',
|
|
1039
930
|
metadata: {
|
|
1040
931
|
elementId: "uiRemoteVideo-" + topic,
|
|
1041
|
-
topic: topic
|
|
932
|
+
topic: topic,
|
|
933
|
+
userId: userId
|
|
1042
934
|
}
|
|
1043
935
|
});
|
|
936
|
+
|
|
937
|
+
sendCallMetaData({
|
|
938
|
+
id: callMetaDataTypes.POORCONNECTIONRESOLVED,
|
|
939
|
+
userid: userId,
|
|
940
|
+
title: 'Poor Connection Resolved',
|
|
941
|
+
description: topic
|
|
942
|
+
});
|
|
1044
943
|
} else {
|
|
1045
944
|
userMetadata.poorConnectionResolvedCount++;
|
|
1046
945
|
}
|
|
@@ -1534,14 +1433,14 @@
|
|
|
1534
1433
|
let newHeight = callVideoMinHeight - (Math.ceil(Math.random() * 50) + 20);
|
|
1535
1434
|
|
|
1536
1435
|
videoTrack.applyConstraints({
|
|
1537
|
-
width: {
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
},
|
|
1541
|
-
height: {
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
},
|
|
1436
|
+
// width: {
|
|
1437
|
+
// min: newWidth,
|
|
1438
|
+
// ideal: 1280
|
|
1439
|
+
// },
|
|
1440
|
+
// height: {
|
|
1441
|
+
// min: newHeight,
|
|
1442
|
+
// ideal: 720
|
|
1443
|
+
// },
|
|
1545
1444
|
advanced: [
|
|
1546
1445
|
{
|
|
1547
1446
|
width: newWidth,
|
|
@@ -1725,10 +1624,62 @@
|
|
|
1725
1624
|
|
|
1726
1625
|
restartMediaOnKeyFrame = function (userId, timeout) {
|
|
1727
1626
|
setTimeout(function () {
|
|
1728
|
-
if(typeof callUsers[userId] !== "undefined" && callUsers[userId])
|
|
1627
|
+
if(typeof callUsers[userId] !== "undefined" && callUsers[userId] && callUsers[userId].peers[callUsers[userId].videoTopicName])
|
|
1729
1628
|
restartMedia(callUsers[userId].videoTopicName);
|
|
1730
1629
|
}, timeout);
|
|
1731
|
-
}
|
|
1630
|
+
},
|
|
1631
|
+
|
|
1632
|
+
sendCallMetaData = function (params, callback) {
|
|
1633
|
+
var message = {
|
|
1634
|
+
id: params.id,
|
|
1635
|
+
userid: params.userid,
|
|
1636
|
+
title: params.title,
|
|
1637
|
+
description: params.description
|
|
1638
|
+
};
|
|
1639
|
+
|
|
1640
|
+
sendCallMessage({
|
|
1641
|
+
id: 'SENDMETADATA',
|
|
1642
|
+
message: JSON.stringify(message),
|
|
1643
|
+
chatId: currentCallId
|
|
1644
|
+
}, function (res) {
|
|
1645
|
+
callback && callback(res)
|
|
1646
|
+
});
|
|
1647
|
+
},
|
|
1648
|
+
handleReceivedMetaData = function (jsonMessage) {
|
|
1649
|
+
var id = jsonMessage.id;
|
|
1650
|
+
if(!id || typeof id === "undefined" || jsonMessage.userid == chatMessaging.userInfo.id) {
|
|
1651
|
+
return;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
switch (id) {
|
|
1655
|
+
case callMetaDataTypes.POORCONNECTION:
|
|
1656
|
+
chatEvents.fireEvent("callEvents", {
|
|
1657
|
+
type: 'POOR_VIDEO_CONNECTION',
|
|
1658
|
+
subType: 'SHORT_TIME',
|
|
1659
|
+
message: 'Poor connection detected',
|
|
1660
|
+
metadata: {
|
|
1661
|
+
elementId: "uiRemoteVideo-" + jsonMessage.description,
|
|
1662
|
+
topic: jsonMessage.description,
|
|
1663
|
+
userId: jsonMessage.userid
|
|
1664
|
+
}
|
|
1665
|
+
});
|
|
1666
|
+
break;
|
|
1667
|
+
case callMetaDataTypes.POORCONNECTIONRESOLVED:
|
|
1668
|
+
chatEvents.fireEvent('callEvents', {
|
|
1669
|
+
type: 'POOR_VIDEO_CONNECTION_RESOLVED',
|
|
1670
|
+
message: 'Poor connection resolved',
|
|
1671
|
+
metadata: {
|
|
1672
|
+
elementId: "uiRemoteVideo-" + jsonMessage.description,
|
|
1673
|
+
topic: jsonMessage.description,
|
|
1674
|
+
userId: jsonMessage.userid
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1677
|
+
break;
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
|
|
1732
1683
|
|
|
1733
1684
|
this.updateToken = function (newToken) {
|
|
1734
1685
|
token = newToken;
|
|
@@ -1768,23 +1719,6 @@
|
|
|
1768
1719
|
restartMediaOnKeyFrame('screenShare', 8000);
|
|
1769
1720
|
restartMediaOnKeyFrame('screenShare', 12000);
|
|
1770
1721
|
}
|
|
1771
|
-
|
|
1772
|
-
/* setTimeout(function () {
|
|
1773
|
-
if(typeof callUsers[chatMessaging.userInfo.id] === "undefined" || !callUsers[chatMessaging.userInfo.id])
|
|
1774
|
-
restartMedia(callUsers[chatMessaging.userInfo.id].videoTopicName);
|
|
1775
|
-
}, 2000);
|
|
1776
|
-
setTimeout(function () {
|
|
1777
|
-
if(typeof callUsers[chatMessaging.userInfo.id] === "undefined" || !callUsers[chatMessaging.userInfo.id])
|
|
1778
|
-
restartMedia(callUsers[chatMessaging.userInfo.id].videoTopicName);
|
|
1779
|
-
}, 4000);
|
|
1780
|
-
setTimeout(function () {
|
|
1781
|
-
if(typeof callUsers[chatMessaging.userInfo.id] === "undefined" || !callUsers[chatMessaging.userInfo.id])
|
|
1782
|
-
restartMedia(callUsers[chatMessaging.userInfo.id].videoTopicName);
|
|
1783
|
-
}, 8000);
|
|
1784
|
-
setTimeout(function () {
|
|
1785
|
-
if(typeof callUsers[chatMessaging.userInfo.id] === "undefined" || !callUsers[chatMessaging.userInfo.id])
|
|
1786
|
-
restartMedia(callUsers[chatMessaging.userInfo.id].videoTopicName);
|
|
1787
|
-
}, 12000);*/
|
|
1788
1722
|
break;
|
|
1789
1723
|
|
|
1790
1724
|
case 'FREEZED':
|
|
@@ -1796,11 +1730,13 @@
|
|
|
1796
1730
|
chatMessaging.messagesCallbacks[uniqueId](jsonMessage);
|
|
1797
1731
|
}
|
|
1798
1732
|
break;*/
|
|
1733
|
+
|
|
1799
1734
|
case 'STOP':
|
|
1800
1735
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
1801
1736
|
chatMessaging.messagesCallbacks[uniqueId](jsonMessage);
|
|
1802
1737
|
}
|
|
1803
1738
|
break;
|
|
1739
|
+
|
|
1804
1740
|
case 'CLOSE':
|
|
1805
1741
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
1806
1742
|
chatMessaging.messagesCallbacks[uniqueId](jsonMessage);
|
|
@@ -1819,6 +1755,14 @@
|
|
|
1819
1755
|
}
|
|
1820
1756
|
break;
|
|
1821
1757
|
|
|
1758
|
+
case 'RECEIVEMETADATA':
|
|
1759
|
+
// if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
1760
|
+
// chatMessaging.messagesCallbacks[uniqueId](jsonMessage);
|
|
1761
|
+
// }
|
|
1762
|
+
handleReceivedMetaData(JSON.parse(jsonMessage.message));
|
|
1763
|
+
|
|
1764
|
+
break;
|
|
1765
|
+
|
|
1822
1766
|
case 'ERROR':
|
|
1823
1767
|
handleError(jsonMessage, params.sendingTopic, params.receiveTopic);
|
|
1824
1768
|
break;
|
|
@@ -1865,7 +1809,7 @@
|
|
|
1865
1809
|
result: messageContent
|
|
1866
1810
|
});
|
|
1867
1811
|
|
|
1868
|
-
currentCallId = messageContent.callId;
|
|
1812
|
+
//currentCallId = messageContent.callId;
|
|
1869
1813
|
|
|
1870
1814
|
break;
|
|
1871
1815
|
|
|
@@ -1912,6 +1856,8 @@
|
|
|
1912
1856
|
type: 'RECEIVE_CALL',
|
|
1913
1857
|
result: messageContent
|
|
1914
1858
|
});
|
|
1859
|
+
|
|
1860
|
+
currentCallId = messageContent.callId;
|
|
1915
1861
|
} else {
|
|
1916
1862
|
chatEvents.fireEvent('callEvents', {
|
|
1917
1863
|
type: 'PARTNER_RECEIVED_YOUR_CALL',
|
|
@@ -1919,7 +1865,7 @@
|
|
|
1919
1865
|
});
|
|
1920
1866
|
}
|
|
1921
1867
|
|
|
1922
|
-
|
|
1868
|
+
|
|
1923
1869
|
|
|
1924
1870
|
break;
|
|
1925
1871
|
|
|
@@ -1960,6 +1906,7 @@
|
|
|
1960
1906
|
screenShare: messageContent.chatDataDto.screenShare,
|
|
1961
1907
|
brokerAddress: messageContent.chatDataDto.brokerAddressWeb,
|
|
1962
1908
|
turnAddress: messageContent.chatDataDto.turnAddress,
|
|
1909
|
+
selfData: messageContent.clientDTO,
|
|
1963
1910
|
clientsList: messageContent.otherClientDtoList
|
|
1964
1911
|
}, function (callDivs) {
|
|
1965
1912
|
chatEvents.fireEvent('callEvents', {
|
|
@@ -2067,10 +2014,10 @@
|
|
|
2067
2014
|
* Type 91 Send Group Call Request
|
|
2068
2015
|
*/
|
|
2069
2016
|
case chatMessageVOTypes.GROUP_CALL_REQUEST:
|
|
2017
|
+
callRequestController.callRequestReceived = true;
|
|
2070
2018
|
callReceived({
|
|
2071
2019
|
callId: messageContent.callId
|
|
2072
|
-
}, function (r) {
|
|
2073
|
-
});
|
|
2020
|
+
}, function (r) {});
|
|
2074
2021
|
|
|
2075
2022
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
2076
2023
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
@@ -2081,7 +2028,7 @@
|
|
|
2081
2028
|
result: messageContent
|
|
2082
2029
|
});
|
|
2083
2030
|
|
|
2084
|
-
currentCallId = messageContent.callId;
|
|
2031
|
+
//currentCallId = messageContent.callId;
|
|
2085
2032
|
|
|
2086
2033
|
break;
|
|
2087
2034
|
|
|
@@ -2098,9 +2045,16 @@
|
|
|
2098
2045
|
result: messageContent
|
|
2099
2046
|
});
|
|
2100
2047
|
|
|
2101
|
-
if (!!messageContent[0].
|
|
2102
|
-
//removeFromCallUI(messageContent[0].sendTopic)
|
|
2103
|
-
callStateController.
|
|
2048
|
+
if (!!messageContent[0].userId) {
|
|
2049
|
+
//callStateController.removeFromCallUI(messageContent[0].sendTopic)
|
|
2050
|
+
callStateController.removeParticipant(messageContent[0].userId);
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
//If I'm the only call participant, stop the call
|
|
2054
|
+
if(callUsers) {
|
|
2055
|
+
if(Object.values(callUsers).length < 2) {
|
|
2056
|
+
callStop()
|
|
2057
|
+
}
|
|
2104
2058
|
}
|
|
2105
2059
|
|
|
2106
2060
|
break;
|
|
@@ -2122,6 +2076,28 @@
|
|
|
2122
2076
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
2123
2077
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
2124
2078
|
}
|
|
2079
|
+
if(Array.isArray(messageContent)) {
|
|
2080
|
+
for (var i in messageContent) {
|
|
2081
|
+
var correctedData = {
|
|
2082
|
+
video: messageContent[i].video,
|
|
2083
|
+
mute: messageContent[i].mute,
|
|
2084
|
+
userId: messageContent[i].userId,
|
|
2085
|
+
topicSend: messageContent[i].sendTopic
|
|
2086
|
+
}
|
|
2087
|
+
callStateController.setupCallParticipant(correctedData);
|
|
2088
|
+
if(correctedData.video) {
|
|
2089
|
+
callStateController.startParticipantVideo(correctedData.userId);
|
|
2090
|
+
}
|
|
2091
|
+
if(!correctedData.mute) {
|
|
2092
|
+
callStateController.startParticipantAudio(correctedData.userId);
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
chatEvents.fireEvent('callEvents', {
|
|
2098
|
+
type: 'CALL_DIVS',
|
|
2099
|
+
result: generateCallUIList()
|
|
2100
|
+
});
|
|
2125
2101
|
|
|
2126
2102
|
chatEvents.fireEvent('callEvents', {
|
|
2127
2103
|
type: 'CALL_PARTICIPANT_JOINED',
|
|
@@ -2179,18 +2155,15 @@
|
|
|
2179
2155
|
'audioTopicName',
|
|
2180
2156
|
'mute'
|
|
2181
2157
|
)
|
|
2182
|
-
/*if(callUsers[messageContent[i].userId]) {
|
|
2183
|
-
callUsers[messageContent[i].userId].mute = true;
|
|
2184
|
-
|
|
2185
|
-
var user = callUsers[messageContent[i].userId];
|
|
2186
|
-
clearInterval(callUsers[messageContent[i].userId].topicMetaData[user.audioTopicName].interval)
|
|
2187
|
-
callStateController.removeTopic(messageContent[i].userId, user.audioTopicName);
|
|
2188
|
-
callStateController.removeStreamFromWebRTC(messageContent[i].userId, user.audioTopicName);
|
|
2189
|
-
}*/
|
|
2190
2158
|
}
|
|
2191
2159
|
}
|
|
2192
2160
|
}
|
|
2193
2161
|
|
|
2162
|
+
chatEvents.fireEvent('callEvents', {
|
|
2163
|
+
type: 'CALL_DIVS',
|
|
2164
|
+
result: generateCallUIList()
|
|
2165
|
+
});
|
|
2166
|
+
|
|
2194
2167
|
chatEvents.fireEvent('callEvents', {
|
|
2195
2168
|
type: 'CALL_PARTICIPANT_MUTE',
|
|
2196
2169
|
result: messageContent
|
|
@@ -2230,6 +2203,11 @@
|
|
|
2230
2203
|
}
|
|
2231
2204
|
}
|
|
2232
2205
|
|
|
2206
|
+
chatEvents.fireEvent('callEvents', {
|
|
2207
|
+
type: 'CALL_DIVS',
|
|
2208
|
+
result: generateCallUIList()
|
|
2209
|
+
});
|
|
2210
|
+
|
|
2233
2211
|
chatEvents.fireEvent('callEvents', {
|
|
2234
2212
|
type: 'CALL_PARTICIPANT_UNMUTE',
|
|
2235
2213
|
result: messageContent
|
|
@@ -2279,16 +2257,6 @@
|
|
|
2279
2257
|
messageContent[i].sendTopic,
|
|
2280
2258
|
'video'
|
|
2281
2259
|
);
|
|
2282
|
-
/*if(callUsers[messageContent[i].userId]) {
|
|
2283
|
-
callUsers[messageContent[i].userId].video = true;
|
|
2284
|
-
callUsers[messageContent[i].userId].videoTopicName = 'Vi-' + messageContent[i].sendTopic;
|
|
2285
|
-
|
|
2286
|
-
var user = callUsers[messageContent[i].userId];
|
|
2287
|
-
callStateController.appendUserToCallDiv(messageContent[i].userId, callStateController.generateHTMLElements(messageContent[i].userId));
|
|
2288
|
-
setTimeout(function () {
|
|
2289
|
-
callStateController.createTopic(messageContent[i].userId, user.videoTopicName, 'video', 'receive');
|
|
2290
|
-
})
|
|
2291
|
-
}*/
|
|
2292
2260
|
}
|
|
2293
2261
|
}
|
|
2294
2262
|
}
|
|
@@ -2321,13 +2289,6 @@
|
|
|
2321
2289
|
'videoTopicName',
|
|
2322
2290
|
'video'
|
|
2323
2291
|
)
|
|
2324
|
-
/* if(callUsers[messageContent[i].userId]) {
|
|
2325
|
-
callUsers[messageContent[i].userId].video = false;
|
|
2326
|
-
var user = callUsers[messageContent[i].userId];
|
|
2327
|
-
clearInterval(callUsers[messageContent[i].userId].topicMetaData[user.videoTopicName].interval)
|
|
2328
|
-
callStateController.removeTopic(messageContent[i].userId, user.videoTopicName);
|
|
2329
|
-
callStateController.removeStreamFromWebRTC(messageContent[i].userId, user.videoTopicName);
|
|
2330
|
-
}*/
|
|
2331
2292
|
}
|
|
2332
2293
|
}
|
|
2333
2294
|
}
|
|
@@ -2359,8 +2320,16 @@
|
|
|
2359
2320
|
result: messageContent
|
|
2360
2321
|
});
|
|
2361
2322
|
|
|
2362
|
-
|
|
2363
|
-
restartMediaOnKeyFrame(chatMessaging.userInfo.id,
|
|
2323
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 4000);
|
|
2324
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 8000);
|
|
2325
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 12000);
|
|
2326
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 25000);
|
|
2327
|
+
|
|
2328
|
+
restartMediaOnKeyFrame("screenShare", 4000);
|
|
2329
|
+
restartMediaOnKeyFrame("screenShare", 8000);
|
|
2330
|
+
restartMediaOnKeyFrame("screenShare", 12000);
|
|
2331
|
+
restartMediaOnKeyFrame("screenShare", 25000);
|
|
2332
|
+
|
|
2364
2333
|
break;
|
|
2365
2334
|
|
|
2366
2335
|
/**
|
|
@@ -2456,8 +2425,16 @@
|
|
|
2456
2425
|
result: messageContent
|
|
2457
2426
|
});
|
|
2458
2427
|
|
|
2459
|
-
|
|
2460
|
-
restartMediaOnKeyFrame(chatMessaging.userInfo.id,
|
|
2428
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 4000);
|
|
2429
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 8000);
|
|
2430
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 12000);
|
|
2431
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 25000);
|
|
2432
|
+
|
|
2433
|
+
restartMediaOnKeyFrame("screenShare", 4000);
|
|
2434
|
+
restartMediaOnKeyFrame("screenShare", 8000);
|
|
2435
|
+
restartMediaOnKeyFrame("screenShare", 12000);
|
|
2436
|
+
restartMediaOnKeyFrame("screenShare", 25000);
|
|
2437
|
+
|
|
2461
2438
|
break;
|
|
2462
2439
|
}
|
|
2463
2440
|
}
|
|
@@ -2485,8 +2462,8 @@
|
|
|
2485
2462
|
|
|
2486
2463
|
if (params.clientType
|
|
2487
2464
|
&& typeof params.clientType === 'string'
|
|
2488
|
-
&&
|
|
2489
|
-
content.creatorClientDto.clientType =
|
|
2465
|
+
&& callClientType[params.clientType.toUpperCase()] > 0) {
|
|
2466
|
+
content.creatorClientDto.clientType = callClientType[params.clientType.toUpperCase()];
|
|
2490
2467
|
} else {
|
|
2491
2468
|
content.creatorClientDto.clientType = callClientType.WEB;
|
|
2492
2469
|
}
|
|
@@ -2495,13 +2472,14 @@
|
|
|
2495
2472
|
content.threadId = +params.threadId;
|
|
2496
2473
|
} else {
|
|
2497
2474
|
if (Array.isArray(params.invitees)) {
|
|
2498
|
-
content.invitees =
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2475
|
+
content.invitees = params.invitees;
|
|
2476
|
+
|
|
2477
|
+
//for (var i = 0; i < params.invitees.length; i++) {
|
|
2478
|
+
//var tempInvitee = params.invitees[i];
|
|
2479
|
+
//if (tempInvitee) {
|
|
2480
|
+
//content.invitees.push(tempInvitee);
|
|
2481
|
+
//}
|
|
2482
|
+
//}
|
|
2505
2483
|
} else {
|
|
2506
2484
|
chatEvents.fireEvent('error', {
|
|
2507
2485
|
code: 999,
|
|
@@ -2550,8 +2528,8 @@
|
|
|
2550
2528
|
|
|
2551
2529
|
content.creatorClientDto.mute = (typeof params.mute === 'boolean') ? params.mute : false;
|
|
2552
2530
|
|
|
2553
|
-
if (params.clientType && typeof params.clientType === 'string' &&
|
|
2554
|
-
content.creatorClientDto.clientType =
|
|
2531
|
+
if (params.clientType && typeof params.clientType === 'string' && callClientType[params.clientType.toUpperCase()] > 0) {
|
|
2532
|
+
content.creatorClientDto.clientType = callClientType[params.clientType.toUpperCase()];
|
|
2555
2533
|
} else {
|
|
2556
2534
|
content.creatorClientDto.clientType = callClientType.WEB;
|
|
2557
2535
|
}
|
|
@@ -2560,13 +2538,14 @@
|
|
|
2560
2538
|
content.threadId = +params.threadId;
|
|
2561
2539
|
} else {
|
|
2562
2540
|
if (Array.isArray(params.invitees)) {
|
|
2563
|
-
content.invitees =
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
}
|
|
2541
|
+
content.invitees = params.invitees;
|
|
2542
|
+
|
|
2543
|
+
//for (var i = 0; i < params.invitees.length; i++) {
|
|
2544
|
+
//var tempInvitee = params.invitees[i];
|
|
2545
|
+
//if (tempInvitee) {
|
|
2546
|
+
//content.invitees.push(tempInvitee);
|
|
2547
|
+
//}
|
|
2548
|
+
//}
|
|
2570
2549
|
} else {
|
|
2571
2550
|
chatEvents.fireEvent('error', {
|
|
2572
2551
|
code: 999,
|
|
@@ -2585,6 +2564,10 @@
|
|
|
2585
2564
|
return;
|
|
2586
2565
|
}
|
|
2587
2566
|
|
|
2567
|
+
callRequestController.cameraPaused = (typeof params.cameraPaused === 'boolean') ? params.cameraPaused : false;
|
|
2568
|
+
callRequestController.callRequestReceived = true;
|
|
2569
|
+
callRequestController.callEstablishedInMySide = true;
|
|
2570
|
+
|
|
2588
2571
|
return chatMessaging.sendMessage(startCallData, {
|
|
2589
2572
|
onResult: function (result) {
|
|
2590
2573
|
callback && callback(result);
|
|
@@ -2656,8 +2639,8 @@
|
|
|
2656
2639
|
|
|
2657
2640
|
callRequestController.cameraPaused = (typeof params.cameraPaused === 'boolean') ? params.cameraPaused : callRequestController.cameraPaused;
|
|
2658
2641
|
|
|
2659
|
-
if (params.clientType && typeof params.clientType === 'string' &&
|
|
2660
|
-
content.clientType =
|
|
2642
|
+
if (params.clientType && typeof params.clientType === 'string' && callClientType[params.clientType.toUpperCase()] > 0) {
|
|
2643
|
+
content.clientType = callClientType[params.clientType.toUpperCase()];
|
|
2661
2644
|
} else {
|
|
2662
2645
|
content.clientType = callClientType.WEB;
|
|
2663
2646
|
}
|
|
@@ -3204,10 +3187,6 @@
|
|
|
3204
3187
|
'audioTopicName',
|
|
3205
3188
|
'mute'
|
|
3206
3189
|
)
|
|
3207
|
-
/*
|
|
3208
|
-
callStateController.removeTopic(chatMessaging.userInfo.id, callUsers[chatMessaging.userInfo.id].audioTopicName)
|
|
3209
|
-
callStateController.removeStreamFromWebRTC(chatMessaging.userInfo.id, callUsers[chatMessaging.userInfo.id].audioTopicName)
|
|
3210
|
-
*/
|
|
3211
3190
|
|
|
3212
3191
|
return chatMessaging.sendMessage(sendMessageParams, {
|
|
3213
3192
|
onResult: function (result) {
|
|
@@ -3259,16 +3238,6 @@
|
|
|
3259
3238
|
callUsers[myId].topicSend,
|
|
3260
3239
|
'mute'
|
|
3261
3240
|
);
|
|
3262
|
-
/*if(callUsers[myId]) {
|
|
3263
|
-
callUsers[myId].mute = false;
|
|
3264
|
-
callUsers[myId].audioTopicName = 'Vo-' + callUsers[myId].topicSend;
|
|
3265
|
-
|
|
3266
|
-
var user = callUsers[myId];
|
|
3267
|
-
callStateController.appendUserToCallDiv(myId, callStateController.generateHTMLElements(myId));
|
|
3268
|
-
setTimeout(function () {
|
|
3269
|
-
callStateController.createTopic(myId, user.audioTopicName, 'audio', 'send');
|
|
3270
|
-
})
|
|
3271
|
-
}*/
|
|
3272
3241
|
|
|
3273
3242
|
return chatMessaging.sendMessage(sendMessageParams, {
|
|
3274
3243
|
onResult: function (result) {
|