Skip to content

Commit

Permalink
feat(transcript) add recording settings for recording transcriptions (j…
Browse files Browse the repository at this point in the history
  • Loading branch information
quitrk authored Dec 19, 2023
1 parent 6d11aa8 commit 7f87d4e
Show file tree
Hide file tree
Showing 14 changed files with 392 additions and 82 deletions.
6 changes: 3 additions & 3 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ var config = {
// DEPRECATED. Use transcription.preferredLanguage instead.
// preferredTranscribeLanguage: 'en-US',

// DEPRECATED. Use transcription.autoCaptionOnRecord instead.
// DEPRECATED. Use transcription.autoTranscribeOnRecord instead.
// autoCaptionOnRecord: false,

// Transcription options.
Expand Down Expand Up @@ -410,8 +410,8 @@ var config = {
// // Disable start transcription for all participants.
// disableStartForAll: false,

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

// Misc
Expand Down
4 changes: 4 additions & 0 deletions css/_recording.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
font-size: 14px;
margin-left: 16px;
max-width: 70%;

&-no-space {
margin-left: 0;
}
}

&.space-top {
Expand Down
3 changes: 3 additions & 0 deletions lang/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -1016,12 +1016,15 @@
"onlyRecordSelf": "Record only my audio and video streams",
"pending": "Preparing to record the meeting...",
"rec": "REC",
"recordAudioAndVideo": "Record audio and video",
"recordTranscription": "Record transcription",
"saveLocalRecording": "Save recording file locally (Beta)",
"serviceDescription": "Your recording will be saved by the recording service",
"serviceDescriptionCloud": "Cloud recording",
"serviceDescriptionCloudInfo": "Recorded meetings are automatically cleared 24h after their recording time.",
"serviceName": "Recording service",
"sessionAlreadyActive": "This session is already being recorded or live streamed.",
"showAdvancedOptions": "Advanced options",
"signIn": "Sign in",
"signOut": "Sign out",
"surfaceError": "Please select the current tab.",
Expand Down
2 changes: 1 addition & 1 deletion react/features/base/config/configType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ export interface IConfig {
transcribeWithAppLanguage?: boolean;
transcribingEnabled?: boolean;
transcription?: {
autoCaptionOnRecord?: boolean;
autoTranscribeOnRecord?: boolean;
disableStartForAll?: boolean;
enabled?: boolean;
preferredLanguage?: string;
Expand Down
2 changes: 1 addition & 1 deletion react/features/base/config/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ function _translateLegacyConfig(oldValue: IConfig) {
if (oldValue.autoCaptionOnRecord !== undefined) {
newValue.transcription = {
...newValue.transcription,
autoCaptionOnRecord: oldValue.autoCaptionOnRecord
autoTranscribeOnRecord: oldValue.autoCaptionOnRecord
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { updateDropboxToken } from '../../../dropbox/actions';
import { getDropboxData, getNewAccessToken, isEnabled as isDropboxEnabled } from '../../../dropbox/functions.any';
import { showErrorNotification } from '../../../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE } from '../../../notifications/constants';
import { toggleRequestingSubtitles } from '../../../subtitles/actions';
import { setRequestingSubtitles } from '../../../subtitles/actions.any';
import { setSelectedRecordingService, startLocalVideoRecording } from '../../actions';
import { RECORDING_TYPES } from '../../constants';
import { supportsLocalRecording } from '../../functions';
Expand All @@ -23,9 +23,9 @@ export interface IProps extends WithTranslation {
_appKey: string;

/**
* Requests subtitles when recording is turned on.
* Requests transcribing when recording is turned on.
*/
_autoCaptionOnRecord: boolean;
_autoTranscribeOnRecord: boolean;

/**
* The {@code JitsiConference} for the current conference.
Expand Down Expand Up @@ -114,6 +114,16 @@ interface IState {
*/
sharingEnabled: boolean;

/**
* True if the user requested the service to record audio and video.
*/
shouldRecordAudioAndVideo: boolean;

/**
* True if the user requested the service to record transcription.
*/
shouldRecordTranscription: boolean;

/**
* Number of MiB of available space in user's Dropbox account.
*/
Expand Down Expand Up @@ -144,6 +154,8 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {
this._onSharingSettingChanged = this._onSharingSettingChanged.bind(this);
this._toggleScreenshotCapture = this._toggleScreenshotCapture.bind(this);
this._onLocalRecordingSelfChange = this._onLocalRecordingSelfChange.bind(this);
this._onTranscriptionChange = this._onTranscriptionChange.bind(this);
this._onRecordAudioAndVideoChange = this._onRecordAudioAndVideoChange.bind(this);

let selectedRecordingService = '';

Expand All @@ -165,6 +177,8 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {
isValidating: false,
userName: undefined,
sharingEnabled: true,
shouldRecordAudioAndVideo: true,
shouldRecordTranscription: true,
spaceLeft: undefined,
selectedRecordingService,
localRecordingOnlySelf: false
Expand Down Expand Up @@ -241,6 +255,30 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {
});
}

/**
* Handles transcription switch change.
*
* @param {boolean} value - The new value.
* @returns {void}
*/
_onTranscriptionChange(value: boolean) {
this.setState({
shouldRecordTranscription: value
});
}

/**
* Handles audio and video switch change.
*
* @param {boolean} value - The new value.
* @returns {void}
*/
_onRecordAudioAndVideoChange(value: boolean) {
this.setState({
shouldRecordAudioAndVideo: value
});
}

/**
* Validates the dropbox access token and fetches account information.
*
Expand Down Expand Up @@ -297,7 +335,7 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {
_onSubmit() {
const {
_appKey,
_autoCaptionOnRecord,
_autoTranscribeOnRecord,
_conference,
_isDropboxEnabled,
_rToken,
Expand All @@ -309,57 +347,59 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {
type?: string;
} = {};

switch (this.state.selectedRecordingService) {
case RECORDING_TYPES.DROPBOX: {
if (_isDropboxEnabled && _token) {
if (this.state.shouldRecordAudioAndVideo) {
switch (this.state.selectedRecordingService) {
case RECORDING_TYPES.DROPBOX: {
if (_isDropboxEnabled && _token) {
appData = JSON.stringify({
'file_recording_metadata': {
'upload_credentials': {
'service_name': RECORDING_TYPES.DROPBOX,
'token': _token,
'r_token': _rToken,
'app_key': _appKey
}
}
});
attributes.type = RECORDING_TYPES.DROPBOX;
} else {
dispatch(showErrorNotification({
titleKey: 'dialog.noDropboxToken'
}, NOTIFICATION_TIMEOUT_TYPE.LONG));

return;
}
break;
}
case RECORDING_TYPES.JITSI_REC_SERVICE: {
appData = JSON.stringify({
'file_recording_metadata': {
'upload_credentials': {
'service_name': RECORDING_TYPES.DROPBOX,
'token': _token,
'r_token': _rToken,
'app_key': _appKey
}
'share': this.state.sharingEnabled
}
});
attributes.type = RECORDING_TYPES.DROPBOX;
} else {
dispatch(showErrorNotification({
titleKey: 'dialog.noDropboxToken'
}, NOTIFICATION_TIMEOUT_TYPE.LONG));

return;
attributes.type = RECORDING_TYPES.JITSI_REC_SERVICE;
break;
}
break;
}
case RECORDING_TYPES.JITSI_REC_SERVICE: {
appData = JSON.stringify({
'file_recording_metadata': {
'share': this.state.sharingEnabled
}
});
attributes.type = RECORDING_TYPES.JITSI_REC_SERVICE;
break;
}
case RECORDING_TYPES.LOCAL: {
dispatch(startLocalVideoRecording(this.state.localRecordingOnlySelf));
case RECORDING_TYPES.LOCAL: {
dispatch(startLocalVideoRecording(this.state.localRecordingOnlySelf));

return true;
}
}
return true;
}
}

sendAnalytics(
createRecordingDialogEvent('start', 'confirm.button', attributes)
);
sendAnalytics(
createRecordingDialogEvent('start', 'confirm.button', attributes)
);

this._toggleScreenshotCapture();
_conference?.startRecording({
mode: JitsiRecordingConstants.mode.FILE,
appData
});
this._toggleScreenshotCapture();
_conference?.startRecording({
mode: JitsiRecordingConstants.mode.FILE,
appData
});
}

if (_autoCaptionOnRecord) {
dispatch(toggleRequestingSubtitles());
if (_autoTranscribeOnRecord || this.state.shouldRecordTranscription) {
dispatch(setRequestingSubtitles(true, false));
}

return true;
Expand Down Expand Up @@ -392,7 +432,7 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {
* @private
* @returns {{
* _appKey: string,
* _autoCaptionOnRecord: boolean,
* _autoTranscribeOnRecord: boolean,
* _conference: JitsiConference,
* _fileRecordingsServiceEnabled: boolean,
* _fileRecordingsServiceSharingEnabled: boolean,
Expand All @@ -412,7 +452,7 @@ export function mapStateToProps(state: IReduxState, _ownProps: any) {

return {
_appKey: dropbox.appKey ?? '',
_autoCaptionOnRecord: transcription?.autoCaptionOnRecord ?? false,
_autoTranscribeOnRecord: transcription?.autoTranscribeOnRecord ?? false,
_conference: state['features/base/conference'].conference,
_fileRecordingsServiceEnabled: recordingService?.enabled ?? false,
_fileRecordingsServiceSharingEnabled: recordingService?.sharingEnabled ?? false,
Expand Down
Loading

0 comments on commit 7f87d4e

Please sign in to comment.