Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(analytics) make sure rtcstats is not enabled on mobile
Saúl Ibarra Corretgé919be219128b
diff --git a/react/features/rtcstats/functions.js b/react/features/rtcstats/functions.jsnew file mode 100644index 0000000000..d980da3752--- /dev/null+++ b/react/features/rtcstats/functions.js@@ -0,0 +1,21 @@+// @flow++import { toState } from '../base/redux';++/**+ * Checks whether rtcstats is enabled or not.+ *+ * @param {Function|Object} stateful - The redux store or {@code getState} function.+ * @returns {boolean}+ */+export function isRtcstatsEnabled(stateful: Function | Object) {+ // TODO: Remove when rtcstats is fully cimpatible with mobile.+ if (navigator.product === 'ReactNative') {+ return false;+ }++ const state = toState(stateful);+ const config = state['features/base/config'];++ return config?.analytics?.rtcstatsEnabled ?? false;+}diff --git a/react/features/rtcstats/middleware.js b/react/features/rtcstats/middleware.jsindex 73c5f40abb..0d816ba726 100644--- a/react/features/rtcstats/middleware.js+++ b/react/features/rtcstats/middleware.js@@ -9,6 +9,7 @@ import { getLocalParticipant } from '../base/participants';import { MiddlewareRegistry } from '../base/redux';import RTCStats from './RTCStats';+import { isRtcstatsEnabled } from './functions';import logger from './logger';/**@@ -25,7 +26,7 @@ MiddlewareRegistry.register(store => next => action => {switch (action.type) {case LIB_WILL_INIT: {- if (analytics.rtcstatsEnabled) {+ if (isRtcstatsEnabled(state)) {// RTCStats "proxies" WebRTC functions such as GUM and RTCPeerConnection by rewriting the global// window functions. Because lib-jitsi-meet uses references to those functions that are taken on// init, we need to add these proxies before it initializes, otherwise lib-jitsi-meet will use the@@ -47,7 +48,7 @@ MiddlewareRegistry.register(store => next => action => {break;}case CONFERENCE_JOINED: {- if (analytics.rtcstatsEnabled && RTCStats.isInitialized()) {+ if (isRtcstatsEnabled(state) && RTCStats.isInitialized()) {// Once the conference started connect to the rtcstats server and send data.try {RTCStats.connect();