agora-appbuilder-core 4.0.29-beta-21 → 4.0.29-beta-22
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 +1 -1
- package/template/defaultConfig.js +2 -0
- package/template/global.d.ts +2 -0
- package/template/package.json +1 -1
- package/template/src/components/EventsConfigure.tsx +43 -6
- package/template/src/logger/AppBuilderLogger.tsx +7 -0
- package/template/src/pages/VideoCall.tsx +2 -1
- package/template/src/subComponents/caption/useCaption.tsx +9 -1
- package/template/src/subComponents/caption/useSTTAPI.tsx +4 -2
- package/template/src/subComponents/recording/useRecording.tsx +28 -0
package/package.json
CHANGED
package/template/global.d.ts
CHANGED
|
@@ -166,6 +166,8 @@ interface ConfigInterface {
|
|
|
166
166
|
CLI_VERSION: string;
|
|
167
167
|
CORE_VERSION: string;
|
|
168
168
|
DISABLE_LANDSCAPE_MODE: boolean;
|
|
169
|
+
STT_AUTO_START: boolean;
|
|
170
|
+
CLOUD_RECORDING_AUTO_START: boolean;
|
|
169
171
|
}
|
|
170
172
|
declare var $config: ConfigInterface;
|
|
171
173
|
declare module 'customization' {
|
package/template/package.json
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@react-native-community/clipboard": "1.5.1",
|
|
60
60
|
"@supersami/rn-foreground-service": "^1.1.1",
|
|
61
61
|
"add": "^2.0.6",
|
|
62
|
-
"agora-chat": "
|
|
62
|
+
"agora-chat": "1.2.2-3",
|
|
63
63
|
"agora-extension-ai-denoiser": "1.1.0",
|
|
64
64
|
"agora-extension-beauty-effect": "^1.0.2-beta",
|
|
65
65
|
"agora-extension-virtual-background": "^1.1.3",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
information visit https://appbuilder.agora.io.
|
|
10
10
|
*********************************************
|
|
11
11
|
*/
|
|
12
|
-
import React, {useContext, useEffect, useRef} from 'react';
|
|
12
|
+
import React, {useContext, useEffect, useRef, useState} from 'react';
|
|
13
13
|
import {StyleSheet, View, TouchableOpacity, Text} from 'react-native';
|
|
14
14
|
import {
|
|
15
15
|
RtcContext,
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
PermissionState,
|
|
20
20
|
} from '../../agora-rn-uikit';
|
|
21
21
|
import events, {PersistanceLevel} from '../rtm-events-api';
|
|
22
|
-
import {controlMessageEnum} from '../components/ChatContext';
|
|
22
|
+
import ChatContext, {controlMessageEnum} from '../components/ChatContext';
|
|
23
23
|
import Toast from '../../react-native-toast-message';
|
|
24
24
|
import TertiaryButton from '../atoms/TertiaryButton';
|
|
25
|
-
import {useContent, useLocalUserInfo} from 'customization-api';
|
|
25
|
+
import {useContent, useLocalUserInfo, useSpeechToText} from 'customization-api';
|
|
26
26
|
import {isAndroid, isIOS, isWebInternal} from '../utils/common';
|
|
27
27
|
import {useScreenshare} from '../subComponents/screenshare/useScreenshare';
|
|
28
28
|
import {
|
|
@@ -53,12 +53,14 @@ import {
|
|
|
53
53
|
} from '../language/default-labels/videoCallScreenLabels';
|
|
54
54
|
import {useString} from '../utils/useString';
|
|
55
55
|
import useEndCall from '../utils/useEndCall';
|
|
56
|
+
import {logger, LogSource} from '../logger/AppBuilderLogger';
|
|
56
57
|
|
|
57
58
|
interface Props {
|
|
58
59
|
children: React.ReactNode;
|
|
60
|
+
callActive: boolean;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
const EventsConfigure: React.FC<Props> =
|
|
63
|
+
const EventsConfigure: React.FC<Props> = ({callActive, children}) => {
|
|
62
64
|
// mute user audio
|
|
63
65
|
const hostMutedUserAudioToastHeadingTT = useString<I18nMuteType>(
|
|
64
66
|
hostMutedUserToastHeading,
|
|
@@ -231,7 +233,7 @@ const EventsConfigure: React.FC<Props> = props => {
|
|
|
231
233
|
defaultContentRef.current.defaultContent = defaultContent;
|
|
232
234
|
}, [defaultContent]);
|
|
233
235
|
const {
|
|
234
|
-
data: {isHost},
|
|
236
|
+
data: {isHost, roomId},
|
|
235
237
|
} = useRoomInfo();
|
|
236
238
|
const {setRoomInfo} = useSetRoomInfo();
|
|
237
239
|
const isHostRef = React.useRef(isHost);
|
|
@@ -255,6 +257,41 @@ const EventsConfigure: React.FC<Props> = props => {
|
|
|
255
257
|
permissionStatusRef.current = permissionStatus;
|
|
256
258
|
}, [permissionStatus]);
|
|
257
259
|
|
|
260
|
+
const {hasUserJoinedRTM} = useContext(ChatContext);
|
|
261
|
+
const {startSpeechToText} = useSpeechToText();
|
|
262
|
+
const [autoStartCompleted, setAutoStartCompleted] = useState(false);
|
|
263
|
+
|
|
264
|
+
//auto start stt
|
|
265
|
+
useEffect(() => {
|
|
266
|
+
if (
|
|
267
|
+
$config.ENABLE_CAPTION &&
|
|
268
|
+
$config.STT_AUTO_START &&
|
|
269
|
+
callActive &&
|
|
270
|
+
hasUserJoinedRTM &&
|
|
271
|
+
!autoStartCompleted
|
|
272
|
+
) {
|
|
273
|
+
//host will start the caption
|
|
274
|
+
if (isHost && roomId?.host) {
|
|
275
|
+
logger.log(LogSource.Internals, 'STT', 'STT_AUTO_START triggered');
|
|
276
|
+
//start with default language
|
|
277
|
+
startSpeechToText(['en-US'])
|
|
278
|
+
.then(() => {
|
|
279
|
+
logger.log(LogSource.Internals, 'STT', 'STT_AUTO_START success');
|
|
280
|
+
setAutoStartCompleted(true);
|
|
281
|
+
})
|
|
282
|
+
.catch(err => {
|
|
283
|
+
logger.log(
|
|
284
|
+
LogSource.Internals,
|
|
285
|
+
'RECORDING',
|
|
286
|
+
'STT_AUTO_START failed',
|
|
287
|
+
err,
|
|
288
|
+
);
|
|
289
|
+
setAutoStartCompleted(false);
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}, [callActive, isHost, hasUserJoinedRTM, roomId, autoStartCompleted]);
|
|
294
|
+
|
|
258
295
|
useEffect(() => {
|
|
259
296
|
//user joined event listener
|
|
260
297
|
// events.on(controlMessageEnum.newUserJoined, ({payload}) => {
|
|
@@ -773,7 +810,7 @@ const EventsConfigure: React.FC<Props> = props => {
|
|
|
773
810
|
};
|
|
774
811
|
}, []);
|
|
775
812
|
|
|
776
|
-
return <>{
|
|
813
|
+
return <>{children}</>;
|
|
777
814
|
};
|
|
778
815
|
|
|
779
816
|
export default EventsConfigure;
|
|
@@ -147,6 +147,11 @@ export default class AppBuilderLogger implements Logger {
|
|
|
147
147
|
const rtcPkg = isWeb()
|
|
148
148
|
? pkg.dependencies['agora-rtc-sdk-ng']
|
|
149
149
|
: pkg.dependencies['react-native-agora'];
|
|
150
|
+
|
|
151
|
+
const agoraChatPkg = isWeb()
|
|
152
|
+
? pkg.dependencies['agora-chat']
|
|
153
|
+
: pkg.dependencies['react-native-agora-chat'];
|
|
154
|
+
|
|
150
155
|
let roomInfo = {
|
|
151
156
|
meeting_title: '',
|
|
152
157
|
channel_id: '',
|
|
@@ -189,6 +194,8 @@ export default class AppBuilderLogger implements Logger {
|
|
|
189
194
|
cli: cli_version,
|
|
190
195
|
core: core_version,
|
|
191
196
|
},
|
|
197
|
+
agora_chat_version: agoraChatPkg,
|
|
198
|
+
agora_chat_url: $config.CHAT_URL,
|
|
192
199
|
meeting_title: roomInfo?.meeting_title,
|
|
193
200
|
};
|
|
194
201
|
|
|
@@ -434,7 +434,8 @@ const VideoCall: React.FC = () => {
|
|
|
434
434
|
<UserPreferenceProvider>
|
|
435
435
|
<CaptionProvider>
|
|
436
436
|
<WaitingRoomProvider>
|
|
437
|
-
<EventsConfigure
|
|
437
|
+
<EventsConfigure
|
|
438
|
+
callActive={callActive}>
|
|
438
439
|
<ScreenshareConfigure
|
|
439
440
|
isRecordingActive={
|
|
440
441
|
isRecordingActive
|
|
@@ -71,7 +71,15 @@ export const CaptionContext = React.createContext<{
|
|
|
71
71
|
prevSpeakerRef: {current: ''},
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
interface CaptionProviderProps {
|
|
75
|
+
callActive: boolean;
|
|
76
|
+
children: React.ReactNode;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const CaptionProvider: React.FC<CaptionProviderProps> = ({
|
|
80
|
+
callActive,
|
|
81
|
+
children,
|
|
82
|
+
}) => {
|
|
75
83
|
const [isSTTError, setIsSTTError] = React.useState<boolean>(false);
|
|
76
84
|
const [isCaptionON, setIsCaptionON] = React.useState<boolean>(false);
|
|
77
85
|
const [isSTTActive, setIsSTTActive] = React.useState<boolean>(false);
|
|
@@ -125,9 +125,11 @@ const useSTTAPI = (): IuseSTTAPI => {
|
|
|
125
125
|
const isSTTAlreadyActive =
|
|
126
126
|
res?.error?.message
|
|
127
127
|
?.toLowerCase()
|
|
128
|
-
.indexOf('current status is
|
|
128
|
+
.indexOf('current status is STARTED') !== -1 ||
|
|
129
|
+
res?.error?.code === 610 ||
|
|
130
|
+
false;
|
|
129
131
|
|
|
130
|
-
if (res?.error?.message) {
|
|
132
|
+
if (res?.error?.message && res?.error?.code !== 610) {
|
|
131
133
|
setIsSTTError(true);
|
|
132
134
|
logger.error(
|
|
133
135
|
LogSource.NetworkRest,
|
|
@@ -142,6 +142,7 @@ const showErrorToast = (text1: string, text2?: string) => {
|
|
|
142
142
|
|
|
143
143
|
const RecordingProvider = (props: RecordingProviderProps) => {
|
|
144
144
|
const {setRecordingActive, isRecordingActive, callActive} = props?.value;
|
|
145
|
+
const [autoStartCompleted, setAutoStartCompleted] = useState(false);
|
|
145
146
|
const {
|
|
146
147
|
data: {isHost, roomId},
|
|
147
148
|
} = useRoomInfo();
|
|
@@ -825,6 +826,33 @@ const RecordingProvider = (props: RecordingProviderProps) => {
|
|
|
825
826
|
_stopRecording,
|
|
826
827
|
]);
|
|
827
828
|
|
|
829
|
+
// auto start recording
|
|
830
|
+
useEffect(() => {
|
|
831
|
+
if (
|
|
832
|
+
$config.CLOUD_RECORDING &&
|
|
833
|
+
$config.CLOUD_RECORDING_AUTO_START &&
|
|
834
|
+
callActive &&
|
|
835
|
+
!isRecordingActive &&
|
|
836
|
+
isHost &&
|
|
837
|
+
hasUserJoinedRTM &&
|
|
838
|
+
!autoStartCompleted
|
|
839
|
+
) {
|
|
840
|
+
logger.log(
|
|
841
|
+
LogSource.Internals,
|
|
842
|
+
'RECORDING',
|
|
843
|
+
'CLOUD_RECORDING_AUTO_START triggered',
|
|
844
|
+
);
|
|
845
|
+
startRecording();
|
|
846
|
+
setAutoStartCompleted(true);
|
|
847
|
+
}
|
|
848
|
+
}, [
|
|
849
|
+
isRecordingActive,
|
|
850
|
+
isHost,
|
|
851
|
+
callActive,
|
|
852
|
+
hasUserJoinedRTM,
|
|
853
|
+
autoStartCompleted,
|
|
854
|
+
]);
|
|
855
|
+
|
|
828
856
|
// useEffect(() => { //
|
|
829
857
|
// if (hasUserJoinedRTM && isRecordingBot) {
|
|
830
858
|
// log('Recording-bot: sending event that recording has started');
|