agora-appbuilder-core 4.1.5 → 4.1.6-beta.1

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.1.5",
3
+ "version": "4.1.6-beta.1",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -77,8 +77,8 @@ const DefaultConfig = {
77
77
  CHAT_ORG_NAME: '',
78
78
  CHAT_APP_NAME: '',
79
79
  CHAT_URL: '',
80
- CLI_VERSION: '3.1.5',
81
- CORE_VERSION: '4.1.5',
80
+ CLI_VERSION: '3.1.6-beta.1',
81
+ CORE_VERSION: '4.1.6-beta.1',
82
82
  DISABLE_LANDSCAPE_MODE: false,
83
83
  STT_AUTO_START: false,
84
84
  CLOUD_RECORDING_AUTO_START: false,
@@ -4,8 +4,9 @@ import {
4
4
  useContent,
5
5
  useLocalAudio,
6
6
  } from 'customization-api';
7
- import {View, StyleSheet, Platform} from 'react-native';
8
- import hark from 'hark';
7
+ import {View, StyleSheet, Platform, Text} from 'react-native';
8
+ import ThemeConfig from '../../theme';
9
+ import {isAndroid, isIOS} from '../../utils/common';
9
10
  import {AgentContext} from '../components/AgentControls/AgentContext';
10
11
 
11
12
  const NotJoinedMp4 = require('./1.Not-Joined.mp4').default;
@@ -34,27 +35,27 @@ export default function AiAgentCustomView({
34
35
  const aiMediaStream = useRef(null);
35
36
 
36
37
  useEffect(() => {
37
- if (activeUids?.indexOf(agentUID) !== -1 && !aiMediaStream.current) {
38
+ if (
39
+ activeUids?.indexOf(agentUID) !== -1 &&
40
+ !aiMediaStream?.current &&
41
+ !(isAndroid() || isIOS())
42
+ ) {
38
43
  const track = getRemoteAudioStream(agentUID);
39
44
  if (track) {
45
+ const hark = require('hark');
40
46
  try {
41
- if (!aiMediaStream.current) {
42
- console.log('debugging creating MediaStream here');
47
+ if (!aiMediaStream?.current) {
43
48
  aiMediaStream.current = new MediaStream([
44
49
  track.getMediaStreamTrack(),
45
50
  ]);
46
- } else {
47
- console.log('debugging existing MediaStream used');
48
51
  }
49
- const harkai = hark(aiMediaStream.current, {
52
+ const harkai = hark(aiMediaStream?.current, {
50
53
  interval: 100,
51
54
  });
52
55
  harkai.on('speaking', () => {
53
- console.log('debugging ai is speaking');
54
56
  setAISpeaking(true);
55
57
  });
56
58
  harkai.on('stopped_speaking', () => {
57
- console.log('debugging ai is not speaking');
58
59
  setAISpeaking(false);
59
60
  });
60
61
  } catch (error) {
@@ -93,19 +94,36 @@ export default function AiAgentCustomView({
93
94
  }, [connectionState, animation, isAISpeaking]);
94
95
  return (
95
96
  <View style={styles.container}>
96
- <video
97
- autoPlay
98
- style={{pointerEvents: 'none'}}
99
- loop
100
- src={AI_ANIMATION_VIDEO[animation]}
101
- width="40%"
102
- height="40%"
103
- />
97
+ {isAndroid() || isIOS() ? (
98
+ <View style={styles.nativeTextContainer}>
99
+ <Text style={styles.nativeText}>AI Agent...</Text>
100
+ </View>
101
+ ) : (
102
+ <video
103
+ autoPlay
104
+ style={{pointerEvents: 'none'}}
105
+ loop
106
+ src={AI_ANIMATION_VIDEO[animation]}
107
+ width="40%"
108
+ height="40%"
109
+ />
110
+ )}
104
111
  </View>
105
112
  );
106
113
  }
107
114
 
108
115
  const styles = StyleSheet.create({
116
+ nativeTextContainer: {
117
+ flex: 1,
118
+ justifyContent: 'center',
119
+ alignItems: 'center',
120
+ },
121
+ nativeText: {
122
+ fontFamily: ThemeConfig.FontFamily.sansPro,
123
+ fontSize: 18,
124
+ fontWeight: '800',
125
+ color: $config.FONT_COLOR,
126
+ },
109
127
  container: {
110
128
  flex: 1,
111
129
  backgroundColor: 'black',
@@ -8,7 +8,7 @@ const Bottombar = () => {
8
8
  return (
9
9
  <ToolbarPreset
10
10
  align="bottom"
11
- snapPointsMinMax={AI_LAYOUT === 'LAYOUT_TYPE_1' ? [100, 100] : [0, 0]}
11
+ snapPointsMinMax={AI_LAYOUT === 'LAYOUT_TYPE_2' ? [100, 100] : [0, 0]}
12
12
  items={{
13
13
  layout: {hide: true},
14
14
  invite: {hide: true},
@@ -10,11 +10,11 @@ import CustomSettingsPanel from './components/CustomSettingsPanel';
10
10
  import {AgentProvider} from './components/AgentControls/AgentContext';
11
11
 
12
12
  //LAYOUT_TYPE_1
13
- import DefaultLayout from './layout/DefaultLayout';
13
+ import NewAnimationLayout from './layout/NewAnimation';
14
14
  //LAYOUT_TYPE_2
15
- import ConversationalAILayout from './layout/ConversationalAI';
15
+ import AIWithLocalUser from './layout/AIWithLocalUser';
16
16
  //LAYOUT_TYPE_3
17
- import NewAnimationLayout from './layout/NewAnimation';
17
+ import ConversationalAILayout from './layout/ConversationalAI';
18
18
 
19
19
  const DummyComponent = () => {
20
20
  return <></>;
@@ -25,7 +25,7 @@ const getAILayoutType = () => {
25
25
  };
26
26
 
27
27
  const getTopBarComponent = () => {
28
- return isMobileUA() || getAILayoutType() !== 'LAYOUT_TYPE_1'
28
+ return isMobileUA() || getAILayoutType() !== 'LAYOUT_TYPE_2'
29
29
  ? MobileTopBar
30
30
  : DummyComponent;
31
31
  };
@@ -33,17 +33,17 @@ const getTopBarComponent = () => {
33
33
  const getBottombarComponent = () => {
34
34
  return isMobileUA()
35
35
  ? MobileBottombar
36
- : getAILayoutType() === 'LAYOUT_TYPE_1'
36
+ : getAILayoutType() === 'LAYOUT_TYPE_2'
37
37
  ? Bottombar
38
38
  : DummyComponent;
39
39
  };
40
40
 
41
41
  const getCustomLayoutComponent = () => {
42
42
  return getAILayoutType() === 'LAYOUT_TYPE_3'
43
- ? NewAnimationLayout
44
- : getAILayoutType() === 'LAYOUT_TYPE_2'
45
43
  ? ConversationalAILayout
46
- : DefaultLayout;
44
+ : getAILayoutType() === 'LAYOUT_TYPE_2'
45
+ ? AIWithLocalUser
46
+ : NewAnimationLayout;
47
47
  };
48
48
 
49
49
  export const AI_AGENT_CUSTOMIZATION: CustomizationApiInterface = {
@@ -14,7 +14,7 @@ import AudioVisualizer, {DisconnectedView} from '../components/AudioVisualizer';
14
14
  import {AgentState} from '../components/AgentControls/const';
15
15
  import {AgentContext} from '../components/AgentControls/AgentContext';
16
16
 
17
- export default function DefaultLayout() {
17
+ export default function AIWithLocalUser() {
18
18
  const localUid = useLocalUid();
19
19
  const {defaultContent, activeUids} = useContent();
20
20
  const {RtcEngineUnsafe} = useRtc();
@@ -142,7 +142,7 @@ const styles = StyleSheet.create({
142
142
  },
143
143
  layoutRootContainer: {
144
144
  flex: 1,
145
- backgroundColor: $config.VIDEO_AUDIO_TILE_COLOR,
145
+ backgroundColor: '#1D1D1D',
146
146
  borderRadius: 8,
147
147
  },
148
148
  callAgentBtnInnerContainer: {
@@ -109,7 +109,6 @@ const styles = StyleSheet.create({
109
109
  },
110
110
  layoutRootContainer: {
111
111
  flex: 1,
112
- backgroundColor: $config.VIDEO_AUDIO_TILE_COLOR,
113
112
  borderRadius: 8,
114
113
  },
115
114
  callAgentBtnInnerContainer: {