@reactoo/watchtogether-sdk-js 2.7.86-beta.1 → 2.7.86
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.
|
@@ -11304,6 +11304,7 @@ class RoomSession {
|
|
|
11304
11304
|
return medianStats;
|
|
11305
11305
|
}
|
|
11306
11306
|
_parseVideoStats(participantsStats) {
|
|
11307
|
+
let statsToEmitt = [];
|
|
11307
11308
|
for (const sourceStats of participantsStats) {
|
|
11308
11309
|
for (const participantStats of sourceStats) {
|
|
11309
11310
|
var _handle$webrtcStuff4, _handle$webrtcStuff4$, _handle$webrtcStuff5, _handle$webrtcStuff5$, _decodeJanusDisplay12;
|
|
@@ -11364,7 +11365,7 @@ class RoomSession {
|
|
|
11364
11365
|
if (handle.webrtcStuff.stats[mid].length > this._statsMaxLength) {
|
|
11365
11366
|
handle.webrtcStuff.stats[mid].shift();
|
|
11366
11367
|
}
|
|
11367
|
-
|
|
11368
|
+
statsToEmitt.push({
|
|
11368
11369
|
handleId: participantStats.handleId,
|
|
11369
11370
|
stats,
|
|
11370
11371
|
userId: (_decodeJanusDisplay12 = (0,_models_utils__WEBPACK_IMPORTED_MODULE_2__.decodeJanusDisplay)(handle.userId)) === null || _decodeJanusDisplay12 === void 0 ? void 0 : _decodeJanusDisplay12.userId,
|
|
@@ -11373,81 +11374,8 @@ class RoomSession {
|
|
|
11373
11374
|
});
|
|
11374
11375
|
}
|
|
11375
11376
|
}
|
|
11377
|
+
this.emit('rtcStats', statsToEmitt);
|
|
11376
11378
|
}
|
|
11377
|
-
|
|
11378
|
-
// _parseVideoStats(participantsStats) {
|
|
11379
|
-
// participantsStats.forEach(sourceStats => {
|
|
11380
|
-
// sourceStats.forEach(participantStats => {
|
|
11381
|
-
// if(participantStats !== null && participantStats?.handle?.handleId !== this.handleId) {
|
|
11382
|
-
// let handle = this._getHandle(participantStats.handle.handleId);
|
|
11383
|
-
// if(handle) {
|
|
11384
|
-
//
|
|
11385
|
-
// if(!handle.webrtcStuff.stats[participantStats.mid]) {
|
|
11386
|
-
// handle.webrtcStuff.stats[participantStats.mid] = [];
|
|
11387
|
-
// }
|
|
11388
|
-
//
|
|
11389
|
-
// const stats = {
|
|
11390
|
-
// framesPerSecond: null,
|
|
11391
|
-
// framesDropped: null,
|
|
11392
|
-
// totalFreezesDuration: null,
|
|
11393
|
-
// freezeDurationSinceLast: null,
|
|
11394
|
-
// freezeCount: null,
|
|
11395
|
-
// jitter: null,
|
|
11396
|
-
// packetsLost: null,
|
|
11397
|
-
// nackCount: null,
|
|
11398
|
-
// roundTripTime: null,
|
|
11399
|
-
// width: null,
|
|
11400
|
-
// height: null,
|
|
11401
|
-
// networkType: null,
|
|
11402
|
-
// powerEfficientDecoder: null,
|
|
11403
|
-
// };
|
|
11404
|
-
// participantStats.stats.forEach(report => {
|
|
11405
|
-
//
|
|
11406
|
-
// const simulcastConfigForSource = this._findSimulcastConfig(participantStats.source, this.simulcastSettings);
|
|
11407
|
-
// const defaultSelectedSubstream = handle.webrtcStuff?.overriddenSimulcastMode[participantStats.mid]?.defaultSubstream ?? simulcastConfigForSource?.defaultSubstream;
|
|
11408
|
-
// const simulcastMode = handle.webrtcStuff?.overriddenSimulcastMode[participantStats.mid]?.mode ?? simulcastConfigForSource?.mode ;
|
|
11409
|
-
//
|
|
11410
|
-
// if(report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
11411
|
-
// stats.framesPerSecond = report.framesPerSecond || 0;
|
|
11412
|
-
// stats.framesDropped = report.framesDropped || 0;
|
|
11413
|
-
// stats.totalFreezesDuration = report.totalFreezesDuration || 0;
|
|
11414
|
-
// stats.freezeDurationSinceLast = (report.totalFreezesDuration || 0) - (handle.webrtcStuff.stats?.[participantStats.mid]?.[handle.webrtcStuff.stats?.[participantStats.mid]?.length - 1]?.totalFreezesDuration || 0);
|
|
11415
|
-
// stats.freezeCount = report.freezeCount || 0;
|
|
11416
|
-
// stats.freezeCountSinceLast = (report.freezeCount || 0) - (handle.webrtcStuff.stats?.[participantStats.mid]?.[handle.webrtcStuff.stats?.[participantStats.mid]?.length - 1]?.freezeCount || 0);
|
|
11417
|
-
// stats.jitter = report.jitter;
|
|
11418
|
-
// stats.packetsLost = report.packetsLost;
|
|
11419
|
-
// stats.nackCount = report.nackCount;
|
|
11420
|
-
// stats.width = report.frameWidth;
|
|
11421
|
-
// stats.height = report.frameHeight;
|
|
11422
|
-
// stats.powerEfficientDecoder = report.powerEfficientDecoder;
|
|
11423
|
-
// }
|
|
11424
|
-
// if(report.type === 'candidate-pair') {
|
|
11425
|
-
// stats.roundTripTime = report.currentRoundTripTime;
|
|
11426
|
-
// }
|
|
11427
|
-
// if(report.type === 'local-candidate') {
|
|
11428
|
-
// stats.networkType = report.networkType;
|
|
11429
|
-
// }
|
|
11430
|
-
//
|
|
11431
|
-
// stats.selectedSubstream = handle.webrtcStuff.selectedSubstream[participantStats.mid];
|
|
11432
|
-
// stats.desiredSubstream = defaultSelectedSubstream;
|
|
11433
|
-
// stats.simulcastMode = simulcastMode;
|
|
11434
|
-
//
|
|
11435
|
-
// });
|
|
11436
|
-
//
|
|
11437
|
-
// // pushing stats into handle stats array but keeping only 6 last stats
|
|
11438
|
-
// handle.webrtcStuff.stats[participantStats.mid].push(stats);
|
|
11439
|
-
// if(handle.webrtcStuff.stats[participantStats.mid].length > this._statsMaxLength) {
|
|
11440
|
-
// handle.webrtcStuff.stats[participantStats.mid].shift();
|
|
11441
|
-
// }
|
|
11442
|
-
//
|
|
11443
|
-
// this.emit('rtcStats', {handleId: participantStats.handle.handleId, stats, userId: decodeJanusDisplay(participantStats.handle.userId)?.userId, source: participantStats.source, mid: participantStats.mid});
|
|
11444
|
-
// }
|
|
11445
|
-
// }
|
|
11446
|
-
// });
|
|
11447
|
-
// })
|
|
11448
|
-
//
|
|
11449
|
-
// }
|
|
11450
|
-
|
|
11451
11379
|
_getStats() {
|
|
11452
11380
|
let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
11453
11381
|
return this._participants.reduce((promise, participant) => {
|
|
@@ -11496,33 +11424,6 @@ class RoomSession {
|
|
|
11496
11424
|
});
|
|
11497
11425
|
}, Promise.resolve([]));
|
|
11498
11426
|
}
|
|
11499
|
-
|
|
11500
|
-
// _getStats(type = null) {
|
|
11501
|
-
// return Promise.all(this._participants.map(participant => {
|
|
11502
|
-
// let mediaTrack = [];
|
|
11503
|
-
// if (type === 'video') {
|
|
11504
|
-
// mediaTrack = participant?.webrtcStuff?.stream?.getVideoTracks() || [];
|
|
11505
|
-
// } else if (type === 'audio') {
|
|
11506
|
-
// mediaTrack = participant?.webrtcStuff?.stream?.getAudioTracks() || [];
|
|
11507
|
-
// }
|
|
11508
|
-
// if(type !== null ) {
|
|
11509
|
-
// const transceivers = participant?.webrtcStuff?.pc?.getTransceivers();
|
|
11510
|
-
// return Promise.all(mediaTrack.map(track => {
|
|
11511
|
-
// const source = Object.keys(participant.webrtcStuff.streamMap).find(s => participant.webrtcStuff.streamMap[s].find(t => t === track.id));
|
|
11512
|
-
// const mid = transceivers.find(t => t.receiver?.track?.id === track.id || t.sender?.track?.id === track.id)?.mid;
|
|
11513
|
-
// return participant.webrtcStuff.pc.getStats(track)
|
|
11514
|
-
// .then(r =>({stats: r, source, mid, handleId: participant.handleId}))
|
|
11515
|
-
// .catch(e => Promise.reject({stats: null, error: e,handleId: participant.handleId, source, mid}))
|
|
11516
|
-
// }))
|
|
11517
|
-
// }
|
|
11518
|
-
// else {
|
|
11519
|
-
// return participant?.webrtcStuff?.pc?.getStats(null)
|
|
11520
|
-
// .then(r => ({handleId: participant.handleId, stats: r}))
|
|
11521
|
-
// .catch(e => Promise.reject({ handleId: participant.handleId, error: e}))
|
|
11522
|
-
// }
|
|
11523
|
-
// }))
|
|
11524
|
-
// }
|
|
11525
|
-
|
|
11526
11427
|
_resetStats(handleId, mid) {
|
|
11527
11428
|
let handle = this._getHandle(handleId);
|
|
11528
11429
|
if (handle) {
|