agora-appbuilder-core 4.0.0-beta.8 → 4.0.0
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/bridge/rtc/webNg/RtcEngine.ts +22 -2
- package/template/react-native-toast-message/src/components/checkbox.js +7 -2
- package/template/src/assets/font-styles.css +3 -1
- package/template/src/components/DeviceConfigure.tsx +4 -4
- package/template/src/components/DeviceContext.tsx +6 -6
- package/template/src/pages/video-call/ActionSheetContent.tsx +1 -1
- package/template/src/subComponents/LocalSwitchCamera.tsx +1 -4
- package/template/src/subComponents/SelectDevice.tsx +10 -10
- package/template/src/utils/useMuteToggleLocal.ts +2 -2
- package/template/web/index.html +2 -1
package/package.json
CHANGED
|
@@ -192,8 +192,8 @@ export default class RtcEngine {
|
|
|
192
192
|
private inScreenshare: Boolean = false;
|
|
193
193
|
private videoProfile: VideoProfile = '480p_9';
|
|
194
194
|
private isPublished = false;
|
|
195
|
-
private isAudioEnabled =
|
|
196
|
-
private isVideoEnabled =
|
|
195
|
+
private isAudioEnabled = false;
|
|
196
|
+
private isVideoEnabled = false;
|
|
197
197
|
private isAudioPublished = false;
|
|
198
198
|
private isVideoPublished = false;
|
|
199
199
|
private isJoined = false;
|
|
@@ -229,6 +229,10 @@ export default class RtcEngine {
|
|
|
229
229
|
try {
|
|
230
230
|
let localAudio = await AgoraRTC.createMicrophoneAudioTrack(audioConfig);
|
|
231
231
|
this.localStream.audio = localAudio;
|
|
232
|
+
this.audioDeviceId = localAudio
|
|
233
|
+
?.getMediaStreamTrack()
|
|
234
|
+
.getSettings().deviceId;
|
|
235
|
+
this.isAudioEnabled = true;
|
|
232
236
|
} catch (e) {
|
|
233
237
|
let audioError = e;
|
|
234
238
|
e.status = {audioError};
|
|
@@ -262,6 +266,14 @@ export default class RtcEngine {
|
|
|
262
266
|
);
|
|
263
267
|
this.localStream.audio = localAudio;
|
|
264
268
|
this.localStream.video = localVideo;
|
|
269
|
+
this.audioDeviceId = localAudio
|
|
270
|
+
?.getMediaStreamTrack()
|
|
271
|
+
.getSettings().deviceId;
|
|
272
|
+
this.videoDeviceId = localVideo
|
|
273
|
+
?.getMediaStreamTrack()
|
|
274
|
+
.getSettings().deviceId;
|
|
275
|
+
this.isVideoEnabled = true;
|
|
276
|
+
this.isAudioEnabled = true;
|
|
265
277
|
} catch (e) {
|
|
266
278
|
let audioError = false;
|
|
267
279
|
let videoError = false;
|
|
@@ -269,12 +281,20 @@ export default class RtcEngine {
|
|
|
269
281
|
let localAudio = await AgoraRTC.createMicrophoneAudioTrack(audioConfig);
|
|
270
282
|
|
|
271
283
|
this.localStream.audio = localAudio;
|
|
284
|
+
this.audioDeviceId = localAudio
|
|
285
|
+
?.getMediaStreamTrack()
|
|
286
|
+
.getSettings().deviceId;
|
|
287
|
+
this.isAudioEnabled = true;
|
|
272
288
|
} catch (error) {
|
|
273
289
|
audioError = error;
|
|
274
290
|
}
|
|
275
291
|
try {
|
|
276
292
|
let localVideo = await AgoraRTC.createCameraVideoTrack(videoConfig);
|
|
277
293
|
this.localStream.video = localVideo;
|
|
294
|
+
this.videoDeviceId = localVideo
|
|
295
|
+
?.getMediaStreamTrack()
|
|
296
|
+
.getSettings().deviceId;
|
|
297
|
+
this.isVideoEnabled = true;
|
|
278
298
|
} catch (error) {
|
|
279
299
|
videoError = error;
|
|
280
300
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { View, TouchableOpacity, Text, Pressable } from 'react-native';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { stylePropType } from '../utils/prop-types';
|
|
@@ -115,6 +115,7 @@ function BaseToast({
|
|
|
115
115
|
{...primaryBtn}
|
|
116
116
|
onPress={(e) => {
|
|
117
117
|
primaryBtn.onPress(checked, e);
|
|
118
|
+
setChecked(false);
|
|
118
119
|
}}
|
|
119
120
|
/>
|
|
120
121
|
)}
|
|
@@ -127,6 +128,10 @@ function BaseToast({
|
|
|
127
128
|
paddingVertical: 0
|
|
128
129
|
}}
|
|
129
130
|
{...secondaryBtn}
|
|
131
|
+
onPress={(e) => {
|
|
132
|
+
secondaryBtn.onPress(checked, e);
|
|
133
|
+
setChecked(false);
|
|
134
|
+
}}
|
|
130
135
|
/>
|
|
131
136
|
)}
|
|
132
137
|
</View>
|
|
@@ -144,7 +149,7 @@ BaseToast.propTypes = {
|
|
|
144
149
|
leadingIcon: PropTypes.node,
|
|
145
150
|
trailingIcon: PropTypes.node,
|
|
146
151
|
text1: PropTypes.string,
|
|
147
|
-
text2: PropTypes.string || PropTypes.element,
|
|
152
|
+
text2: PropTypes.string || PropTypes.element || PropTypes.any,
|
|
148
153
|
onPress: PropTypes.func,
|
|
149
154
|
style: stylePropType,
|
|
150
155
|
contentContainerStyle: stylePropType,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap");
|
|
2
|
+
|
|
1
3
|
@font-face {
|
|
2
4
|
font-family: 'icomoon';
|
|
3
|
-
src: url('
|
|
5
|
+
src: url('https://dbudicf5k4as1.cloudfront.net/10/icomoon.ttf') format('truetype');
|
|
4
6
|
font-weight: normal;
|
|
5
7
|
font-style: normal;
|
|
6
8
|
font-display: block;
|
|
@@ -239,7 +239,7 @@ const DeviceConfigure: React.FC<Props> = (props: any) => {
|
|
|
239
239
|
|
|
240
240
|
const logTag = 'useEffect[rtc,store]';
|
|
241
241
|
|
|
242
|
-
if (activeDeviceId && deviceList.length
|
|
242
|
+
if (activeDeviceId && deviceList.length > 0) {
|
|
243
243
|
// If stream exists and selected devices are empty, check for devices again
|
|
244
244
|
if (!selectedCam || selectedCam.trim().length == 0) {
|
|
245
245
|
log(logTag, 'cam: Device list populated but No selected cam');
|
|
@@ -416,7 +416,7 @@ const DeviceConfigure: React.FC<Props> = (props: any) => {
|
|
|
416
416
|
() => {
|
|
417
417
|
syncSelectedDeviceUi('audioinput');
|
|
418
418
|
updateActiveDeviceId('audioinput', deviceId);
|
|
419
|
-
res();
|
|
419
|
+
res(null);
|
|
420
420
|
},
|
|
421
421
|
(e: any) => {
|
|
422
422
|
console.error('DeviceConfigure: Error setting mic', e);
|
|
@@ -434,7 +434,7 @@ const DeviceConfigure: React.FC<Props> = (props: any) => {
|
|
|
434
434
|
() => {
|
|
435
435
|
syncSelectedDeviceUi('videoinput');
|
|
436
436
|
updateActiveDeviceId('videoinput', deviceId);
|
|
437
|
-
res();
|
|
437
|
+
res(null);
|
|
438
438
|
},
|
|
439
439
|
(e: any) => {
|
|
440
440
|
console.error('Device Configure: Error setting webcam', e);
|
|
@@ -452,7 +452,7 @@ const DeviceConfigure: React.FC<Props> = (props: any) => {
|
|
|
452
452
|
() => {
|
|
453
453
|
setUiSelectedSpeaker(deviceId);
|
|
454
454
|
updateActiveDeviceId('audiooutput', deviceId);
|
|
455
|
-
res();
|
|
455
|
+
res(null);
|
|
456
456
|
},
|
|
457
457
|
(e: any) => {
|
|
458
458
|
console.error('Device Configure: Error setting speaker', e);
|
|
@@ -13,11 +13,11 @@ import {createContext} from 'react';
|
|
|
13
13
|
|
|
14
14
|
interface DeviceContext {
|
|
15
15
|
selectedCam: string;
|
|
16
|
-
setSelectedCam: (cam: string) =>
|
|
16
|
+
setSelectedCam: (cam: string) => Promise<any>;
|
|
17
17
|
selectedMic: string;
|
|
18
|
-
setSelectedMic: (mic: string) =>
|
|
18
|
+
setSelectedMic: (mic: string) => Promise<any>;
|
|
19
19
|
selectedSpeaker: string;
|
|
20
|
-
setSelectedSpeaker: (speaker: string) =>
|
|
20
|
+
setSelectedSpeaker: (speaker: string) => Promise<any>;
|
|
21
21
|
deviceList: MediaDeviceInfo[];
|
|
22
22
|
setDeviceList: (devices: MediaDeviceInfo[]) => void;
|
|
23
23
|
}
|
|
@@ -27,9 +27,9 @@ const DeviceContext = createContext<DeviceContext>({
|
|
|
27
27
|
selectedMic: '',
|
|
28
28
|
selectedSpeaker: '',
|
|
29
29
|
deviceList: [],
|
|
30
|
-
setSelectedCam: () => {},
|
|
31
|
-
setSelectedMic: () => {},
|
|
32
|
-
setSelectedSpeaker: () => {},
|
|
30
|
+
setSelectedCam: async () => {},
|
|
31
|
+
setSelectedMic: async () => {},
|
|
32
|
+
setSelectedSpeaker: async () => {},
|
|
33
33
|
setDeviceList: () => {},
|
|
34
34
|
});
|
|
35
35
|
export default DeviceContext;
|
|
@@ -180,7 +180,7 @@ const SettingsIcon = (props: SettingsIconProps) => {
|
|
|
180
180
|
<TouchableOpacity style={styles.iconContainer} onPress={onPress}>
|
|
181
181
|
<ImageIcon
|
|
182
182
|
name={'settings'}
|
|
183
|
-
tintColor={$config.
|
|
183
|
+
tintColor={$config.SECONDARY_ACTION_COLOR}
|
|
184
184
|
/>
|
|
185
185
|
</TouchableOpacity>
|
|
186
186
|
{$config.ICON_TEXT && <Text style={styles.iconText}>Settings</Text>}
|
|
@@ -30,16 +30,13 @@ function LocalSwitchCamera(props: LocalSwitchCameraProps) {
|
|
|
30
30
|
name: 'switch-camera',
|
|
31
31
|
tintColor:
|
|
32
32
|
isVideoEnabled || !disabled
|
|
33
|
-
? $config.
|
|
33
|
+
? $config.SECONDARY_ACTION_COLOR
|
|
34
34
|
: $config.SEMANTIC_NEUTRAL,
|
|
35
35
|
},
|
|
36
36
|
disabled: !isVideoEnabled || disabled ? true : false,
|
|
37
37
|
onPress: onPress,
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
iconButtonProps.style = Styles.localButton as Object;
|
|
41
|
-
iconButtonProps.btnTextProps = showLabel ? switchCameraButtonText : '';
|
|
42
|
-
|
|
43
40
|
return props?.render ? (
|
|
44
41
|
props.render(onPress, isVideoEnabled)
|
|
45
42
|
) : (
|
|
@@ -107,9 +107,9 @@ const SelectVideoDevice = (props: SelectVideoDeviceProps) => {
|
|
|
107
107
|
if (isPendingUpdate) {
|
|
108
108
|
selectedDeviceExists && setIsPendingUpdate(false);
|
|
109
109
|
} else {
|
|
110
|
-
!selectedDeviceExists && setIsPendingUpdate(true);
|
|
110
|
+
!selectedDeviceExists && data?.length && setIsPendingUpdate(true);
|
|
111
111
|
}
|
|
112
|
-
}, [selectedCam,
|
|
112
|
+
}, [selectedCam, data]);
|
|
113
113
|
|
|
114
114
|
const isPermissionGranted =
|
|
115
115
|
local.permissionStatus === PermissionState.GRANTED_FOR_CAM_AND_MIC ||
|
|
@@ -121,7 +121,7 @@ const SelectVideoDevice = (props: SelectVideoDeviceProps) => {
|
|
|
121
121
|
<Text style={style.label}>Camera</Text>
|
|
122
122
|
<Dropdown
|
|
123
123
|
icon={
|
|
124
|
-
isPendingUpdate
|
|
124
|
+
isPendingUpdate && isPermissionGranted
|
|
125
125
|
? 'connection-loading'
|
|
126
126
|
: props?.isIconDropdown
|
|
127
127
|
? 'video-on'
|
|
@@ -133,7 +133,7 @@ const SelectVideoDevice = (props: SelectVideoDeviceProps) => {
|
|
|
133
133
|
? 'No Camera Detected'
|
|
134
134
|
: isPendingUpdate
|
|
135
135
|
? 'Updating'
|
|
136
|
-
: ''
|
|
136
|
+
: 'No Camera Selected'
|
|
137
137
|
}
|
|
138
138
|
data={isPermissionGranted ? data : []}
|
|
139
139
|
onSelect={({label, value}) => {
|
|
@@ -194,9 +194,9 @@ const SelectAudioDevice = (props: SelectAudioDeviceProps) => {
|
|
|
194
194
|
if (isPendingUpdate) {
|
|
195
195
|
selectedDeviceExists && setIsPendingUpdate(false);
|
|
196
196
|
} else {
|
|
197
|
-
!selectedDeviceExists && setIsPendingUpdate(true);
|
|
197
|
+
!selectedDeviceExists && data?.length && setIsPendingUpdate(true);
|
|
198
198
|
}
|
|
199
|
-
}, [selectedMic,
|
|
199
|
+
}, [selectedMic, data]);
|
|
200
200
|
|
|
201
201
|
const isPermissionGranted =
|
|
202
202
|
local.permissionStatus === PermissionState.GRANTED_FOR_CAM_AND_MIC ||
|
|
@@ -208,7 +208,7 @@ const SelectAudioDevice = (props: SelectAudioDeviceProps) => {
|
|
|
208
208
|
<Text style={style.label}>Microphone</Text>
|
|
209
209
|
<Dropdown
|
|
210
210
|
icon={
|
|
211
|
-
isPendingUpdate
|
|
211
|
+
isPendingUpdate && isPermissionGranted
|
|
212
212
|
? 'connection-loading'
|
|
213
213
|
: props?.isIconDropdown
|
|
214
214
|
? 'mic-on'
|
|
@@ -221,7 +221,7 @@ const SelectAudioDevice = (props: SelectAudioDeviceProps) => {
|
|
|
221
221
|
? 'No Microphone Detected'
|
|
222
222
|
: isPendingUpdate
|
|
223
223
|
? 'Updating'
|
|
224
|
-
: ''
|
|
224
|
+
: 'No Microphone Selected'
|
|
225
225
|
}
|
|
226
226
|
data={isPermissionGranted ? data : []}
|
|
227
227
|
onSelect={({label, value}) => {
|
|
@@ -283,9 +283,9 @@ const SelectSpeakerDevice = (props: SelectSpeakerDeviceProps) => {
|
|
|
283
283
|
if (isPendingUpdate) {
|
|
284
284
|
selectedDeviceExists && setIsPendingUpdate(false);
|
|
285
285
|
} else {
|
|
286
|
-
!selectedDeviceExists && setIsPendingUpdate(true);
|
|
286
|
+
!selectedDeviceExists && data?.length && setIsPendingUpdate(true);
|
|
287
287
|
}
|
|
288
|
-
}, [selectedSpeaker,
|
|
288
|
+
}, [selectedSpeaker, data]);
|
|
289
289
|
|
|
290
290
|
return props?.render ? (
|
|
291
291
|
props.render(
|
|
@@ -13,7 +13,7 @@ import {useLocalUserInfo, useRtc} from 'customization-api';
|
|
|
13
13
|
import {useContext, useEffect, useRef, useState} from 'react';
|
|
14
14
|
|
|
15
15
|
import {ToggleState} from '../../agora-rn-uikit/src/Contexts/PropsContext';
|
|
16
|
-
import {isWebInternal} from './common';
|
|
16
|
+
import {isMobileUA, isWebInternal} from './common';
|
|
17
17
|
import {AppState} from 'react-native';
|
|
18
18
|
|
|
19
19
|
export enum MUTE_LOCAL_TYPE {
|
|
@@ -32,7 +32,7 @@ function useMuteToggleLocal() {
|
|
|
32
32
|
const isCamON = useRef(local.video);
|
|
33
33
|
|
|
34
34
|
useEffect(() => {
|
|
35
|
-
if ($config.AUDIO_ROOM) return;
|
|
35
|
+
if ($config.AUDIO_ROOM || !isMobileUA()) return;
|
|
36
36
|
const subscription = AppState.addEventListener('change', (nextAppState) => {
|
|
37
37
|
appState.current = nextAppState;
|
|
38
38
|
setAppStateVisible(appState.current);
|
package/template/web/index.html
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
7
7
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
8
|
-
|
|
8
|
+
<!-- moved to template/src/assets/font-styles.css as it was not available for sdks-->
|
|
9
|
+
<!-- <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet"> -->
|
|
9
10
|
|
|
10
11
|
<base href="/">
|
|
11
12
|
<title><%= htmlWebpackPlugin.options.title %></title>
|