Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(live-translation): drive the meeting label from metadata.

Jaya Allamsetty7ebc4a813a74
diff --git a/react/features/audio-translation/functions.ts b/react/features/audio-translation/functions.ts
index 9409b38d7e..2e64fb7614 100644
--- a/react/features/audio-translation/functions.ts
+++ b/react/features/audio-translation/functions.ts
@@ -107,20 +107,21 @@ export function getTranslationTreatment(state: IReduxState, participantId: strin
}
/**
- * Whether audio translation is currently active anywhere in the meeting: a remote participant is translating
- * the local user, translated audio is being received, or the local user has translation on.
+ * Whether audio translation is in progress in the meeting, for the conference label. Only control-plane
+ * signals count: languages participants declare, the listener counts speakers publish in room metadata, and
+ * the component's listeners push.
*
* @param {IReduxState} state - The redux state.
* @returns {boolean}
*/
export function isAudioTranslationActiveInMeeting(state: IReduxState): boolean {
- const { language, participantLanguages, receivingSources, translationListeners }
- = state['features/audio-translation'];
+ const { language, participantLanguages, translationListeners } = state['features/audio-translation'];
+ const listenerCounts = state['features/base/conference'].metadata?.audioTranslationListenerCounts ?? {};
return translationListeners.length > 0
- || receivingSources.length > 0
|| Boolean(language)
- || Object.values(participantLanguages).some(lang => lang !== null);
+ || Object.values(participantLanguages).some(lang => lang !== null)
+ || Object.values(listenerCounts).some(counts => Object.values(counts).some(count => count > 0));
}
/**
diff --git a/react/features/audio-translation/reducer.ts b/react/features/audio-translation/reducer.ts
index f2c2c164a3..66cf82163e 100644
--- a/react/features/audio-translation/reducer.ts
+++ b/react/features/audio-translation/reducer.ts
@@ -1,3 +1,4 @@
+import { PARTICIPANT_LEFT } from '../base/participants/actionTypes';
import ReducerRegistry from '../base/redux/ReducerRegistry';
import {
@@ -69,6 +70,12 @@ ReducerRegistry.register<IAudioTranslationState>(
[action.participantId]: action.language
}
};
+ case PARTICIPANT_LEFT: {
+ // A per-speaker choice must not outlive the speaker, or the meeting label never clears.
+ const { [action.participant.id]: _left, ...participantLanguages } = state.participantLanguages;
+
+ return _left === undefined ? state : { ...state, participantLanguages };
+ }
case SET_TRANSLATION_LISTENERS:
return {
...state,