podchat-browser 11.3.4 → 11.4.1-snapshot.0
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 +7 -2
- package/examples/index.html +2 -2
- package/package.json +2 -2
- package/src/call.module.js +123 -209
- package/src/chat.js +60 -20
package/changelog.md
CHANGED
|
@@ -4,9 +4,14 @@ All notable changes to this project will be documented here.
|
|
|
4
4
|
to see complete list of changelog please visit [ChangeLog](https://github.com/masoudmanson/pod-chat/blob/master/changelog.md)
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
## [
|
|
7
|
+
## [11.3.4] - 2021-12-04
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### Fixed
|
|
10
|
+
- Screenshare reconnect in current call
|
|
11
|
+
- Interval error when peer not fully connected
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- Sample code of preventing async error when sending multiple file messages
|
|
10
15
|
|
|
11
16
|
|
|
12
17
|
## [4.10.0] - 2019-06-24
|
package/examples/index.html
CHANGED
|
@@ -3097,8 +3097,8 @@ Thread: <input type="text" id="threadInput" autocomplete="on" width="500">
|
|
|
3097
3097
|
threadId: inp,
|
|
3098
3098
|
autoStartDownload: true,
|
|
3099
3099
|
responseType: 'link',
|
|
3100
|
-
wantedCount:
|
|
3101
|
-
stepCount:
|
|
3100
|
+
wantedCount: 10000,
|
|
3101
|
+
stepCount: 1000
|
|
3102
3102
|
}, result => {
|
|
3103
3103
|
console.log(result);
|
|
3104
3104
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podchat-browser",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.4.1-snapshot.0",
|
|
4
4
|
"description": "Javascript SDK to use POD's Chat Service - Browser Only",
|
|
5
5
|
"main": "./src/chat.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publish:snapshot": "npm run version:snapshot && npm publish --tag snapshot",
|
|
10
10
|
"version:snapshot": "npm version prerelease --preid snapshot",
|
|
11
11
|
"publish:release": "npm run version:release && npm publish",
|
|
12
|
-
"version:release": "npm version 11.
|
|
12
|
+
"version:release": "npm version 11.4.0"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
package/src/call.module.js
CHANGED
|
@@ -488,172 +488,29 @@
|
|
|
488
488
|
*/
|
|
489
489
|
startCallWebRTCFunctions = function (params, callback) {
|
|
490
490
|
if (callDivId) {
|
|
491
|
-
var
|
|
492
|
-
callVideo = (typeof params.video === 'boolean') ? params.video : true,
|
|
491
|
+
var callVideo = (typeof params.video === 'boolean') ? params.video : true,
|
|
493
492
|
callMute = (typeof params.mute === 'boolean') ? params.mute : false;
|
|
494
|
-
|
|
495
|
-
|
|
493
|
+
|
|
494
|
+
if(params.selfData) {
|
|
495
|
+
callStateController.setupCallParticipant(params.selfData);
|
|
496
|
+
}
|
|
496
497
|
|
|
497
498
|
if(params.clientsList && params.clientsList.length) {
|
|
498
499
|
for(var i in params.clientsList) {
|
|
499
|
-
|
|
500
|
-
|
|
500
|
+
if(params.clientsList[i].userId !== chatMessaging.userInfo.id)
|
|
501
|
+
callStateController.setupCallParticipant(params.clientsList[i]);
|
|
501
502
|
}
|
|
502
503
|
}
|
|
503
504
|
|
|
504
505
|
callStateController.setupScreenSharingObject(params.screenShare);
|
|
505
506
|
|
|
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
507
|
callback && callback(generateCallUIList());
|
|
604
508
|
|
|
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
509
|
callStateController.createSessionInChat(Object.assign(params, {
|
|
641
510
|
callVideo: callVideo,
|
|
642
511
|
callAudio: !callMute,
|
|
643
512
|
}));
|
|
644
513
|
|
|
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
514
|
} else {
|
|
658
515
|
consoleLogging && console.log('No Call DIV has been declared!');
|
|
659
516
|
return;
|
|
@@ -868,11 +725,33 @@
|
|
|
868
725
|
* @param params
|
|
869
726
|
* @param direction
|
|
870
727
|
*/
|
|
871
|
-
removeParticipant: function (
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
callStop();
|
|
728
|
+
removeParticipant: function (userId) {
|
|
729
|
+
var user = callUsers[userId];
|
|
730
|
+
if(!user)
|
|
875
731
|
return;
|
|
732
|
+
|
|
733
|
+
if(user.videoTopicName && user.peers[user.videoTopicName]) {
|
|
734
|
+
clearInterval(callUsers[userId].topicMetaData[user.videoTopicName].interval);
|
|
735
|
+
callStateController.removeConnectionQualityInterval(userId, user.videoTopicName);
|
|
736
|
+
callStateController.removeStreamFromWebRTC(userId, user.videoTopicName);
|
|
737
|
+
callUsers[userId].peers[user.videoTopicName].dispose();
|
|
738
|
+
delete callUsers[userId].peers[user.videoTopicName];
|
|
739
|
+
|
|
740
|
+
}
|
|
741
|
+
if(user.audioTopicName && user.peers[user.audioTopicName]) {
|
|
742
|
+
clearInterval(callUsers[userId].topicMetaData[user.audioTopicName].interval);
|
|
743
|
+
callStateController.removeConnectionQualityInterval(userId, user.audioTopicName);
|
|
744
|
+
callStateController.removeStreamFromWebRTC(userId, user.audioTopicName);
|
|
745
|
+
|
|
746
|
+
callUsers[userId].peers[user.audioTopicName].dispose();
|
|
747
|
+
delete callUsers[userId].peers[user.audioTopicName];
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
if(callUsers[userId]){
|
|
751
|
+
callUsers[userId].peers = {};
|
|
752
|
+
callUsers[userId].topicMetaData = {};
|
|
753
|
+
callUsers[userId].htmlElements = {};
|
|
754
|
+
callUsers[userId] = null;
|
|
876
755
|
}
|
|
877
756
|
},
|
|
878
757
|
stopParticipantAudio: function (userId) {
|
|
@@ -1725,7 +1604,7 @@
|
|
|
1725
1604
|
|
|
1726
1605
|
restartMediaOnKeyFrame = function (userId, timeout) {
|
|
1727
1606
|
setTimeout(function () {
|
|
1728
|
-
if(typeof callUsers[userId] !== "undefined" && callUsers[userId])
|
|
1607
|
+
if(typeof callUsers[userId] !== "undefined" && callUsers[userId] && callUsers[userId].peers[callUsers[userId].videoTopicName])
|
|
1729
1608
|
restartMedia(callUsers[userId].videoTopicName);
|
|
1730
1609
|
}, timeout);
|
|
1731
1610
|
};
|
|
@@ -1960,6 +1839,7 @@
|
|
|
1960
1839
|
screenShare: messageContent.chatDataDto.screenShare,
|
|
1961
1840
|
brokerAddress: messageContent.chatDataDto.brokerAddressWeb,
|
|
1962
1841
|
turnAddress: messageContent.chatDataDto.turnAddress,
|
|
1842
|
+
selfData: messageContent.clientDTO,
|
|
1963
1843
|
clientsList: messageContent.otherClientDtoList
|
|
1964
1844
|
}, function (callDivs) {
|
|
1965
1845
|
chatEvents.fireEvent('callEvents', {
|
|
@@ -2067,10 +1947,10 @@
|
|
|
2067
1947
|
* Type 91 Send Group Call Request
|
|
2068
1948
|
*/
|
|
2069
1949
|
case chatMessageVOTypes.GROUP_CALL_REQUEST:
|
|
1950
|
+
callRequestController.callRequestReceived = true;
|
|
2070
1951
|
callReceived({
|
|
2071
1952
|
callId: messageContent.callId
|
|
2072
|
-
}, function (r) {
|
|
2073
|
-
});
|
|
1953
|
+
}, function (r) {});
|
|
2074
1954
|
|
|
2075
1955
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
2076
1956
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
@@ -2098,9 +1978,16 @@
|
|
|
2098
1978
|
result: messageContent
|
|
2099
1979
|
});
|
|
2100
1980
|
|
|
2101
|
-
if (!!messageContent[0].
|
|
2102
|
-
//removeFromCallUI(messageContent[0].sendTopic)
|
|
2103
|
-
callStateController.
|
|
1981
|
+
if (!!messageContent[0].userId) {
|
|
1982
|
+
//callStateController.removeFromCallUI(messageContent[0].sendTopic)
|
|
1983
|
+
callStateController.removeParticipant(messageContent[0].userId);
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
//If I'm the only call participant, stop the call
|
|
1987
|
+
if(callUsers) {
|
|
1988
|
+
if(Object.values(callUsers).length < 2) {
|
|
1989
|
+
callStop()
|
|
1990
|
+
}
|
|
2104
1991
|
}
|
|
2105
1992
|
|
|
2106
1993
|
break;
|
|
@@ -2122,6 +2009,28 @@
|
|
|
2122
2009
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
2123
2010
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
2124
2011
|
}
|
|
2012
|
+
if(Array.isArray(messageContent)) {
|
|
2013
|
+
for (var i in messageContent) {
|
|
2014
|
+
var correctedData = {
|
|
2015
|
+
video: messageContent[i].video,
|
|
2016
|
+
mute: messageContent[i].mute,
|
|
2017
|
+
userId: messageContent[i].userId,
|
|
2018
|
+
topicSend: messageContent[i].sendTopic
|
|
2019
|
+
}
|
|
2020
|
+
callStateController.setupCallParticipant(correctedData);
|
|
2021
|
+
if(correctedData.video) {
|
|
2022
|
+
callStateController.startParticipantVideo(correctedData.userId);
|
|
2023
|
+
}
|
|
2024
|
+
if(!correctedData.mute) {
|
|
2025
|
+
callStateController.startParticipantAudio(correctedData.userId);
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
chatEvents.fireEvent('callEvents', {
|
|
2031
|
+
type: 'CALL_DIVS',
|
|
2032
|
+
result: generateCallUIList()
|
|
2033
|
+
});
|
|
2125
2034
|
|
|
2126
2035
|
chatEvents.fireEvent('callEvents', {
|
|
2127
2036
|
type: 'CALL_PARTICIPANT_JOINED',
|
|
@@ -2179,18 +2088,15 @@
|
|
|
2179
2088
|
'audioTopicName',
|
|
2180
2089
|
'mute'
|
|
2181
2090
|
)
|
|
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
2091
|
}
|
|
2191
2092
|
}
|
|
2192
2093
|
}
|
|
2193
2094
|
|
|
2095
|
+
chatEvents.fireEvent('callEvents', {
|
|
2096
|
+
type: 'CALL_DIVS',
|
|
2097
|
+
result: generateCallUIList()
|
|
2098
|
+
});
|
|
2099
|
+
|
|
2194
2100
|
chatEvents.fireEvent('callEvents', {
|
|
2195
2101
|
type: 'CALL_PARTICIPANT_MUTE',
|
|
2196
2102
|
result: messageContent
|
|
@@ -2230,6 +2136,11 @@
|
|
|
2230
2136
|
}
|
|
2231
2137
|
}
|
|
2232
2138
|
|
|
2139
|
+
chatEvents.fireEvent('callEvents', {
|
|
2140
|
+
type: 'CALL_DIVS',
|
|
2141
|
+
result: generateCallUIList()
|
|
2142
|
+
});
|
|
2143
|
+
|
|
2233
2144
|
chatEvents.fireEvent('callEvents', {
|
|
2234
2145
|
type: 'CALL_PARTICIPANT_UNMUTE',
|
|
2235
2146
|
result: messageContent
|
|
@@ -2279,16 +2190,6 @@
|
|
|
2279
2190
|
messageContent[i].sendTopic,
|
|
2280
2191
|
'video'
|
|
2281
2192
|
);
|
|
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
2193
|
}
|
|
2293
2194
|
}
|
|
2294
2195
|
}
|
|
@@ -2321,13 +2222,6 @@
|
|
|
2321
2222
|
'videoTopicName',
|
|
2322
2223
|
'video'
|
|
2323
2224
|
)
|
|
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
2225
|
}
|
|
2332
2226
|
}
|
|
2333
2227
|
}
|
|
@@ -2359,8 +2253,15 @@
|
|
|
2359
2253
|
result: messageContent
|
|
2360
2254
|
});
|
|
2361
2255
|
|
|
2362
|
-
|
|
2363
|
-
restartMediaOnKeyFrame(chatMessaging.userInfo.id,
|
|
2256
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 2000);
|
|
2257
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 4000);
|
|
2258
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 8000);
|
|
2259
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 12000);
|
|
2260
|
+
|
|
2261
|
+
restartMediaOnKeyFrame("screenShare", 2000);
|
|
2262
|
+
restartMediaOnKeyFrame("screenShare", 4000);
|
|
2263
|
+
restartMediaOnKeyFrame("screenShare", 8000);
|
|
2264
|
+
restartMediaOnKeyFrame("screenShare", 12000);
|
|
2364
2265
|
break;
|
|
2365
2266
|
|
|
2366
2267
|
/**
|
|
@@ -2456,8 +2357,15 @@
|
|
|
2456
2357
|
result: messageContent
|
|
2457
2358
|
});
|
|
2458
2359
|
|
|
2459
|
-
|
|
2460
|
-
restartMediaOnKeyFrame(chatMessaging.userInfo.id,
|
|
2360
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 2000);
|
|
2361
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 4000);
|
|
2362
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 8000);
|
|
2363
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 12000);
|
|
2364
|
+
|
|
2365
|
+
restartMediaOnKeyFrame("screenShare", 2000);
|
|
2366
|
+
restartMediaOnKeyFrame("screenShare", 4000);
|
|
2367
|
+
restartMediaOnKeyFrame("screenShare", 8000);
|
|
2368
|
+
restartMediaOnKeyFrame("screenShare", 12000);
|
|
2461
2369
|
break;
|
|
2462
2370
|
}
|
|
2463
2371
|
}
|
|
@@ -2485,8 +2393,8 @@
|
|
|
2485
2393
|
|
|
2486
2394
|
if (params.clientType
|
|
2487
2395
|
&& typeof params.clientType === 'string'
|
|
2488
|
-
&&
|
|
2489
|
-
content.creatorClientDto.clientType =
|
|
2396
|
+
&& callClientType[params.clientType.toUpperCase()] > 0) {
|
|
2397
|
+
content.creatorClientDto.clientType = callClientType[params.clientType.toUpperCase()];
|
|
2490
2398
|
} else {
|
|
2491
2399
|
content.creatorClientDto.clientType = callClientType.WEB;
|
|
2492
2400
|
}
|
|
@@ -2495,13 +2403,14 @@
|
|
|
2495
2403
|
content.threadId = +params.threadId;
|
|
2496
2404
|
} else {
|
|
2497
2405
|
if (Array.isArray(params.invitees)) {
|
|
2498
|
-
content.invitees =
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2406
|
+
content.invitees = params.invitees;
|
|
2407
|
+
|
|
2408
|
+
//for (var i = 0; i < params.invitees.length; i++) {
|
|
2409
|
+
//var tempInvitee = params.invitees[i];
|
|
2410
|
+
//if (tempInvitee) {
|
|
2411
|
+
//content.invitees.push(tempInvitee);
|
|
2412
|
+
//}
|
|
2413
|
+
//}
|
|
2505
2414
|
} else {
|
|
2506
2415
|
chatEvents.fireEvent('error', {
|
|
2507
2416
|
code: 999,
|
|
@@ -2550,8 +2459,8 @@
|
|
|
2550
2459
|
|
|
2551
2460
|
content.creatorClientDto.mute = (typeof params.mute === 'boolean') ? params.mute : false;
|
|
2552
2461
|
|
|
2553
|
-
if (params.clientType && typeof params.clientType === 'string' &&
|
|
2554
|
-
content.creatorClientDto.clientType =
|
|
2462
|
+
if (params.clientType && typeof params.clientType === 'string' && callClientType[params.clientType.toUpperCase()] > 0) {
|
|
2463
|
+
content.creatorClientDto.clientType = callClientType[params.clientType.toUpperCase()];
|
|
2555
2464
|
} else {
|
|
2556
2465
|
content.creatorClientDto.clientType = callClientType.WEB;
|
|
2557
2466
|
}
|
|
@@ -2560,13 +2469,14 @@
|
|
|
2560
2469
|
content.threadId = +params.threadId;
|
|
2561
2470
|
} else {
|
|
2562
2471
|
if (Array.isArray(params.invitees)) {
|
|
2563
|
-
content.invitees =
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
}
|
|
2472
|
+
content.invitees = params.invitees;
|
|
2473
|
+
|
|
2474
|
+
//for (var i = 0; i < params.invitees.length; i++) {
|
|
2475
|
+
//var tempInvitee = params.invitees[i];
|
|
2476
|
+
//if (tempInvitee) {
|
|
2477
|
+
//content.invitees.push(tempInvitee);
|
|
2478
|
+
//}
|
|
2479
|
+
//}
|
|
2570
2480
|
} else {
|
|
2571
2481
|
chatEvents.fireEvent('error', {
|
|
2572
2482
|
code: 999,
|
|
@@ -2585,6 +2495,10 @@
|
|
|
2585
2495
|
return;
|
|
2586
2496
|
}
|
|
2587
2497
|
|
|
2498
|
+
callRequestController.cameraPaused = (typeof params.cameraPaused === 'boolean') ? params.cameraPaused : false;
|
|
2499
|
+
callRequestController.callRequestReceived = true;
|
|
2500
|
+
callRequestController.callEstablishedInMySide = true;
|
|
2501
|
+
|
|
2588
2502
|
return chatMessaging.sendMessage(startCallData, {
|
|
2589
2503
|
onResult: function (result) {
|
|
2590
2504
|
callback && callback(result);
|
|
@@ -2656,8 +2570,8 @@
|
|
|
2656
2570
|
|
|
2657
2571
|
callRequestController.cameraPaused = (typeof params.cameraPaused === 'boolean') ? params.cameraPaused : callRequestController.cameraPaused;
|
|
2658
2572
|
|
|
2659
|
-
if (params.clientType && typeof params.clientType === 'string' &&
|
|
2660
|
-
content.clientType =
|
|
2573
|
+
if (params.clientType && typeof params.clientType === 'string' && callClientType[params.clientType.toUpperCase()] > 0) {
|
|
2574
|
+
content.clientType = callClientType[params.clientType.toUpperCase()];
|
|
2661
2575
|
} else {
|
|
2662
2576
|
content.clientType = callClientType.WEB;
|
|
2663
2577
|
}
|
package/src/chat.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
3
|
(function () {
|
|
4
4
|
/*
|
|
@@ -13535,25 +13535,22 @@
|
|
|
13535
13535
|
|
|
13536
13536
|
if(stackArr.length < wantedCount) {
|
|
13537
13537
|
stepCount = wantedCount - stackArr.length < stepCount ? wantedCount - stackArr.length : stepCount;
|
|
13538
|
+
//setTimeout(function () {
|
|
13538
13539
|
resolve(requestExportChat(stackArr, wantedCount, stepCount, stackArr.length, sendData));
|
|
13540
|
+
//}, 1000)
|
|
13539
13541
|
} else {
|
|
13540
13542
|
resolve(stackArr);
|
|
13541
13543
|
}
|
|
13542
13544
|
});
|
|
13543
|
-
/*returnData.result = result;*/
|
|
13544
|
-
/*var messageContent = result.result,
|
|
13545
|
-
messageLength = messageContent.length,
|
|
13546
|
-
resultData = {
|
|
13547
|
-
participants: formatDataToMakeAssistantHistoryList(messageContent),
|
|
13548
|
-
contentCount: result.contentCount,
|
|
13549
|
-
hasNext: (sendData.content.offset + sendData.content.count < result.contentCount && messageLength > 0),
|
|
13550
|
-
nextOffset: sendData.content.offset * 1 + messageLength * 1
|
|
13551
|
-
};
|
|
13552
|
-
|
|
13553
|
-
returnData.result = resultData;*/
|
|
13554
13545
|
} else {
|
|
13555
|
-
|
|
13556
|
-
|
|
13546
|
+
if(result.errorCode !== 21) {
|
|
13547
|
+
consoleLogging && console.log("[SDK][exportChat] Problem in one step... . Rerunning the request.", wantedCount, stepCount, stackArr.length, sendData, result);
|
|
13548
|
+
setTimeout(function () {
|
|
13549
|
+
resolve(requestExportChat(stackArr, wantedCount, stepCount, stackArr.length, sendData))
|
|
13550
|
+
}, 2000)
|
|
13551
|
+
} else {
|
|
13552
|
+
reject(result)
|
|
13553
|
+
}
|
|
13557
13554
|
}
|
|
13558
13555
|
}
|
|
13559
13556
|
});
|
|
@@ -13592,9 +13589,10 @@
|
|
|
13592
13589
|
offset = params.offset;
|
|
13593
13590
|
}
|
|
13594
13591
|
|
|
13595
|
-
if (params.messageType && typeof params.messageType.toUpperCase() !== 'undefined' && chatMessageTypes[params.messageType.toUpperCase()] > 0) {
|
|
13596
|
-
|
|
13597
|
-
}
|
|
13592
|
+
// if (params.messageType && typeof params.messageType.toUpperCase() !== 'undefined' && chatMessageTypes[params.messageType.toUpperCase()] > 0) {
|
|
13593
|
+
// sendData.content.messageType = chatMessageTypes[params.messageType.toUpperCase()];
|
|
13594
|
+
// }
|
|
13595
|
+
sendData.content.messageType = 1;
|
|
13598
13596
|
|
|
13599
13597
|
if(wantedCount < stepCount)
|
|
13600
13598
|
stepCount = wantedCount;
|
|
@@ -13607,7 +13605,47 @@
|
|
|
13607
13605
|
responseType = params.responseType !== null ? params.responseType : "blob",
|
|
13608
13606
|
autoStartDownload = params.autoStartDownload !== null ? params.autoStartDownload : true
|
|
13609
13607
|
|
|
13610
|
-
var
|
|
13608
|
+
var str = ''
|
|
13609
|
+
, universalBOM = "\uFEFF";
|
|
13610
|
+
|
|
13611
|
+
console.log(result);
|
|
13612
|
+
str += "تاریخ " + ',';
|
|
13613
|
+
str += " ساعت " + ',';
|
|
13614
|
+
str += "نام فرستنده" + ',';
|
|
13615
|
+
str += "نام کاربری فرستنده" + ',';
|
|
13616
|
+
str += "متن پیام" + ',';
|
|
13617
|
+
str += '\r\n';
|
|
13618
|
+
var line = '', radif = 1;
|
|
13619
|
+
for (var i = 0; i < result.length; i++) {
|
|
13620
|
+
line = '';
|
|
13621
|
+
|
|
13622
|
+
if(result[i].messageType !== 1) {
|
|
13623
|
+
continue;
|
|
13624
|
+
}
|
|
13625
|
+
|
|
13626
|
+
var sender = '';
|
|
13627
|
+
if(result[i].participant.contactName) {
|
|
13628
|
+
sender = result[i].participant.contactName + ',';
|
|
13629
|
+
} else {
|
|
13630
|
+
if(result[i].participant.firstName) {
|
|
13631
|
+
sender = result[i].participant.firstName + ' ';
|
|
13632
|
+
}
|
|
13633
|
+
if(result[i].participant.lastName) {
|
|
13634
|
+
sender += result[i].participant.lastName;
|
|
13635
|
+
}
|
|
13636
|
+
sender += ','
|
|
13637
|
+
}
|
|
13638
|
+
|
|
13639
|
+
line += new Date(result[i].time).toLocaleDateString('fa-IR') + ',';
|
|
13640
|
+
line += new Date(result[i].time).toLocaleTimeString('fa-IR') + ',';
|
|
13641
|
+
line += sender;
|
|
13642
|
+
line += result[i].participant.username + ',';
|
|
13643
|
+
line += result[i].message.replaceAll(",", ".").replace(/(\r\n|\n|\r)/gm, " ") + ',';
|
|
13644
|
+
|
|
13645
|
+
str += line + '\r\n';
|
|
13646
|
+
radif++;
|
|
13647
|
+
}
|
|
13648
|
+
var blob = new Blob([str], { type: 'text/csv;charset=utf-8;' });
|
|
13611
13649
|
chatEvents.fireEvent('threadEvents', {
|
|
13612
13650
|
type: 'EXPORT_CHAT',
|
|
13613
13651
|
subType: 'DONE',
|
|
@@ -13630,7 +13668,7 @@
|
|
|
13630
13668
|
url = URL.createObjectURL(blob);
|
|
13631
13669
|
//if (link.download !== undefined) { // feature detection
|
|
13632
13670
|
// Browsers that support HTML5 download attribute
|
|
13633
|
-
link.setAttribute("href",
|
|
13671
|
+
link.setAttribute("href", 'data:text/csv; charset=utf-8,' + encodeURIComponent(universalBOM + str));
|
|
13634
13672
|
link.setAttribute("download", exportedFilename);
|
|
13635
13673
|
if(autoStartDownload) {
|
|
13636
13674
|
link.style.visibility = 'hidden';
|
|
@@ -13653,7 +13691,9 @@
|
|
|
13653
13691
|
}
|
|
13654
13692
|
//}
|
|
13655
13693
|
callback = undefined;
|
|
13656
|
-
})
|
|
13694
|
+
})/*.catch(function (result) {
|
|
13695
|
+
consoleLogging && console.log(result);
|
|
13696
|
+
});*/
|
|
13657
13697
|
}
|
|
13658
13698
|
|
|
13659
13699
|
this.startCall = callModule.startCall;
|