Skip to content

Commit

Permalink
feat(subtitles): Adds an option to automatically enable subtitles whe…
Browse files Browse the repository at this point in the history
…n transcriber is available.
  • Loading branch information
damencho committed Oct 22, 2024
1 parent 1f37e0b commit 036d783
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,10 @@ var config = {

// // Enables automatic turning on transcribing when recording is started
// autoTranscribeOnRecord: false,

// // Enables automatic request of subtitles when transcriber is present in the meeting, uses the default
// // language that is set
// autoCaptionOnTranscribe: false,
// },

// Misc
Expand Down
1 change: 1 addition & 0 deletions react/features/base/config/configType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ export interface IConfig {
transcribeWithAppLanguage?: boolean;
transcribingEnabled?: boolean;
transcription?: {
autoCaptionOnTranscribe?: boolean;
autoTranscribeOnRecord?: boolean;
enabled?: boolean;
preferredLanguage?: string;
Expand Down
10 changes: 10 additions & 0 deletions react/features/subtitles/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { isJwtFeatureEnabled } from '../base/jwt/functions';
import JitsiMeetJS from '../base/lib-jitsi-meet';
import { isLocalParticipantModerator } from '../base/participants/functions';
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import { TRANSCRIBER_JOINED } from '../transcribing/actionTypes';

import {
SET_REQUESTING_SUBTITLES,
Expand Down Expand Up @@ -80,6 +81,15 @@ MiddlewareRegistry.register(store => next => action => {
_requestingSubtitlesChange(store, toggledValue, state._language);
break;
}
case TRANSCRIBER_JOINED: {
const { transcription } = store.getState()['features/base/config'];

if (transcription?.autoCaptionOnTranscribe) {
store.dispatch(setRequestingSubtitles(true));
}

break;
}
case SET_REQUESTING_SUBTITLES:
_requestingSubtitlesChange(store, action.enabled, action.language);
break;
Expand Down
2 changes: 1 addition & 1 deletion react/features/transcribing/subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { isLiveStreamingRunning, isRecordingRunning } from '../recording/functio
import { isRecorderTranscriptionsRunning } from './functions';

/**
* Listens for large video participant ID changes.
* Listens for transcriber status change.
*/
StateListenerRegistry.register(
/* selector */ isRecorderTranscriptionsRunning,
Expand Down

0 comments on commit 036d783

Please sign in to comment.