agora-appbuilder-core 2.3.0-beta.35 → 2.3.0-beta.36

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": "2.3.0-beta.35",
3
+ "version": "2.3.0-beta.36",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -2,6 +2,8 @@ import React, {useState, useEffect, useContext, useRef, FC} from 'react';
2
2
  import RtcEngine, {
3
3
  VideoEncoderConfiguration,
4
4
  AreaCode,
5
+ AudioProfile,
6
+ AudioScenario,
5
7
  } from 'react-native-agora';
6
8
  import {Platform} from 'react-native';
7
9
  import requestCameraAndAudioPermission from '../Utils/permission';
@@ -175,17 +177,36 @@ const Create = ({
175
177
  } else {
176
178
  await engine.current.setChannelProfile(ChannelProfile.Communication);
177
179
  }
178
- if (rtcProps.profile) {
179
- if (Platform.OS === 'web') {
180
- // move this to bridge?
181
- // @ts-ignore
182
- await engine.current.setVideoProfile(rtcProps.profile);
183
- } else {
184
- const config: VideoEncoderConfiguration = quality[rtcProps.profile];
185
- await engine.current.setVideoEncoderConfiguration({
186
- ...config,
187
- bitrate: 0,
188
- });
180
+ if (!audioRoom) {
181
+ if (rtcProps.profile) {
182
+ if (Platform.OS === 'web') {
183
+ // move this to bridge?
184
+ // @ts-ignore
185
+ await engine.current.setVideoProfile(rtcProps.profile);
186
+ } else {
187
+ const config: VideoEncoderConfiguration =
188
+ quality[rtcProps.profile];
189
+ await engine.current.setVideoEncoderConfiguration({
190
+ ...config,
191
+ bitrate: 0,
192
+ });
193
+ }
194
+ }
195
+ } else {
196
+ //web will work even without audio profile
197
+ //but native need to set audio profile otherwise user will experience low audio issue
198
+ if (Platform.OS === 'android' || Platform.OS === 'ios') {
199
+ await engine.current.setAudioProfile(
200
+ AudioProfile.Default,
201
+ AudioScenario.Default,
202
+ );
203
+ //also audio route for voice-chat will work through earpiece not phonespeaker
204
+ //for audiolivecast it will work through phone speaker
205
+ //ref - https://docs.agora.io/en/help/integration-issues/profile_difference/#audio-route
206
+ //so setting into phone speaker manually as requested
207
+ if (mode == ChannelProfile.Communication) {
208
+ await engine.current.setEnableSpeakerphone(true);
209
+ }
189
210
  }
190
211
  }
191
212
 
@@ -89,12 +89,6 @@ function validateCustomRoutes(routes: any) {
89
89
  }
90
90
  }
91
91
 
92
- function validateAppRoot(data: any) {
93
- if (data && !isComponent(data)) {
94
- console.error(`Customize:Error appRoot should be a react component`);
95
- }
96
- }
97
-
98
92
  function validatei18n(data: any) {
99
93
  if (data) {
100
94
  if (!Array.isArray(data)) {
@@ -124,9 +118,6 @@ export const customize = (config: CustomizationApiInterface) => {
124
118
  //commented for v1 release
125
119
  //config?.customRoutes && validateCustomRoutes(config.customRoutes);
126
120
 
127
- //validating the app root
128
- config?.appRoot && validateAppRoot(config.appRoot);
129
-
130
121
  //validating the i18n
131
122
  config?.i18n && validatei18n(config.i18n);
132
123
 
@@ -95,6 +95,10 @@ export interface VideoCallInterface extends BeforeAndAfterInterface {
95
95
  }
96
96
 
97
97
  export type ComponentsInterface = {
98
+ /**
99
+ * Custom context/api provider wrapped in root level
100
+ */
101
+ appRoot?: React.ComponentType;
98
102
  // commented for v1 release
99
103
  //precall?: PreCallInterface | React.ComponentType;
100
104
  //create?: React.ComponentType;
@@ -125,10 +129,6 @@ export interface CustomizationApiInterface {
125
129
  */
126
130
  // commented for v1 release
127
131
  //customRoutes?: CustomRoutesInterface[];
128
- /**
129
- * Custom context/api provider wrapped in root level
130
- */
131
- appRoot?: React.ComponentType;
132
132
  /**
133
133
  * Internationlization
134
134
  */
@@ -32,8 +32,11 @@ interface AppWrapperProps {
32
32
 
33
33
  const AppWrapper = (props: AppWrapperProps) => {
34
34
  const AppRoot = useCustomization((data) => {
35
- if (data?.appRoot && isValidReactComponent(data.appRoot)) {
36
- return data.appRoot;
35
+ if (
36
+ data?.components?.appRoot &&
37
+ isValidReactComponent(data?.components?.appRoot)
38
+ ) {
39
+ return data.components.appRoot;
37
40
  }
38
41
  return React.Fragment;
39
42
  });