snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
33
react/features/subtitles/hooks.web.ts
Normal file
33
react/features/subtitles/hooks.web.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { useSelector } from 'react-redux';
|
||||
|
||||
import { IReduxState } from '../app/types';
|
||||
import { isInBreakoutRoom } from '../breakout-rooms/functions';
|
||||
|
||||
import ClosedCaptionButton from './components/web/ClosedCaptionButton';
|
||||
import { areClosedCaptionsEnabled, canStartSubtitles } from './functions.any';
|
||||
|
||||
const cc = {
|
||||
key: 'closedcaptions',
|
||||
Content: ClosedCaptionButton,
|
||||
group: 2
|
||||
};
|
||||
|
||||
/**
|
||||
* A hook that returns the CC button if it is enabled and undefined otherwise.
|
||||
*
|
||||
* @returns {Object | undefined}
|
||||
*/
|
||||
export function useClosedCaptionButton() {
|
||||
const isStartSubtitlesButtonVisible = useSelector(canStartSubtitles);
|
||||
const { showSubtitlesOnStage = false } = useSelector((state: IReduxState) => state['features/base/settings']);
|
||||
const _areClosedCaptionsEnabled = useSelector(areClosedCaptionsEnabled);
|
||||
const _isInBreakoutRoom = useSelector((state: IReduxState) => isInBreakoutRoom(state));
|
||||
|
||||
if (!_areClosedCaptionsEnabled || _isInBreakoutRoom) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (isStartSubtitlesButtonVisible || !showSubtitlesOnStage) {
|
||||
return cc;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user