Skip to content

Commit

Permalink
feat(transcriptions): Adds a notification if transcriber leaves abrup…
Browse files Browse the repository at this point in the history
…tly.
  • Loading branch information
damencho committed Oct 1, 2024
1 parent d0cafb6 commit ea54012
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 9 deletions.
4 changes: 2 additions & 2 deletions conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -1687,11 +1687,11 @@ export default {

room.on(
JitsiConferenceEvents.TRANSCRIPTION_STATUS_CHANGED,
(status, id) => {
(status, id, abruptly) => {
if (status === JitsiMeetJS.constants.transcriptionStatus.ON) {
APP.store.dispatch(transcriberJoined(id));
} else if (status === JitsiMeetJS.constants.transcriptionStatus.OFF) {
APP.store.dispatch(transcriberLeft(id));
APP.store.dispatch(transcriberLeft(id, abruptly));
}
});

Expand Down
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ var config = {
// 'toolbar.noAudioSignalTitle', // shown when a broken mic is detected
// 'toolbar.noisyAudioInputTitle', // shown when noise is detected for the current microphone
// 'toolbar.talkWhileMutedPopup', // shown when user tries to speak while muted
// 'transcribing.failedToStart', // shown when transcribing fails to start
// 'transcribing.failed', // shown when transcribing fails
// ],

// List of notifications to be disabled. Works in tandem with the above setting.
Expand Down
2 changes: 1 addition & 1 deletion lang/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@
"transcribing": {
"ccButtonTooltip": "Start / Stop subtitles",
"expandedLabel": "Transcribing is currently on",
"failedToStart": "Transcribing failed to start",
"failed": "Transcribing failed",
"labelToolTip": "The meeting is being transcribed",
"sourceLanguageDesc": "Currently the meeting language is set to <b>{{sourceLanguage}}</b>. <br/> You can change it from ",
"sourceLanguageHere": "here",
Expand Down
1 change: 1 addition & 0 deletions react/features/app/middlewares.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import '../room-lock/middleware';
import '../rtcstats/middleware';
import '../speaker-stats/middleware';
import '../subtitles/middleware';
import '../transcribing/middleware';
import '../video-layout/middleware';
import '../video-quality/middleware';
import '../videosipgw/middleware';
Expand Down
4 changes: 2 additions & 2 deletions react/features/base/conference/actions.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,11 @@ function _addConferenceListeners(conference: IJitsiConference, dispatch: IStore[

conference.on(
JitsiConferenceEvents.TRANSCRIPTION_STATUS_CHANGED,
(status: string, id: string) => {
(status: string, id: string, abruptly: boolean) => {
if (status === JitsiMeetJS.constants.transcriptionStatus.ON) {
dispatch(transcriberJoined(id));
} else if (status === JitsiMeetJS.constants.transcriptionStatus.OFF) {
dispatch(transcriberLeft(id));
dispatch(transcriberLeft(id, abruptly));
}
});

Expand Down
10 changes: 7 additions & 3 deletions react/features/transcribing/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ export function transcriberJoined(participantId: string) {
* Notify that the transcriber, with a unique ID, has left.
*
* @param {string} participantId - The participant id of the transcriber.
* @param {boolean} abruptly - The transcriber did not exit the conference gracefully with switching off first.
* It maybe there was some backend problem, like network.
* @returns {{
* type: TRANSCRIBER_LEFT,
* participantId: string
* participantId: string,
* abruptly: boolean
* }}
*/
export function transcriberLeft(participantId: string) {
export function transcriberLeft(participantId: string, abruptly: boolean) {
return {
type: TRANSCRIBER_LEFT,
transcriberJID: participantId
transcriberJID: participantId,
abruptly
};
}
25 changes: 25 additions & 0 deletions react/features/transcribing/middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import { showErrorNotification } from '../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';

import { TRANSCRIBER_LEFT } from './actionTypes';

/**
* Implements the middleware of the feature transcribing.
*
* @param {Store} store - The redux store.
* @returns {Function}
*/
MiddlewareRegistry.register(({ dispatch }) => next => action => {
switch (action.type) {
case TRANSCRIBER_LEFT:
if (action.abruptly) {
dispatch(showErrorNotification({
titleKey: 'transcribing.failed'
}, NOTIFICATION_TIMEOUT_TYPE.LONG));
}
break;
}

return next(action);
});

0 comments on commit ea54012

Please sign in to comment.