podchat-browser 12.9.17 → 12.9.18-snapshot.1
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/node/buildConfig.json +1 -1
- package/dist/node/chat.js +1 -352
- package/dist/node/lib/call/multitrack/callManager.js +25 -99
- package/dist/node/lib/call/multitrack/midManager.js +45 -85
- package/dist/node/lib/store/history/historyItem.js +6 -0
- package/dist/podchat-browser-bundle.js +78 -412
- package/package.json +1 -1
- package/src/buildConfig.json +1 -1
- package/src/chat.js +0 -356
- package/src/lib/call/multitrack/callManager.js +3 -91
- package/src/lib/call/multitrack/midManager.js +6 -4
- package/src/lib/store/history/historyItem.js +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"12.9.
|
|
1
|
+
{"version":"12.9.18-snapshot.1","date":"۱۴۰۴/۶/۸","VersionInfo":"Release: false, Snapshot: true, Is For Test: true"}
|
package/dist/node/chat.js
CHANGED
|
@@ -4111,73 +4111,7 @@ function Chat(params) {
|
|
|
4111
4111
|
*/
|
|
4112
4112
|
startCacheDatabases = function startCacheDatabases(callback) {
|
|
4113
4113
|
(0, _deprecateMethods.printIsDeprecate)(_deprecateMethods.deprecatedString.startCacheDatabases.methodName);
|
|
4114
|
-
return;
|
|
4115
|
-
// queueDb = new Dexie('podQueues');
|
|
4116
|
-
//
|
|
4117
|
-
// queueDb.version(1)
|
|
4118
|
-
// .stores({
|
|
4119
|
-
// waitQ: '[owner+threadId+uniqueId], owner, threadId, uniqueId, message'
|
|
4120
|
-
// });
|
|
4121
|
-
//
|
|
4122
|
-
// if (enableCache) {
|
|
4123
|
-
// db = new Dexie('podChat');
|
|
4124
|
-
//
|
|
4125
|
-
// db.version(1)
|
|
4126
|
-
// .stores({
|
|
4127
|
-
// users: '&id, name, cellphoneNumber, keyId',
|
|
4128
|
-
// contacts: '[owner+id], id, owner, uniqueId, userId, cellphoneNumber, email, firstName, lastName, expireTime',
|
|
4129
|
-
// threads: '[owner+id] ,id, owner, title, time, pin, [owner+time]',
|
|
4130
|
-
// participants: '[owner+id], id, owner, threadId, notSeenDuration, admin, auditor, name, contactName, email, expireTime',
|
|
4131
|
-
// messages: '[owner+id], id, owner, threadId, time, [threadId+id], [threadId+owner+time]',
|
|
4132
|
-
// messageGaps: '[owner+id], [owner+waitsFor], id, waitsFor, owner, threadId, time, [threadId+owner+time]',
|
|
4133
|
-
// contentCount: 'threadId, contentCount'
|
|
4134
|
-
// });
|
|
4135
|
-
//
|
|
4136
|
-
// db.open()
|
|
4137
|
-
// .catch(function (e) {
|
|
4138
|
-
// consoleLogging && console.log('Open failed: ' + e.stack);
|
|
4139
|
-
// });
|
|
4140
|
-
//
|
|
4141
|
-
// db.on('ready', function () {
|
|
4142
|
-
// isCacheReady = true;
|
|
4143
|
-
// callback && callback();
|
|
4144
|
-
// }, true);
|
|
4145
|
-
//
|
|
4146
|
-
// db.on('versionchange', function (event) {
|
|
4147
|
-
// window.location.reload();
|
|
4148
|
-
// });
|
|
4149
|
-
// } else {
|
|
4150
|
-
// callback && callback();
|
|
4151
|
-
// }
|
|
4152
|
-
// } else {
|
|
4153
|
-
// consoleLogging && console.log(CHAT_ERRORS[6600]);
|
|
4154
|
-
// callback && callback();
|
|
4155
|
-
// }
|
|
4156
|
-
},
|
|
4157
|
-
|
|
4158
|
-
/**
|
|
4159
|
-
* Get Chat Send Queue
|
|
4160
|
-
*
|
|
4161
|
-
* This function returns chat send queue
|
|
4162
|
-
*
|
|
4163
|
-
* @access private
|
|
4164
|
-
*
|
|
4165
|
-
* @return {array} An array of messages on sendQueue
|
|
4166
|
-
*/
|
|
4167
|
-
getChatSendQueue = function getChatSendQueue(threadId, callback) {
|
|
4168
|
-
if (threadId) {
|
|
4169
|
-
var tempSendQueue = [];
|
|
4170
|
-
|
|
4171
|
-
for (var i = 0; i < chatSendQueue.length; i++) {
|
|
4172
|
-
if (chatSendQueue[i].threadId === threadId) {
|
|
4173
|
-
tempSendQueue.push(chatSendQueue[i]);
|
|
4174
|
-
}
|
|
4175
|
-
}
|
|
4176
|
-
|
|
4177
|
-
callback && callback(tempSendQueue);
|
|
4178
|
-
} else {
|
|
4179
|
-
callback && callback(chatSendQueue);
|
|
4180
|
-
}
|
|
4114
|
+
return;
|
|
4181
4115
|
},
|
|
4182
4116
|
|
|
4183
4117
|
/**
|
|
@@ -4237,291 +4171,6 @@ function Chat(params) {
|
|
|
4237
4171
|
// callback && callback([]);
|
|
4238
4172
|
// }
|
|
4239
4173
|
},
|
|
4240
|
-
|
|
4241
|
-
/**
|
|
4242
|
-
* Get Chat Upload Queue
|
|
4243
|
-
*
|
|
4244
|
-
* This function checks if cache is enabled on client's
|
|
4245
|
-
* machine, and if it is, retrieves uploadQueue from
|
|
4246
|
-
* cache. Otherwise returns uploadQueue from RAM
|
|
4247
|
-
*
|
|
4248
|
-
* @access private
|
|
4249
|
-
*
|
|
4250
|
-
* @return {array} An array of messages on uploadQueue
|
|
4251
|
-
*/
|
|
4252
|
-
getChatUploadQueue = function getChatUploadQueue(threadId, callback) {
|
|
4253
|
-
var uploadQ = [];
|
|
4254
|
-
|
|
4255
|
-
for (var i = 0; i < chatUploadQueue.length; i++) {
|
|
4256
|
-
if (parseInt(chatUploadQueue[i].message.subjectId) === threadId) {
|
|
4257
|
-
uploadQ.push(chatUploadQueue[i]);
|
|
4258
|
-
}
|
|
4259
|
-
}
|
|
4260
|
-
|
|
4261
|
-
callback && callback(uploadQ);
|
|
4262
|
-
},
|
|
4263
|
-
|
|
4264
|
-
/**
|
|
4265
|
-
* Delete an Item from Chat Send Queue
|
|
4266
|
-
*
|
|
4267
|
-
* This function gets an item and deletes it
|
|
4268
|
-
* from Chat Send Queue
|
|
4269
|
-
*
|
|
4270
|
-
* @access private
|
|
4271
|
-
*
|
|
4272
|
-
* @return {undefined}
|
|
4273
|
-
*/
|
|
4274
|
-
deleteFromChatSentQueue = function deleteFromChatSentQueue(item, callback) {
|
|
4275
|
-
for (var i = 0; i < chatSendQueue.length; i++) {
|
|
4276
|
-
if (chatSendQueue[i].message.uniqueId === item.message.uniqueId) {
|
|
4277
|
-
chatSendQueue.splice(i, 1);
|
|
4278
|
-
}
|
|
4279
|
-
}
|
|
4280
|
-
|
|
4281
|
-
callback && callback();
|
|
4282
|
-
},
|
|
4283
|
-
|
|
4284
|
-
/**
|
|
4285
|
-
* Delete an Item from Chat Wait Queue
|
|
4286
|
-
*
|
|
4287
|
-
* This function gets an item and deletes it
|
|
4288
|
-
* from Chat Wait Queue, from either cached
|
|
4289
|
-
* queue or the queue on RAM memory
|
|
4290
|
-
*
|
|
4291
|
-
* @access private
|
|
4292
|
-
*
|
|
4293
|
-
* @return {undefined}
|
|
4294
|
-
*/
|
|
4295
|
-
deleteFromChatWaitQueue = function deleteFromChatWaitQueue(item, callback) {
|
|
4296
|
-
for (var i = 0; i < chatWaitQueue.length; i++) {
|
|
4297
|
-
if (chatWaitQueue[i].uniqueId === item.uniqueId) {
|
|
4298
|
-
chatWaitQueue.splice(i, 1);
|
|
4299
|
-
}
|
|
4300
|
-
}
|
|
4301
|
-
|
|
4302
|
-
callback && callback();
|
|
4303
|
-
},
|
|
4304
|
-
|
|
4305
|
-
/**
|
|
4306
|
-
* Delete an Item from Chat Upload Queue
|
|
4307
|
-
*
|
|
4308
|
-
* This function gets an item and deletes it
|
|
4309
|
-
* from Chat Upload Queue
|
|
4310
|
-
*
|
|
4311
|
-
* @access private
|
|
4312
|
-
*
|
|
4313
|
-
* @return {undefined}
|
|
4314
|
-
*/
|
|
4315
|
-
deleteFromChatUploadQueue = function deleteFromChatUploadQueue(item, callback) {
|
|
4316
|
-
for (var i = 0; i < chatUploadQueue.length; i++) {
|
|
4317
|
-
if (chatUploadQueue[i].message.uniqueId === item.message.uniqueId) {
|
|
4318
|
-
chatUploadQueue.splice(i, 1);
|
|
4319
|
-
}
|
|
4320
|
-
}
|
|
4321
|
-
|
|
4322
|
-
callback && callback();
|
|
4323
|
-
},
|
|
4324
|
-
// deleteThreadFailedMessagesFromWaitQueue = function (threadId, callback) {
|
|
4325
|
-
// for (var i = 0; i < chatWaitQueue.length; i++) {
|
|
4326
|
-
// if (chatWaitQueue[i].uniqueId === item.uniqueId) {
|
|
4327
|
-
// chatWaitQueue.splice(i, 1);
|
|
4328
|
-
// }
|
|
4329
|
-
// }
|
|
4330
|
-
// callback && callback();
|
|
4331
|
-
// },
|
|
4332
|
-
|
|
4333
|
-
/**
|
|
4334
|
-
* Push Message Into Send Queue
|
|
4335
|
-
*
|
|
4336
|
-
* This functions takes a message and puts it
|
|
4337
|
-
* into chat's send queue
|
|
4338
|
-
*
|
|
4339
|
-
* @access private
|
|
4340
|
-
*
|
|
4341
|
-
* @param {object} params The Message and its callbacks to be enqueued
|
|
4342
|
-
*
|
|
4343
|
-
* @return {undefined}
|
|
4344
|
-
*/
|
|
4345
|
-
putInChatSendQueue = function putInChatSendQueue(params, callback, skip) {
|
|
4346
|
-
chatSendQueue.push(params);
|
|
4347
|
-
|
|
4348
|
-
if (!skip) {
|
|
4349
|
-
var time = new Date().getTime();
|
|
4350
|
-
params.message.time = time;
|
|
4351
|
-
params.message.timeNanos = time % 1000 * 1000000;
|
|
4352
|
-
putInChatWaitQueue(params.message, function () {
|
|
4353
|
-
callback && callback();
|
|
4354
|
-
});
|
|
4355
|
-
} else {
|
|
4356
|
-
callback && callback();
|
|
4357
|
-
}
|
|
4358
|
-
},
|
|
4359
|
-
|
|
4360
|
-
/**
|
|
4361
|
-
* Put an Item inside Chat Wait Queue
|
|
4362
|
-
*
|
|
4363
|
-
* This function takes an item and puts it
|
|
4364
|
-
* inside Chat Wait Queue, either on cached
|
|
4365
|
-
* wait queue or the wait queue on RAM memory
|
|
4366
|
-
*
|
|
4367
|
-
* @access private
|
|
4368
|
-
*
|
|
4369
|
-
* @return {undefined}
|
|
4370
|
-
*/
|
|
4371
|
-
putInChatWaitQueue = function putInChatWaitQueue(item, callback) {
|
|
4372
|
-
if (item.uniqueId !== '') {
|
|
4373
|
-
var waitQueueUniqueId = typeof item.uniqueId == 'string' ? item.uniqueId : Array.isArray(item.uniqueId) ? item.uniqueId[0] : null;
|
|
4374
|
-
|
|
4375
|
-
if (waitQueueUniqueId != null) {
|
|
4376
|
-
app.sdkParams.consoleLogging && console.log('Forced to use in memory cache');
|
|
4377
|
-
item.uniqueId = waitQueueUniqueId;
|
|
4378
|
-
chatWaitQueue.push(item);
|
|
4379
|
-
callback && callback();
|
|
4380
|
-
}
|
|
4381
|
-
}
|
|
4382
|
-
},
|
|
4383
|
-
getItemFromChatWaitQueue = function getItemFromChatWaitQueue(uniqueId, callback) {
|
|
4384
|
-
for (var i = 0; i < chatWaitQueue.length; i++) {
|
|
4385
|
-
if (chatWaitQueue[i].uniqueId === uniqueId) {
|
|
4386
|
-
var decryptedEnqueuedMessage = chatWaitQueue[i];
|
|
4387
|
-
var time = new Date().getTime();
|
|
4388
|
-
var message = (0, _dataFormatters.formatDataToMakeMessage)(decryptedEnqueuedMessage.threadId, {
|
|
4389
|
-
uniqueId: decryptedEnqueuedMessage.uniqueId,
|
|
4390
|
-
ownerId: app.store.user.get().id,
|
|
4391
|
-
message: decryptedEnqueuedMessage.content,
|
|
4392
|
-
metadata: decryptedEnqueuedMessage.metadata,
|
|
4393
|
-
systemMetadata: decryptedEnqueuedMessage.systemMetadata,
|
|
4394
|
-
replyInfo: decryptedEnqueuedMessage.replyInfo,
|
|
4395
|
-
forwardInfo: decryptedEnqueuedMessage.forwardInfo,
|
|
4396
|
-
participant: app.store.user.get(),
|
|
4397
|
-
time: time,
|
|
4398
|
-
timeNanos: time % 1000 * 1000000
|
|
4399
|
-
});
|
|
4400
|
-
callback && callback(message);
|
|
4401
|
-
break;
|
|
4402
|
-
}
|
|
4403
|
-
}
|
|
4404
|
-
},
|
|
4405
|
-
|
|
4406
|
-
/**
|
|
4407
|
-
* Put an Item inside Chat Upload Queue
|
|
4408
|
-
*
|
|
4409
|
-
* This function takes an item and puts it
|
|
4410
|
-
* inside Chat upload Queue
|
|
4411
|
-
*
|
|
4412
|
-
* @access private
|
|
4413
|
-
*
|
|
4414
|
-
* @return {undefined}
|
|
4415
|
-
*/
|
|
4416
|
-
putInChatUploadQueue = function putInChatUploadQueue(params, callback) {
|
|
4417
|
-
chatUploadQueue.push(params);
|
|
4418
|
-
callback && callback();
|
|
4419
|
-
},
|
|
4420
|
-
|
|
4421
|
-
/**
|
|
4422
|
-
* Transfer an Item from uploadQueue to sendQueue
|
|
4423
|
-
*
|
|
4424
|
-
* This function takes an uniqueId, finds that item
|
|
4425
|
-
* inside uploadQ. takes it's uploaded metadata and
|
|
4426
|
-
* attaches them to the message. Finally removes item
|
|
4427
|
-
* from uploadQueue and pushes it inside sendQueue
|
|
4428
|
-
*
|
|
4429
|
-
* @access private
|
|
4430
|
-
*
|
|
4431
|
-
* @return {undefined}
|
|
4432
|
-
*/
|
|
4433
|
-
// transferFromUploadQToSendQ = function (threadId, uniqueId, metadata, callback) {
|
|
4434
|
-
// getChatUploadQueue(threadId, function (uploadQueue) {
|
|
4435
|
-
// for (var i = 0; i < uploadQueue.length; i++) {
|
|
4436
|
-
// if (uploadQueue[i].message.uniqueId === uniqueId) {
|
|
4437
|
-
// try {
|
|
4438
|
-
// var message = uploadQueue[i].message,
|
|
4439
|
-
// callbacks = uploadQueue[i].callbacks;
|
|
4440
|
-
// let oldMetadata = JSON.parse(message.metadata),
|
|
4441
|
-
// newMetadata = JSON.parse(metadata);
|
|
4442
|
-
// var finalMetaData = Utility.objectDeepMerger(newMetadata, oldMetadata);
|
|
4443
|
-
//
|
|
4444
|
-
// if (typeof message !== 'undefined' && message && typeof message.content !== 'undefined' && message.content && message.content.hasOwnProperty('message')) {
|
|
4445
|
-
// message.content.message['metadata'] = JSON.stringify(finalMetaData);
|
|
4446
|
-
// }
|
|
4447
|
-
//
|
|
4448
|
-
// if (typeof message !== 'undefined' && message && typeof message.content !== 'undefined' && message.content && message.content.hasOwnProperty('metadata')) {
|
|
4449
|
-
// message.content['metadata'] = JSON.stringify(finalMetaData);
|
|
4450
|
-
// }
|
|
4451
|
-
//
|
|
4452
|
-
// if (message.chatMessageVOType === 21) {
|
|
4453
|
-
// getImageDownloadLinkFromPodspace({
|
|
4454
|
-
// hashCode: finalMetaData.fileHash
|
|
4455
|
-
// }, function (result) {
|
|
4456
|
-
// if (!result.hasError) {
|
|
4457
|
-
// message.content.image = result.downloadUrl;
|
|
4458
|
-
// }
|
|
4459
|
-
// });
|
|
4460
|
-
// }
|
|
4461
|
-
//
|
|
4462
|
-
// message.metadata = JSON.stringify(finalMetaData);
|
|
4463
|
-
// } catch (e) {
|
|
4464
|
-
// app.sdkParams.consoleLogging && console.log(e);
|
|
4465
|
-
// }
|
|
4466
|
-
// deleteFromChatUploadQueue(uploadQueue[i],
|
|
4467
|
-
// function () {
|
|
4468
|
-
// putInChatSendQueue({
|
|
4469
|
-
// message: message,
|
|
4470
|
-
// callbacks: callbacks
|
|
4471
|
-
// }, function () {
|
|
4472
|
-
// callback && callback();
|
|
4473
|
-
// }, true);
|
|
4474
|
-
// });
|
|
4475
|
-
// break;
|
|
4476
|
-
// }
|
|
4477
|
-
// }
|
|
4478
|
-
// });
|
|
4479
|
-
// },
|
|
4480
|
-
|
|
4481
|
-
/**
|
|
4482
|
-
* Decrypt Encrypted strings using secret key and salt
|
|
4483
|
-
*
|
|
4484
|
-
* @param string String to get decrypted
|
|
4485
|
-
* @param secret Cache Secret
|
|
4486
|
-
* @param salt Salt used while string was getting encrypted
|
|
4487
|
-
*
|
|
4488
|
-
* @return string Decrypted string
|
|
4489
|
-
*/
|
|
4490
|
-
chatDecrypt = function chatDecrypt(string, secret, salt) {
|
|
4491
|
-
var decryptedString = _utility["default"].decrypt(string, secret, salt);
|
|
4492
|
-
|
|
4493
|
-
if (!decryptedString.hasError) {
|
|
4494
|
-
return decryptedString.result;
|
|
4495
|
-
} else {
|
|
4496
|
-
/**
|
|
4497
|
-
* If there is a problem with decrypting cache
|
|
4498
|
-
* Some body is trying to decrypt cache with wrong key
|
|
4499
|
-
* or cacheSecret has been expired, so we should truncate
|
|
4500
|
-
* cache databases to avoid attacks.
|
|
4501
|
-
*
|
|
4502
|
-
* But before deleting cache database we should make
|
|
4503
|
-
* sure that cacheSecret has been retrieved from server
|
|
4504
|
-
* and is ready. If so, and cache is still not decryptable,
|
|
4505
|
-
* there is definitely something wrong with the key; so we are
|
|
4506
|
-
* good to go and delete cache databases.
|
|
4507
|
-
*/
|
|
4508
|
-
if (typeof secret !== 'undefined' && secret !== '') {
|
|
4509
|
-
if (db) {
|
|
4510
|
-
db.threads.where('owner').equals(parseInt(app.store.user.get().id)).count().then(function (threadsCount) {
|
|
4511
|
-
if (threadsCount > 0) {
|
|
4512
|
-
clearCacheDatabasesOfUser(function () {
|
|
4513
|
-
app.sdkParams.consoleLogging && console.log('All cache databases have been cleared.');
|
|
4514
|
-
});
|
|
4515
|
-
}
|
|
4516
|
-
})["catch"](function (e) {
|
|
4517
|
-
app.sdkParams.consoleLogging && console.log(e);
|
|
4518
|
-
});
|
|
4519
|
-
}
|
|
4520
|
-
}
|
|
4521
|
-
|
|
4522
|
-
return '{}';
|
|
4523
|
-
}
|
|
4524
|
-
},
|
|
4525
4174
|
setRoleToUser = function setRoleToUser(params, callback) {
|
|
4526
4175
|
var setRoleData = {
|
|
4527
4176
|
chatMessageVOType: _constants.chatMessageVOTypes.SET_ROLE_TO_USER,
|
|
@@ -610,8 +610,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
610
610
|
config.callServerController.setServers(callConfig.kurentoAddress);
|
|
611
611
|
createPeerManager('send');
|
|
612
612
|
createPeerManager('receive');
|
|
613
|
-
config.onChatReadyUniqueId = app.chatEvents.on('chatReady', socketConnectListener);
|
|
614
|
-
|
|
613
|
+
config.onChatReadyUniqueId = app.chatEvents.on('chatReady', socketConnectListener);
|
|
615
614
|
new Promise(function (resolve) {
|
|
616
615
|
var callVideo = typeof callConfig.video === 'boolean' ? callConfig.video : true,
|
|
617
616
|
callMute = typeof callConfig.mute === 'boolean' ? callConfig.mute : false;
|
|
@@ -688,9 +687,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
688
687
|
resolve();
|
|
689
688
|
}).then(function () {
|
|
690
689
|
app.call.currentCall().sendCallDivs();
|
|
691
|
-
});
|
|
692
|
-
// app.sdkParams.consoleLogging && console.log('No Call DIV has been declared!');
|
|
693
|
-
// }
|
|
690
|
+
});
|
|
694
691
|
}
|
|
695
692
|
|
|
696
693
|
function createSessionInChat() {
|
|
@@ -728,9 +725,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
728
725
|
});
|
|
729
726
|
app.call.endCall({
|
|
730
727
|
callId: app.call.currentCall().getCallId()
|
|
731
|
-
});
|
|
732
|
-
// endCall({callId: config.callId});
|
|
733
|
-
// callStop(true, true);
|
|
728
|
+
});
|
|
734
729
|
}
|
|
735
730
|
};
|
|
736
731
|
|
|
@@ -790,12 +785,11 @@ function MultiTrackCallManager(_ref) {
|
|
|
790
785
|
timeoutTime = _ref5$timeoutTime === void 0 ? 0 : _ref5$timeoutTime,
|
|
791
786
|
_ref5$timeoutRetriesC = _ref5.timeoutRetriesCount,
|
|
792
787
|
timeoutRetriesCount = _ref5$timeoutRetriesC === void 0 ? 0 : _ref5$timeoutRetriesC;
|
|
793
|
-
message.token = app.sdkParams.token;
|
|
788
|
+
message.token = app.sdkParams.token;
|
|
794
789
|
|
|
795
790
|
if (!message.uniqueId) {
|
|
796
791
|
message.uniqueId = _utility["default"].generateUUID();
|
|
797
|
-
}
|
|
798
|
-
|
|
792
|
+
}
|
|
799
793
|
|
|
800
794
|
message.chatId = config.callId;
|
|
801
795
|
var data = {
|
|
@@ -867,28 +861,18 @@ function MultiTrackCallManager(_ref) {
|
|
|
867
861
|
app.logger.log(app.logger.tags.CALL_PROCESS.id, "[media][RECEIVING_MEDIA][User] ", " clientId: ".concat(list[i].clientId, " , topic: ").concat(list[i].topic, " , item: , ").concat(list[i], ", ").concat({
|
|
868
862
|
userId: userId,
|
|
869
863
|
user: user
|
|
870
|
-
}));
|
|
864
|
+
}));
|
|
871
865
|
|
|
872
866
|
if (user) {
|
|
873
867
|
if (user.isScreenShare() && !config.screenShareInfo.iAmOwner() || !user.isMe()) {
|
|
874
|
-
user.processTrackChange(list[i]);
|
|
875
|
-
|
|
876
|
-
// }, 10);
|
|
877
|
-
} // else if (user.isMe()){
|
|
878
|
-
// config.sendPeerManager.removeRequestTimeoutByTopic(list[i].topic);
|
|
879
|
-
// config.sendPeerManager.processingCurrentTrackCompleted();
|
|
880
|
-
// }
|
|
881
|
-
|
|
868
|
+
user.processTrackChange(list[i]);
|
|
869
|
+
}
|
|
882
870
|
} else {
|
|
883
871
|
console.log('[media][RECEIVING_MEDIA] User not found in the call , clientIds: ', list[i]);
|
|
884
872
|
console.error('[SDK][handleReceivingTracksChanges] User not found in the call. ', list[i]);
|
|
885
873
|
}
|
|
886
874
|
}
|
|
887
|
-
}
|
|
888
|
-
// trackChangeTimeout = setTimeout(() => {
|
|
889
|
-
// config.receivePeerManager && config.receivePeerManager.maybeNextTrack();
|
|
890
|
-
// }, 10);
|
|
891
|
-
|
|
875
|
+
}
|
|
892
876
|
} catch (error) {
|
|
893
877
|
console.error('Unable to parse receive list', error);
|
|
894
878
|
}
|
|
@@ -910,8 +894,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
910
894
|
if (prevOffer == temp) {
|
|
911
895
|
console.warn('[media][handleProcessSdpOffer] same offers', {
|
|
912
896
|
prevOffer: prevOffer
|
|
913
|
-
}, jsonMessage.sdpOffer);
|
|
914
|
-
|
|
897
|
+
}, jsonMessage.sdpOffer);
|
|
915
898
|
config.receivePeerManager.handleProcessSDPOfferForReceiveTrackUseExsistingTracks(jsonMessage, null);
|
|
916
899
|
} else {
|
|
917
900
|
config.receivePeerManager.handleProcessSDPOfferForReceiveTrack(jsonMessage, null);
|
|
@@ -926,8 +909,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
926
909
|
config.receivePeerSdpVersion = jsonMessage.sdpVersion;
|
|
927
910
|
config.receivePeerManager.removeRequestTimeout(jsonMessage.uniqueId);
|
|
928
911
|
config.receivePeerManager.addNegotiationOfferToQueue(jsonMessage.sdpOffer, jsonMessage.topic);
|
|
929
|
-
config.receivePeerManager.maybeNextTrack();
|
|
930
|
-
// config.receivePeerManager.handleProcessSDPOfferForRenegotiate(jsonMessage, null);
|
|
912
|
+
config.receivePeerManager.maybeNextTrack();
|
|
931
913
|
}
|
|
932
914
|
|
|
933
915
|
var requestReceivingMediaTimeout = null;
|
|
@@ -947,13 +929,10 @@ function MultiTrackCallManager(_ref) {
|
|
|
947
929
|
function handleProcessLatestSdpOffer(jsonMessage) {
|
|
948
930
|
if (!config.receivePeerManager) return;
|
|
949
931
|
config.receivePeerSdpVersion = jsonMessage.sdpVersion;
|
|
950
|
-
config.receivePeerManager.removeRequestTimeout(jsonMessage.uniqueId);
|
|
951
|
-
// // config.receivePeerManager.removeRequestTimeout(jsonMessage.uniqueId);
|
|
932
|
+
config.receivePeerManager.removeRequestTimeout(jsonMessage.uniqueId);
|
|
952
933
|
|
|
953
934
|
if (jsonMessage.sdpOffer) {
|
|
954
|
-
config.receivePeerManager.addNegotiationOfferToQueue(jsonMessage.sdpOffer, []);
|
|
955
|
-
// requestReceivingMedia();
|
|
956
|
-
// });
|
|
935
|
+
config.receivePeerManager.addNegotiationOfferToQueue(jsonMessage.sdpOffer, []);
|
|
957
936
|
} else {
|
|
958
937
|
requestReceivingMedia();
|
|
959
938
|
}
|
|
@@ -973,17 +952,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
973
952
|
receivePeer: false
|
|
974
953
|
});
|
|
975
954
|
return;
|
|
976
|
-
}
|
|
977
|
-
// app.call.currentCall().sendCallMessage({
|
|
978
|
-
// id: "SEND_ADD_ICE_CANDIDATE",
|
|
979
|
-
// token: app.sdkParams.token,
|
|
980
|
-
// chatId: config.callId,
|
|
981
|
-
// brokerAddress: config.callConfig.brokerAddress,
|
|
982
|
-
//
|
|
983
|
-
// iceCandidate: JSON.stringify(candidate),
|
|
984
|
-
// }, null, {});
|
|
985
|
-
// };
|
|
986
|
-
|
|
955
|
+
}
|
|
987
956
|
|
|
988
957
|
peer.processAnswer(jsonMessage.sdpAnswer, function (err) {
|
|
989
958
|
if (err) {
|
|
@@ -1012,15 +981,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
1012
981
|
callId: config.callId,
|
|
1013
982
|
message: "Error: Skip, no WebRTC Peer ",
|
|
1014
983
|
info: getCallDetails()
|
|
1015
|
-
});
|
|
1016
|
-
// type: 'CALL_ERROR',
|
|
1017
|
-
// callId: config.callId,
|
|
1018
|
-
// code: 7000,
|
|
1019
|
-
// message: "[handleSendAddIceCandidate] Skip, no WebRTC Peer",
|
|
1020
|
-
// error: JSON.stringify(peer),
|
|
1021
|
-
// environmentDetails: getCallDetails()
|
|
1022
|
-
// });
|
|
1023
|
-
|
|
984
|
+
});
|
|
1024
985
|
return;
|
|
1025
986
|
}
|
|
1026
987
|
|
|
@@ -1028,8 +989,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
1028
989
|
var candidate = JSON.parse(jsonMessage.candidate);
|
|
1029
990
|
config.sendPeerManager.addIceCandidateToQueue(candidate);
|
|
1030
991
|
}
|
|
1031
|
-
}
|
|
1032
|
-
|
|
992
|
+
}
|
|
1033
993
|
|
|
1034
994
|
function handleReceiveAddIceCandidate(jsonMessage) {
|
|
1035
995
|
if (!config.receivePeerManager) return;
|
|
@@ -1040,15 +1000,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
1040
1000
|
callId: config.callId,
|
|
1041
1001
|
message: "Error: Skip, no WebRTC Peer ",
|
|
1042
1002
|
info: getCallDetails()
|
|
1043
|
-
});
|
|
1044
|
-
// type: 'CALL_ERROR',
|
|
1045
|
-
// callId: config.callId,
|
|
1046
|
-
// code: 7000,
|
|
1047
|
-
// message: "[handleReceiveAddIceCandidate] Skip, no WebRTC Peer",
|
|
1048
|
-
// error: JSON.stringify(peer),
|
|
1049
|
-
// environmentDetails: getCallDetails()
|
|
1050
|
-
// });
|
|
1051
|
-
|
|
1003
|
+
});
|
|
1052
1004
|
return;
|
|
1053
1005
|
}
|
|
1054
1006
|
|
|
@@ -1061,9 +1013,6 @@ function MultiTrackCallManager(_ref) {
|
|
|
1061
1013
|
function getCallDetails(customData) {
|
|
1062
1014
|
return _objectSpread({
|
|
1063
1015
|
currentUser: app.store.user.get(),
|
|
1064
|
-
// currentServers: {
|
|
1065
|
-
// callTurnIp: app.call.sharedVariables.callTurnIp,
|
|
1066
|
-
// },
|
|
1067
1016
|
isJanus: config.callId && config.callServerController.isJanus(),
|
|
1068
1017
|
screenShareInfo: {
|
|
1069
1018
|
isStarted: config.screenShareInfo.isStarted(),
|
|
@@ -1182,13 +1131,6 @@ function MultiTrackCallManager(_ref) {
|
|
|
1182
1131
|
if (message.done !== 'FALSE' || message.done === 'FALSE' && message.desc === 'duplicated') {
|
|
1183
1132
|
app.store.asyncRequestTimeouts[uniqueId] && clearTimeout(app.store.asyncRequestTimeouts[uniqueId]);
|
|
1184
1133
|
} else if (message.done === 'FALSE') {
|
|
1185
|
-
// app.chatEvents.fireEvent('callEvents', {
|
|
1186
|
-
// type: 'CALL_ERROR',
|
|
1187
|
-
// callId: config.callId,
|
|
1188
|
-
// code: 7000,
|
|
1189
|
-
// message: "Server error: " + (message.desc ? message.desc : message.message),
|
|
1190
|
-
// environmentDetails: getCallDetails()
|
|
1191
|
-
// });
|
|
1192
1134
|
app.logger.error(app.logger.tags.CALL_SERVER_MESSAGE.id, "[processCallMessage] ", {
|
|
1193
1135
|
callId: config.callId,
|
|
1194
1136
|
message: " Server error: " + (message.desc ? message.desc : message.message),
|
|
@@ -1198,8 +1140,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
1198
1140
|
type: 'CALL_SERVER_ERROR',
|
|
1199
1141
|
result: message
|
|
1200
1142
|
});
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1143
|
+
}
|
|
1203
1144
|
|
|
1204
1145
|
app.logger.log(app.logger.tags.CALL_SERVER_MESSAGE.id, "[".concat(message.id, "] "), message);
|
|
1205
1146
|
|
|
@@ -1244,10 +1185,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
1244
1185
|
app.store.messagesCallbacks[uniqueId](message);
|
|
1245
1186
|
} else {
|
|
1246
1187
|
handleProcessSdpNegotiate(message);
|
|
1247
|
-
}
|
|
1248
|
-
// config.canProcessSdpNegotiate = false;
|
|
1249
|
-
// }
|
|
1250
|
-
|
|
1188
|
+
}
|
|
1251
1189
|
|
|
1252
1190
|
break;
|
|
1253
1191
|
|
|
@@ -1258,9 +1196,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
1258
1196
|
app.store.messagesCallbacks[uniqueId](message);
|
|
1259
1197
|
} else {
|
|
1260
1198
|
handleProcessLatestSdpOffer(message);
|
|
1261
|
-
}
|
|
1262
|
-
// handleProcessSdpNegotiate(message);
|
|
1263
|
-
|
|
1199
|
+
}
|
|
1264
1200
|
|
|
1265
1201
|
break;
|
|
1266
1202
|
|
|
@@ -1274,7 +1210,8 @@ function MultiTrackCallManager(_ref) {
|
|
|
1274
1210
|
|
|
1275
1211
|
case 'JOIN_AADDITIONN_COMPLETE':
|
|
1276
1212
|
// For receive connections 2
|
|
1277
|
-
|
|
1213
|
+
// let topics = JSON.parse(message.topic);
|
|
1214
|
+
// let recvData = message.addition;
|
|
1278
1215
|
// if(recvData && recvData.length) {
|
|
1279
1216
|
// try {
|
|
1280
1217
|
// recvData = JSON.parse(recvData);
|
|
@@ -1292,7 +1229,6 @@ function MultiTrackCallManager(_ref) {
|
|
|
1292
1229
|
// config.users.get(userId).appendVideoToCallDiv();
|
|
1293
1230
|
// }
|
|
1294
1231
|
// }
|
|
1295
|
-
|
|
1296
1232
|
config.receivePeerManager && config.receivePeerManager.processingCurrentTrackCompleted(); // config.isReconnecting = false;
|
|
1297
1233
|
// config.receivePeerManager && requestReceivingMedia();
|
|
1298
1234
|
|
|
@@ -1600,7 +1536,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
1600
1536
|
height: config.screenShareInfo.getHeight()
|
|
1601
1537
|
}
|
|
1602
1538
|
}
|
|
1603
|
-
});
|
|
1539
|
+
});
|
|
1604
1540
|
}
|
|
1605
1541
|
};
|
|
1606
1542
|
|
|
@@ -1631,8 +1567,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
1631
1567
|
case 7:
|
|
1632
1568
|
if (config.screenShareInfo.isStarted() && config.screenShareInfo.getOwner() === messageContent[0].userId) {
|
|
1633
1569
|
config.users.removeItem("screenShare");
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1570
|
+
}
|
|
1636
1571
|
|
|
1637
1572
|
case 8:
|
|
1638
1573
|
if (!app.call.currentCall()) {
|
|
@@ -1822,14 +1757,6 @@ function MultiTrackCallManager(_ref) {
|
|
|
1822
1757
|
break;
|
|
1823
1758
|
|
|
1824
1759
|
case 12:
|
|
1825
|
-
// sendCallMessage({
|
|
1826
|
-
// id: 'REQUEST_RECEIVING_MEDIA',
|
|
1827
|
-
// token: app.sdkParams.token,
|
|
1828
|
-
// chatId: config.callId,
|
|
1829
|
-
// brokerAddress: config.callConfig.brokerAddress,
|
|
1830
|
-
// }, (result) => {
|
|
1831
|
-
// console.log('Response for 2 \'REQUEST_RECEIVING_MEDIA\'', {result});
|
|
1832
|
-
// }, {});
|
|
1833
1760
|
setTimeout(function () {
|
|
1834
1761
|
app.call.currentCall().sendCallDivs();
|
|
1835
1762
|
});
|
|
@@ -1916,8 +1843,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
1916
1843
|
}
|
|
1917
1844
|
}
|
|
1918
1845
|
});
|
|
1919
|
-
}
|
|
1920
|
-
|
|
1846
|
+
}
|
|
1921
1847
|
|
|
1922
1848
|
if (config.screenShareInfo.iAmOwner()) {
|
|
1923
1849
|
setTimeout(function () {
|