feat(rtcstats): switch to rtcstats v3 protocol (#8989)
* use new rtcstats clinet * add room name to identity * update rtcstats version
This commit is contained in:
parent
12552766ce
commit
96e886d306
|
@ -15059,10 +15059,11 @@
|
|||
}
|
||||
},
|
||||
"rtcstats": {
|
||||
"version": "github:jitsi/rtcstats#0597c6a928f321d3cdec947d877012b7e8c2f1dc",
|
||||
"from": "github:jitsi/rtcstats#v6.2.0",
|
||||
"version": "github:jitsi/rtcstats#7593044b35b46881fb88af9b20db0f9b660f5752",
|
||||
"from": "github:jitsi/rtcstats#v8.0.1",
|
||||
"requires": {
|
||||
"@jitsi/js-utils": "1.0.0"
|
||||
"@jitsi/js-utils": "1.0.0",
|
||||
"uuid": "3.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jitsi/js-utils": {
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
"redux": "4.0.4",
|
||||
"redux-thunk": "2.2.0",
|
||||
"rnnoise-wasm": "github:jitsi/rnnoise-wasm#566a16885897704d6e6d67a1d5ac5d39781db2af",
|
||||
"rtcstats": "github:jitsi/rtcstats#v6.2.0",
|
||||
"rtcstats": "github:jitsi/rtcstats#v8.0.1",
|
||||
"styled-components": "3.4.9",
|
||||
"util": "0.12.1",
|
||||
"uuid": "3.1.0",
|
||||
|
|
|
@ -37,14 +37,30 @@ class RTCStats {
|
|||
* loaded before it does.
|
||||
*
|
||||
* @param {Object} options -.
|
||||
* @param {string} options.rtcstatsEndpoint - The Amplitude app key required.
|
||||
* @param {number} options.rtcstatsPollInterval - The getstats poll interval in ms.
|
||||
* @param {string} options.endpoint - The Amplitude app key required.
|
||||
* @param {string} options.useLegacy - Switch to legacy chrome webrtc statistics. Parameter will only have
|
||||
* an effect on chrome based applications.
|
||||
* @param {number} options.pollInterval - The getstats poll interval in ms.
|
||||
* @returns {void}
|
||||
*/
|
||||
init(options) {
|
||||
this.handleTraceWSClose = this.handleTraceWSClose.bind(this);
|
||||
this.trace = traceInit(options.rtcstatsEndpoint, this.handleTraceWSClose);
|
||||
rtcstatsInit(this.trace, options.rtcstatsPollInterval, [ '' ], connectionFilter);
|
||||
|
||||
const { endpoint, useLegacy, pollInterval } = options;
|
||||
|
||||
const traceOptions = {
|
||||
endpoint,
|
||||
onCloseCallback: this.handleTraceWSClose.bind(this),
|
||||
useLegacy
|
||||
};
|
||||
|
||||
const rtcstatsOptions = {
|
||||
connectionFilter,
|
||||
pollInterval,
|
||||
useLegacy
|
||||
};
|
||||
|
||||
this.trace = traceInit(traceOptions);
|
||||
rtcstatsInit(this.trace, rtcstatsOptions);
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
|
@ -66,7 +82,7 @@ class RTCStats {
|
|||
* @returns {void}
|
||||
*/
|
||||
sendIdentityData(identityData) {
|
||||
this.trace && this.trace('identity', null, identityData);
|
||||
this.trace && this.trace.identity('identity', null, identityData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// @flow
|
||||
|
||||
import { getAmplitudeIdentity } from '../analytics';
|
||||
import { CONFERENCE_UNIQUE_ID_SET } from '../base/conference';
|
||||
import { CONFERENCE_UNIQUE_ID_SET, getRoomName } from '../base/conference';
|
||||
import { LIB_WILL_INIT } from '../base/lib-jitsi-meet';
|
||||
import { getLocalParticipant } from '../base/participants';
|
||||
import { MiddlewareRegistry } from '../base/redux';
|
||||
|
@ -22,6 +22,7 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
const config = state['features/base/config'];
|
||||
const { analytics } = config;
|
||||
|
||||
|
||||
switch (action.type) {
|
||||
case LIB_WILL_INIT: {
|
||||
if (isRtcstatsEnabled(state)) {
|
||||
|
@ -30,14 +31,17 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
// init, we need to add these proxies before it initializes, otherwise lib-jitsi-meet will use the
|
||||
// original non proxy versions of these functions.
|
||||
try {
|
||||
// Default poll interval is 1000ms if not provided in the config.
|
||||
// Default poll interval is 1000ms and standard stats will be used, if not provided in the config.
|
||||
const pollInterval = analytics.rtcstatsPollInterval || 1000;
|
||||
const useLegacy = analytics.rtcstatsUseLegacy || false;
|
||||
|
||||
|
||||
// Initialize but don't connect to the rtcstats server wss, as it will start sending data for all
|
||||
// media calls made even before the conference started.
|
||||
RTCStats.init({
|
||||
rtcstatsEndpoint: analytics.rtcstatsEndpoint,
|
||||
rtcstatsPollInterval: pollInterval
|
||||
endpoint: analytics.rtcstatsEndpoint,
|
||||
useLegacy,
|
||||
pollInterval
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error('Failed to initialize RTCStats: ', error);
|
||||
|
@ -68,6 +72,7 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
RTCStats.sendIdentityData({
|
||||
...getAmplitudeIdentity(),
|
||||
...config,
|
||||
confName: getRoomName(state),
|
||||
displayName: localParticipant?.name,
|
||||
meetingUniqueId
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue