Skip to content

Commit

Permalink
fix(transcribing): Handle transcriber status changed.
Browse files Browse the repository at this point in the history
* fix(subtitles): Handle errors to revert to default state.

* fix(transcribing): Handle transcriber status changed.

Drops potential transcribers and hidden participant actions and handling. Expect ljm to detect transcriptions on and off.

* feat(transcriptions): Adds a notification if transcriber leaves abruptly.

* squash: Renames action.

* chore(deps) lib-jitsi-meet@latest

jitsi/lib-jitsi-meet@v1869.0.0+5671c5d6...v1872.0.0+8940b5c9
  • Loading branch information
damencho authored Oct 2, 2024
1 parent 5da6919 commit d5269e8
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 182 deletions.
11 changes: 11 additions & 0 deletions conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ import { toggleScreenshotCaptureSummary } from './react/features/screenshot-capt
import { AudioMixerEffect } from './react/features/stream-effects/audio-mixer/AudioMixerEffect';
import { createRnnoiseProcessor } from './react/features/stream-effects/rnnoise';
import { handleToggleVideoMuted } from './react/features/toolbox/actions.any';
import { transcriberJoined, transcriberLeft } from './react/features/transcribing/actions';
import { muteLocal } from './react/features/video-menu/actions.any';

const logger = Logger.getLogger(__filename);
Expand Down Expand Up @@ -1684,6 +1685,16 @@ export default {
}
);

room.on(
JitsiConferenceEvents.TRANSCRIPTION_STATUS_CHANGED,
(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, abruptly));
}
});

room.on(
JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
(participant, data) => {
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
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"js-md5": "0.6.1",
"js-sha512": "0.8.0",
"jwt-decode": "2.2.0",
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1869.0.0+5671c5d6/lib-jitsi-meet.tgz",
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1872.0.0+8940b5c9/lib-jitsi-meet.tgz",
"lodash-es": "4.17.21",
"moment": "2.29.4",
"moment-duration-format": "2.2.2",
Expand Down
13 changes: 12 additions & 1 deletion react/features/base/conference/actions.any.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { createStartMutedConfigurationEvent } from '../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../analytics/functions';
import { IReduxState, IStore } from '../../app/types';
import { transcriberJoined, transcriberLeft } from '../../transcribing/actions';
import { setIAmVisitor } from '../../visitors/actions';
import { iAmVisitor } from '../../visitors/functions';
import { overwriteConfig } from '../config/actions';
import { getReplaceParticipant } from '../config/functions';
import { connect, disconnect, hangup } from '../connection/actions';
import { JITSI_CONNECTION_CONFERENCE_KEY } from '../connection/constants';
import { hasAvailableDevices } from '../devices/functions.any';
import { JitsiConferenceEvents, JitsiE2ePingEvents } from '../lib-jitsi-meet';
import JitsiMeetJS, { JitsiConferenceEvents, JitsiE2ePingEvents } from '../lib-jitsi-meet';
import {
setAudioMuted,
setAudioUnmutePermissions,
Expand Down Expand Up @@ -276,6 +277,16 @@ function _addConferenceListeners(conference: IJitsiConference, dispatch: IStore[
botType
})));

conference.on(
JitsiConferenceEvents.TRANSCRIPTION_STATUS_CHANGED,
(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, abruptly));
}
});

conference.addCommandListener(
AVATAR_URL_COMMAND,
(data: { value: string; }, id: string) => {
Expand Down
10 changes: 2 additions & 8 deletions react/features/base/conference/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { determineTranscriptionLanguage } from '../../transcribing/functions';
import { IStateful } from '../app/types';
import { JitsiTrackErrors } from '../lib-jitsi-meet';
import {
hiddenParticipantJoined,
hiddenParticipantLeft,
participantJoined,
participantLeft
} from '../participants/actions';
Expand Down Expand Up @@ -85,9 +83,7 @@ export function commonUserJoinedHandling(
const id = user.getId();
const displayName = user.getDisplayName();

if (user.isHidden()) {
dispatch(hiddenParticipantJoined(id, displayName));
} else {
if (!user.isHidden()) {
const isReplacing = user?.isReplacing();

// the identity and avatar come from jwt and never change in the presence
Expand Down Expand Up @@ -122,9 +118,7 @@ export function commonUserLeftHandling(
user: any) {
const id = user.getId();

if (user.isHidden()) {
dispatch(hiddenParticipantLeft(id));
} else {
if (!user.isHidden()) {
const isReplaced = user.isReplaced?.();

dispatch(participantLeft(id, conference, { isReplaced }));
Expand Down
22 changes: 0 additions & 22 deletions react/features/base/participants/actionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,28 +146,6 @@ export const PARTICIPANT_UPDATED = 'PARTICIPANT_UPDATED';
*/
export const PIN_PARTICIPANT = 'PIN_PARTICIPANT';

/**
* Action to signal that a hidden participant has joined.
*
* {
* type: HIDDEN_PARTICIPANT_JOINED,
* participant: Participant
* }
*/
export const HIDDEN_PARTICIPANT_JOINED = 'HIDDEN_PARTICIPANT_JOINED';

/**
* Action to handle case when hidden participant leaves.
*
* {
* type: PARTICIPANT_LEFT,
* participant: {
* id: string
* }
* }
*/
export const HIDDEN_PARTICIPANT_LEFT = 'HIDDEN_PARTICIPANT_LEFT';

/**
* The type of Redux action which notifies the app that the loadable avatar URL has changed.
*
Expand Down
38 changes: 0 additions & 38 deletions react/features/base/participants/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { set } from '../redux/functions';
import {
DOMINANT_SPEAKER_CHANGED,
GRANT_MODERATOR,
HIDDEN_PARTICIPANT_JOINED,
HIDDEN_PARTICIPANT_LEFT,
KICK_PARTICIPANT,
LOCAL_PARTICIPANT_AUDIO_LEVEL_CHANGED,
LOCAL_PARTICIPANT_RAISE_HAND,
Expand Down Expand Up @@ -331,42 +329,6 @@ export function updateRemoteParticipantFeatures(jitsiParticipant: any) {
};
}

/**
* Action to signal that a hidden participant has joined the conference.
*
* @param {string} id - The id of the participant.
* @param {string} displayName - The display name, or undefined when
* unknown.
* @returns {{
* type: HIDDEN_PARTICIPANT_JOINED,
* displayName: string,
* id: string
* }}
*/
export function hiddenParticipantJoined(id: string, displayName: string) {
return {
type: HIDDEN_PARTICIPANT_JOINED,
id,
displayName
};
}

/**
* Action to signal that a hidden participant has left the conference.
*
* @param {string} id - The id of the participant.
* @returns {{
* type: HIDDEN_PARTICIPANT_LEFT,
* id: string
* }}
*/
export function hiddenParticipantLeft(id: string) {
return {
type: HIDDEN_PARTICIPANT_LEFT,
id
};
}

/**
* Action to signal that a participant has left.
*
Expand Down
2 changes: 1 addition & 1 deletion react/features/subtitles/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ function _requestingSubtitlesChange(
logger.error('Error dialing', e);

// let's back to the correct state
dispatch(setRequestingSubtitles(false, false));
dispatch(setRequestingSubtitles(false, false, null));
});
}
}
Expand Down
6 changes: 6 additions & 0 deletions react/features/subtitles/reducer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ReducerRegistry from '../base/redux/ReducerRegistry';
import { TRANSCRIBER_LEFT } from '../transcribing/actionTypes';

import {
REMOVE_TRANSCRIPT_MESSAGE,
Expand Down Expand Up @@ -48,6 +49,11 @@ ReducerRegistry.register<ISubtitlesState>('features/subtitles', (
...state,
_requestingSubtitles: !state._requestingSubtitles
};
case TRANSCRIBER_LEFT:
return {
...state,
...defaultState
};
}

return state;
Expand Down
16 changes: 2 additions & 14 deletions react/features/transcribing/actionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* }
* @private
*/
export const _TRANSCRIBER_JOINED = 'TRANSCRIBER_JOINED';
export const TRANSCRIBER_JOINED = 'TRANSCRIBER_JOINED';

/**
* The type of Redux action signalling that the transcriber has left
Expand All @@ -19,16 +19,4 @@ export const _TRANSCRIBER_JOINED = 'TRANSCRIBER_JOINED';
* }
* @private
*/
export const _TRANSCRIBER_LEFT = 'TRANSCRIBER_LEFT';

/**
* The type of a Redux action signalling that a hidden participant has joined,
* which can be candidate for being a transcriber.
*
* {
* type: _POTENTIAL_TRANSCRIBER_JOINED,
* }
* @private
*/
export const _POTENTIAL_TRANSCRIBER_JOINED
= 'POTENTIAL_TRANSCRIBER_JOINED';
export const TRANSCRIBER_LEFT = 'TRANSCRIBER_LEFT';
39 changes: 13 additions & 26 deletions react/features/transcribing/actions.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import {
_POTENTIAL_TRANSCRIBER_JOINED,
_TRANSCRIBER_JOINED,
_TRANSCRIBER_LEFT
TRANSCRIBER_JOINED,
TRANSCRIBER_LEFT
} from './actionTypes';

/**
* Notify that the transcriber, with a unique ID, has joined.
*
* @param {string} participantId - The participant id of the transcriber.
* @returns {{
* type: _TRANSCRIBER_JOINED,
* type: TRANSCRIBER_JOINED,
* participantId: string
* }}
*/
export function transcriberJoined(participantId: string) {
return {
type: _TRANSCRIBER_JOINED,
type: TRANSCRIBER_JOINED,
transcriberJID: participantId
};
}
Expand All @@ -24,30 +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
* }}
*/
export function transcriberLeft(participantId: string) {
return {
type: _TRANSCRIBER_LEFT,
transcriberJID: participantId
};
}

/**
* Notify that a potential transcriber, with a unique ID, has joined.
*
* @param {string} participantId - The participant id of the transcriber.
* @returns {{
* type: _POTENTIAL_TRANSCRIBER_JOINED,
* participantId: string
* type: TRANSCRIBER_LEFT,
* participantId: string,
* abruptly: boolean
* }}
*/
export function potentialTranscriberJoined(participantId: string) {
export function transcriberLeft(participantId: string, abruptly: boolean) {
return {
type: _POTENTIAL_TRANSCRIBER_JOINED,
transcriberJID: participantId
type: TRANSCRIBER_LEFT,
transcriberJID: participantId,
abruptly
};
}
Loading

0 comments on commit d5269e8

Please sign in to comment.