@reactoo/watchtogether-sdk-js 2.7.86-beta.2 → 2.7.87
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.
|
@@ -787,6 +787,9 @@ let roomSession = function (_ref, room, wt) {
|
|
|
787
787
|
get constructId() {
|
|
788
788
|
return room.constructId;
|
|
789
789
|
},
|
|
790
|
+
get role() {
|
|
791
|
+
return role;
|
|
792
|
+
},
|
|
790
793
|
// needs to be called before connect or it doesn't have any effect
|
|
791
794
|
changeUserRole: function (newRole) {
|
|
792
795
|
role = newRole;
|
|
@@ -11376,80 +11379,6 @@ class RoomSession {
|
|
|
11376
11379
|
}
|
|
11377
11380
|
this.emit('rtcStats', statsToEmitt);
|
|
11378
11381
|
}
|
|
11379
|
-
|
|
11380
|
-
// _parseVideoStats(participantsStats) {
|
|
11381
|
-
// participantsStats.forEach(sourceStats => {
|
|
11382
|
-
// sourceStats.forEach(participantStats => {
|
|
11383
|
-
// if(participantStats !== null && participantStats?.handle?.handleId !== this.handleId) {
|
|
11384
|
-
// let handle = this._getHandle(participantStats.handle.handleId);
|
|
11385
|
-
// if(handle) {
|
|
11386
|
-
//
|
|
11387
|
-
// if(!handle.webrtcStuff.stats[participantStats.mid]) {
|
|
11388
|
-
// handle.webrtcStuff.stats[participantStats.mid] = [];
|
|
11389
|
-
// }
|
|
11390
|
-
//
|
|
11391
|
-
// const stats = {
|
|
11392
|
-
// framesPerSecond: null,
|
|
11393
|
-
// framesDropped: null,
|
|
11394
|
-
// totalFreezesDuration: null,
|
|
11395
|
-
// freezeDurationSinceLast: null,
|
|
11396
|
-
// freezeCount: null,
|
|
11397
|
-
// jitter: null,
|
|
11398
|
-
// packetsLost: null,
|
|
11399
|
-
// nackCount: null,
|
|
11400
|
-
// roundTripTime: null,
|
|
11401
|
-
// width: null,
|
|
11402
|
-
// height: null,
|
|
11403
|
-
// networkType: null,
|
|
11404
|
-
// powerEfficientDecoder: null,
|
|
11405
|
-
// };
|
|
11406
|
-
// participantStats.stats.forEach(report => {
|
|
11407
|
-
//
|
|
11408
|
-
// const simulcastConfigForSource = this._findSimulcastConfig(participantStats.source, this.simulcastSettings);
|
|
11409
|
-
// const defaultSelectedSubstream = handle.webrtcStuff?.overriddenSimulcastMode[participantStats.mid]?.defaultSubstream ?? simulcastConfigForSource?.defaultSubstream;
|
|
11410
|
-
// const simulcastMode = handle.webrtcStuff?.overriddenSimulcastMode[participantStats.mid]?.mode ?? simulcastConfigForSource?.mode ;
|
|
11411
|
-
//
|
|
11412
|
-
// if(report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
11413
|
-
// stats.framesPerSecond = report.framesPerSecond || 0;
|
|
11414
|
-
// stats.framesDropped = report.framesDropped || 0;
|
|
11415
|
-
// stats.totalFreezesDuration = report.totalFreezesDuration || 0;
|
|
11416
|
-
// stats.freezeDurationSinceLast = (report.totalFreezesDuration || 0) - (handle.webrtcStuff.stats?.[participantStats.mid]?.[handle.webrtcStuff.stats?.[participantStats.mid]?.length - 1]?.totalFreezesDuration || 0);
|
|
11417
|
-
// stats.freezeCount = report.freezeCount || 0;
|
|
11418
|
-
// stats.freezeCountSinceLast = (report.freezeCount || 0) - (handle.webrtcStuff.stats?.[participantStats.mid]?.[handle.webrtcStuff.stats?.[participantStats.mid]?.length - 1]?.freezeCount || 0);
|
|
11419
|
-
// stats.jitter = report.jitter;
|
|
11420
|
-
// stats.packetsLost = report.packetsLost;
|
|
11421
|
-
// stats.nackCount = report.nackCount;
|
|
11422
|
-
// stats.width = report.frameWidth;
|
|
11423
|
-
// stats.height = report.frameHeight;
|
|
11424
|
-
// stats.powerEfficientDecoder = report.powerEfficientDecoder;
|
|
11425
|
-
// }
|
|
11426
|
-
// if(report.type === 'candidate-pair') {
|
|
11427
|
-
// stats.roundTripTime = report.currentRoundTripTime;
|
|
11428
|
-
// }
|
|
11429
|
-
// if(report.type === 'local-candidate') {
|
|
11430
|
-
// stats.networkType = report.networkType;
|
|
11431
|
-
// }
|
|
11432
|
-
//
|
|
11433
|
-
// stats.selectedSubstream = handle.webrtcStuff.selectedSubstream[participantStats.mid];
|
|
11434
|
-
// stats.desiredSubstream = defaultSelectedSubstream;
|
|
11435
|
-
// stats.simulcastMode = simulcastMode;
|
|
11436
|
-
//
|
|
11437
|
-
// });
|
|
11438
|
-
//
|
|
11439
|
-
// // pushing stats into handle stats array but keeping only 6 last stats
|
|
11440
|
-
// handle.webrtcStuff.stats[participantStats.mid].push(stats);
|
|
11441
|
-
// if(handle.webrtcStuff.stats[participantStats.mid].length > this._statsMaxLength) {
|
|
11442
|
-
// handle.webrtcStuff.stats[participantStats.mid].shift();
|
|
11443
|
-
// }
|
|
11444
|
-
//
|
|
11445
|
-
// this.emit('rtcStats', {handleId: participantStats.handle.handleId, stats, userId: decodeJanusDisplay(participantStats.handle.userId)?.userId, source: participantStats.source, mid: participantStats.mid});
|
|
11446
|
-
// }
|
|
11447
|
-
// }
|
|
11448
|
-
// });
|
|
11449
|
-
// })
|
|
11450
|
-
//
|
|
11451
|
-
// }
|
|
11452
|
-
|
|
11453
11382
|
_getStats() {
|
|
11454
11383
|
let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
11455
11384
|
return this._participants.reduce((promise, participant) => {
|
|
@@ -11498,33 +11427,6 @@ class RoomSession {
|
|
|
11498
11427
|
});
|
|
11499
11428
|
}, Promise.resolve([]));
|
|
11500
11429
|
}
|
|
11501
|
-
|
|
11502
|
-
// _getStats(type = null) {
|
|
11503
|
-
// return Promise.all(this._participants.map(participant => {
|
|
11504
|
-
// let mediaTrack = [];
|
|
11505
|
-
// if (type === 'video') {
|
|
11506
|
-
// mediaTrack = participant?.webrtcStuff?.stream?.getVideoTracks() || [];
|
|
11507
|
-
// } else if (type === 'audio') {
|
|
11508
|
-
// mediaTrack = participant?.webrtcStuff?.stream?.getAudioTracks() || [];
|
|
11509
|
-
// }
|
|
11510
|
-
// if(type !== null ) {
|
|
11511
|
-
// const transceivers = participant?.webrtcStuff?.pc?.getTransceivers();
|
|
11512
|
-
// return Promise.all(mediaTrack.map(track => {
|
|
11513
|
-
// const source = Object.keys(participant.webrtcStuff.streamMap).find(s => participant.webrtcStuff.streamMap[s].find(t => t === track.id));
|
|
11514
|
-
// const mid = transceivers.find(t => t.receiver?.track?.id === track.id || t.sender?.track?.id === track.id)?.mid;
|
|
11515
|
-
// return participant.webrtcStuff.pc.getStats(track)
|
|
11516
|
-
// .then(r =>({stats: r, source, mid, handleId: participant.handleId}))
|
|
11517
|
-
// .catch(e => Promise.reject({stats: null, error: e,handleId: participant.handleId, source, mid}))
|
|
11518
|
-
// }))
|
|
11519
|
-
// }
|
|
11520
|
-
// else {
|
|
11521
|
-
// return participant?.webrtcStuff?.pc?.getStats(null)
|
|
11522
|
-
// .then(r => ({handleId: participant.handleId, stats: r}))
|
|
11523
|
-
// .catch(e => Promise.reject({ handleId: participant.handleId, error: e}))
|
|
11524
|
-
// }
|
|
11525
|
-
// }))
|
|
11526
|
-
// }
|
|
11527
|
-
|
|
11528
11430
|
_resetStats(handleId, mid) {
|
|
11529
11431
|
let handle = this._getHandle(handleId);
|
|
11530
11432
|
if (handle) {
|