snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
79
react/features/transcribing/reducer.ts
Normal file
79
react/features/transcribing/reducer.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import { CONFERENCE_PROPERTIES_CHANGED } from '../base/conference/actionTypes';
|
||||
import ReducerRegistry from '../base/redux/ReducerRegistry';
|
||||
|
||||
import {
|
||||
TRANSCRIBER_JOINED,
|
||||
TRANSCRIBER_LEFT
|
||||
} from './actionTypes';
|
||||
|
||||
/**
|
||||
* Returns initial state for transcribing feature part of Redux store.
|
||||
*
|
||||
* @returns {{
|
||||
* isTranscribing: boolean,
|
||||
* transcriberJID: null
|
||||
* }}
|
||||
* @private
|
||||
*/
|
||||
function _getInitialState() {
|
||||
return {
|
||||
/**
|
||||
* Indicates whether there is currently an active transcriber in the
|
||||
* room.
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
isTranscribing: false,
|
||||
|
||||
/**
|
||||
* The JID of the active transcriber.
|
||||
*
|
||||
* @type { string }
|
||||
*/
|
||||
transcriberJID: null
|
||||
};
|
||||
}
|
||||
|
||||
export interface ITranscribingState {
|
||||
isTranscribing: boolean;
|
||||
transcriberJID?: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces the Redux actions of the feature features/transcribing.
|
||||
*/
|
||||
ReducerRegistry.register<ITranscribingState>('features/transcribing',
|
||||
(state = _getInitialState(), action): ITranscribingState => {
|
||||
switch (action.type) {
|
||||
case CONFERENCE_PROPERTIES_CHANGED: {
|
||||
const audioRecording = action.properties?.['audio-recording-enabled'];
|
||||
|
||||
if (typeof audioRecording !== 'undefined') {
|
||||
const audioRecordingEnabled = audioRecording === 'true';
|
||||
|
||||
if (state.isTranscribing !== audioRecordingEnabled) {
|
||||
return {
|
||||
...state,
|
||||
isTranscribing: audioRecordingEnabled
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
case TRANSCRIBER_JOINED:
|
||||
return {
|
||||
...state,
|
||||
isTranscribing: true,
|
||||
transcriberJID: action.transcriberJID
|
||||
};
|
||||
case TRANSCRIBER_LEFT:
|
||||
return {
|
||||
...state,
|
||||
isTranscribing: false,
|
||||
transcriberJID: undefined
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user