@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.
package/package.json
CHANGED
package/src/modules/wt-room.js
CHANGED
|
@@ -1788,6 +1788,9 @@ class RoomSession {
|
|
|
1788
1788
|
|
|
1789
1789
|
|
|
1790
1790
|
_parseVideoStats(participantsStats) {
|
|
1791
|
+
|
|
1792
|
+
let statsToEmitt = [];
|
|
1793
|
+
|
|
1791
1794
|
for (const sourceStats of participantsStats) {
|
|
1792
1795
|
|
|
1793
1796
|
for (const participantStats of sourceStats) {
|
|
@@ -1862,7 +1865,7 @@ class RoomSession {
|
|
|
1862
1865
|
handle.webrtcStuff.stats[mid].shift();
|
|
1863
1866
|
}
|
|
1864
1867
|
|
|
1865
|
-
|
|
1868
|
+
statsToEmitt.push({
|
|
1866
1869
|
handleId: participantStats.handleId,
|
|
1867
1870
|
stats,
|
|
1868
1871
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
@@ -1871,81 +1874,9 @@ class RoomSession {
|
|
|
1871
1874
|
});
|
|
1872
1875
|
}
|
|
1873
1876
|
}
|
|
1874
|
-
}
|
|
1875
|
-
|
|
1876
|
-
// _parseVideoStats(participantsStats) {
|
|
1877
|
-
// participantsStats.forEach(sourceStats => {
|
|
1878
|
-
// sourceStats.forEach(participantStats => {
|
|
1879
|
-
// if(participantStats !== null && participantStats?.handle?.handleId !== this.handleId) {
|
|
1880
|
-
// let handle = this._getHandle(participantStats.handle.handleId);
|
|
1881
|
-
// if(handle) {
|
|
1882
|
-
//
|
|
1883
|
-
// if(!handle.webrtcStuff.stats[participantStats.mid]) {
|
|
1884
|
-
// handle.webrtcStuff.stats[participantStats.mid] = [];
|
|
1885
|
-
// }
|
|
1886
|
-
//
|
|
1887
|
-
// const stats = {
|
|
1888
|
-
// framesPerSecond: null,
|
|
1889
|
-
// framesDropped: null,
|
|
1890
|
-
// totalFreezesDuration: null,
|
|
1891
|
-
// freezeDurationSinceLast: null,
|
|
1892
|
-
// freezeCount: null,
|
|
1893
|
-
// jitter: null,
|
|
1894
|
-
// packetsLost: null,
|
|
1895
|
-
// nackCount: null,
|
|
1896
|
-
// roundTripTime: null,
|
|
1897
|
-
// width: null,
|
|
1898
|
-
// height: null,
|
|
1899
|
-
// networkType: null,
|
|
1900
|
-
// powerEfficientDecoder: null,
|
|
1901
|
-
// };
|
|
1902
|
-
// participantStats.stats.forEach(report => {
|
|
1903
|
-
//
|
|
1904
|
-
// const simulcastConfigForSource = this._findSimulcastConfig(participantStats.source, this.simulcastSettings);
|
|
1905
|
-
// const defaultSelectedSubstream = handle.webrtcStuff?.overriddenSimulcastMode[participantStats.mid]?.defaultSubstream ?? simulcastConfigForSource?.defaultSubstream;
|
|
1906
|
-
// const simulcastMode = handle.webrtcStuff?.overriddenSimulcastMode[participantStats.mid]?.mode ?? simulcastConfigForSource?.mode ;
|
|
1907
|
-
//
|
|
1908
|
-
// if(report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
1909
|
-
// stats.framesPerSecond = report.framesPerSecond || 0;
|
|
1910
|
-
// stats.framesDropped = report.framesDropped || 0;
|
|
1911
|
-
// stats.totalFreezesDuration = report.totalFreezesDuration || 0;
|
|
1912
|
-
// stats.freezeDurationSinceLast = (report.totalFreezesDuration || 0) - (handle.webrtcStuff.stats?.[participantStats.mid]?.[handle.webrtcStuff.stats?.[participantStats.mid]?.length - 1]?.totalFreezesDuration || 0);
|
|
1913
|
-
// stats.freezeCount = report.freezeCount || 0;
|
|
1914
|
-
// stats.freezeCountSinceLast = (report.freezeCount || 0) - (handle.webrtcStuff.stats?.[participantStats.mid]?.[handle.webrtcStuff.stats?.[participantStats.mid]?.length - 1]?.freezeCount || 0);
|
|
1915
|
-
// stats.jitter = report.jitter;
|
|
1916
|
-
// stats.packetsLost = report.packetsLost;
|
|
1917
|
-
// stats.nackCount = report.nackCount;
|
|
1918
|
-
// stats.width = report.frameWidth;
|
|
1919
|
-
// stats.height = report.frameHeight;
|
|
1920
|
-
// stats.powerEfficientDecoder = report.powerEfficientDecoder;
|
|
1921
|
-
// }
|
|
1922
|
-
// if(report.type === 'candidate-pair') {
|
|
1923
|
-
// stats.roundTripTime = report.currentRoundTripTime;
|
|
1924
|
-
// }
|
|
1925
|
-
// if(report.type === 'local-candidate') {
|
|
1926
|
-
// stats.networkType = report.networkType;
|
|
1927
|
-
// }
|
|
1928
|
-
//
|
|
1929
|
-
// stats.selectedSubstream = handle.webrtcStuff.selectedSubstream[participantStats.mid];
|
|
1930
|
-
// stats.desiredSubstream = defaultSelectedSubstream;
|
|
1931
|
-
// stats.simulcastMode = simulcastMode;
|
|
1932
|
-
//
|
|
1933
|
-
// });
|
|
1934
|
-
//
|
|
1935
|
-
// // pushing stats into handle stats array but keeping only 6 last stats
|
|
1936
|
-
// handle.webrtcStuff.stats[participantStats.mid].push(stats);
|
|
1937
|
-
// if(handle.webrtcStuff.stats[participantStats.mid].length > this._statsMaxLength) {
|
|
1938
|
-
// handle.webrtcStuff.stats[participantStats.mid].shift();
|
|
1939
|
-
// }
|
|
1940
|
-
//
|
|
1941
|
-
// this.emit('rtcStats', {handleId: participantStats.handle.handleId, stats, userId: decodeJanusDisplay(participantStats.handle.userId)?.userId, source: participantStats.source, mid: participantStats.mid});
|
|
1942
|
-
// }
|
|
1943
|
-
// }
|
|
1944
|
-
// });
|
|
1945
|
-
// })
|
|
1946
|
-
//
|
|
1947
|
-
// }
|
|
1948
1877
|
|
|
1878
|
+
this.emit('rtcStats', statsToEmitt);
|
|
1879
|
+
}
|
|
1949
1880
|
|
|
1950
1881
|
_getStats(type = null) {
|
|
1951
1882
|
return this._participants.reduce((promise, participant) => {
|
|
@@ -1997,32 +1928,6 @@ class RoomSession {
|
|
|
1997
1928
|
}, Promise.resolve([]));
|
|
1998
1929
|
}
|
|
1999
1930
|
|
|
2000
|
-
// _getStats(type = null) {
|
|
2001
|
-
// return Promise.all(this._participants.map(participant => {
|
|
2002
|
-
// let mediaTrack = [];
|
|
2003
|
-
// if (type === 'video') {
|
|
2004
|
-
// mediaTrack = participant?.webrtcStuff?.stream?.getVideoTracks() || [];
|
|
2005
|
-
// } else if (type === 'audio') {
|
|
2006
|
-
// mediaTrack = participant?.webrtcStuff?.stream?.getAudioTracks() || [];
|
|
2007
|
-
// }
|
|
2008
|
-
// if(type !== null ) {
|
|
2009
|
-
// const transceivers = participant?.webrtcStuff?.pc?.getTransceivers();
|
|
2010
|
-
// return Promise.all(mediaTrack.map(track => {
|
|
2011
|
-
// const source = Object.keys(participant.webrtcStuff.streamMap).find(s => participant.webrtcStuff.streamMap[s].find(t => t === track.id));
|
|
2012
|
-
// const mid = transceivers.find(t => t.receiver?.track?.id === track.id || t.sender?.track?.id === track.id)?.mid;
|
|
2013
|
-
// return participant.webrtcStuff.pc.getStats(track)
|
|
2014
|
-
// .then(r =>({stats: r, source, mid, handleId: participant.handleId}))
|
|
2015
|
-
// .catch(e => Promise.reject({stats: null, error: e,handleId: participant.handleId, source, mid}))
|
|
2016
|
-
// }))
|
|
2017
|
-
// }
|
|
2018
|
-
// else {
|
|
2019
|
-
// return participant?.webrtcStuff?.pc?.getStats(null)
|
|
2020
|
-
// .then(r => ({handleId: participant.handleId, stats: r}))
|
|
2021
|
-
// .catch(e => Promise.reject({ handleId: participant.handleId, error: e}))
|
|
2022
|
-
// }
|
|
2023
|
-
// }))
|
|
2024
|
-
// }
|
|
2025
|
-
|
|
2026
1931
|
_resetStats(handleId, mid) {
|
|
2027
1932
|
let handle = this._getHandle(handleId);
|
|
2028
1933
|
if(handle) {
|