agora-appbuilder-core 4.0.0-beta.14 → 4.0.0-beta.16
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
CHANGED
|
@@ -23,6 +23,7 @@ const Create = ({
|
|
|
23
23
|
dispatch: DispatchType;
|
|
24
24
|
children: (engine: React.MutableRefObject<RtcEngine>) => JSX.Element;
|
|
25
25
|
}) => {
|
|
26
|
+
const mutexLock = useRef(false);
|
|
26
27
|
const [ready, setReady] = useState(false);
|
|
27
28
|
const {callbacks, rtcProps, mode} = useContext(PropsContext);
|
|
28
29
|
const {
|
|
@@ -194,6 +195,7 @@ const Create = ({
|
|
|
194
195
|
|
|
195
196
|
useEffect(() => {
|
|
196
197
|
async function init() {
|
|
198
|
+
mutexLock.current = true;
|
|
197
199
|
if (Platform.OS === 'android') {
|
|
198
200
|
//Request required permissions from Android
|
|
199
201
|
await requestCameraAndAudioPermission(audioRoom);
|
|
@@ -375,8 +377,11 @@ const Create = ({
|
|
|
375
377
|
} catch (e) {
|
|
376
378
|
console.error(e);
|
|
377
379
|
}
|
|
380
|
+
mutexLock.current = false;
|
|
381
|
+
}
|
|
382
|
+
if (!mutexLock.current) {
|
|
383
|
+
init();
|
|
378
384
|
}
|
|
379
|
-
init();
|
|
380
385
|
return () => {
|
|
381
386
|
/**
|
|
382
387
|
* if condition add for websdk issue
|
|
@@ -391,7 +396,10 @@ const Create = ({
|
|
|
391
396
|
|
|
392
397
|
useEffect(() => {
|
|
393
398
|
const toggleRole = async () => {
|
|
394
|
-
if (
|
|
399
|
+
if (
|
|
400
|
+
mode == ChannelProfile.LiveBroadcasting &&
|
|
401
|
+
engine.current.setClientRole // Check if engine initialized
|
|
402
|
+
) {
|
|
395
403
|
if (rtcProps.role == ClientRole.Broadcaster) {
|
|
396
404
|
await engine.current?.setClientRole(ClientRole.Broadcaster);
|
|
397
405
|
// isVideoEnabledRef checks if the permission is already taken once
|