agora-appbuilder-core 4.0.0-beta.13 → 4.0.0-beta.15

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.0.0-beta.13",
3
+ "version": "4.0.0-beta.15",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -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 {
@@ -186,14 +187,15 @@ const Create = ({
186
187
  mode == ChannelProfile.LiveBroadcasting &&
187
188
  rtcProps?.role == ClientRole.Audience
188
189
  ) {
189
- enableVideoAndAudioWithDisabledState();
190
+ await enableVideoAndAudioWithDisabledState();
190
191
  } else {
191
- enableVideoAndAudioWithEnabledState();
192
+ await enableVideoAndAudioWithEnabledState();
192
193
  }
193
194
  };
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 (mode == ChannelProfile.LiveBroadcasting) {
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
@@ -407,12 +415,12 @@ const Create = ({
407
415
  }
408
416
  // This updates the uid interface
409
417
  dispatch({
410
- type: 'LocalMuteAudio',
418
+ type: "LocalMuteAudio",
411
419
  value: [ToggleState.disabled],
412
420
  });
413
421
  if (!audioRoom) {
414
422
  dispatch({
415
- type: 'LocalMuteVideo',
423
+ type: "LocalMuteVideo",
416
424
  value: [ToggleState.disabled],
417
425
  });
418
426
  }
@@ -428,12 +436,12 @@ const Create = ({
428
436
  await engine.current?.muteLocalVideoStream(true);
429
437
  }
430
438
  dispatch({
431
- type: 'LocalMuteAudio',
439
+ type: "LocalMuteAudio",
432
440
  value: [ToggleState.disabled],
433
441
  });
434
442
  if (!audioRoom) {
435
443
  dispatch({
436
- type: 'LocalMuteVideo',
444
+ type: "LocalMuteVideo",
437
445
  value: [ToggleState.disabled],
438
446
  });
439
447
  }
@@ -163,7 +163,7 @@ const ParticipantView = (props) => {
163
163
  onPress={() => setShowHostSection(!showHostSection)}
164
164
  />
165
165
  {showHostSection ? (
166
- <AllAudienceParticipants
166
+ <AllHostParticipants
167
167
  emptyMessage={'No Host has joined yet.'}
168
168
  uids={hostUids}
169
169
  isMobile={isSmall()}
@@ -177,10 +177,10 @@ const ShareLinkProvider = (props: ShareLinkProvideProps) => {
177
177
  };
178
178
 
179
179
  const getBaseURL = () => {
180
- let baseURL =
181
- platform === 'web' && !isSDK
182
- ? $config.FRONTEND_ENDPOINT || window.location.origin
183
- : undefined;
180
+ let baseURL = !isSDK
181
+ ? $config.FRONTEND_ENDPOINT ||
182
+ (platform === 'web' && window.location.origin)
183
+ : undefined;
184
184
  return baseURL;
185
185
  };
186
186