@100mslive/react-native-room-kit 0.0.2 → 0.0.3
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/lib/commonjs/HMSRoomSetup.js +1 -1
- package/lib/commonjs/HMSRoomSetup.js.map +1 -1
- package/lib/commonjs/Icons/AnswerPhone/assets/answer-phone.png +0 -0
- package/lib/commonjs/Icons/AnswerPhone/assets/answer-phone@2x.png +0 -0
- package/lib/commonjs/Icons/AnswerPhone/assets/answer-phone@3x.png +0 -0
- package/lib/commonjs/Icons/AnswerPhone/index.js +30 -0
- package/lib/commonjs/Icons/AnswerPhone/index.js.map +1 -0
- package/lib/commonjs/Icons/Bluetooth/assets/bluetooth-on.png +0 -0
- package/lib/commonjs/Icons/Bluetooth/assets/bluetooth-on@2x.png +0 -0
- package/lib/commonjs/Icons/Bluetooth/assets/bluetooth-on@3x.png +0 -0
- package/lib/commonjs/Icons/Bluetooth/index.js +30 -0
- package/lib/commonjs/Icons/Bluetooth/index.js.map +1 -0
- package/lib/commonjs/Icons/GenericLogo/assets/generic-logo.png +0 -0
- package/lib/commonjs/Icons/GenericLogo/assets/generic-logo@2x.png +0 -0
- package/lib/commonjs/Icons/GenericLogo/assets/generic-logo@3x.png +0 -0
- package/lib/commonjs/Icons/GenericLogo/index.js +30 -0
- package/lib/commonjs/Icons/GenericLogo/index.js.map +1 -0
- package/lib/commonjs/Icons/Headphones/assets/headphones.png +0 -0
- package/lib/commonjs/Icons/Headphones/assets/headphones@2x.png +0 -0
- package/lib/commonjs/Icons/Headphones/assets/headphones@3x.png +0 -0
- package/lib/commonjs/Icons/Headphones/index.js +30 -0
- package/lib/commonjs/Icons/Headphones/index.js.map +1 -0
- package/lib/commonjs/Icons/Person/assets/person.png +0 -0
- package/lib/commonjs/Icons/Person/assets/person@2x.png +0 -0
- package/lib/commonjs/Icons/Person/assets/person@3x.png +0 -0
- package/lib/commonjs/Icons/Person/index.js +30 -0
- package/lib/commonjs/Icons/Person/index.js.map +1 -0
- package/lib/commonjs/Icons/Speaker/assets/speaker-large.png +0 -0
- package/lib/commonjs/Icons/Speaker/assets/speaker-large@2x.png +0 -0
- package/lib/commonjs/Icons/Speaker/assets/speaker-large@3x.png +0 -0
- package/lib/commonjs/Icons/Speaker/index.js +7 -2
- package/lib/commonjs/Icons/Speaker/index.js.map +1 -1
- package/lib/commonjs/Icons/Wave/assets/wave.png +0 -0
- package/lib/commonjs/Icons/Wave/assets/wave@2x.png +0 -0
- package/lib/commonjs/Icons/Wave/assets/wave@3x.png +0 -0
- package/lib/commonjs/Icons/Wave/index.js +30 -0
- package/lib/commonjs/Icons/Wave/index.js.map +1 -0
- package/lib/commonjs/Icons/index.js +66 -0
- package/lib/commonjs/Icons/index.js.map +1 -1
- package/lib/commonjs/components/BackButton.js +1 -1
- package/lib/commonjs/components/BackButton.js.map +1 -1
- package/lib/commonjs/components/HMSPreviewEditName.js +1 -1
- package/lib/commonjs/components/HMSPreviewEditName.js.map +1 -1
- package/lib/commonjs/components/HMSPreviewJoinButton.js +11 -4
- package/lib/commonjs/components/HMSPreviewJoinButton.js.map +1 -1
- package/lib/commonjs/components/HMSPreviewPeersList.js +9 -32
- package/lib/commonjs/components/HMSPreviewPeersList.js.map +1 -1
- package/lib/commonjs/components/HMSPreviewSubtitle.js +1 -1
- package/lib/commonjs/components/HMSPreviewSubtitle.js.map +1 -1
- package/lib/commonjs/components/HMSPreviewTile.js +11 -61
- package/lib/commonjs/components/HMSPreviewTile.js.map +1 -1
- package/lib/commonjs/components/HMSPreviewTitle.js +0 -1
- package/lib/commonjs/components/HMSPreviewTitle.js.map +1 -1
- package/lib/commonjs/components/{HMSPreviewDeviceSettings.js → HMSSpeakerSettings.js} +69 -161
- package/lib/commonjs/components/HMSSpeakerSettings.js.map +1 -0
- package/lib/commonjs/components/Preview.js +72 -21
- package/lib/commonjs/components/Preview.js.map +1 -1
- package/lib/commonjs/hooks-util.js +17 -60
- package/lib/commonjs/hooks-util.js.map +1 -1
- package/lib/commonjs/redux/actionTypes.js +2 -0
- package/lib/commonjs/redux/actionTypes.js.map +1 -1
- package/lib/commonjs/redux/actions/index.js +11 -1
- package/lib/commonjs/redux/actions/index.js.map +1 -1
- package/lib/commonjs/redux/reducers/hmsStates.js +12 -1
- package/lib/commonjs/redux/reducers/hmsStates.js.map +1 -1
- package/lib/commonjs/utils/theme.js +5 -1
- package/lib/commonjs/utils/theme.js.map +1 -1
- package/lib/module/HMSRoomSetup.js +1 -1
- package/lib/module/HMSRoomSetup.js.map +1 -1
- package/lib/module/Icons/AnswerPhone/assets/answer-phone.png +0 -0
- package/lib/module/Icons/AnswerPhone/assets/answer-phone@2x.png +0 -0
- package/lib/module/Icons/AnswerPhone/assets/answer-phone@3x.png +0 -0
- package/lib/module/Icons/AnswerPhone/index.js +22 -0
- package/lib/module/Icons/AnswerPhone/index.js.map +1 -0
- package/lib/module/Icons/Bluetooth/assets/bluetooth-on.png +0 -0
- package/lib/module/Icons/Bluetooth/assets/bluetooth-on@2x.png +0 -0
- package/lib/module/Icons/Bluetooth/assets/bluetooth-on@3x.png +0 -0
- package/lib/module/Icons/Bluetooth/index.js +22 -0
- package/lib/module/Icons/Bluetooth/index.js.map +1 -0
- package/lib/module/Icons/GenericLogo/assets/generic-logo.png +0 -0
- package/lib/module/Icons/GenericLogo/assets/generic-logo@2x.png +0 -0
- package/lib/module/Icons/GenericLogo/assets/generic-logo@3x.png +0 -0
- package/lib/module/Icons/GenericLogo/index.js +22 -0
- package/lib/module/Icons/GenericLogo/index.js.map +1 -0
- package/lib/module/Icons/Headphones/assets/headphones.png +0 -0
- package/lib/module/Icons/Headphones/assets/headphones@2x.png +0 -0
- package/lib/module/Icons/Headphones/assets/headphones@3x.png +0 -0
- package/lib/module/Icons/Headphones/index.js +22 -0
- package/lib/module/Icons/Headphones/index.js.map +1 -0
- package/lib/module/Icons/Person/assets/person.png +0 -0
- package/lib/module/Icons/Person/assets/person@2x.png +0 -0
- package/lib/module/Icons/Person/assets/person@3x.png +0 -0
- package/lib/module/Icons/Person/index.js +22 -0
- package/lib/module/Icons/Person/index.js.map +1 -0
- package/lib/module/Icons/Speaker/assets/speaker-large.png +0 -0
- package/lib/module/Icons/Speaker/assets/speaker-large@2x.png +0 -0
- package/lib/module/Icons/Speaker/assets/speaker-large@3x.png +0 -0
- package/lib/module/Icons/Speaker/index.js +7 -2
- package/lib/module/Icons/Speaker/index.js.map +1 -1
- package/lib/module/Icons/Wave/assets/wave.png +0 -0
- package/lib/module/Icons/Wave/assets/wave@2x.png +0 -0
- package/lib/module/Icons/Wave/assets/wave@3x.png +0 -0
- package/lib/module/Icons/Wave/index.js +22 -0
- package/lib/module/Icons/Wave/index.js.map +1 -0
- package/lib/module/Icons/index.js +6 -0
- package/lib/module/Icons/index.js.map +1 -1
- package/lib/module/components/BackButton.js +1 -1
- package/lib/module/components/BackButton.js.map +1 -1
- package/lib/module/components/HMSPreviewEditName.js +1 -1
- package/lib/module/components/HMSPreviewEditName.js.map +1 -1
- package/lib/module/components/HMSPreviewJoinButton.js +11 -4
- package/lib/module/components/HMSPreviewJoinButton.js.map +1 -1
- package/lib/module/components/HMSPreviewPeersList.js +9 -32
- package/lib/module/components/HMSPreviewPeersList.js.map +1 -1
- package/lib/module/components/HMSPreviewSubtitle.js +1 -1
- package/lib/module/components/HMSPreviewSubtitle.js.map +1 -1
- package/lib/module/components/HMSPreviewTile.js +12 -62
- package/lib/module/components/HMSPreviewTile.js.map +1 -1
- package/lib/module/components/HMSPreviewTitle.js +0 -1
- package/lib/module/components/HMSPreviewTitle.js.map +1 -1
- package/lib/module/components/HMSSpeakerSettings.js +204 -0
- package/lib/module/components/HMSSpeakerSettings.js.map +1 -0
- package/lib/module/components/Preview.js +73 -23
- package/lib/module/components/Preview.js.map +1 -1
- package/lib/module/hooks-util.js +18 -61
- package/lib/module/hooks-util.js.map +1 -1
- package/lib/module/redux/actionTypes.js +2 -0
- package/lib/module/redux/actionTypes.js.map +1 -1
- package/lib/module/redux/actions/index.js +8 -0
- package/lib/module/redux/actions/index.js.map +1 -1
- package/lib/module/redux/reducers/hmsStates.js +12 -1
- package/lib/module/redux/reducers/hmsStates.js.map +1 -1
- package/lib/module/utils/theme.js +5 -1
- package/lib/module/utils/theme.js.map +1 -1
- package/lib/typescript/Icons/AnswerPhone/index.d.ts +7 -0
- package/lib/typescript/Icons/AnswerPhone/index.d.ts.map +1 -0
- package/lib/typescript/Icons/Bluetooth/index.d.ts +7 -0
- package/lib/typescript/Icons/Bluetooth/index.d.ts.map +1 -0
- package/lib/typescript/Icons/GenericLogo/index.d.ts +7 -0
- package/lib/typescript/Icons/GenericLogo/index.d.ts.map +1 -0
- package/lib/typescript/Icons/Headphones/index.d.ts +7 -0
- package/lib/typescript/Icons/Headphones/index.d.ts.map +1 -0
- package/lib/typescript/Icons/Person/index.d.ts +7 -0
- package/lib/typescript/Icons/Person/index.d.ts.map +1 -0
- package/lib/typescript/Icons/Speaker/index.d.ts +1 -0
- package/lib/typescript/Icons/Speaker/index.d.ts.map +1 -1
- package/lib/typescript/Icons/Wave/index.d.ts +7 -0
- package/lib/typescript/Icons/Wave/index.d.ts.map +1 -0
- package/lib/typescript/Icons/index.d.ts +6 -0
- package/lib/typescript/Icons/index.d.ts.map +1 -1
- package/lib/typescript/components/HMSPreviewJoinButton.d.ts.map +1 -1
- package/lib/typescript/components/HMSPreviewPeersList.d.ts.map +1 -1
- package/lib/typescript/components/HMSPreviewTile.d.ts.map +1 -1
- package/lib/typescript/components/HMSSpeakerSettings.d.ts +3 -0
- package/lib/typescript/components/HMSSpeakerSettings.d.ts.map +1 -0
- package/lib/typescript/components/Preview.d.ts.map +1 -1
- package/lib/typescript/hooks-util.d.ts +1 -1
- package/lib/typescript/hooks-util.d.ts.map +1 -1
- package/lib/typescript/redux/actionTypes.d.ts +3 -1
- package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
- package/lib/typescript/redux/actions/index.d.ts +8 -0
- package/lib/typescript/redux/actions/index.d.ts.map +1 -1
- package/lib/typescript/redux/index.d.ts +1 -0
- package/lib/typescript/redux/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/hmsStates.d.ts +11 -2
- package/lib/typescript/redux/reducers/hmsStates.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/index.d.ts +1 -0
- package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
- package/lib/typescript/utils/theme.d.ts +4 -0
- package/lib/typescript/utils/theme.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/HMSRoomSetup.tsx +1 -1
- package/src/Icons/AnswerPhone/assets/answer-phone.png +0 -0
- package/src/Icons/AnswerPhone/assets/answer-phone@2x.png +0 -0
- package/src/Icons/AnswerPhone/assets/answer-phone@3x.png +0 -0
- package/src/Icons/AnswerPhone/index.tsx +27 -0
- package/src/Icons/Bluetooth/assets/bluetooth-on.png +0 -0
- package/src/Icons/Bluetooth/assets/bluetooth-on@2x.png +0 -0
- package/src/Icons/Bluetooth/assets/bluetooth-on@3x.png +0 -0
- package/src/Icons/Bluetooth/index.tsx +27 -0
- package/src/Icons/GenericLogo/assets/generic-logo.png +0 -0
- package/src/Icons/GenericLogo/assets/generic-logo@2x.png +0 -0
- package/src/Icons/GenericLogo/assets/generic-logo@3x.png +0 -0
- package/src/Icons/GenericLogo/index.tsx +27 -0
- package/src/Icons/Headphones/assets/headphones.png +0 -0
- package/src/Icons/Headphones/assets/headphones@2x.png +0 -0
- package/src/Icons/Headphones/assets/headphones@3x.png +0 -0
- package/src/Icons/Headphones/index.tsx +27 -0
- package/src/Icons/Person/assets/person.png +0 -0
- package/src/Icons/Person/assets/person@2x.png +0 -0
- package/src/Icons/Person/assets/person@3x.png +0 -0
- package/src/Icons/Person/index.tsx +27 -0
- package/src/Icons/Speaker/assets/speaker-large.png +0 -0
- package/src/Icons/Speaker/assets/speaker-large@2x.png +0 -0
- package/src/Icons/Speaker/assets/speaker-large@3x.png +0 -0
- package/src/Icons/Speaker/index.tsx +10 -2
- package/src/Icons/Wave/assets/wave.png +0 -0
- package/src/Icons/Wave/assets/wave@2x.png +0 -0
- package/src/Icons/Wave/assets/wave@3x.png +0 -0
- package/src/Icons/Wave/index.tsx +24 -0
- package/src/Icons/index.ts +6 -0
- package/src/components/BackButton.tsx +1 -1
- package/src/components/HMSPreviewEditName.tsx +1 -1
- package/src/components/HMSPreviewJoinButton.tsx +21 -4
- package/src/components/HMSPreviewPeersList.tsx +19 -40
- package/src/components/HMSPreviewSubtitle.tsx +1 -1
- package/src/components/HMSPreviewTile.tsx +11 -67
- package/src/components/HMSPreviewTitle.tsx +0 -1
- package/src/components/HMSSpeakerSettings.tsx +259 -0
- package/src/components/Preview.tsx +92 -37
- package/src/hooks-util.ts +23 -57
- package/src/redux/actionTypes.ts +2 -0
- package/src/redux/actions/index.ts +10 -0
- package/src/redux/reducers/hmsStates.ts +28 -1
- package/src/utils/theme.ts +5 -1
- package/lib/commonjs/components/HMSPreviewDeviceSettings.js.map +0 -1
- package/lib/module/components/HMSPreviewDeviceSettings.js +0 -296
- package/lib/module/components/HMSPreviewDeviceSettings.js.map +0 -1
- package/lib/typescript/components/HMSPreviewDeviceSettings.d.ts +0 -3
- package/lib/typescript/components/HMSPreviewDeviceSettings.d.ts.map +0 -1
- package/src/components/HMSPreviewDeviceSettings.tsx +0 -387
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Modal from 'react-native-modal';
|
|
3
|
+
import { Platform, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
4
|
+
import Toast from 'react-native-simple-toast';
|
|
5
|
+
import { useSelector } from 'react-redux';
|
|
6
|
+
import { HMSUpdateListenerActions, HMSAudioDevice } from '@100mslive/react-native-hms';
|
|
7
|
+
import { AnswerPhoneIcon, BluetoothIcon, HeadphonesIcon, SpeakerIcon, WaveIcon } from '../Icons';
|
|
8
|
+
import { PressableIcon } from './PressableIcon';
|
|
9
|
+
import { COLORS } from '../utils/theme';
|
|
10
|
+
import { CloseIcon } from '../Icons';
|
|
11
|
+
import { useHMSInstance } from '../hooks-util';
|
|
12
|
+
export const HMSSpeakerSettings = () => {
|
|
13
|
+
const hmsInstance = useHMSInstance();
|
|
14
|
+
const [settingsModalVisible, setSettingsModalVisible] = React.useState(false);
|
|
15
|
+
const [currentAudioOutputDevice, setCurrentAudioOutputDevice] = React.useState(null);
|
|
16
|
+
const [availableAudioOutputDevices, setAvailableAudioOutputDevices] = React.useState([]);
|
|
17
|
+
const debugMode = useSelector(state => state.user.debugMode);
|
|
18
|
+
|
|
19
|
+
// Fetch current selected audio device and audio devices list on Android
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
if (Platform.OS === 'android') {
|
|
22
|
+
let ignore = false;
|
|
23
|
+
const getCurrentAudioOutputDevice = async () => {
|
|
24
|
+
const device = await hmsInstance.getAudioOutputRouteType();
|
|
25
|
+
if (!ignore) {
|
|
26
|
+
setCurrentAudioOutputDevice(device);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const getAvailableAudioOutputDevices = async () => {
|
|
30
|
+
const devices = await hmsInstance.getAudioDevicesList();
|
|
31
|
+
if (!ignore) {
|
|
32
|
+
setAvailableAudioOutputDevices(devices);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
getCurrentAudioOutputDevice();
|
|
36
|
+
getAvailableAudioOutputDevices();
|
|
37
|
+
return () => {
|
|
38
|
+
ignore = true;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}, [hmsInstance]);
|
|
42
|
+
|
|
43
|
+
// closes modal and no action will be taken after modal has been closed
|
|
44
|
+
const dismissModal = () => {
|
|
45
|
+
setSettingsModalVisible(false);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Handles showing Modal for changing Audio device
|
|
49
|
+
const handleSpeakerChange = () => {
|
|
50
|
+
if (Platform.OS === 'ios') {
|
|
51
|
+
hmsInstance.switchAudioOutputUsingIOSUI();
|
|
52
|
+
} else {
|
|
53
|
+
if (availableAudioOutputDevices.length === 0) {
|
|
54
|
+
hmsInstance.getAudioDevicesList().then(devices => setAvailableAudioOutputDevices(devices)); // TODO(set-state-after-unmount): setting state irrespective of component unmount check
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
setSettingsModalVisible(true);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Add audio device change listeners
|
|
62
|
+
React.useEffect(() => {
|
|
63
|
+
if (Platform.OS === 'android') {
|
|
64
|
+
let ignore = false;
|
|
65
|
+
hmsInstance.setAudioDeviceChangeListener(data => {
|
|
66
|
+
if (!ignore && data) {
|
|
67
|
+
setCurrentAudioOutputDevice(data.device);
|
|
68
|
+
}
|
|
69
|
+
if (debugMode) {
|
|
70
|
+
Toast.showWithGravity(`Audio Device Output changed to: ${data === null || data === void 0 ? void 0 : data.device}`, Toast.LONG, Toast.TOP);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return () => {
|
|
74
|
+
ignore = true;
|
|
75
|
+
hmsInstance.removeEventListener(HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}, [hmsInstance, debugMode]);
|
|
79
|
+
|
|
80
|
+
// Handle changing selected audio device
|
|
81
|
+
const handleSelectAudioDevice = device => {
|
|
82
|
+
hmsInstance.switchAudioOutput(device);
|
|
83
|
+
setSettingsModalVisible(false);
|
|
84
|
+
};
|
|
85
|
+
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(PressableIcon, {
|
|
86
|
+
onPress: handleSpeakerChange
|
|
87
|
+
}, Platform.OS === 'ios' ? /*#__PURE__*/React.createElement(SpeakerIcon, {
|
|
88
|
+
muted: false
|
|
89
|
+
}) : getIcon(currentAudioOutputDevice || HMSAudioDevice.AUTOMATIC)), /*#__PURE__*/React.createElement(Modal, {
|
|
90
|
+
isVisible: settingsModalVisible,
|
|
91
|
+
animationIn: 'slideInUp',
|
|
92
|
+
animationOut: 'slideOutDown',
|
|
93
|
+
backdropColor: COLORS.BACKGROUND.DIM,
|
|
94
|
+
backdropOpacity: 0.3,
|
|
95
|
+
onBackButtonPress: dismissModal,
|
|
96
|
+
onBackdropPress: dismissModal,
|
|
97
|
+
useNativeDriver: true,
|
|
98
|
+
useNativeDriverForBackdrop: true,
|
|
99
|
+
hideModalContentWhileAnimating: true
|
|
100
|
+
// swipeDirection={['up', 'down']}
|
|
101
|
+
// swipe
|
|
102
|
+
,
|
|
103
|
+
style: styles.modal
|
|
104
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
105
|
+
style: styles.container
|
|
106
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
107
|
+
style: styles.header
|
|
108
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
109
|
+
style: styles.headerText
|
|
110
|
+
}, "Speaker Settings"), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
111
|
+
onPress: dismissModal,
|
|
112
|
+
hitSlop: styles.closeIconHitSlop
|
|
113
|
+
}, /*#__PURE__*/React.createElement(CloseIcon, null))), availableAudioOutputDevices.length === 0 ? /*#__PURE__*/React.createElement(View, {
|
|
114
|
+
style: styles.emptyView
|
|
115
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
116
|
+
style: styles.itemText
|
|
117
|
+
}, "No other devices available!")) : /*#__PURE__*/React.createElement(ScrollView, {
|
|
118
|
+
showsVerticalScrollIndicator: true
|
|
119
|
+
}, availableAudioOutputDevices.sort().map(device => /*#__PURE__*/React.createElement(React.Fragment, {
|
|
120
|
+
key: device
|
|
121
|
+
}, true ? /*#__PURE__*/React.createElement(View, {
|
|
122
|
+
style: styles.divider
|
|
123
|
+
}) : null, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
124
|
+
style: styles.audioDeviceItem,
|
|
125
|
+
onPress: () => handleSelectAudioDevice(device)
|
|
126
|
+
}, getIcon(device), /*#__PURE__*/React.createElement(Text, {
|
|
127
|
+
style: styles.itemText
|
|
128
|
+
}, device))))))));
|
|
129
|
+
};
|
|
130
|
+
const styles = StyleSheet.create({
|
|
131
|
+
modal: {
|
|
132
|
+
margin: 0,
|
|
133
|
+
justifyContent: 'flex-end'
|
|
134
|
+
},
|
|
135
|
+
container: {
|
|
136
|
+
backgroundColor: COLORS.SURFACE.DIM,
|
|
137
|
+
borderTopLeftRadius: 16,
|
|
138
|
+
borderTopRightRadius: 16,
|
|
139
|
+
paddingTop: 24,
|
|
140
|
+
paddingHorizontal: 16,
|
|
141
|
+
paddingBottom: 32
|
|
142
|
+
},
|
|
143
|
+
header: {
|
|
144
|
+
flexDirection: 'row',
|
|
145
|
+
alignItems: 'center',
|
|
146
|
+
justifyContent: 'space-between',
|
|
147
|
+
marginBottom: 16
|
|
148
|
+
},
|
|
149
|
+
headerText: {
|
|
150
|
+
color: COLORS.SURFACE.ON_SURFACE.HIGH,
|
|
151
|
+
fontSize: 16,
|
|
152
|
+
fontFamily: 'Inter',
|
|
153
|
+
fontWeight: '500',
|
|
154
|
+
lineHeight: 24,
|
|
155
|
+
letterSpacing: 0.15
|
|
156
|
+
},
|
|
157
|
+
closeIconHitSlop: {
|
|
158
|
+
bottom: 16,
|
|
159
|
+
left: 16,
|
|
160
|
+
right: 16,
|
|
161
|
+
top: 16
|
|
162
|
+
},
|
|
163
|
+
itemText: {
|
|
164
|
+
flex: 1,
|
|
165
|
+
marginHorizontal: 16,
|
|
166
|
+
color: COLORS.SURFACE.ON_SURFACE.HIGH,
|
|
167
|
+
fontSize: 14,
|
|
168
|
+
fontFamily: 'Inter',
|
|
169
|
+
fontWeight: '600',
|
|
170
|
+
lineHeight: 20,
|
|
171
|
+
letterSpacing: 0.1
|
|
172
|
+
},
|
|
173
|
+
emptyView: {
|
|
174
|
+
height: 160,
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
justifyContent: 'center'
|
|
177
|
+
},
|
|
178
|
+
audioDeviceItem: {
|
|
179
|
+
flexDirection: 'row',
|
|
180
|
+
alignItems: 'center',
|
|
181
|
+
paddingVertical: 24
|
|
182
|
+
},
|
|
183
|
+
divider: {
|
|
184
|
+
height: 1,
|
|
185
|
+
backgroundColor: COLORS.BORDER.DEFAULT
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
const getIcon = ofDevice => {
|
|
189
|
+
switch (ofDevice) {
|
|
190
|
+
case HMSAudioDevice.AUTOMATIC:
|
|
191
|
+
return /*#__PURE__*/React.createElement(WaveIcon, null);
|
|
192
|
+
case HMSAudioDevice.BLUETOOTH:
|
|
193
|
+
return /*#__PURE__*/React.createElement(BluetoothIcon, null);
|
|
194
|
+
case HMSAudioDevice.EARPIECE:
|
|
195
|
+
return /*#__PURE__*/React.createElement(AnswerPhoneIcon, null);
|
|
196
|
+
case HMSAudioDevice.SPEAKER_PHONE:
|
|
197
|
+
return /*#__PURE__*/React.createElement(SpeakerIcon, {
|
|
198
|
+
muted: false
|
|
199
|
+
});
|
|
200
|
+
case HMSAudioDevice.WIRED_HEADSET:
|
|
201
|
+
return /*#__PURE__*/React.createElement(HeadphonesIcon, null);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
//# sourceMappingURL=HMSSpeakerSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Modal","Platform","ScrollView","StyleSheet","Text","TouchableOpacity","View","Toast","useSelector","HMSUpdateListenerActions","HMSAudioDevice","AnswerPhoneIcon","BluetoothIcon","HeadphonesIcon","SpeakerIcon","WaveIcon","PressableIcon","COLORS","CloseIcon","useHMSInstance","HMSSpeakerSettings","hmsInstance","settingsModalVisible","setSettingsModalVisible","useState","currentAudioOutputDevice","setCurrentAudioOutputDevice","availableAudioOutputDevices","setAvailableAudioOutputDevices","debugMode","state","user","useEffect","OS","ignore","getCurrentAudioOutputDevice","device","getAudioOutputRouteType","getAvailableAudioOutputDevices","devices","getAudioDevicesList","dismissModal","handleSpeakerChange","switchAudioOutputUsingIOSUI","length","then","setAudioDeviceChangeListener","data","showWithGravity","LONG","TOP","removeEventListener","ON_AUDIO_DEVICE_CHANGED","handleSelectAudioDevice","switchAudioOutput","createElement","onPress","muted","getIcon","AUTOMATIC","isVisible","animationIn","animationOut","backdropColor","BACKGROUND","DIM","backdropOpacity","onBackButtonPress","onBackdropPress","useNativeDriver","useNativeDriverForBackdrop","hideModalContentWhileAnimating","style","styles","modal","container","header","headerText","hitSlop","closeIconHitSlop","emptyView","itemText","showsVerticalScrollIndicator","sort","map","Fragment","key","divider","audioDeviceItem","create","margin","justifyContent","backgroundColor","SURFACE","borderTopLeftRadius","borderTopRightRadius","paddingTop","paddingHorizontal","paddingBottom","flexDirection","alignItems","marginBottom","color","ON_SURFACE","HIGH","fontSize","fontFamily","fontWeight","lineHeight","letterSpacing","bottom","left","right","top","flex","marginHorizontal","height","paddingVertical","BORDER","DEFAULT","ofDevice","BLUETOOTH","EARPIECE","SPEAKER_PHONE","WIRED_HEADSET"],"sourceRoot":"../../../src","sources":["components/HMSSpeakerSettings.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,KAAK,MAAM,oBAAoB;AACtC,SACEC,QAAQ,EACRC,UAAU,EACVC,UAAU,EACVC,IAAI,EACJC,gBAAgB,EAChBC,IAAI,QACC,cAAc;AACrB,OAAOC,KAAK,MAAM,2BAA2B;AAC7C,SAASC,WAAW,QAAQ,aAAa;AACzC,SACEC,wBAAwB,EACxBC,cAAc,QACT,6BAA6B;AAEpC,SACEC,eAAe,EACfC,aAAa,EACbC,cAAc,EACdC,WAAW,EACXC,QAAQ,QACH,UAAU;AACjB,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SAASC,SAAS,QAAQ,UAAU;AACpC,SAASC,cAAc,QAAQ,eAAe;AAG9C,OAAO,MAAMC,kBAA4B,GAAGA,CAAA,KAAM;EAChD,MAAMC,WAAW,GAAGF,cAAc,CAAC,CAAC;EACpC,MAAM,CAACG,oBAAoB,EAAEC,uBA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KD,cAAc,CAACiH,aAAa;MAC/B,oBAAO5H,KAAA,CAAAwD,aAAA,CAACzC,WAAW;QAAC2C,KAAK,EAAE;MAAM,CAAE,CAAC;IACtC,KAAK/C,cAAc,CAACkH,aAAa;MAC/B,oBAAO7H,KAAA,CAAAwD,aAAA,CAAC1C,cAAc,MAAE,CAAC;EAC7B;AACF,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
import { AvoidSoftInput } from 'react-native-avoid-softinput';
|
|
4
|
-
import {
|
|
4
|
+
import { useSelector } from 'react-redux';
|
|
5
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
6
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
5
7
|
import { COLORS } from '../utils/theme';
|
|
6
8
|
import { BackButton } from './BackButton';
|
|
7
9
|
import { HMSManageCameraRotation } from './HMSManageCameraRotation';
|
|
@@ -13,51 +15,100 @@ import { HMSPreviewPeersList } from './HMSPreviewPeersList';
|
|
|
13
15
|
import { HMSPreviewSubtitle } from './HMSPreviewSubtitle';
|
|
14
16
|
import { HMSPreviewTile } from './HMSPreviewTile';
|
|
15
17
|
import { HMSPreviewTitle } from './HMSPreviewTitle';
|
|
16
|
-
import {
|
|
18
|
+
import { HMSSpeakerSettings } from './HMSSpeakerSettings';
|
|
19
|
+
import { GenericLogoIcon, NetworkQualityIcon } from '../Icons';
|
|
17
20
|
export const Preview = _ref => {
|
|
18
21
|
let {
|
|
19
22
|
join,
|
|
20
23
|
loadingButtonState
|
|
21
24
|
} = _ref;
|
|
22
|
-
const {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
const localPeerNetworkQuality = useSelector(state => {
|
|
26
|
+
var _state$hmsStates$loca;
|
|
27
|
+
return (_state$hmsStates$loca = state.hmsStates.localPeer) === null || _state$hmsStates$loca === void 0 || (_state$hmsStates$loca = _state$hmsStates$loca.networkQuality) === null || _state$hmsStates$loca === void 0 ? void 0 : _state$hmsStates$loca.downlinkQuality;
|
|
28
|
+
});
|
|
25
29
|
useEffect(() => {
|
|
26
30
|
AvoidSoftInput.setAdjustNothing();
|
|
27
31
|
AvoidSoftInput.setEnabled(true);
|
|
28
32
|
return () => AvoidSoftInput.setEnabled(false);
|
|
29
33
|
}, []);
|
|
30
|
-
return /*#__PURE__*/React.createElement(
|
|
34
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
31
35
|
style: styles.container
|
|
32
|
-
}, /*#__PURE__*/React.createElement(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
}, /*#__PURE__*/React.createElement(HMSPreviewTile, null), /*#__PURE__*/React.createElement(LinearGradient, {
|
|
37
|
+
colors: ['#000000', 'rgba(0, 0, 0, 0.9)', 'rgba(0, 0, 0, 0.7)', 'rgba(0, 0, 0, 0.1)', 'rgba(0, 0, 0, 0.05)', 'rgba(0, 0, 0, 0)'],
|
|
38
|
+
locations: [0.45, 0.55, 0.7, 0.9, 0.95, 1],
|
|
39
|
+
style: {
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
top: 0,
|
|
42
|
+
width: '100%',
|
|
43
|
+
height: 260
|
|
44
|
+
}
|
|
45
|
+
}), /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
46
|
+
style: {
|
|
47
|
+
position: 'absolute',
|
|
48
|
+
top: 0,
|
|
49
|
+
width: '100%',
|
|
50
|
+
marginTop: 24
|
|
51
|
+
},
|
|
52
|
+
edges: ['top', 'left', 'right'],
|
|
53
|
+
mode: "margin"
|
|
54
|
+
}, /*#__PURE__*/React.createElement(GenericLogoIcon, {
|
|
55
|
+
style: {
|
|
56
|
+
alignSelf: 'center',
|
|
57
|
+
marginBottom: 16
|
|
58
|
+
}
|
|
59
|
+
}), /*#__PURE__*/React.createElement(HMSPreviewTitle, null), /*#__PURE__*/React.createElement(HMSPreviewSubtitle, null), /*#__PURE__*/React.createElement(HMSPreviewPeersList, null)), /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
60
|
+
style: {
|
|
61
|
+
position: 'absolute',
|
|
62
|
+
top: 0
|
|
63
|
+
},
|
|
64
|
+
edges: ['top'],
|
|
65
|
+
mode: "margin"
|
|
66
|
+
}, /*#__PURE__*/React.createElement(BackButton, null)), /*#__PURE__*/React.createElement(View, {
|
|
67
|
+
style: {
|
|
68
|
+
position: 'absolute',
|
|
69
|
+
bottom: 0,
|
|
70
|
+
width: '100%'
|
|
71
|
+
}
|
|
72
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
73
|
+
style: {
|
|
74
|
+
marginLeft: 8,
|
|
75
|
+
marginBottom: 8,
|
|
76
|
+
borderRadius: 8,
|
|
77
|
+
paddingVertical: 4,
|
|
78
|
+
paddingHorizontal: 8,
|
|
79
|
+
backgroundColor: COLORS.BACKGROUND.DIM_80,
|
|
80
|
+
alignSelf: 'flex-start'
|
|
81
|
+
}
|
|
82
|
+
}, /*#__PURE__*/React.createElement(NetworkQualityIcon, {
|
|
83
|
+
quality: localPeerNetworkQuality
|
|
84
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
85
|
+
style: {
|
|
86
|
+
flex: 1,
|
|
87
|
+
backgroundColor: COLORS.BACKGROUND.DEFAULT,
|
|
88
|
+
borderTopLeftRadius: 16,
|
|
89
|
+
borderTopRightRadius: 16,
|
|
90
|
+
padding: 16
|
|
91
|
+
}
|
|
92
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
36
93
|
style: styles.controlsContainer
|
|
37
94
|
}, /*#__PURE__*/React.createElement(View, {
|
|
38
95
|
style: styles.micAndCameraControls
|
|
39
96
|
}, /*#__PURE__*/React.createElement(HMSManageLocalAudio, null), /*#__PURE__*/React.createElement(View, {
|
|
40
97
|
style: styles.manageLocalVideoWrapper
|
|
41
|
-
}, /*#__PURE__*/React.createElement(HMSManageLocalVideo, null)), /*#__PURE__*/React.createElement(HMSManageCameraRotation, null)), /*#__PURE__*/React.createElement(
|
|
42
|
-
style:
|
|
43
|
-
marginBottom: 34 - bottom + 12
|
|
44
|
-
}]
|
|
98
|
+
}, /*#__PURE__*/React.createElement(HMSManageLocalVideo, null)), /*#__PURE__*/React.createElement(HMSManageCameraRotation, null)), /*#__PURE__*/React.createElement(HMSSpeakerSettings, null)), /*#__PURE__*/React.createElement(View, {
|
|
99
|
+
style: styles.joinButtonRow
|
|
45
100
|
}, /*#__PURE__*/React.createElement(HMSPreviewEditName, null), /*#__PURE__*/React.createElement(HMSPreviewJoinButton, {
|
|
46
101
|
onJoin: join,
|
|
47
102
|
loading: loadingButtonState
|
|
48
|
-
}))));
|
|
103
|
+
})))));
|
|
49
104
|
};
|
|
50
105
|
const styles = StyleSheet.create({
|
|
51
106
|
container: {
|
|
52
107
|
flex: 1,
|
|
108
|
+
position: 'relative',
|
|
53
109
|
backgroundColor: COLORS.BACKGROUND.DIM
|
|
54
110
|
},
|
|
55
|
-
scrollContainer: {
|
|
56
|
-
flexGrow: 1
|
|
57
|
-
},
|
|
58
111
|
controlsContainer: {
|
|
59
|
-
marginHorizontal: 24,
|
|
60
|
-
marginTop: 24,
|
|
61
112
|
flexDirection: 'row',
|
|
62
113
|
alignItems: 'center',
|
|
63
114
|
justifyContent: 'space-between'
|
|
@@ -69,8 +120,7 @@ const styles = StyleSheet.create({
|
|
|
69
120
|
marginHorizontal: 16
|
|
70
121
|
},
|
|
71
122
|
joinButtonRow: {
|
|
72
|
-
|
|
73
|
-
marginTop: 16,
|
|
123
|
+
marginVertical: 16,
|
|
74
124
|
flexDirection: 'row'
|
|
75
125
|
}
|
|
76
126
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","
|
|
1
|
+
{"version":3,"names":["React","useEffect","StyleSheet","View","AvoidSoftInput","useSelector","SafeAreaView","LinearGradient","COLORS","BackButton","HMSManageCameraRotation","HMSManageLocalAudio","HMSManageLocalVideo","HMSPreviewEditName","HMSPreviewJoinButton","HMSPreviewPeersList","HMSPreviewSubtitle","HMSPreviewTile","HMSPreviewTitle","HMSSpeakerSettings","GenericLogoIcon","NetworkQualityIcon","Preview","_ref","join","loadingButtonState","localPeerNetworkQuality","state","_state$hmsStates$loca","hmsStates","localPeer","networkQuality","downlinkQuality","setAdjustNothing","setEnabled","createElement","style","styles","container","colors","locations","position","top","width","height","marginTop","edges","mode","alignSelf","marginBottom","bottom","marginLeft","borderRadius","paddingVertical","paddingHorizontal","backgroundColor","BACKGROUND","DIM_80","quality","flex","DEFAULT","borderTopLeftRadius","borderTopRightRadius","padding","controlsContainer","micAndCameraControls","manageLocalVideoWrapper","joinButtonRow","onJoin","loading","create","DIM","flexDirection","alignItems","justifyContent","marginHorizontal","marginVertical"],"sourceRoot":"../../../src","sources":["components/Preview.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,YAAY,QAAQ,gCAAgC;AAC7D,OAAOC,cAAc,MAAM,8BAA8B;AAEzD,SAASC,MAAM,QAAQ,gBAAgB;AAEvC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,UAAU;AAG9D,OAAO,MAAMC,OAAO,GAAGC,IAAA,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EACjB,CAAC;EACDN,uBAAuB,EAAE;IACvBS,gBAAgB,EAAE;EACpB,CAAC;EACDR,aAAa,EAAE;IACbS,cAAc,EAAE,EAAE;IAClBJ,aAAa,EAAE;EACjB;AACF,CAAC,CAAC"}
|
package/lib/module/hooks-util.js
CHANGED
|
@@ -6,7 +6,7 @@ import { useRef, useCallback, useEffect, useState, useMemo } from 'react';
|
|
|
6
6
|
import { ModalTypes, PipModes } from './utils/types';
|
|
7
7
|
import { createPeerTrackNode, parseMetadata } from './utils/functions';
|
|
8
8
|
import { useDispatch, useSelector, useStore } from 'react-redux';
|
|
9
|
-
import { addMessage, addPinnedMessage, changePipModeStatus, clearStore, saveUserData, setHMSLocalPeerState, setHMSRoleState, setHMSRoomState, setIsLocalAudioMutedState, setIsLocalVideoMutedState, setModalType } from './redux/actions';
|
|
9
|
+
import { addMessage, addPinnedMessage, addToPreviewPeersList, changePipModeStatus, clearStore, removeFromPreviewPeersList, saveUserData, setHMSLocalPeerState, setHMSRoleState, setHMSRoomState, setIsLocalAudioMutedState, setIsLocalVideoMutedState, setModalType } from './redux/actions';
|
|
10
10
|
import { degradeOrRestorePeerTrackNodes, peerTrackNodeExistForPeer, peerTrackNodeExistForPeerAndTrack, removePeerTrackNodes, removePeerTrackNodesWithTrack, replacePeerTrackNodes, replacePeerTrackNodesWithTrack } from './peerTrackNodeUtils';
|
|
11
11
|
import { MeetingState } from './types';
|
|
12
12
|
import { AppState, InteractionManager, LayoutAnimation, Platform } from 'react-native';
|
|
@@ -14,11 +14,11 @@ import { useNavigation } from '@react-navigation/native';
|
|
|
14
14
|
import { useIsLandscapeOrientation, useIsPortraitOrientation } from './utils/dimension';
|
|
15
15
|
import { useSafeAreaFrame, useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
16
16
|
import { selectIsHLSViewer } from './hooks-util-selectors';
|
|
17
|
-
export const useHMSListeners = (setPeerTrackNodes, setMeetingState) => {
|
|
17
|
+
export const useHMSListeners = (meetingState, setPeerTrackNodes, setMeetingState) => {
|
|
18
18
|
const hmsInstance = useHMSInstance();
|
|
19
19
|
const updateLocalPeer = useUpdateHMSLocalPeer(hmsInstance);
|
|
20
20
|
useHMSRoomUpdate(hmsInstance, setMeetingState);
|
|
21
|
-
useHMSPeersUpdate(hmsInstance, updateLocalPeer, setPeerTrackNodes);
|
|
21
|
+
useHMSPeersUpdate(meetingState, hmsInstance, updateLocalPeer, setPeerTrackNodes);
|
|
22
22
|
useHMSTrackUpdate(hmsInstance, updateLocalPeer, setPeerTrackNodes);
|
|
23
23
|
};
|
|
24
24
|
const useHMSRoomUpdate = (hmsInstance, setMeetingState) => {
|
|
@@ -93,69 +93,25 @@ const useHMSRoomUpdate = (hmsInstance, setMeetingState) => {
|
|
|
93
93
|
};
|
|
94
94
|
}, [hmsInstance]);
|
|
95
95
|
};
|
|
96
|
-
const useHMSPeersUpdate = (hmsInstance, updateLocalPeer, setPeerTrackNodes) => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// if (type === HMSPeerUpdate.PEER_JOINED) {
|
|
100
|
-
// return;
|
|
101
|
-
// }
|
|
102
|
-
// if (type === HMSPeerUpdate.PEER_LEFT) {
|
|
103
|
-
// setPeerTrackNodes((prevPeerTrackNodes) =>
|
|
104
|
-
// removePeerTrackNodes(prevPeerTrackNodes, peer)
|
|
105
|
-
// );
|
|
106
|
-
// return;
|
|
107
|
-
// }
|
|
108
|
-
// if (peer.isLocal) {
|
|
109
|
-
// setPeerTrackNodes((prevPeerTrackNodes) => {
|
|
110
|
-
// if (peerTrackNodeExistForPeer(prevPeerTrackNodes, peer)) {
|
|
111
|
-
// return replacePeerTrackNodes(prevPeerTrackNodes, peer);
|
|
112
|
-
// }
|
|
113
|
-
// return prevPeerTrackNodes;
|
|
114
|
-
// });
|
|
115
|
-
|
|
116
|
-
// // - TODO: update local localPeer state
|
|
117
|
-
// // - Pass this updated data to Meeting component -> DisplayView component
|
|
118
|
-
// updateLocalPeer();
|
|
119
|
-
// return;
|
|
120
|
-
// }
|
|
121
|
-
// if (type === HMSPeerUpdate.ROLE_CHANGED) {
|
|
122
|
-
// if (
|
|
123
|
-
// peer.role?.publishSettings?.allowed === undefined ||
|
|
124
|
-
// (peer.role?.publishSettings?.allowed &&
|
|
125
|
-
// peer.role?.publishSettings?.allowed.length < 1)
|
|
126
|
-
// ) {
|
|
127
|
-
// setPeerTrackNodes((prevPeerTrackNodes) => {
|
|
128
|
-
// if (peerTrackNodeExistForPeer(prevPeerTrackNodes, peer)) {
|
|
129
|
-
// return removePeerTrackNodes(prevPeerTrackNodes, peer);
|
|
130
|
-
// }
|
|
131
|
-
// return prevPeerTrackNodes;
|
|
132
|
-
// });
|
|
133
|
-
// }
|
|
134
|
-
// return;
|
|
135
|
-
// }
|
|
136
|
-
// if (
|
|
137
|
-
// type === HMSPeerUpdate.METADATA_CHANGED ||
|
|
138
|
-
// type === HMSPeerUpdate.NAME_CHANGED ||
|
|
139
|
-
// type === HMSPeerUpdate.NETWORK_QUALITY_UPDATED
|
|
140
|
-
// ) {
|
|
141
|
-
// setPeerTrackNodes((prevPeerTrackNodes) => {
|
|
142
|
-
// if (peerTrackNodeExistForPeer(prevPeerTrackNodes, peer)) {
|
|
143
|
-
// return replacePeerTrackNodes(prevPeerTrackNodes, peer);
|
|
144
|
-
// }
|
|
145
|
-
// return prevPeerTrackNodes;
|
|
146
|
-
// });
|
|
147
|
-
// return;
|
|
148
|
-
// }
|
|
149
|
-
// },
|
|
150
|
-
// [hmsInstance]
|
|
151
|
-
// );
|
|
152
|
-
|
|
96
|
+
const useHMSPeersUpdate = (meetingState, hmsInstance, updateLocalPeer, setPeerTrackNodes) => {
|
|
97
|
+
const dispatch = useDispatch();
|
|
98
|
+
const inMeeting = meetingState === MeetingState.IN_MEETING;
|
|
153
99
|
useEffect(() => {
|
|
154
100
|
const peerUpdateHandler = _ref => {
|
|
155
101
|
let {
|
|
156
102
|
peer,
|
|
157
103
|
type
|
|
158
104
|
} = _ref;
|
|
105
|
+
// Handle State from Preview screen
|
|
106
|
+
if (!inMeeting) {
|
|
107
|
+
if (type === HMSPeerUpdate.PEER_JOINED) {
|
|
108
|
+
dispatch(addToPreviewPeersList(peer));
|
|
109
|
+
} else if (type === HMSPeerUpdate.PEER_LEFT) {
|
|
110
|
+
dispatch(removeFromPreviewPeersList(peer));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Handle State for Meeting screen
|
|
159
115
|
if (type === HMSPeerUpdate.PEER_JOINED) {
|
|
160
116
|
return;
|
|
161
117
|
}
|
|
@@ -202,8 +158,9 @@ const useHMSPeersUpdate = (hmsInstance, updateLocalPeer, setPeerTrackNodes) => {
|
|
|
202
158
|
return () => {
|
|
203
159
|
hmsInstance.removeEventListener(HMSUpdateListenerActions.ON_PEER_UPDATE);
|
|
204
160
|
};
|
|
205
|
-
}, [hmsInstance]);
|
|
161
|
+
}, [inMeeting, hmsInstance]); // TODO: When `inMeeting` becomes true Peer Update is resubscribed, we might lose some events during that time
|
|
206
162
|
};
|
|
163
|
+
|
|
207
164
|
const useHMSTrackUpdate = (hmsInstance, updateLocalPeer, setPeerTrackNodes) => {
|
|
208
165
|
const dispatch = useDispatch();
|
|
209
166
|
useEffect(() => {
|