podchat-browser 10.14.3 → 10.14.7
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-10.14.3.js +54515 -54515
- package/dist/{podchat-10.14.2.js → podchat-10.14.4.js} +15 -31
- package/dist/podchat-10.14.5.js +70980 -0
- package/dist/podchat-10.14.6.js +70981 -0
- package/dist/{podchat-10.14.0.js → podchat-10.14.7.js} +54724 -54590
- package/package.json +2 -2
- package/src/chat.js +127 -28
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podchat-browser",
|
|
3
|
-
"version": "10.14.
|
|
3
|
+
"version": "10.14.7",
|
|
4
4
|
"description": "Javascript SDK to use POD's Chat Service - Browser Only",
|
|
5
5
|
"main": "./src/chat.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "mocha --reporter spec --exit",
|
|
8
|
-
"bundle": "browserify browser-bundling.js -o ./dist/podchat-10.14.
|
|
8
|
+
"bundle": "browserify browser-bundling.js -o ./dist/podchat-10.14.7.js"
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
package/src/chat.js
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
if (!!Sentry) {
|
|
41
41
|
Sentry.init({
|
|
42
|
-
dsn: '
|
|
42
|
+
dsn: 'https://784a14966f6a416b8b58a4b144aef0f5@talk-sentry.sakku-khatam.ir/4',
|
|
43
43
|
attachStacktrace: true
|
|
44
44
|
});
|
|
45
45
|
Sentry.setContext("Chat Params", params);
|
|
@@ -317,7 +317,11 @@
|
|
|
317
317
|
DESKTOP: 3
|
|
318
318
|
},
|
|
319
319
|
webpeers = {},
|
|
320
|
+
webpeersMetadata = {},
|
|
320
321
|
uiRemoteMedias = {},
|
|
322
|
+
callStopQueue = {
|
|
323
|
+
callStarted: false,
|
|
324
|
+
},
|
|
321
325
|
systemMessageIntervalPitch = params.systemMessageIntervalPitch || 1000,
|
|
322
326
|
isTypingInterval,
|
|
323
327
|
protocol = params.protocol || 'websocket',
|
|
@@ -8898,6 +8902,7 @@
|
|
|
8898
8902
|
Sentry.setExtra('errorCode', err.code);
|
|
8899
8903
|
Sentry.setExtra('uniqueId', err.uniqueId);
|
|
8900
8904
|
Sentry.setExtra('token', err.token);
|
|
8905
|
+
Sentry.setTag('Error code:', (err.code ? err.code : ''))
|
|
8901
8906
|
Sentry.captureException(err.error, {
|
|
8902
8907
|
logger: eventName
|
|
8903
8908
|
});
|
|
@@ -8911,11 +8916,11 @@
|
|
|
8911
8916
|
},
|
|
8912
8917
|
|
|
8913
8918
|
PodChatErrorException = function (error) {
|
|
8914
|
-
this.code = error.error.code;
|
|
8915
|
-
this.message = error.error.message;
|
|
8916
|
-
this.uniqueId = error.uniqueId;
|
|
8919
|
+
this.code = error.error ? error.error.code : error.code;
|
|
8920
|
+
this.message = error.error ? error.error.message : error.message;
|
|
8921
|
+
this.uniqueId = error.uniqueId ? error.uniqueId : '';
|
|
8917
8922
|
this.token = token;
|
|
8918
|
-
this.error =
|
|
8923
|
+
this.error = JSON.stringify((error.error ? error.error : error));
|
|
8919
8924
|
},
|
|
8920
8925
|
|
|
8921
8926
|
/**
|
|
@@ -10206,6 +10211,23 @@
|
|
|
10206
10211
|
callTopics['receiveVideoTopic'] = 'Vi-' + receiveTopic;
|
|
10207
10212
|
callTopics['receiveAudioTopic'] = 'Vo-' + receiveTopic;
|
|
10208
10213
|
|
|
10214
|
+
webpeersMetadata[callTopics['sendVideoTopic']] = {
|
|
10215
|
+
interval: null,
|
|
10216
|
+
receivedSdpAnswer: false
|
|
10217
|
+
};
|
|
10218
|
+
webpeersMetadata[callTopics['sendAudioTopic']] = {
|
|
10219
|
+
interval: null,
|
|
10220
|
+
receivedSdpAnswer: false
|
|
10221
|
+
};
|
|
10222
|
+
webpeersMetadata[callTopics['receiveVideoTopic']] = {
|
|
10223
|
+
interval: null,
|
|
10224
|
+
receivedSdpAnswer: false
|
|
10225
|
+
};
|
|
10226
|
+
webpeersMetadata[callTopics['receiveAudioTopic']] = {
|
|
10227
|
+
interval: null,
|
|
10228
|
+
receivedSdpAnswer: false
|
|
10229
|
+
};
|
|
10230
|
+
|
|
10209
10231
|
callParentDiv = document.getElementById(callDivId);
|
|
10210
10232
|
|
|
10211
10233
|
// Local Video Tag
|
|
@@ -10271,16 +10293,16 @@
|
|
|
10271
10293
|
});
|
|
10272
10294
|
}
|
|
10273
10295
|
|
|
10274
|
-
sendCallMessage({
|
|
10296
|
+
/*sendCallMessage({
|
|
10275
10297
|
id: 'STOPALL'
|
|
10276
|
-
}, function (result) {
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
});
|
|
10298
|
+
}, function (result) {*/
|
|
10299
|
+
handleCallSocketOpen({
|
|
10300
|
+
brokerAddress: params.brokerAddress,
|
|
10301
|
+
turnAddress: params.turnAddress,
|
|
10302
|
+
callVideo: callVideo,
|
|
10303
|
+
callAudio: !callMute
|
|
10283
10304
|
});
|
|
10305
|
+
/* });*/
|
|
10284
10306
|
} else {
|
|
10285
10307
|
consoleLogging && console.log('No Call DIV has been declared!');
|
|
10286
10308
|
return;
|
|
@@ -10296,8 +10318,10 @@
|
|
|
10296
10318
|
turnAddress: params.turnAddress.split(',')[0]
|
|
10297
10319
|
}, function (res) {
|
|
10298
10320
|
if (res.done === 'TRUE') {
|
|
10321
|
+
callStopQueue.callStarted = true;
|
|
10299
10322
|
generateAndSendSdpOffers(params);
|
|
10300
10323
|
} else if (res.done === 'SKIP') {
|
|
10324
|
+
callStopQueue.callStarted = true;
|
|
10301
10325
|
generateAndSendSdpOffers(params);
|
|
10302
10326
|
} else {
|
|
10303
10327
|
consoleLogging && console.log('CREATE_SESSION faced a problem', res);
|
|
@@ -10370,7 +10394,6 @@
|
|
|
10370
10394
|
|
|
10371
10395
|
// Video Topics
|
|
10372
10396
|
if (params.callVideo) {
|
|
10373
|
-
|
|
10374
10397
|
const sendVideoOptions = {
|
|
10375
10398
|
localVideo: uiRemoteMedias[callTopics['sendVideoTopic']],
|
|
10376
10399
|
mediaConstraints: {
|
|
@@ -10383,13 +10406,27 @@
|
|
|
10383
10406
|
},
|
|
10384
10407
|
iceTransportPolicy: 'relay',
|
|
10385
10408
|
onicecandidate: (candidate) => {
|
|
10386
|
-
|
|
10409
|
+
if (webpeersMetadata[callTopics['sendVideoTopic']].interval !== null) {
|
|
10410
|
+
clearInterval(webpeersMetadata[callTopics['sendVideoTopic']].interval);
|
|
10411
|
+
}
|
|
10412
|
+
webpeersMetadata[callTopics['sendVideoTopic']].interval = setInterval(function() {
|
|
10413
|
+
if(webpeersMetadata[callTopics['sendVideoTopic']].sdpAnswerReceived === true) {
|
|
10414
|
+
webpeersMetadata[callTopics['sendVideoTopic']].sdpAnswerReceived = false;
|
|
10415
|
+
clearInterval(webpeersMetadata[callTopics['sendVideoTopic']].interval);
|
|
10416
|
+
sendCallMessage({
|
|
10417
|
+
id: 'ADD_ICE_CANDIDATE',
|
|
10418
|
+
topic: callTopics['sendVideoTopic'],
|
|
10419
|
+
candidateDto: candidate
|
|
10420
|
+
})
|
|
10421
|
+
}
|
|
10422
|
+
}, 500, {candidate: candidate});
|
|
10423
|
+
/*setTimeout(function () {
|
|
10387
10424
|
sendCallMessage({
|
|
10388
10425
|
id: 'ADD_ICE_CANDIDATE',
|
|
10389
10426
|
topic: callTopics['sendVideoTopic'],
|
|
10390
10427
|
candidateDto: candidate
|
|
10391
10428
|
})
|
|
10392
|
-
},
|
|
10429
|
+
}, 2000, {candidate: candidate});*/
|
|
10393
10430
|
},
|
|
10394
10431
|
configuration: {
|
|
10395
10432
|
iceServers: turnServers
|
|
@@ -10401,13 +10438,28 @@
|
|
|
10401
10438
|
mediaConstraints: {audio: false, video: true},
|
|
10402
10439
|
iceTransportPolicy: 'relay',
|
|
10403
10440
|
onicecandidate: (candidate) => {
|
|
10404
|
-
|
|
10441
|
+
if (webpeersMetadata[callTopics['receiveVideoTopic']].interval !== null) {
|
|
10442
|
+
clearInterval(webpeersMetadata[callTopics['receiveVideoTopic']].interval);
|
|
10443
|
+
}
|
|
10444
|
+
webpeersMetadata[callTopics['receiveVideoTopic']].interval = setInterval(function() {
|
|
10445
|
+
if(webpeersMetadata[callTopics['receiveVideoTopic']].sdpAnswerReceived === true) {
|
|
10446
|
+
webpeersMetadata[callTopics['receiveVideoTopic']].sdpAnswerReceived = false;
|
|
10447
|
+
clearInterval(webpeersMetadata[callTopics['receiveVideoTopic']].interval);
|
|
10448
|
+
sendCallMessage({
|
|
10449
|
+
id: 'ADD_ICE_CANDIDATE',
|
|
10450
|
+
topic: callTopics['receiveVideoTopic'],
|
|
10451
|
+
candidateDto: candidate
|
|
10452
|
+
})
|
|
10453
|
+
}
|
|
10454
|
+
}, 500, {candidate: candidate});
|
|
10455
|
+
|
|
10456
|
+
/* setTimeout(function () {
|
|
10405
10457
|
sendCallMessage({
|
|
10406
10458
|
id: 'ADD_ICE_CANDIDATE',
|
|
10407
10459
|
topic: callTopics['receiveVideoTopic'],
|
|
10408
10460
|
candidateDto: candidate
|
|
10409
10461
|
})
|
|
10410
|
-
},
|
|
10462
|
+
}, 2000, {candidate: candidate});*/
|
|
10411
10463
|
},
|
|
10412
10464
|
configuration: {
|
|
10413
10465
|
iceServers: turnServers
|
|
@@ -10472,13 +10524,27 @@
|
|
|
10472
10524
|
mediaConstraints: {audio: true, video: false},
|
|
10473
10525
|
iceTransportPolicy: 'relay',
|
|
10474
10526
|
onicecandidate: (candidate) => {
|
|
10475
|
-
|
|
10527
|
+
if (webpeersMetadata[callTopics['sendAudioTopic']].interval !== null) {
|
|
10528
|
+
clearInterval(webpeersMetadata[callTopics['sendAudioTopic']].interval);
|
|
10529
|
+
}
|
|
10530
|
+
webpeersMetadata[callTopics['sendAudioTopic']].interval = setInterval(function() {
|
|
10531
|
+
if(webpeersMetadata[callTopics['sendAudioTopic']].sdpAnswerReceived === true) {
|
|
10532
|
+
webpeersMetadata[callTopics['sendAudioTopic']].sdpAnswerReceived = false;
|
|
10533
|
+
clearInterval(webpeersMetadata[callTopics['sendAudioTopic']].interval);
|
|
10534
|
+
sendCallMessage({
|
|
10535
|
+
id: 'ADD_ICE_CANDIDATE',
|
|
10536
|
+
topic: callTopics['sendAudioTopic'],
|
|
10537
|
+
candidateDto: candidate,
|
|
10538
|
+
})
|
|
10539
|
+
}
|
|
10540
|
+
}, 500, {candidate: candidate});
|
|
10541
|
+
/* setTimeout(function () {
|
|
10476
10542
|
sendCallMessage({
|
|
10477
10543
|
id: 'ADD_ICE_CANDIDATE',
|
|
10478
10544
|
topic: callTopics['sendAudioTopic'],
|
|
10479
10545
|
candidateDto: candidate,
|
|
10480
10546
|
})
|
|
10481
|
-
},
|
|
10547
|
+
}, 2000, {candidate: candidate});*/
|
|
10482
10548
|
},
|
|
10483
10549
|
configuration: {
|
|
10484
10550
|
iceServers: turnServers
|
|
@@ -10490,13 +10556,28 @@
|
|
|
10490
10556
|
mediaConstraints: {audio: true, video: false},
|
|
10491
10557
|
iceTransportPolicy: 'relay',
|
|
10492
10558
|
onicecandidate: (candidate) => {
|
|
10493
|
-
|
|
10559
|
+
if (webpeersMetadata[callTopics['receiveAudioTopic']].interval !== null) {
|
|
10560
|
+
clearInterval(webpeersMetadata[callTopics['receiveAudioTopic']].interval);
|
|
10561
|
+
}
|
|
10562
|
+
webpeersMetadata[callTopics['receiveAudioTopic']].interval = setInterval(function() {
|
|
10563
|
+
if(webpeersMetadata[callTopics['receiveAudioTopic']].sdpAnswerReceived === true) {
|
|
10564
|
+
webpeersMetadata[callTopics['receiveAudioTopic']].sdpAnswerReceived = false;
|
|
10565
|
+
clearInterval(webpeersMetadata[callTopics['receiveAudioTopic']].interval);
|
|
10566
|
+
sendCallMessage({
|
|
10567
|
+
id: 'ADD_ICE_CANDIDATE',
|
|
10568
|
+
topic: callTopics['receiveAudioTopic'],
|
|
10569
|
+
candidateDto: candidate,
|
|
10570
|
+
})
|
|
10571
|
+
}
|
|
10572
|
+
}, 500, {candidate: candidate});
|
|
10573
|
+
|
|
10574
|
+
/* setTimeout(function () {
|
|
10494
10575
|
sendCallMessage({
|
|
10495
10576
|
id: 'ADD_ICE_CANDIDATE',
|
|
10496
10577
|
topic: callTopics['receiveAudioTopic'],
|
|
10497
10578
|
candidateDto: candidate,
|
|
10498
10579
|
})
|
|
10499
|
-
},
|
|
10580
|
+
}, 2000, {candidate: candidate});*/
|
|
10500
10581
|
},
|
|
10501
10582
|
configuration: {
|
|
10502
10583
|
iceServers: turnServers
|
|
@@ -10554,9 +10635,19 @@
|
|
|
10554
10635
|
|
|
10555
10636
|
setTimeout(function () {
|
|
10556
10637
|
for (var peer in webpeers) {
|
|
10638
|
+
console.log("set callback on webpeers: ", peer);
|
|
10557
10639
|
if (webpeers[peer]) {
|
|
10640
|
+
webpeers[peer].peerConnection.onconnectionstatechange = function () {
|
|
10641
|
+
console.log("on connection state change, ", "peer: ", peer, "peerConnection.connectionState: ", webpeers[peer].peerConnection.connectionState);
|
|
10642
|
+
if (webpeers[peer].peerConnection.connectionState == 'disconnected') {
|
|
10643
|
+
console.log(peer, 'peerConnection.onconnectionstatechange: disconnected');
|
|
10644
|
+
}
|
|
10645
|
+
}
|
|
10646
|
+
|
|
10558
10647
|
webpeers[peer].peerConnection.oniceconnectionstatechange = function () {
|
|
10648
|
+
console.log("on ice connection state change: ", peer, webpeers[peer].peerConnection.connectionState);
|
|
10559
10649
|
if (webpeers[peer].peerConnection.iceConnectionState == 'disconnected') {
|
|
10650
|
+
console.log( peer , '>>>>>>>>>>>>> disconnected');
|
|
10560
10651
|
fireEvent('callEvents', {
|
|
10561
10652
|
type: 'CALL_STATUS',
|
|
10562
10653
|
errorCode: 7000,
|
|
@@ -10572,10 +10663,11 @@
|
|
|
10572
10663
|
restartMedia(callTopics['sendVideoTopic'])
|
|
10573
10664
|
}, 6000);
|
|
10574
10665
|
|
|
10575
|
-
|
|
10666
|
+
alert('Internet connection failed, Reconnect your call');
|
|
10667
|
+
/*shouldReconnectCallTimeout && clearTimeout(shouldReconnectCallTimeout);
|
|
10576
10668
|
shouldReconnectCallTimeout = setTimeout(function () {
|
|
10577
10669
|
shouldReconnectCall();
|
|
10578
|
-
}, 7000)
|
|
10670
|
+
}, 7000);*/
|
|
10579
10671
|
}
|
|
10580
10672
|
|
|
10581
10673
|
if (webpeers[peer].peerConnection.iceConnectionState === "failed") {
|
|
@@ -10606,7 +10698,7 @@
|
|
|
10606
10698
|
}
|
|
10607
10699
|
}
|
|
10608
10700
|
}
|
|
10609
|
-
},
|
|
10701
|
+
}, 6000);
|
|
10610
10702
|
|
|
10611
10703
|
setTimeout(function () {
|
|
10612
10704
|
restartMedia(callTopics['sendVideoTopic'])
|
|
@@ -10794,6 +10886,10 @@
|
|
|
10794
10886
|
|
|
10795
10887
|
return;
|
|
10796
10888
|
}
|
|
10889
|
+
|
|
10890
|
+
if(webpeersMetadata[jsonMessage.topic].interval !== null) {
|
|
10891
|
+
webpeersMetadata[jsonMessage.topic].sdpAnswerReceived = true;
|
|
10892
|
+
}
|
|
10797
10893
|
startMedia(uiRemoteMedias[jsonMessage.topic]);
|
|
10798
10894
|
});
|
|
10799
10895
|
},
|
|
@@ -10862,9 +10958,12 @@
|
|
|
10862
10958
|
}
|
|
10863
10959
|
}
|
|
10864
10960
|
|
|
10865
|
-
|
|
10866
|
-
|
|
10867
|
-
|
|
10961
|
+
if(callStopQueue.callStarted) {
|
|
10962
|
+
sendCallMessage({
|
|
10963
|
+
id: 'CLOSE'
|
|
10964
|
+
});
|
|
10965
|
+
callStopQueue.callStarted = false;
|
|
10966
|
+
}
|
|
10868
10967
|
|
|
10869
10968
|
currentCallParams = {};
|
|
10870
10969
|
currentCallId = null;
|