podchat-browser 12.9.19-snapshot.9 → 12.9.19
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 +21 -2
- package/dist/node/buildConfig.json +1 -1
- package/dist/node/call.module.js +47 -6
- package/dist/node/chat.js +66 -1
- package/dist/node/lib/call/multitrack/callManager.js +278 -24
- package/dist/node/lib/call/multitrack/midManager.js +40 -23
- package/dist/node/lib/call/multitrack/peerConnectionManager.js +6 -1
- package/dist/node/lib/chat/contacts/contactsV2.js +31 -18
- package/dist/node/lib/constants.js +1 -0
- package/dist/node/lib/distributeCache/index.js +79 -0
- package/dist/node/lib/errorHandler.js +4 -0
- package/dist/node/lib/store/contactsList.js +2 -1
- package/dist/podchat-browser-bundle.js +22905 -23016
- package/examples/index.html +1 -4
- package/package.json +4 -3
- package/src/buildConfig.json +1 -1
- package/src/call.module.js +45 -5
- package/src/chat.js +36 -1
- package/src/lib/call/multitrack/callManager.js +184 -8
- package/src/lib/call/multitrack/midManager.js +8 -0
- package/src/lib/call/multitrack/peerConnectionManager.js +6 -1
- package/src/lib/chat/contacts/contactsV2.js +31 -18
- package/src/lib/constants.js +2 -0
- package/src/lib/errorHandler.js +4 -0
- package/src/lib/store/contactsList.js +2 -2
package/changelog.md
CHANGED
|
@@ -5,7 +5,27 @@ to see complete list of changelog please visit [ChangeLog](http://gp.fanapsoft.i
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
-
## [12.9.
|
|
8
|
+
## [12.9.19] 30-05-2026
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Added possibility to get the original data from threads cache
|
|
12
|
+
- Added method reInit
|
|
13
|
+
- Implemented dataChannel for multitrack calls
|
|
14
|
+
- Added new callType other than normal callType for single user calls
|
|
15
|
+
- Added method getKurentoPeersQualityMetrics
|
|
16
|
+
- Added method getJanusPeersQualityMetrics
|
|
17
|
+
- Added possibility to startSendDataChannel when needed
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- Improved REMOVE_CALL_PARTICIPANT event type 95
|
|
21
|
+
- Fixed bug in method forceJoin
|
|
22
|
+
- Fixed bugs in new contact methods
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- Added uniqueId to new thread event
|
|
26
|
+
- Added field returnOriginalData to get originalData from cache
|
|
27
|
+
|
|
28
|
+
## [12.9.18] 05-01-2026
|
|
9
29
|
|
|
10
30
|
### Added
|
|
11
31
|
|
|
@@ -42,7 +62,6 @@ to see complete list of changelog please visit [ChangeLog](http://gp.fanapsoft.i
|
|
|
42
62
|
|
|
43
63
|
### Added
|
|
44
64
|
|
|
45
|
-
|
|
46
65
|
- Added optional in memory cache for getThreads
|
|
47
66
|
- Added optional in memory cache for getHistory
|
|
48
67
|
- Added cache for method getHistoryByMessageIdRange
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"12.9.19
|
|
1
|
+
{"version":"12.9.19","date":"۱۴۰۵/۳/۹","VersionInfo":"Release: true, Snapshot: false, Is For Test: false"}
|
package/dist/node/call.module.js
CHANGED
|
@@ -471,7 +471,7 @@ function ChatCall(app, params) {
|
|
|
471
471
|
|
|
472
472
|
|
|
473
473
|
function shouldNotProcessChatMessage(type, threadId) {
|
|
474
|
-
var restrictedMessageTypes = [_constants.chatMessageVOTypes.MUTE_CALL_PARTICIPANT, _constants.chatMessageVOTypes.UNMUTE_CALL_PARTICIPANT, _constants.chatMessageVOTypes.CALL_PARTICIPANT_JOINED, _constants.chatMessageVOTypes.REMOVE_CALL_PARTICIPANT, _constants.chatMessageVOTypes.RECONNECT, _constants.chatMessageVOTypes.TURN_OFF_VIDEO_CALL, _constants.chatMessageVOTypes.TURN_ON_VIDEO_CALL, _constants.chatMessageVOTypes.DESTINED_RECORD_CALL, _constants.chatMessageVOTypes.RECORD_CALL, _constants.chatMessageVOTypes.RECORD_CALL_STARTED, _constants.chatMessageVOTypes.END_RECORD_CALL, _constants.chatMessageVOTypes.TERMINATE_CALL, _constants.chatMessageVOTypes.CALL_STICKER_SYSTEM_MESSAGE, _constants.chatMessageVOTypes.CALL_RECORDING_FAILED, _constants.chatMessageVOTypes.RAISE_HAND, _constants.chatMessageVOTypes.LOWER_HAND, _constants.chatMessageVOTypes.SWITCH_TO_GROUP_CALL_REQUEST // chatMessageVOTypes.END_CALL
|
|
474
|
+
var restrictedMessageTypes = [_constants.chatMessageVOTypes.MUTE_CALL_PARTICIPANT, _constants.chatMessageVOTypes.UNMUTE_CALL_PARTICIPANT, _constants.chatMessageVOTypes.CALL_PARTICIPANT_JOINED, _constants.chatMessageVOTypes.REMOVE_CALL_PARTICIPANT, _constants.chatMessageVOTypes.RECONNECT, _constants.chatMessageVOTypes.TURN_OFF_VIDEO_CALL, _constants.chatMessageVOTypes.TURN_ON_VIDEO_CALL, _constants.chatMessageVOTypes.DESTINED_RECORD_CALL, _constants.chatMessageVOTypes.RECORD_CALL, _constants.chatMessageVOTypes.RECORD_CALL_STARTED, _constants.chatMessageVOTypes.END_RECORD_CALL, _constants.chatMessageVOTypes.TERMINATE_CALL, _constants.chatMessageVOTypes.CALL_STICKER_SYSTEM_MESSAGE, _constants.chatMessageVOTypes.CALL_RECORDING_FAILED, _constants.chatMessageVOTypes.RAISE_HAND, _constants.chatMessageVOTypes.LOWER_HAND, _constants.chatMessageVOTypes.SWITCH_TO_GROUP_CALL_REQUEST, _constants.chatMessageVOTypes.CALL_PARTICIPANT_FORCE_JOINED // chatMessageVOTypes.END_CALL
|
|
475
475
|
];
|
|
476
476
|
|
|
477
477
|
if ((!app.call.callStopQueue.callStarted || threadId != app.callsManager.currentCallId()) && restrictedMessageTypes.includes(type)) {
|
|
@@ -600,11 +600,6 @@ function ChatCall(app, params) {
|
|
|
600
600
|
|
|
601
601
|
break;
|
|
602
602
|
|
|
603
|
-
/**
|
|
604
|
-
* Type 263 Force Join
|
|
605
|
-
*/
|
|
606
|
-
|
|
607
|
-
case _constants.chatMessageVOTypes.FORCE_JOIN:
|
|
608
603
|
/**
|
|
609
604
|
* Type 74 Start Call (Start sender and receivers)
|
|
610
605
|
*/
|
|
@@ -1244,6 +1239,52 @@ function ChatCall(app, params) {
|
|
|
1244
1239
|
case _constants.chatMessageVOTypes.REMOVE_PERMISSION_FROM_CALL_PARTICIPANT:
|
|
1245
1240
|
app.call.adminMethods.onRemoveCallParticipantsPermission(uniqueId, messageContent, chatMessage, threadId);
|
|
1246
1241
|
break;
|
|
1242
|
+
|
|
1243
|
+
/**
|
|
1244
|
+
* Type 263 Force Join
|
|
1245
|
+
*/
|
|
1246
|
+
|
|
1247
|
+
case _constants.chatMessageVOTypes.FORCE_JOIN:
|
|
1248
|
+
if (app.call.currentCall()) {
|
|
1249
|
+
app.chatEvents.fireEvent('callEvents', {
|
|
1250
|
+
type: 'FORCE_JOINED_ELSEWHERE',
|
|
1251
|
+
callId: threadId,
|
|
1252
|
+
message: 'User force joined elsewhere',
|
|
1253
|
+
uniqueId: uniqueId
|
|
1254
|
+
});
|
|
1255
|
+
app.call.currentCall().forceSilentClose();
|
|
1256
|
+
app.callsManager.removeItem(app.callsManager.currentCallId());
|
|
1257
|
+
return;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
if (!callRequestController.canProcessStartCall(threadId)) {
|
|
1261
|
+
app.chatEvents.fireEvent('callEvents', {
|
|
1262
|
+
type: 'CALL_STARTED_ELSEWHERE',
|
|
1263
|
+
callId: threadId,
|
|
1264
|
+
message: 'Call already started somewhere else..., aborting...',
|
|
1265
|
+
uniqueId: uniqueId
|
|
1266
|
+
});
|
|
1267
|
+
return;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
callRequestController.iRequestedCall = false;
|
|
1271
|
+
callRequestController.iAcceptedCall = false;
|
|
1272
|
+
processChatStartCallEvent(chatMessage, type, messageContent, contentCount, threadId, uniqueId);
|
|
1273
|
+
break;
|
|
1274
|
+
|
|
1275
|
+
/**
|
|
1276
|
+
* Type 264 A user has forceJoined
|
|
1277
|
+
*/
|
|
1278
|
+
|
|
1279
|
+
case _constants.chatMessageVOTypes.CALL_PARTICIPANT_FORCE_JOINED:
|
|
1280
|
+
app.call.currentCall().updateParticipantsState();
|
|
1281
|
+
app.chatEvents.fireEvent('callEvents', {
|
|
1282
|
+
type: 'CALL_PARTICIPANT_FORCE_JOINED',
|
|
1283
|
+
callId: threadId,
|
|
1284
|
+
result: messageContent,
|
|
1285
|
+
uniqueId: uniqueId
|
|
1286
|
+
});
|
|
1287
|
+
break;
|
|
1247
1288
|
}
|
|
1248
1289
|
};
|
|
1249
1290
|
|
package/dist/node/chat.js
CHANGED
|
@@ -1901,6 +1901,7 @@ function Chat(params) {
|
|
|
1901
1901
|
case _constants.chatMessageVOTypes.RECEIVE_CALL_REQUEST:
|
|
1902
1902
|
case _constants.chatMessageVOTypes.START_CALL:
|
|
1903
1903
|
case _constants.chatMessageVOTypes.FORCE_JOIN:
|
|
1904
|
+
case _constants.chatMessageVOTypes.CALL_PARTICIPANT_FORCE_JOINED:
|
|
1904
1905
|
case _constants.chatMessageVOTypes.START_CALL_INSTANT:
|
|
1905
1906
|
case _constants.chatMessageVOTypes.END_CALL_REQUEST:
|
|
1906
1907
|
case _constants.chatMessageVOTypes.END_CALL:
|
|
@@ -8962,7 +8963,18 @@ function Chat(params) {
|
|
|
8962
8963
|
})), null, true, {});
|
|
8963
8964
|
}
|
|
8964
8965
|
|
|
8965
|
-
app.call.currentCall().sendCallData(params.jsonData);
|
|
8966
|
+
if (app.call.currentCall().sendCallData) app.call.currentCall().sendCallData(params.jsonData);
|
|
8967
|
+
};
|
|
8968
|
+
|
|
8969
|
+
publicized.startSendDataChannel = function (params, callback) {
|
|
8970
|
+
if (!app.call.currentCall()) {
|
|
8971
|
+
app.errorHandler.raiseError(app.errorHandler.getFilledErrorObject(_objectSpread(_objectSpread({}, _errorHandler.errorList.INVALID_CALLID), {}, {
|
|
8972
|
+
replacements: ['startSendDataChannel']
|
|
8973
|
+
})), callback, false, {});
|
|
8974
|
+
return;
|
|
8975
|
+
}
|
|
8976
|
+
|
|
8977
|
+
app.call.currentCall().startSendDataChannel();
|
|
8966
8978
|
};
|
|
8967
8979
|
|
|
8968
8980
|
publicized.getKurentoPeersQualityMetrics = /*#__PURE__*/function () {
|
|
@@ -9018,6 +9030,59 @@ function Chat(params) {
|
|
|
9018
9030
|
};
|
|
9019
9031
|
}();
|
|
9020
9032
|
|
|
9033
|
+
publicized.getJanusPeersQualityMetrics = /*#__PURE__*/function () {
|
|
9034
|
+
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(params, callback) {
|
|
9035
|
+
var parseData, metrics;
|
|
9036
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
9037
|
+
while (1) {
|
|
9038
|
+
switch (_context2.prev = _context2.next) {
|
|
9039
|
+
case 0:
|
|
9040
|
+
if (app.call.currentCall()) {
|
|
9041
|
+
_context2.next = 3;
|
|
9042
|
+
break;
|
|
9043
|
+
}
|
|
9044
|
+
|
|
9045
|
+
app.errorHandler.raiseError(app.errorHandler.getFilledErrorObject(_objectSpread(_objectSpread({}, _errorHandler.errorList.INVALID_CALLID), {}, {
|
|
9046
|
+
replacements: ['getJanusPeersQualityMetrics']
|
|
9047
|
+
})), callback, false, {});
|
|
9048
|
+
return _context2.abrupt("return");
|
|
9049
|
+
|
|
9050
|
+
case 3:
|
|
9051
|
+
parseData = params.parseData;
|
|
9052
|
+
|
|
9053
|
+
if (!app.call.currentCall().callServerController().isJanus()) {
|
|
9054
|
+
_context2.next = 11;
|
|
9055
|
+
break;
|
|
9056
|
+
}
|
|
9057
|
+
|
|
9058
|
+
_context2.next = 7;
|
|
9059
|
+
return app.call.currentCall().getJanusPeersQualityMetrics(parseData);
|
|
9060
|
+
|
|
9061
|
+
case 7:
|
|
9062
|
+
metrics = _context2.sent;
|
|
9063
|
+
callback && callback({
|
|
9064
|
+
hasEror: false,
|
|
9065
|
+
result: metrics
|
|
9066
|
+
});
|
|
9067
|
+
_context2.next = 12;
|
|
9068
|
+
break;
|
|
9069
|
+
|
|
9070
|
+
case 11:
|
|
9071
|
+
app.errorHandler.raiseError(_errorHandler.errorList.CALL_SERVER_IS_NOT_JANUS, callback, false, {});
|
|
9072
|
+
|
|
9073
|
+
case 12:
|
|
9074
|
+
case "end":
|
|
9075
|
+
return _context2.stop();
|
|
9076
|
+
}
|
|
9077
|
+
}
|
|
9078
|
+
}, _callee2);
|
|
9079
|
+
}));
|
|
9080
|
+
|
|
9081
|
+
return function (_x3, _x4) {
|
|
9082
|
+
return _ref5.apply(this, arguments);
|
|
9083
|
+
};
|
|
9084
|
+
}();
|
|
9085
|
+
|
|
9021
9086
|
publicized.reInit = function (config) {
|
|
9022
9087
|
app.messenger.stopChatPing();
|
|
9023
9088
|
params.socketAddress = config.socketAddress;
|
|
@@ -62,7 +62,10 @@ function MultiTrackCallManager(_ref) {
|
|
|
62
62
|
inquiryCallCounter: 0,
|
|
63
63
|
receivePeerReConnectTimes: 0,
|
|
64
64
|
ti: atob(callConfig.tInfo).split(":"),
|
|
65
|
-
callType: callConfig.callType
|
|
65
|
+
callType: callConfig.callType,
|
|
66
|
+
janusQualityMonitor: null,
|
|
67
|
+
silentEndCall: false,
|
|
68
|
+
sendDataChannelEnabled: false
|
|
66
69
|
};
|
|
67
70
|
var publicized = {
|
|
68
71
|
processCallMessage: processCallMessage,
|
|
@@ -285,11 +288,11 @@ function MultiTrackCallManager(_ref) {
|
|
|
285
288
|
}
|
|
286
289
|
|
|
287
290
|
function _correctWhenScreenOwnerChanged() {
|
|
288
|
-
_correctWhenScreenOwnerChanged = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
291
|
+
_correctWhenScreenOwnerChanged = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(_ref3) {
|
|
289
292
|
var inquiryResult, dataChangeDetected, screenOwnerChatId;
|
|
290
|
-
return _regenerator["default"].wrap(function
|
|
293
|
+
return _regenerator["default"].wrap(function _callee11$(_context12) {
|
|
291
294
|
while (1) {
|
|
292
|
-
switch (
|
|
295
|
+
switch (_context12.prev = _context12.next) {
|
|
293
296
|
case 0:
|
|
294
297
|
inquiryResult = _ref3.inquiryResult, dataChangeDetected = _ref3.dataChangeDetected;
|
|
295
298
|
screenOwnerChatId = config.users.findUserIdByClientId(Number(inquiryResult.screenShareUser));
|
|
@@ -302,11 +305,11 @@ function MultiTrackCallManager(_ref) {
|
|
|
302
305
|
// }
|
|
303
306
|
|
|
304
307
|
if (!config.users.userExists('screenShare')) {
|
|
305
|
-
|
|
308
|
+
_context12.next = 11;
|
|
306
309
|
break;
|
|
307
310
|
}
|
|
308
311
|
|
|
309
|
-
|
|
312
|
+
_context12.next = 10;
|
|
310
313
|
return config.users.removeItem('screenShare');
|
|
311
314
|
|
|
312
315
|
case 10:
|
|
@@ -317,10 +320,10 @@ function MultiTrackCallManager(_ref) {
|
|
|
317
320
|
|
|
318
321
|
case 12:
|
|
319
322
|
case "end":
|
|
320
|
-
return
|
|
323
|
+
return _context12.stop();
|
|
321
324
|
}
|
|
322
325
|
}
|
|
323
|
-
},
|
|
326
|
+
}, _callee11);
|
|
324
327
|
}));
|
|
325
328
|
return _correctWhenScreenOwnerChanged.apply(this, arguments);
|
|
326
329
|
}
|
|
@@ -539,7 +542,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
539
542
|
sendPeerFailed && createPeerManager('send');
|
|
540
543
|
setTimeout(function () {
|
|
541
544
|
if (sendPeerFailed) {
|
|
542
|
-
if (app.sdkParams.callOptions.enableDataChannel) {
|
|
545
|
+
if (app.sdkParams.callOptions.enableDataChannel && config.sendDataChannelEnabled) {
|
|
543
546
|
config.sendPeerManager.startDataChannel();
|
|
544
547
|
config.sendPeerManager.addTrack({
|
|
545
548
|
topic: "data-channel-".concat(config.callId, "-").concat(config.users.get(app.store.user.get().id).user().clientId),
|
|
@@ -793,7 +796,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
793
796
|
|
|
794
797
|
_i = _context2.t1.value;
|
|
795
798
|
_context2.next = 5;
|
|
796
|
-
return checkTURNServer(serversTemp[_i].split(":")[0], '3478', true, config.ti[0], config.ti[1],
|
|
799
|
+
return checkTURNServer(serversTemp[_i].split(":")[0], '3478', true, config.ti[0], config.ti[1], 4000);
|
|
797
800
|
|
|
798
801
|
case 5:
|
|
799
802
|
turnCheckRes = _context2.sent;
|
|
@@ -877,9 +880,8 @@ function MultiTrackCallManager(_ref) {
|
|
|
877
880
|
var user = config.users.get(app.store.user.get().id); //Start my own senders
|
|
878
881
|
|
|
879
882
|
if (app.sdkParams.callOptions.enableDataChannel) {
|
|
880
|
-
config.receivePeerManager.startDataChannel();
|
|
881
|
-
|
|
882
|
-
user.startDataChannel();
|
|
883
|
+
config.receivePeerManager.startDataChannel(); // config.sendPeerManager.startDataChannel();
|
|
884
|
+
// user.startDataChannel();
|
|
883
885
|
}
|
|
884
886
|
|
|
885
887
|
if (user.user().video) {
|
|
@@ -916,24 +918,24 @@ function MultiTrackCallManager(_ref) {
|
|
|
916
918
|
}
|
|
917
919
|
|
|
918
920
|
function _callStop() {
|
|
919
|
-
_callStop = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
921
|
+
_callStop = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
920
922
|
var resetCurrentCallId,
|
|
921
923
|
resetCameraPaused,
|
|
922
|
-
|
|
923
|
-
return _regenerator["default"].wrap(function
|
|
924
|
+
_args13 = arguments;
|
|
925
|
+
return _regenerator["default"].wrap(function _callee12$(_context13) {
|
|
924
926
|
while (1) {
|
|
925
|
-
switch (
|
|
927
|
+
switch (_context13.prev = _context13.next) {
|
|
926
928
|
case 0:
|
|
927
|
-
resetCurrentCallId =
|
|
928
|
-
resetCameraPaused =
|
|
929
|
-
|
|
929
|
+
resetCurrentCallId = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : true;
|
|
930
|
+
resetCameraPaused = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : true;
|
|
931
|
+
_context13.next = 4;
|
|
930
932
|
return config.users.destroy();
|
|
931
933
|
|
|
932
934
|
case 4:
|
|
933
935
|
config.sendPeerManager && config.sendPeerManager.destroy();
|
|
934
936
|
config.receivePeerManager && config.receivePeerManager.destroy();
|
|
935
937
|
|
|
936
|
-
if (app.call.callStopQueue.callStarted) {
|
|
938
|
+
if (app.call.callStopQueue.callStarted && !config.silentEndCall) {
|
|
937
939
|
sendCallMessage({
|
|
938
940
|
id: 'EXIT_CLIENT',
|
|
939
941
|
token: app.sdkParams.token
|
|
@@ -948,10 +950,10 @@ function MultiTrackCallManager(_ref) {
|
|
|
948
950
|
|
|
949
951
|
case 11:
|
|
950
952
|
case "end":
|
|
951
|
-
return
|
|
953
|
+
return _context13.stop();
|
|
952
954
|
}
|
|
953
955
|
}
|
|
954
|
-
},
|
|
956
|
+
}, _callee12);
|
|
955
957
|
}));
|
|
956
958
|
return _callStop.apply(this, arguments);
|
|
957
959
|
}
|
|
@@ -1409,7 +1411,7 @@ function MultiTrackCallManager(_ref) {
|
|
|
1409
1411
|
// config.users.get(userId).appendVideoToCallDiv();
|
|
1410
1412
|
// }
|
|
1411
1413
|
// }
|
|
1412
|
-
config.receivePeerManager.removeRequestTimeout(uniqueId);
|
|
1414
|
+
config.receivePeerManager && config.receivePeerManager.removeRequestTimeout(uniqueId);
|
|
1413
1415
|
config.receivePeerManager && config.receivePeerManager.processingCurrentTrackCompleted(); // config.isReconnecting = false;
|
|
1414
1416
|
// config.receivePeerManager && requestReceivingMedia();
|
|
1415
1417
|
|
|
@@ -2222,6 +2224,258 @@ function MultiTrackCallManager(_ref) {
|
|
|
2222
2224
|
config.sendPeerManager.sendCallData(jsonData);
|
|
2223
2225
|
};
|
|
2224
2226
|
|
|
2227
|
+
publicized.startSendDataChannel = function () {
|
|
2228
|
+
config.sendDataChannelEnabled = true;
|
|
2229
|
+
config.sendPeerManager.startDataChannel();
|
|
2230
|
+
config.sendPeerManager.addTrack({
|
|
2231
|
+
topic: "data-channel-".concat(config.callId, "-").concat(config.users.get(app.store.user.get().id).user().clientId),
|
|
2232
|
+
mediaType: 3,
|
|
2233
|
+
//currentTrackId: stream.getTracks()[0].id,
|
|
2234
|
+
clientId: config.users.get(app.store.user.get().id).user().clientId,
|
|
2235
|
+
onTrackCallback: function onTrackCallback() {}
|
|
2236
|
+
});
|
|
2237
|
+
};
|
|
2238
|
+
|
|
2239
|
+
function createJanusQualityMonitor() {
|
|
2240
|
+
var prev = new Map();
|
|
2241
|
+
|
|
2242
|
+
function calcBitrate(id, bytes, now) {
|
|
2243
|
+
var last = prev.get(id);
|
|
2244
|
+
|
|
2245
|
+
if (!last) {
|
|
2246
|
+
prev.set(id, {
|
|
2247
|
+
bytes: bytes,
|
|
2248
|
+
time: now
|
|
2249
|
+
});
|
|
2250
|
+
return null;
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
var bitrate = (bytes - last.bytes) * 8 / ((now - last.time) / 1000);
|
|
2254
|
+
prev.set(id, {
|
|
2255
|
+
bytes: bytes,
|
|
2256
|
+
time: now
|
|
2257
|
+
});
|
|
2258
|
+
return bitrate;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
function calcLoss(pLost, pRecv) {
|
|
2262
|
+
var total = pLost + pRecv;
|
|
2263
|
+
if (total === 0) return 0;
|
|
2264
|
+
return pLost / total * 100;
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
function trackId(report) {
|
|
2268
|
+
return "".concat(report.kind, "_").concat(report.ssrc, "_").concat(report.mid || "x");
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
function parsePc(_x16, _x17, _x18) {
|
|
2272
|
+
return _parsePc.apply(this, arguments);
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
function _parsePc() {
|
|
2276
|
+
_parsePc = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(pc, type, parseData) {
|
|
2277
|
+
var stats, now, out;
|
|
2278
|
+
return _regenerator["default"].wrap(function _callee9$(_context10) {
|
|
2279
|
+
while (1) {
|
|
2280
|
+
switch (_context10.prev = _context10.next) {
|
|
2281
|
+
case 0:
|
|
2282
|
+
_context10.next = 2;
|
|
2283
|
+
return pc.getStats();
|
|
2284
|
+
|
|
2285
|
+
case 2:
|
|
2286
|
+
stats = _context10.sent;
|
|
2287
|
+
now = Date.now();
|
|
2288
|
+
|
|
2289
|
+
if (parseData) {
|
|
2290
|
+
_context10.next = 8;
|
|
2291
|
+
break;
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
return _context10.abrupt("return", stats);
|
|
2295
|
+
|
|
2296
|
+
case 8:
|
|
2297
|
+
out = {
|
|
2298
|
+
connection: {},
|
|
2299
|
+
tracks: {}
|
|
2300
|
+
};
|
|
2301
|
+
stats.forEach(function (report) {
|
|
2302
|
+
// ---------- CONNECTION ----------
|
|
2303
|
+
if (report.type === "candidate-pair" && report.state === "succeeded") {
|
|
2304
|
+
out.connection.rtt = report.currentRoundTripTime;
|
|
2305
|
+
} // ---------- INBOUND (RECV) ----------
|
|
2306
|
+
|
|
2307
|
+
|
|
2308
|
+
if (report.type === "inbound-rtp" && !report.isRemote) {
|
|
2309
|
+
var id = trackId(report);
|
|
2310
|
+
if (!out.tracks[id]) out.tracks[id] = {
|
|
2311
|
+
kind: report.kind
|
|
2312
|
+
};
|
|
2313
|
+
var t = out.tracks[id];
|
|
2314
|
+
t.direction = "recv"; // jitter
|
|
2315
|
+
|
|
2316
|
+
t.jitter = report.jitter; // loss
|
|
2317
|
+
|
|
2318
|
+
if (report.packetsLost != null && report.packetsReceived != null) {
|
|
2319
|
+
t.loss = calcLoss(report.packetsLost, report.packetsReceived);
|
|
2320
|
+
} // bitrate
|
|
2321
|
+
|
|
2322
|
+
|
|
2323
|
+
if (report.bytesReceived != null) {
|
|
2324
|
+
t.bitrate = calcBitrate(report.id, report.bytesReceived, now);
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
if (report.kind === "video") {
|
|
2328
|
+
t.fps = report.framesPerSecond;
|
|
2329
|
+
t.frameDrops = report.framesDropped;
|
|
2330
|
+
}
|
|
2331
|
+
} // ---------- OUTBOUND (SEND) ----------
|
|
2332
|
+
|
|
2333
|
+
|
|
2334
|
+
if (report.type === "outbound-rtp") {
|
|
2335
|
+
var _id = trackId(report);
|
|
2336
|
+
|
|
2337
|
+
if (!out.tracks[_id]) out.tracks[_id] = {
|
|
2338
|
+
kind: report.kind
|
|
2339
|
+
};
|
|
2340
|
+
var _t = out.tracks[_id];
|
|
2341
|
+
_t.direction = "send";
|
|
2342
|
+
|
|
2343
|
+
if (report.bytesSent != null) {
|
|
2344
|
+
_t.bitrate = calcBitrate(report.id, report.bytesSent, now);
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
if (report.kind === "video") {
|
|
2348
|
+
_t.fps = report.framesPerSecond;
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
if (report.qualityLimitationReason) {
|
|
2352
|
+
_t.qualityLimitation = report.qualityLimitationReason;
|
|
2353
|
+
}
|
|
2354
|
+
} // ---------- REMOTE (SEND LOSS) ----------
|
|
2355
|
+
|
|
2356
|
+
|
|
2357
|
+
if (report.type === "remote-inbound-rtp") {
|
|
2358
|
+
var _id2 = trackId(report);
|
|
2359
|
+
|
|
2360
|
+
if (!out.tracks[_id2]) out.tracks[_id2] = {
|
|
2361
|
+
kind: report.kind
|
|
2362
|
+
};
|
|
2363
|
+
var _t2 = out.tracks[_id2]; // jitter
|
|
2364
|
+
|
|
2365
|
+
_t2.jitter = report.jitter;
|
|
2366
|
+
|
|
2367
|
+
if (report.fractionLost != null) {
|
|
2368
|
+
_t2.loss = report.fractionLost / 256 * 100;
|
|
2369
|
+
} else if (report.packetsLost != null) {
|
|
2370
|
+
_t2.loss = report.packetsLost; // fallback
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2373
|
+
if (report.roundTripTime) {
|
|
2374
|
+
out.connection.rtt = report.roundTripTime;
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
});
|
|
2378
|
+
return _context10.abrupt("return", out);
|
|
2379
|
+
|
|
2380
|
+
case 11:
|
|
2381
|
+
case "end":
|
|
2382
|
+
return _context10.stop();
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
}, _callee9);
|
|
2386
|
+
}));
|
|
2387
|
+
return _parsePc.apply(this, arguments);
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
function getStats(_x19) {
|
|
2391
|
+
return _getStats.apply(this, arguments);
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
function _getStats() {
|
|
2395
|
+
_getStats = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(parseData) {
|
|
2396
|
+
var sendPc, recvPc, send, recv;
|
|
2397
|
+
return _regenerator["default"].wrap(function _callee10$(_context11) {
|
|
2398
|
+
while (1) {
|
|
2399
|
+
switch (_context11.prev = _context11.next) {
|
|
2400
|
+
case 0:
|
|
2401
|
+
sendPc = config.sendPeerManager.getPeer().peerConnection;
|
|
2402
|
+
recvPc = config.receivePeerManager.getPeer().peerConnection;
|
|
2403
|
+
|
|
2404
|
+
if (!sendPc) {
|
|
2405
|
+
_context11.next = 8;
|
|
2406
|
+
break;
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
_context11.next = 5;
|
|
2410
|
+
return parsePc(sendPc, "send", parseData);
|
|
2411
|
+
|
|
2412
|
+
case 5:
|
|
2413
|
+
_context11.t0 = _context11.sent;
|
|
2414
|
+
_context11.next = 9;
|
|
2415
|
+
break;
|
|
2416
|
+
|
|
2417
|
+
case 8:
|
|
2418
|
+
_context11.t0 = null;
|
|
2419
|
+
|
|
2420
|
+
case 9:
|
|
2421
|
+
send = _context11.t0;
|
|
2422
|
+
|
|
2423
|
+
if (!recvPc) {
|
|
2424
|
+
_context11.next = 16;
|
|
2425
|
+
break;
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
_context11.next = 13;
|
|
2429
|
+
return parsePc(recvPc, "recv", parseData);
|
|
2430
|
+
|
|
2431
|
+
case 13:
|
|
2432
|
+
_context11.t1 = _context11.sent;
|
|
2433
|
+
_context11.next = 17;
|
|
2434
|
+
break;
|
|
2435
|
+
|
|
2436
|
+
case 16:
|
|
2437
|
+
_context11.t1 = null;
|
|
2438
|
+
|
|
2439
|
+
case 17:
|
|
2440
|
+
recv = _context11.t1;
|
|
2441
|
+
return _context11.abrupt("return", {
|
|
2442
|
+
send: send,
|
|
2443
|
+
recv: recv
|
|
2444
|
+
});
|
|
2445
|
+
|
|
2446
|
+
case 19:
|
|
2447
|
+
case "end":
|
|
2448
|
+
return _context11.stop();
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
}, _callee10);
|
|
2452
|
+
}));
|
|
2453
|
+
return _getStats.apply(this, arguments);
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
return {
|
|
2457
|
+
getStats: getStats
|
|
2458
|
+
};
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
publicized.getJanusPeersQualityMetrics = function () {
|
|
2462
|
+
var parseData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2463
|
+
if (!config.janusQualityMonitor) config.janusQualityMonitor = createJanusQualityMonitor();
|
|
2464
|
+
return config.janusQualityMonitor.getStats(parseData);
|
|
2465
|
+
};
|
|
2466
|
+
|
|
2467
|
+
publicized.forceSilentClose = function () {
|
|
2468
|
+
config.silentEndCall = true; // publicized.destroy();
|
|
2469
|
+
};
|
|
2470
|
+
|
|
2471
|
+
publicized.isForceSilentClose = function () {
|
|
2472
|
+
return config.silentEndCall;
|
|
2473
|
+
};
|
|
2474
|
+
|
|
2475
|
+
publicized.updateParticipantsState = function () {
|
|
2476
|
+
socketConnectListener();
|
|
2477
|
+
};
|
|
2478
|
+
|
|
2225
2479
|
setTimeout(function () {
|
|
2226
2480
|
startCallWebRTCFunctions(config.callConfig);
|
|
2227
2481
|
}, 50);
|