agora-appbuilder-core 4.1.9 → 4.1.11-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +1 -3
- package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +1 -2
- package/template/agora-rn-uikit/src/Reducer/index.ts +0 -2
- package/template/agora-rn-uikit/src/Rtc/Join.tsx +11 -25
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +1 -14
- package/template/agora-rn-uikit/src/Utils/isBotUser.ts +1 -1
- package/template/android/app/build.gradle +0 -7
- package/template/bridge/rtm/web/Types.ts +0 -183
- package/template/bridge/rtm/web/index.ts +491 -423
- package/template/defaultConfig.js +3 -3
- package/template/ios/Podfile +0 -41
- package/template/package.json +5 -5
- package/template/src/assets/font-styles.css +4 -0
- package/template/src/assets/fonts/icomoon.ttf +0 -0
- package/template/src/assets/selection.json +1 -1
- package/template/src/atoms/ActionMenu.tsx +93 -13
- package/template/src/atoms/CustomIcon.tsx +1 -0
- package/template/src/atoms/DropDownMulti.tsx +80 -29
- package/template/src/atoms/Input.tsx +2 -1
- package/template/src/components/Controls.tsx +148 -143
- package/template/src/components/EventsConfigure.tsx +152 -97
- package/template/src/components/RTMConfigure.tsx +426 -644
- package/template/src/components/precall/joinCallBtn.native.tsx +7 -2
- package/template/src/components/precall/joinCallBtn.tsx +7 -2
- package/template/src/components/precall/joinWaitingRoomBtn.native.tsx +8 -3
- package/template/src/components/precall/joinWaitingRoomBtn.tsx +22 -4
- package/template/src/components/precall/textInput.tsx +45 -22
- package/template/src/components/precall/usePreCall.tsx +7 -0
- package/template/src/components/room-info/useRoomInfo.tsx +5 -0
- package/template/src/language/default-labels/videoCallScreenLabels.ts +27 -4
- package/template/src/pages/video-call/ActionSheetContent.tsx +77 -77
- package/template/src/pages/video-call/SidePanelHeader.tsx +81 -36
- package/template/src/rtm/RTMEngine.ts +33 -130
- package/template/src/rtm-events/constants.ts +6 -0
- package/template/src/rtm-events-api/Events.ts +30 -106
- package/template/src/subComponents/caption/Caption.tsx +48 -7
- package/template/src/subComponents/caption/CaptionContainer.tsx +324 -51
- package/template/src/subComponents/caption/CaptionIcon.tsx +35 -34
- package/template/src/subComponents/caption/CaptionText.tsx +103 -2
- package/template/src/subComponents/caption/LanguageSelectorPopup.tsx +179 -69
- package/template/src/subComponents/caption/Transcript.tsx +46 -11
- package/template/src/subComponents/caption/TranscriptIcon.tsx +27 -35
- package/template/src/subComponents/caption/TranscriptText.tsx +78 -3
- package/template/src/subComponents/caption/proto/ptoto.js +38 -4
- package/template/src/subComponents/caption/proto/test.proto +34 -19
- package/template/src/subComponents/caption/useCaption.tsx +753 -10
- package/template/src/subComponents/caption/useSTTAPI.tsx +118 -205
- package/template/src/subComponents/caption/useStreamMessageUtils.native.ts +152 -33
- package/template/src/subComponents/caption/useStreamMessageUtils.ts +165 -34
- package/template/src/subComponents/caption/utils.ts +171 -3
- package/template/src/utils/SdkEvents.ts +3 -0
- package/template/src/utils/useEndCall.ts +3 -5
- package/template/src/utils/useSpeechToText.ts +31 -20
- package/template/agora-rn-uikit/src/Reducer/Spotlight.ts +0 -11
- package/template/agora-rn-uikit/src/Reducer/UserBanned.ts +0 -11
- package/template/bridge/rtm/web/index-legacy.ts +0 -540
- package/template/src/components/RTMConfigure-legacy.tsx +0 -848
|
@@ -58,13 +58,19 @@ import {
|
|
|
58
58
|
import {useVideoCall} from './useVideoCall';
|
|
59
59
|
import {useScreenshare} from '../subComponents/screenshare/useScreenshare';
|
|
60
60
|
import LayoutIconDropdown from '../subComponents/LayoutIconDropdown';
|
|
61
|
-
import {
|
|
61
|
+
import {
|
|
62
|
+
LanguageTranslationConfig,
|
|
63
|
+
useCaption,
|
|
64
|
+
} from '../../src/subComponents/caption/useCaption';
|
|
62
65
|
import LanguageSelectorPopup from '../../src/subComponents/caption/LanguageSelectorPopup';
|
|
63
|
-
import useSTTAPI from '../../src/subComponents/caption/useSTTAPI';
|
|
64
66
|
import {EventNames} from '../rtm-events';
|
|
65
67
|
import events, {PersistanceLevel} from '../rtm-events-api';
|
|
66
68
|
import Toast from '../../react-native-toast-message';
|
|
67
|
-
import {
|
|
69
|
+
import {
|
|
70
|
+
getLanguageLabel,
|
|
71
|
+
LanguageType,
|
|
72
|
+
TranslateConfig,
|
|
73
|
+
} from '../../src/subComponents/caption/utils';
|
|
68
74
|
import Toolbar from '../atoms/Toolbar';
|
|
69
75
|
import ToolbarItem, {useToolbarProps} from '../atoms/ToolbarItem';
|
|
70
76
|
import {
|
|
@@ -312,20 +318,21 @@ const MoreButton = (props: {fields: ToolbarMoreButtonDefaultFields}) => {
|
|
|
312
318
|
const {
|
|
313
319
|
isCaptionON,
|
|
314
320
|
setIsCaptionON,
|
|
315
|
-
language: prevLang,
|
|
321
|
+
// language: prevLang,
|
|
316
322
|
isSTTActive,
|
|
317
|
-
setIsSTTActive,
|
|
323
|
+
// setIsSTTActive,
|
|
318
324
|
isSTTError,
|
|
325
|
+
handleTranslateConfigChange,
|
|
319
326
|
} = useCaption();
|
|
320
327
|
|
|
321
328
|
const isTranscriptON = sidePanel === SidePanelType.Transcript;
|
|
322
329
|
|
|
323
330
|
const [isLanguagePopupOpen, setLanguagePopup] =
|
|
324
331
|
React.useState<boolean>(false);
|
|
325
|
-
const isFirstTimePopupOpen = React.useRef(false);
|
|
332
|
+
// const isFirstTimePopupOpen = React.useRef(false);
|
|
326
333
|
const STT_clicked = React.useRef(null);
|
|
327
334
|
|
|
328
|
-
const {start, restart} = useSTTAPI();
|
|
335
|
+
// const {start, restart} = useSTTAPI();
|
|
329
336
|
const {
|
|
330
337
|
data: {isHost},
|
|
331
338
|
} = useRoomInfo();
|
|
@@ -531,25 +538,17 @@ const MoreButton = (props: {fields: ToolbarMoreButtonDefaultFields}) => {
|
|
|
531
538
|
icon: `${isCaptionON ? 'captions-off' : 'captions'}`,
|
|
532
539
|
iconColor: $config.SECONDARY_ACTION_COLOR,
|
|
533
540
|
textColor: $config.FONT_COLOR,
|
|
534
|
-
disabled: !(
|
|
535
|
-
$config.ENABLE_STT &&
|
|
536
|
-
$config.ENABLE_CAPTION &&
|
|
537
|
-
(isHost || (!isHost && isSTTActive))
|
|
538
|
-
),
|
|
541
|
+
disabled: !($config.ENABLE_STT && $config.ENABLE_CAPTION),
|
|
539
542
|
title: captionLabel(isCaptionON),
|
|
540
543
|
onPress: () => {
|
|
541
544
|
setActionMenuVisible(false);
|
|
542
545
|
STT_clicked.current = !isCaptionON ? 'caption' : null;
|
|
543
|
-
if (isSTTError) {
|
|
544
|
-
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
if (isSTTActive) {
|
|
548
|
-
setIsCaptionON(prev => !prev);
|
|
549
|
-
// is lang popup has been shown once for any user in meeting
|
|
550
|
-
} else {
|
|
551
|
-
isFirstTimePopupOpen.current = true;
|
|
546
|
+
if (isSTTError || !isSTTActive) {
|
|
547
|
+
// Show popup when error or STT not active
|
|
552
548
|
setLanguagePopup(true);
|
|
549
|
+
} else {
|
|
550
|
+
// STT is active and no error
|
|
551
|
+
setIsCaptionON(prev => !prev);
|
|
553
552
|
}
|
|
554
553
|
},
|
|
555
554
|
});
|
|
@@ -564,26 +563,19 @@ const MoreButton = (props: {fields: ToolbarMoreButtonDefaultFields}) => {
|
|
|
564
563
|
disabled: !(
|
|
565
564
|
$config.ENABLE_STT &&
|
|
566
565
|
$config.ENABLE_CAPTION &&
|
|
567
|
-
$config.ENABLE_MEETING_TRANSCRIPT
|
|
568
|
-
(isHost || (!isHost && isSTTActive))
|
|
566
|
+
$config.ENABLE_MEETING_TRANSCRIPT
|
|
569
567
|
),
|
|
570
568
|
title: transcriptLabel(isTranscriptON),
|
|
571
569
|
onPress: () => {
|
|
572
570
|
setActionMenuVisible(false);
|
|
573
571
|
STT_clicked.current = !isTranscriptON ? 'transcript' : null;
|
|
574
|
-
if (isSTTError) {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
: setSidePanel(SidePanelType.None);
|
|
578
|
-
return;
|
|
579
|
-
}
|
|
580
|
-
if (isSTTActive) {
|
|
572
|
+
if (isSTTError || !isSTTActive) {
|
|
573
|
+
setLanguagePopup(true);
|
|
574
|
+
} else {
|
|
581
575
|
!isTranscriptON
|
|
582
576
|
? setSidePanel(SidePanelType.Transcript)
|
|
583
577
|
: setSidePanel(SidePanelType.None);
|
|
584
|
-
|
|
585
|
-
isFirstTimePopupOpen.current = true;
|
|
586
|
-
setLanguagePopup(true);
|
|
578
|
+
// isFirstTimePopupOpen.current = true;
|
|
587
579
|
}
|
|
588
580
|
},
|
|
589
581
|
});
|
|
@@ -845,39 +837,51 @@ const MoreButton = (props: {fields: ToolbarMoreButtonDefaultFields}) => {
|
|
|
845
837
|
setActionMenuVisible(false);
|
|
846
838
|
}, [currentLayout]);
|
|
847
839
|
|
|
848
|
-
const onConfirm = async (
|
|
840
|
+
const onConfirm = async (inputTranslateConfig: LanguageTranslationConfig) => {
|
|
841
|
+
console.log(
|
|
842
|
+
'[STT_PER_USER_BOT] Controls onConfirm called',
|
|
843
|
+
inputTranslateConfig,
|
|
844
|
+
);
|
|
849
845
|
const isCaptionClicked = STT_clicked.current === 'caption';
|
|
850
846
|
const isTranscriptClicked = STT_clicked.current === 'transcript';
|
|
851
847
|
setLanguagePopup(false);
|
|
852
|
-
isFirstTimePopupOpen.current = false;
|
|
853
|
-
const method = isCaptionClicked
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
if (isTranscriptClicked) {
|
|
859
|
-
if (!isTranscriptON) {
|
|
860
|
-
setSidePanel(SidePanelType.Transcript);
|
|
861
|
-
} else {
|
|
862
|
-
setSidePanel(SidePanelType.None);
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
if (method === 'stop') return; // not closing the stt service as it will stop for whole channel
|
|
866
|
-
if (method === 'start' && isSTTActive === true) return; // not triggering the start service if STT Service already started by anyone else in the channel
|
|
848
|
+
// isFirstTimePopupOpen.current = false;
|
|
849
|
+
// const method = isCaptionClicked
|
|
850
|
+
// ? isCaptionON
|
|
851
|
+
// : isTranscriptON
|
|
852
|
+
// ? 'stop'
|
|
853
|
+
// : 'start';
|
|
867
854
|
|
|
868
|
-
if (
|
|
869
|
-
|
|
870
|
-
} else {
|
|
871
|
-
}
|
|
855
|
+
// if (method === 'stop') return; // not closing the stt service as it will stop for whole channel
|
|
856
|
+
// if (method === 'start' && isSTTActive === true) return; // not triggering the start service if STT Service already started by anyone else in the channel
|
|
872
857
|
|
|
873
858
|
try {
|
|
874
|
-
const res = await start(language);
|
|
875
|
-
if (res?.message.includes('STARTED')) {
|
|
876
|
-
|
|
877
|
-
|
|
859
|
+
// const res = await start(language, language);
|
|
860
|
+
// if (res?.message.includes('STARTED')) {
|
|
861
|
+
// // channel is already started now restart
|
|
862
|
+
// await restart(language, language);
|
|
863
|
+
// }
|
|
864
|
+
if (isTranscriptClicked) {
|
|
865
|
+
if (!isTranscriptON) {
|
|
866
|
+
setSidePanel(SidePanelType.Transcript);
|
|
867
|
+
} else {
|
|
868
|
+
setSidePanel(SidePanelType.None);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
if (isCaptionClicked) {
|
|
872
|
+
setIsCaptionON(prev => !prev);
|
|
873
|
+
} else {
|
|
878
874
|
}
|
|
875
|
+
await handleTranslateConfigChange(inputTranslateConfig);
|
|
879
876
|
} catch (error) {
|
|
880
|
-
|
|
877
|
+
setIsCaptionON(false);
|
|
878
|
+
setSidePanel(SidePanelType.None);
|
|
879
|
+
logger.error(
|
|
880
|
+
LogSource.Internals,
|
|
881
|
+
'STT',
|
|
882
|
+
'error in starting caption',
|
|
883
|
+
error,
|
|
884
|
+
);
|
|
881
885
|
}
|
|
882
886
|
};
|
|
883
887
|
|
|
@@ -952,12 +956,14 @@ const MoreButton = (props: {fields: ToolbarMoreButtonDefaultFields}) => {
|
|
|
952
956
|
|
|
953
957
|
return (
|
|
954
958
|
<>
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
959
|
+
{isLanguagePopupOpen && (
|
|
960
|
+
<LanguageSelectorPopup
|
|
961
|
+
modalVisible={isLanguagePopupOpen}
|
|
962
|
+
setModalVisible={setLanguagePopup}
|
|
963
|
+
onConfirm={onConfirm}
|
|
964
|
+
// isFirstTimePopupOpen={isFirstTimePopupOpen.current}
|
|
965
|
+
/>
|
|
966
|
+
)}
|
|
961
967
|
{$config.CLOUD_RECORDING && isHost && isWeb() && (
|
|
962
968
|
<>
|
|
963
969
|
<RecordingDeletePopup
|
|
@@ -1134,9 +1140,7 @@ export const MoreButtonToolbarItem = (props?: {
|
|
|
1134
1140
|
}, [isHost]);
|
|
1135
1141
|
|
|
1136
1142
|
return width < BREAKPOINTS.lg ||
|
|
1137
|
-
($config.ENABLE_STT &&
|
|
1138
|
-
$config.ENABLE_CAPTION &&
|
|
1139
|
-
(isHost || (!isHost && isSTTActive))) ||
|
|
1143
|
+
($config.ENABLE_STT && $config.ENABLE_CAPTION) ||
|
|
1140
1144
|
$config.ENABLE_NOISE_CANCELLATION ||
|
|
1141
1145
|
(isHost && $config.CLOUD_RECORDING && isWeb()) ||
|
|
1142
1146
|
($config.ENABLE_VIRTUAL_BACKGROUND && !$config.AUDIO_ROOM) ||
|
|
@@ -1179,7 +1183,7 @@ const Controls = (props: ControlsProps) => {
|
|
|
1179
1183
|
const {items = {}, includeDefaultItems = true} = props;
|
|
1180
1184
|
const {width, height} = useWindowDimensions();
|
|
1181
1185
|
const {defaultContent} = useContent();
|
|
1182
|
-
const {
|
|
1186
|
+
const {setMeetingTranscript} = useCaption();
|
|
1183
1187
|
const defaultContentRef = React.useRef(defaultContent);
|
|
1184
1188
|
const {setRoomInfo} = useSetRoomInfo();
|
|
1185
1189
|
const heading = useString<'Set' | 'Changed'>(sttSpokenLanguageToastHeading);
|
|
@@ -1190,86 +1194,87 @@ const Controls = (props: ControlsProps) => {
|
|
|
1190
1194
|
username: string;
|
|
1191
1195
|
}>(sttSpokenLanguageToastSubHeading);
|
|
1192
1196
|
|
|
1193
|
-
const {sttLanguage
|
|
1194
|
-
const {addStreamMessageListener} = useSpeechToText();
|
|
1197
|
+
// const {sttLanguage} = useRoomInfo();
|
|
1198
|
+
// const {addStreamMessageListener} = useSpeechToText();
|
|
1195
1199
|
|
|
1196
1200
|
React.useEffect(() => {
|
|
1197
1201
|
defaultContentRef.current = defaultContent;
|
|
1198
1202
|
}, [defaultContent]);
|
|
1199
1203
|
|
|
1200
|
-
React.useEffect(() => {
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
}, [sttLanguage]);
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1204
|
+
// React.useEffect(() => {
|
|
1205
|
+
// // for mobile events are set in ActionSheetContent
|
|
1206
|
+
// if (!sttLanguage) return;
|
|
1207
|
+
// const {
|
|
1208
|
+
// username,
|
|
1209
|
+
// prevLang,
|
|
1210
|
+
// newLang,
|
|
1211
|
+
// uid,
|
|
1212
|
+
// langChanged,
|
|
1213
|
+
// }: RoomInfoContextInterface['sttLanguage'] = sttLanguage;
|
|
1214
|
+
// if (!langChanged) return;
|
|
1215
|
+
// const actionText =
|
|
1216
|
+
// prevLang.indexOf('') !== -1
|
|
1217
|
+
// ? `has set the spoken language to "${getLanguageLabel(newLang)}" `
|
|
1218
|
+
// : `changed the spoken language from "${getLanguageLabel(
|
|
1219
|
+
// prevLang,
|
|
1220
|
+
// )}" to "${getLanguageLabel(newLang)}" `;
|
|
1221
|
+
// // const msg = `${
|
|
1222
|
+
// // //@ts-ignore
|
|
1223
|
+
// // defaultContentRef.current[uid]?.name || username
|
|
1224
|
+
// // } ${actionText} `;
|
|
1225
|
+
// let subheadingObj: any = {};
|
|
1226
|
+
// if (prevLang.indexOf('') !== -1) {
|
|
1227
|
+
// subheadingObj = {
|
|
1228
|
+
// username: defaultContentRef.current[uid]?.name || username,
|
|
1229
|
+
// action: prevLang.indexOf('') !== -1 ? 'Set' : 'Changed',
|
|
1230
|
+
// newLanguage: getLanguageLabel(newLang),
|
|
1231
|
+
// };
|
|
1232
|
+
// } else {
|
|
1233
|
+
// subheadingObj = {
|
|
1234
|
+
// username: defaultContentRef.current[uid]?.name || username,
|
|
1235
|
+
// action: prevLang.indexOf('') !== -1 ? 'Set' : 'Changed',
|
|
1236
|
+
// newLanguage: getLanguageLabel(newLang),
|
|
1237
|
+
// oldLanguage: getLanguageLabel(prevLang),
|
|
1238
|
+
// };
|
|
1239
|
+
// }
|
|
1240
|
+
|
|
1241
|
+
// // Toast.show({
|
|
1242
|
+
// // leadingIconName: 'lang-select',
|
|
1243
|
+
// // type: 'info',
|
|
1244
|
+
// // text1: heading(prevLang.indexOf('') !== -1 ? 'Set' : 'Changed'),
|
|
1245
|
+
// // visibilityTime: 3000,
|
|
1246
|
+
// // primaryBtn: null,
|
|
1247
|
+
// // secondaryBtn: null,
|
|
1248
|
+
// // text2: subheading(subheadingObj),
|
|
1249
|
+
// // });
|
|
1250
|
+
// setRoomInfo(prev => {
|
|
1251
|
+
// return {
|
|
1252
|
+
// ...prev,
|
|
1253
|
+
// sttLanguage: {...sttLanguage, langChanged: false},
|
|
1254
|
+
// };
|
|
1255
|
+
// });
|
|
1256
|
+
// // syncing local set language
|
|
1257
|
+
// // newLang && setLanguage(newLang);
|
|
1258
|
+
// // add spoken lang msg to transcript
|
|
1259
|
+
// setMeetingTranscript(prev => {
|
|
1260
|
+
// return [
|
|
1261
|
+
// ...prev,
|
|
1262
|
+
// {
|
|
1263
|
+
// name: 'langUpdate',
|
|
1264
|
+
// time: new Date().getTime(),
|
|
1265
|
+
// uid: `langUpdate-${uid}`,
|
|
1266
|
+
// text: actionText,
|
|
1267
|
+
// },
|
|
1268
|
+
// ];
|
|
1269
|
+
// });
|
|
1270
|
+
// // start listening to stream Message callback
|
|
1271
|
+
// addStreamMessageListener();
|
|
1272
|
+
// }, [sttLanguage]);
|
|
1273
|
+
|
|
1274
|
+
// Ask bhupendra
|
|
1275
|
+
// React.useEffect(() => {
|
|
1276
|
+
// setIsSTTActive(isSTTActive);
|
|
1277
|
+
// }, [isSTTActive]);
|
|
1273
1278
|
|
|
1274
1279
|
const isHidden = (hide: ToolbarItemHide = false) => {
|
|
1275
1280
|
try {
|
|
@@ -268,65 +268,65 @@ const EventsConfigure: React.FC<Props> = ({
|
|
|
268
268
|
permissionStatusRef.current = permissionStatus;
|
|
269
269
|
}, [permissionStatus]);
|
|
270
270
|
|
|
271
|
-
const {hasUserJoinedRTM, isInitialQueueCompleted} = useContext(ChatContext);
|
|
272
|
-
const {startSpeechToText, addStreamMessageListener} = useSpeechToText();
|
|
273
|
-
|
|
274
|
-
//auto start stt
|
|
275
|
-
useEffect(() => {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}, [
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
]);
|
|
271
|
+
// const {hasUserJoinedRTM, isInitialQueueCompleted} = useContext(ChatContext);
|
|
272
|
+
// const {startSpeechToText, addStreamMessageListener} = useSpeechToText();
|
|
273
|
+
|
|
274
|
+
// auto start stt
|
|
275
|
+
// useEffect(() => {
|
|
276
|
+
// if (
|
|
277
|
+
// !isRecordingBot &&
|
|
278
|
+
// $config.ENABLE_CAPTION &&
|
|
279
|
+
// $config.STT_AUTO_START &&
|
|
280
|
+
// callActive &&
|
|
281
|
+
// hasUserJoinedRTM &&
|
|
282
|
+
// isInitialQueueCompleted &&
|
|
283
|
+
// !sttAutoStarted
|
|
284
|
+
// ) {
|
|
285
|
+
// //host will start the caption
|
|
286
|
+
// if (isHost && roomId?.host && !isSTTAlreadyActiveRef.current) {
|
|
287
|
+
// logger.log(LogSource.Internals, 'STT', 'STT_AUTO_START triggered', {
|
|
288
|
+
// uidWhoTriggered: localUid,
|
|
289
|
+
// });
|
|
290
|
+
|
|
291
|
+
// // add stream message callback listener
|
|
292
|
+
// addStreamMessageListener();
|
|
293
|
+
|
|
294
|
+
// //start with default language
|
|
295
|
+
// startSpeechToText(['en-US'])
|
|
296
|
+
// .then(() => {
|
|
297
|
+
// logger.log(LogSource.Internals, 'STT', 'STT_AUTO_START success');
|
|
298
|
+
// setSttAutoStarted(true);
|
|
299
|
+
// })
|
|
300
|
+
// .catch(err => {
|
|
301
|
+
// logger.log(
|
|
302
|
+
// LogSource.Internals,
|
|
303
|
+
// 'STT',
|
|
304
|
+
// 'STT_AUTO_START failed',
|
|
305
|
+
// err,
|
|
306
|
+
// );
|
|
307
|
+
// setSttAutoStarted(false);
|
|
308
|
+
// });
|
|
309
|
+
// }
|
|
310
|
+
|
|
311
|
+
// if (isHost && roomId?.host && isSTTAlreadyActiveRef.current) {
|
|
312
|
+
// logger.log(
|
|
313
|
+
// LogSource.Internals,
|
|
314
|
+
// 'STT',
|
|
315
|
+
// 'STT_AUTO_START already triggered by some other host',
|
|
316
|
+
// );
|
|
317
|
+
// setSttAutoStarted(true);
|
|
318
|
+
// }
|
|
319
|
+
// }
|
|
320
|
+
// }, [
|
|
321
|
+
// isRecordingBot,
|
|
322
|
+
// callActive,
|
|
323
|
+
// isHost,
|
|
324
|
+
// hasUserJoinedRTM,
|
|
325
|
+
// roomId,
|
|
326
|
+
// sttAutoStarted,
|
|
327
|
+
// isInitialQueueCompleted,
|
|
328
|
+
// isSTTAlreadyActiveRef.current,
|
|
329
|
+
// ]);
|
|
330
330
|
|
|
331
331
|
useEffect(() => {
|
|
332
332
|
//user joined event listener
|
|
@@ -570,43 +570,97 @@ const EventsConfigure: React.FC<Props> = ({
|
|
|
570
570
|
}
|
|
571
571
|
});
|
|
572
572
|
|
|
573
|
-
events.on(EventNames.STT_ACTIVE, data => {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
});
|
|
573
|
+
// events.on(EventNames.STT_ACTIVE, data => {
|
|
574
|
+
// const payload = JSON.parse(data?.payload);
|
|
575
|
+
// if (payload.active) {
|
|
576
|
+
// isSTTAlreadyActiveRef.current = true;
|
|
577
|
+
// } else {
|
|
578
|
+
// isSTTAlreadyActiveRef.current = false;
|
|
579
|
+
// }
|
|
580
|
+
// setRoomInfo(prev => {
|
|
581
|
+
// return {
|
|
582
|
+
// ...prev,
|
|
583
|
+
// isSTTActive: payload.active,
|
|
584
|
+
// };
|
|
585
|
+
// });
|
|
586
|
+
// });
|
|
587
587
|
|
|
588
|
-
events.on(EventNames.STT_LANGUAGE, data => {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
588
|
+
// events.on(EventNames.STT_LANGUAGE, data => {
|
|
589
|
+
// const {
|
|
590
|
+
// username,
|
|
591
|
+
// prevLang,
|
|
592
|
+
// newLang,
|
|
593
|
+
// uid,
|
|
594
|
+
// remoteLang,
|
|
595
|
+
// }: RoomInfoContextInterface['sttLanguage'] = JSON.parse(data?.payload);
|
|
596
|
+
|
|
597
|
+
// setRoomInfo(prev => {
|
|
598
|
+
// // Merge remoteLang with existing remoteLang to accumulate protected languages
|
|
599
|
+
// const existingRemoteLang = prev.sttLanguage?.remoteLang || [];
|
|
600
|
+
// const newRemoteLang = remoteLang || [];
|
|
601
|
+
// const mergedRemoteLang = [...new Set([...existingRemoteLang, ...newRemoteLang])];
|
|
602
|
+
|
|
603
|
+
// const sttLangObj = {
|
|
604
|
+
// username,
|
|
605
|
+
// prevLang,
|
|
606
|
+
// newLang, // All languages in the channel
|
|
607
|
+
// uid,
|
|
608
|
+
// langChanged: true,
|
|
609
|
+
// remoteLang: mergedRemoteLang, // Accumulated protected languages
|
|
610
|
+
// };
|
|
611
|
+
|
|
612
|
+
// return {
|
|
613
|
+
// ...prev,
|
|
614
|
+
// sttLanguage: sttLangObj,
|
|
615
|
+
// };
|
|
616
|
+
// });
|
|
617
|
+
// });
|
|
618
|
+
|
|
619
|
+
// events.on(EventNames.STT_TRANSLATE_LANGUAGE, data => {
|
|
620
|
+
// const {
|
|
621
|
+
// username,
|
|
622
|
+
// uid,
|
|
623
|
+
// translateConfig,
|
|
624
|
+
// } = JSON.parse(data?.payload);
|
|
625
|
+
|
|
626
|
+
// setRoomInfo(prev => {
|
|
627
|
+
// // Merge translate configs with existing configuration
|
|
628
|
+
// const existingTranslateConfig = prev.sttLanguage?.translateConfig || [];
|
|
629
|
+
// const newTranslateConfig = translateConfig || [];
|
|
630
|
+
|
|
631
|
+
// // Merge logic: for each new source language, merge with existing or add new
|
|
632
|
+
// const mergedTranslateConfig = [...existingTranslateConfig];
|
|
633
|
+
|
|
634
|
+
// newTranslateConfig.forEach(newConfig => {
|
|
635
|
+
// const existingIndex = mergedTranslateConfig.findIndex(
|
|
636
|
+
// existing => existing.source_lang === newConfig.source_lang
|
|
637
|
+
// );
|
|
638
|
+
|
|
639
|
+
// if (existingIndex !== -1) {
|
|
640
|
+
// // Same source language - merge target languages
|
|
641
|
+
// const existingTargets = mergedTranslateConfig[existingIndex].target_lang;
|
|
642
|
+
// const mergedTargets = [...new Set([...existingTargets, ...newConfig.target_lang])];
|
|
643
|
+
// mergedTranslateConfig[existingIndex] = {
|
|
644
|
+
// ...mergedTranslateConfig[existingIndex],
|
|
645
|
+
// target_lang: mergedTargets,
|
|
646
|
+
// };
|
|
647
|
+
// } else {
|
|
648
|
+
// // Different source language - add new config
|
|
649
|
+
// mergedTranslateConfig.push(newConfig);
|
|
650
|
+
// }
|
|
651
|
+
// });
|
|
652
|
+
|
|
653
|
+
// const sttLangObj = {
|
|
654
|
+
// ...prev.sttLanguage,
|
|
655
|
+
// translateConfig: mergedTranslateConfig,
|
|
656
|
+
// };
|
|
657
|
+
|
|
658
|
+
// return {
|
|
659
|
+
// ...prev,
|
|
660
|
+
// sttLanguage: sttLangObj,
|
|
661
|
+
// };
|
|
662
|
+
// });
|
|
663
|
+
// });
|
|
610
664
|
|
|
611
665
|
events.on(EventNames.WAITING_ROOM_STATUS_UPDATE, data => {
|
|
612
666
|
if (!isHostRef.current) return;
|
|
@@ -871,8 +925,9 @@ const EventsConfigure: React.FC<Props> = ({
|
|
|
871
925
|
events.off(EventNames.WHITEBOARD_ACTIVE);
|
|
872
926
|
events.off(EventNames.WHITEBOARD_LAST_IMAGE_UPLOAD_POSITION);
|
|
873
927
|
events.off(EventNames.BOARD_COLOR_CHANGED);
|
|
874
|
-
events.off(EventNames.STT_ACTIVE);
|
|
875
|
-
events.off(EventNames.STT_LANGUAGE);
|
|
928
|
+
// events.off(EventNames.STT_ACTIVE);
|
|
929
|
+
// events.off(EventNames.STT_LANGUAGE);
|
|
930
|
+
// events.off(EventNames.STT_TRANSLATE_LANGUAGE);
|
|
876
931
|
};
|
|
877
932
|
}, []);
|
|
878
933
|
|