podchat-browser 10.14.6 → 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.6.js +54515 -54515
- package/dist/podchat-10.14.7.js +71078 -0
- package/package.json +2 -2
- package/src/chat.js +111 -14
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
|
@@ -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',
|
|
@@ -10207,6 +10211,23 @@
|
|
|
10207
10211
|
callTopics['receiveVideoTopic'] = 'Vi-' + receiveTopic;
|
|
10208
10212
|
callTopics['receiveAudioTopic'] = 'Vo-' + receiveTopic;
|
|
10209
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
|
+
|
|
10210
10231
|
callParentDiv = document.getElementById(callDivId);
|
|
10211
10232
|
|
|
10212
10233
|
// Local Video Tag
|
|
@@ -10297,8 +10318,10 @@
|
|
|
10297
10318
|
turnAddress: params.turnAddress.split(',')[0]
|
|
10298
10319
|
}, function (res) {
|
|
10299
10320
|
if (res.done === 'TRUE') {
|
|
10321
|
+
callStopQueue.callStarted = true;
|
|
10300
10322
|
generateAndSendSdpOffers(params);
|
|
10301
10323
|
} else if (res.done === 'SKIP') {
|
|
10324
|
+
callStopQueue.callStarted = true;
|
|
10302
10325
|
generateAndSendSdpOffers(params);
|
|
10303
10326
|
} else {
|
|
10304
10327
|
consoleLogging && console.log('CREATE_SESSION faced a problem', res);
|
|
@@ -10371,7 +10394,6 @@
|
|
|
10371
10394
|
|
|
10372
10395
|
// Video Topics
|
|
10373
10396
|
if (params.callVideo) {
|
|
10374
|
-
|
|
10375
10397
|
const sendVideoOptions = {
|
|
10376
10398
|
localVideo: uiRemoteMedias[callTopics['sendVideoTopic']],
|
|
10377
10399
|
mediaConstraints: {
|
|
@@ -10384,13 +10406,27 @@
|
|
|
10384
10406
|
},
|
|
10385
10407
|
iceTransportPolicy: 'relay',
|
|
10386
10408
|
onicecandidate: (candidate) => {
|
|
10387
|
-
|
|
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 () {
|
|
10388
10424
|
sendCallMessage({
|
|
10389
10425
|
id: 'ADD_ICE_CANDIDATE',
|
|
10390
10426
|
topic: callTopics['sendVideoTopic'],
|
|
10391
10427
|
candidateDto: candidate
|
|
10392
10428
|
})
|
|
10393
|
-
}, 2000, {candidate: candidate})
|
|
10429
|
+
}, 2000, {candidate: candidate});*/
|
|
10394
10430
|
},
|
|
10395
10431
|
configuration: {
|
|
10396
10432
|
iceServers: turnServers
|
|
@@ -10402,13 +10438,28 @@
|
|
|
10402
10438
|
mediaConstraints: {audio: false, video: true},
|
|
10403
10439
|
iceTransportPolicy: 'relay',
|
|
10404
10440
|
onicecandidate: (candidate) => {
|
|
10405
|
-
|
|
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 () {
|
|
10406
10457
|
sendCallMessage({
|
|
10407
10458
|
id: 'ADD_ICE_CANDIDATE',
|
|
10408
10459
|
topic: callTopics['receiveVideoTopic'],
|
|
10409
10460
|
candidateDto: candidate
|
|
10410
10461
|
})
|
|
10411
|
-
}, 2000, {candidate: candidate})
|
|
10462
|
+
}, 2000, {candidate: candidate});*/
|
|
10412
10463
|
},
|
|
10413
10464
|
configuration: {
|
|
10414
10465
|
iceServers: turnServers
|
|
@@ -10473,13 +10524,27 @@
|
|
|
10473
10524
|
mediaConstraints: {audio: true, video: false},
|
|
10474
10525
|
iceTransportPolicy: 'relay',
|
|
10475
10526
|
onicecandidate: (candidate) => {
|
|
10476
|
-
|
|
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 () {
|
|
10477
10542
|
sendCallMessage({
|
|
10478
10543
|
id: 'ADD_ICE_CANDIDATE',
|
|
10479
10544
|
topic: callTopics['sendAudioTopic'],
|
|
10480
10545
|
candidateDto: candidate,
|
|
10481
10546
|
})
|
|
10482
|
-
}, 2000, {candidate: candidate})
|
|
10547
|
+
}, 2000, {candidate: candidate});*/
|
|
10483
10548
|
},
|
|
10484
10549
|
configuration: {
|
|
10485
10550
|
iceServers: turnServers
|
|
@@ -10491,13 +10556,28 @@
|
|
|
10491
10556
|
mediaConstraints: {audio: true, video: false},
|
|
10492
10557
|
iceTransportPolicy: 'relay',
|
|
10493
10558
|
onicecandidate: (candidate) => {
|
|
10494
|
-
|
|
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 () {
|
|
10495
10575
|
sendCallMessage({
|
|
10496
10576
|
id: 'ADD_ICE_CANDIDATE',
|
|
10497
10577
|
topic: callTopics['receiveAudioTopic'],
|
|
10498
10578
|
candidateDto: candidate,
|
|
10499
10579
|
})
|
|
10500
|
-
}, 2000, {candidate: candidate})
|
|
10580
|
+
}, 2000, {candidate: candidate});*/
|
|
10501
10581
|
},
|
|
10502
10582
|
configuration: {
|
|
10503
10583
|
iceServers: turnServers
|
|
@@ -10555,9 +10635,19 @@
|
|
|
10555
10635
|
|
|
10556
10636
|
setTimeout(function () {
|
|
10557
10637
|
for (var peer in webpeers) {
|
|
10638
|
+
console.log("set callback on webpeers: ", peer);
|
|
10558
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
|
+
|
|
10559
10647
|
webpeers[peer].peerConnection.oniceconnectionstatechange = function () {
|
|
10648
|
+
console.log("on ice connection state change: ", peer, webpeers[peer].peerConnection.connectionState);
|
|
10560
10649
|
if (webpeers[peer].peerConnection.iceConnectionState == 'disconnected') {
|
|
10650
|
+
console.log( peer , '>>>>>>>>>>>>> disconnected');
|
|
10561
10651
|
fireEvent('callEvents', {
|
|
10562
10652
|
type: 'CALL_STATUS',
|
|
10563
10653
|
errorCode: 7000,
|
|
@@ -10573,7 +10663,7 @@
|
|
|
10573
10663
|
restartMedia(callTopics['sendVideoTopic'])
|
|
10574
10664
|
}, 6000);
|
|
10575
10665
|
|
|
10576
|
-
alert('Internet connection failed, Reconnect your call')
|
|
10666
|
+
alert('Internet connection failed, Reconnect your call');
|
|
10577
10667
|
/*shouldReconnectCallTimeout && clearTimeout(shouldReconnectCallTimeout);
|
|
10578
10668
|
shouldReconnectCallTimeout = setTimeout(function () {
|
|
10579
10669
|
shouldReconnectCall();
|
|
@@ -10608,7 +10698,7 @@
|
|
|
10608
10698
|
}
|
|
10609
10699
|
}
|
|
10610
10700
|
}
|
|
10611
|
-
},
|
|
10701
|
+
}, 6000);
|
|
10612
10702
|
|
|
10613
10703
|
setTimeout(function () {
|
|
10614
10704
|
restartMedia(callTopics['sendVideoTopic'])
|
|
@@ -10796,6 +10886,10 @@
|
|
|
10796
10886
|
|
|
10797
10887
|
return;
|
|
10798
10888
|
}
|
|
10889
|
+
|
|
10890
|
+
if(webpeersMetadata[jsonMessage.topic].interval !== null) {
|
|
10891
|
+
webpeersMetadata[jsonMessage.topic].sdpAnswerReceived = true;
|
|
10892
|
+
}
|
|
10799
10893
|
startMedia(uiRemoteMedias[jsonMessage.topic]);
|
|
10800
10894
|
});
|
|
10801
10895
|
},
|
|
@@ -10864,9 +10958,12 @@
|
|
|
10864
10958
|
}
|
|
10865
10959
|
}
|
|
10866
10960
|
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
|
|
10961
|
+
if(callStopQueue.callStarted) {
|
|
10962
|
+
sendCallMessage({
|
|
10963
|
+
id: 'CLOSE'
|
|
10964
|
+
});
|
|
10965
|
+
callStopQueue.callStarted = false;
|
|
10966
|
+
}
|
|
10870
10967
|
|
|
10871
10968
|
currentCallParams = {};
|
|
10872
10969
|
currentCallId = null;
|