Files
jitsi-meet/react/features/toolbox/functions.any.ts
Дамян Минков ede26956e8 feat(visitors): Transcriptions for visitors. (#15119)
* feat(visitors): Transcriptions for visitors.

* squash: Fixes filter iq.

* feat: Rewrites room name requests in rayo iq for visitors.

* squash: Handles visitors count that request transcriptions and the languages requested.

* fix(subtitles): Make sure we show captions button when no features but is transcribing.
2024-09-13 18:35:34 -05:00

54 lines
1.7 KiB
TypeScript

import { IReduxState } from '../app/types';
import { isJwtFeatureEnabledStateless } from '../base/jwt/functions';
import { IGUMPendingState } from '../base/media/types';
import { IParticipantFeatures } from '../base/participants/types';
import { isTranscribing } from '../transcribing/functions';
/**
* Indicates if the audio mute button is disabled or not.
*
* @param {IReduxState} state - The state from the Redux store.
* @returns {boolean}
*/
export function isAudioMuteButtonDisabled(state: IReduxState) {
const { available, muted, unmuteBlocked, gumPending } = state['features/base/media'].audio;
const { startSilent } = state['features/base/config'];
return Boolean(!available || startSilent || (muted && unmuteBlocked) || gumPending !== IGUMPendingState.NONE);
}
/**
* Returns the buttons corresponding to features disabled through jwt.
*
* @param {IReduxState} state - The state from the Redux store.
* @param {string | undefined} jwt - The jwt token.
* @param {ILocalParticipant} localParticipantFeatures - The features of the local participant.
* @returns {string[]} - The disabled by jwt buttons array.
*/
export function getJwtDisabledButtons(
state: IReduxState,
jwt: string | undefined,
localParticipantFeatures?: IParticipantFeatures) {
const acc = [];
if (!isJwtFeatureEnabledStateless({
jwt,
localParticipantFeatures,
feature: 'livestreaming',
ifNoToken: true
})) {
acc.push('livestreaming');
}
if (!isTranscribing(state) && !isJwtFeatureEnabledStateless({
jwt,
localParticipantFeatures,
feature: 'transcription',
ifNoToken: true
})) {
acc.push('closedcaptions');
}
return acc;
}