You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

functions.js 902B

12345678910111213141516171819202122232425262728293031323334
  1. // @flow
  2. import { toState } from '../base/redux';
  3. import RTCStats from './RTCStats';
  4. /**
  5. * Checks whether rtcstats is enabled or not.
  6. *
  7. * @param {Function|Object} stateful - The redux store or {@code getState} function.
  8. * @returns {boolean}
  9. */
  10. export function isRtcstatsEnabled(stateful: Function | Object) {
  11. // TODO: Remove when rtcstats is fully cimpatible with mobile.
  12. if (navigator.product === 'ReactNative') {
  13. return false;
  14. }
  15. const state = toState(stateful);
  16. const config = state['features/base/config'];
  17. return config?.analytics?.rtcstatsEnabled ?? false;
  18. }
  19. /**
  20. * Can the rtcstats service send data.
  21. *
  22. * @param {Function|Object} stateful - The redux store or {@code getState} function.
  23. * @returns {boolean}
  24. */
  25. export function canSendRtcstatsData(stateful: Function | Object) {
  26. return isRtcstatsEnabled(stateful) && RTCStats.isInitialized();
  27. }