Files
jitsi-meet/react/features/rtcstats/functions.ts
Andrei Gavrilescu 77d299338a feat(rtcstats): use rtcstats from lib-jitsi-meet (#13693)
* added option to use rtctstats from lib-jitsi-meet

* Addressed review feedback:
- moved rtcstats function into JitsiMeetJS.rtcstats
- changed from callbacks to events

* moved rtcstatsUseLibJitsi from analytics to testing

* fixed linting errors

* use ljm rtcstats

* remove debug logs, additional dependencies

* fix ts and dependency

* address code review

---------

Co-authored-by: Nils Ohlmeier <github@ohlmeier.org>
2023-09-06 16:00:53 +03:00

30 lines
906 B
TypeScript

import { IStateful } from '../base/app/types';
import { toState } from '../base/redux/functions';
/**
* Checks whether rtcstats is enabled or not.
*
* @param {IStateful} stateful - The redux store or {@code getState} function.
* @returns {boolean}
*/
export function isRTCStatsEnabled(stateful: IStateful) {
const state = toState(stateful);
const { analytics } = state['features/base/config'];
return analytics?.rtcstatsEnabled ?? false;
}
/**
* Checks if the faceLandmarks data can be sent to the rtcstats server.
*
* @param {IStateful} stateful - The redux store or {@code getState} function.
* @returns {boolean}
*/
export function canSendFaceLandmarksRTCStatsData(stateful: IStateful): boolean {
const state = toState(stateful);
const { faceLandmarks } = state['features/base/config'];
return Boolean(faceLandmarks?.enableRTCStats && isRTCStatsEnabled(state));
}