2022-09-06 10:42:59 +03:00
|
|
|
|
2022-10-11 13:47:54 +03:00
|
|
|
import { IStateful } from '../base/app/types';
|
2022-09-22 13:06:31 +03:00
|
|
|
import { toState } from '../base/redux/functions';
|
2022-09-06 10:42:59 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks whether rtcstats is enabled or not.
|
|
|
|
|
*
|
2022-09-22 13:06:31 +03:00
|
|
|
* @param {IStateful} stateful - The redux store or {@code getState} function.
|
2022-09-06 10:42:59 +03:00
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
2023-09-06 16:00:53 +03:00
|
|
|
export function isRTCStatsEnabled(stateful: IStateful) {
|
2022-09-06 10:42:59 +03:00
|
|
|
const state = toState(stateful);
|
2022-09-22 13:06:31 +03:00
|
|
|
const { analytics } = state['features/base/config'];
|
2022-09-06 10:42:59 +03:00
|
|
|
|
2022-09-22 13:06:31 +03:00
|
|
|
return analytics?.rtcstatsEnabled ?? false;
|
2022-09-06 10:42:59 +03:00
|
|
|
}
|
|
|
|
|
|
2022-09-22 13:06:31 +03:00
|
|
|
/**
|
|
|
|
|
* Checks if the faceLandmarks data can be sent to the rtcstats server.
|
|
|
|
|
*
|
|
|
|
|
* @param {IStateful} stateful - The redux store or {@code getState} function.
|
|
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
2023-09-06 16:00:53 +03:00
|
|
|
export function canSendFaceLandmarksRTCStatsData(stateful: IStateful): boolean {
|
2022-09-22 13:06:31 +03:00
|
|
|
const state = toState(stateful);
|
|
|
|
|
const { faceLandmarks } = state['features/base/config'];
|
|
|
|
|
|
2023-09-06 16:00:53 +03:00
|
|
|
return Boolean(faceLandmarks?.enableRTCStats && isRTCStatsEnabled(state));
|
2022-09-22 13:06:31 +03:00
|
|
|
}
|