@100mslive/react-native-room-kit 1.0.1 → 1.0.2-beta.0

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.
Files changed (256) hide show
  1. package/lib/commonjs/HMSPrebuilt.js +16 -14
  2. package/lib/commonjs/HMSPrebuilt.js.map +1 -1
  3. package/lib/commonjs/HMSRoomSetup.js +85 -44
  4. package/lib/commonjs/HMSRoomSetup.js.map +1 -1
  5. package/lib/commonjs/Icons/Hand/assets/hand-off.png +0 -0
  6. package/lib/commonjs/Icons/Hand/assets/hand-off@2x.png +0 -0
  7. package/lib/commonjs/Icons/Hand/assets/hand-off@3x.png +0 -0
  8. package/lib/commonjs/Icons/Hand/index.js +2 -1
  9. package/lib/commonjs/Icons/Hand/index.js.map +1 -1
  10. package/lib/commonjs/Icons/Recording/assets/recording-off.png +0 -0
  11. package/lib/commonjs/Icons/Recording/assets/recording-off@2x.png +0 -0
  12. package/lib/commonjs/Icons/Recording/assets/recording-off@3x.png +0 -0
  13. package/lib/commonjs/Icons/Recording/index.js +2 -1
  14. package/lib/commonjs/Icons/Recording/index.js.map +1 -1
  15. package/lib/commonjs/components/DisplayView.js +3 -1
  16. package/lib/commonjs/components/DisplayView.js.map +1 -1
  17. package/lib/commonjs/components/EndRoomModal.js +29 -0
  18. package/lib/commonjs/components/EndRoomModal.js.map +1 -0
  19. package/lib/commonjs/components/EndRoomModalContent.js +9 -2
  20. package/lib/commonjs/components/EndRoomModalContent.js.map +1 -1
  21. package/lib/commonjs/components/Footer.js +9 -1
  22. package/lib/commonjs/components/Footer.js.map +1 -1
  23. package/lib/commonjs/components/HMSKeyboardAvoidingView.js +3 -18
  24. package/lib/commonjs/components/HMSKeyboardAvoidingView.js.map +1 -1
  25. package/lib/commonjs/components/HMSLocalScreenshareNotification.js +2 -2
  26. package/lib/commonjs/components/HMSLocalScreenshareNotification.js.map +1 -1
  27. package/lib/commonjs/components/HMSManageLeave.js +3 -178
  28. package/lib/commonjs/components/HMSManageLeave.js.map +1 -1
  29. package/lib/commonjs/components/HMSNotification.js +4 -3
  30. package/lib/commonjs/components/HMSNotification.js.map +1 -1
  31. package/lib/commonjs/components/HMSNotifications.js +32 -6
  32. package/lib/commonjs/components/HMSNotifications.js.map +1 -1
  33. package/lib/commonjs/components/HMSOverlayChatView.js +7 -1
  34. package/lib/commonjs/components/HMSOverlayChatView.js.map +1 -1
  35. package/lib/commonjs/components/HMSReconnectingNotification.js +33 -0
  36. package/lib/commonjs/components/HMSReconnectingNotification.js.map +1 -0
  37. package/lib/commonjs/components/HMSRecordingIndicator.js +1 -1
  38. package/lib/commonjs/components/HMSRecordingIndicator.js.map +1 -1
  39. package/lib/commonjs/components/HMSTerminalErrorNotification.js +66 -0
  40. package/lib/commonjs/components/HMSTerminalErrorNotification.js.map +1 -0
  41. package/lib/commonjs/components/LeaveRoomBottomSheet.js +175 -0
  42. package/lib/commonjs/components/LeaveRoomBottomSheet.js.map +1 -0
  43. package/lib/commonjs/components/Meeting.js +4 -0
  44. package/lib/commonjs/components/Meeting.js.map +1 -1
  45. package/lib/commonjs/components/MeetingScreenContent.js +3 -2
  46. package/lib/commonjs/components/MeetingScreenContent.js.map +1 -1
  47. package/lib/commonjs/components/PIPView.js +80 -15
  48. package/lib/commonjs/components/PIPView.js.map +1 -1
  49. package/lib/commonjs/components/Participants/ParticipantsItemOptions.js +23 -1
  50. package/lib/commonjs/components/Participants/ParticipantsItemOptions.js.map +1 -1
  51. package/lib/commonjs/components/PeerVideoTile/AvatarView.js +4 -4
  52. package/lib/commonjs/components/PeerVideoTile/PeerAudioIndicator.js +3 -1
  53. package/lib/commonjs/components/PeerVideoTile/PeerAudioIndicator.js.map +1 -1
  54. package/lib/commonjs/components/PeerVideoTile/PeerVideoTileView.js +1 -1
  55. package/lib/commonjs/components/PeerVideoTile/PeerVideoTileView.js.map +1 -1
  56. package/lib/commonjs/components/PreviewForRoleChangeModal.js +2 -2
  57. package/lib/commonjs/components/PreviewForRoleChangeModal.js.map +1 -1
  58. package/lib/commonjs/components/RoomSettingsModalContent.js +4 -7
  59. package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
  60. package/lib/commonjs/components/StopRecordingModalContent.js +4 -1
  61. package/lib/commonjs/components/StopRecordingModalContent.js.map +1 -1
  62. package/lib/commonjs/hooks-util.js +191 -27
  63. package/lib/commonjs/hooks-util.js.map +1 -1
  64. package/lib/commonjs/index.js +11 -0
  65. package/lib/commonjs/index.js.map +1 -1
  66. package/lib/commonjs/redux/actionTypes.js +6 -1
  67. package/lib/commonjs/redux/actionTypes.js.map +1 -1
  68. package/lib/commonjs/redux/actions/index.js +22 -1
  69. package/lib/commonjs/redux/actions/index.js.map +1 -1
  70. package/lib/commonjs/redux/reducers/appState.js +17 -1
  71. package/lib/commonjs/redux/reducers/appState.js.map +1 -1
  72. package/lib/commonjs/redux/reducers/userState.js +5 -1
  73. package/lib/commonjs/redux/reducers/userState.js.map +1 -1
  74. package/lib/commonjs/types.js +10 -1
  75. package/lib/commonjs/types.js.map +1 -1
  76. package/lib/commonjs/utils/types.js +11 -1
  77. package/lib/commonjs/utils/types.js.map +1 -1
  78. package/lib/commonjs/utils.js +1 -7
  79. package/lib/commonjs/utils.js.map +1 -1
  80. package/lib/module/HMSPrebuilt.js +16 -14
  81. package/lib/module/HMSPrebuilt.js.map +1 -1
  82. package/lib/module/HMSRoomSetup.js +81 -40
  83. package/lib/module/HMSRoomSetup.js.map +1 -1
  84. package/lib/module/Icons/Hand/assets/hand-off.png +0 -0
  85. package/lib/module/Icons/Hand/assets/hand-off@2x.png +0 -0
  86. package/lib/module/Icons/Hand/assets/hand-off@3x.png +0 -0
  87. package/lib/module/Icons/Hand/index.js +2 -1
  88. package/lib/module/Icons/Hand/index.js.map +1 -1
  89. package/lib/module/Icons/Recording/assets/recording-off.png +0 -0
  90. package/lib/module/Icons/Recording/assets/recording-off@2x.png +0 -0
  91. package/lib/module/Icons/Recording/assets/recording-off@3x.png +0 -0
  92. package/lib/module/Icons/Recording/index.js +2 -1
  93. package/lib/module/Icons/Recording/index.js.map +1 -1
  94. package/lib/module/components/DisplayView.js +3 -1
  95. package/lib/module/components/DisplayView.js.map +1 -1
  96. package/lib/module/components/EndRoomModal.js +20 -0
  97. package/lib/module/components/EndRoomModal.js.map +1 -0
  98. package/lib/module/components/EndRoomModalContent.js +9 -2
  99. package/lib/module/components/EndRoomModalContent.js.map +1 -1
  100. package/lib/module/components/Footer.js +9 -1
  101. package/lib/module/components/Footer.js.map +1 -1
  102. package/lib/module/components/HMSKeyboardAvoidingView.js +4 -19
  103. package/lib/module/components/HMSKeyboardAvoidingView.js.map +1 -1
  104. package/lib/module/components/HMSLocalScreenshareNotification.js +1 -1
  105. package/lib/module/components/HMSManageLeave.js +5 -181
  106. package/lib/module/components/HMSManageLeave.js.map +1 -1
  107. package/lib/module/components/HMSNotification.js +4 -3
  108. package/lib/module/components/HMSNotification.js.map +1 -1
  109. package/lib/module/components/HMSNotifications.js +28 -2
  110. package/lib/module/components/HMSNotifications.js.map +1 -1
  111. package/lib/module/components/HMSOverlayChatView.js +7 -1
  112. package/lib/module/components/HMSOverlayChatView.js.map +1 -1
  113. package/lib/module/components/HMSReconnectingNotification.js +24 -0
  114. package/lib/module/components/HMSReconnectingNotification.js.map +1 -0
  115. package/lib/module/components/HMSRecordingIndicator.js +1 -1
  116. package/lib/module/components/HMSRecordingIndicator.js.map +1 -1
  117. package/lib/module/components/HMSTerminalErrorNotification.js +57 -0
  118. package/lib/module/components/HMSTerminalErrorNotification.js.map +1 -0
  119. package/lib/module/components/LeaveRoomBottomSheet.js +167 -0
  120. package/lib/module/components/LeaveRoomBottomSheet.js.map +1 -0
  121. package/lib/module/components/Meeting.js +5 -1
  122. package/lib/module/components/Meeting.js.map +1 -1
  123. package/lib/module/components/MeetingScreenContent.js +3 -2
  124. package/lib/module/components/MeetingScreenContent.js.map +1 -1
  125. package/lib/module/components/PIPView.js +81 -16
  126. package/lib/module/components/PIPView.js.map +1 -1
  127. package/lib/module/components/Participants/ParticipantsItemOptions.js +24 -2
  128. package/lib/module/components/Participants/ParticipantsItemOptions.js.map +1 -1
  129. package/lib/module/components/PeerVideoTile/AvatarView.js +4 -4
  130. package/lib/module/components/PeerVideoTile/PeerAudioIndicator.js +3 -1
  131. package/lib/module/components/PeerVideoTile/PeerAudioIndicator.js.map +1 -1
  132. package/lib/module/components/PeerVideoTile/PeerVideoTileView.js +1 -1
  133. package/lib/module/components/PeerVideoTile/PeerVideoTileView.js.map +1 -1
  134. package/lib/module/components/PreviewForRoleChangeModal.js +1 -1
  135. package/lib/module/components/RoomSettingsModalContent.js +6 -9
  136. package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
  137. package/lib/module/components/StopRecordingModalContent.js +4 -1
  138. package/lib/module/components/StopRecordingModalContent.js.map +1 -1
  139. package/lib/module/hooks-util.js +182 -24
  140. package/lib/module/hooks-util.js.map +1 -1
  141. package/lib/module/index.js +1 -0
  142. package/lib/module/index.js.map +1 -1
  143. package/lib/module/redux/actionTypes.js +6 -1
  144. package/lib/module/redux/actionTypes.js.map +1 -1
  145. package/lib/module/redux/actions/index.js +18 -0
  146. package/lib/module/redux/actions/index.js.map +1 -1
  147. package/lib/module/redux/reducers/appState.js +17 -1
  148. package/lib/module/redux/reducers/appState.js.map +1 -1
  149. package/lib/module/redux/reducers/userState.js +5 -1
  150. package/lib/module/redux/reducers/userState.js.map +1 -1
  151. package/lib/module/types.js +9 -0
  152. package/lib/module/types.js.map +1 -1
  153. package/lib/module/utils/types.js +11 -0
  154. package/lib/module/utils/types.js.map +1 -1
  155. package/lib/module/utils.js +0 -6
  156. package/lib/module/utils.js.map +1 -1
  157. package/lib/typescript/HMSPrebuilt.d.ts +2 -16
  158. package/lib/typescript/HMSPrebuilt.d.ts.map +1 -1
  159. package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
  160. package/lib/typescript/Icons/Hand/index.d.ts +1 -0
  161. package/lib/typescript/Icons/Hand/index.d.ts.map +1 -1
  162. package/lib/typescript/Icons/Recording/index.d.ts +1 -0
  163. package/lib/typescript/Icons/Recording/index.d.ts.map +1 -1
  164. package/lib/typescript/components/DisplayView.d.ts.map +1 -1
  165. package/lib/typescript/components/EndRoomModal.d.ts +6 -0
  166. package/lib/typescript/components/EndRoomModal.d.ts.map +1 -0
  167. package/lib/typescript/components/EndRoomModalContent.d.ts.map +1 -1
  168. package/lib/typescript/components/Footer.d.ts +1 -0
  169. package/lib/typescript/components/Footer.d.ts.map +1 -1
  170. package/lib/typescript/components/HMSKeyboardAvoidingView.d.ts +1 -0
  171. package/lib/typescript/components/HMSKeyboardAvoidingView.d.ts.map +1 -1
  172. package/lib/typescript/components/HMSManageLeave.d.ts.map +1 -1
  173. package/lib/typescript/components/HMSNotification.d.ts +1 -0
  174. package/lib/typescript/components/HMSNotification.d.ts.map +1 -1
  175. package/lib/typescript/components/HMSNotifications.d.ts +1 -0
  176. package/lib/typescript/components/HMSNotifications.d.ts.map +1 -1
  177. package/lib/typescript/components/HMSOverlayChatView.d.ts.map +1 -1
  178. package/lib/typescript/components/HMSReconnectingNotification.d.ts +5 -0
  179. package/lib/typescript/components/HMSReconnectingNotification.d.ts.map +1 -0
  180. package/lib/typescript/components/HMSTerminalErrorNotification.d.ts +10 -0
  181. package/lib/typescript/components/HMSTerminalErrorNotification.d.ts.map +1 -0
  182. package/lib/typescript/components/LeaveRoomBottomSheet.d.ts +6 -0
  183. package/lib/typescript/components/LeaveRoomBottomSheet.d.ts.map +1 -0
  184. package/lib/typescript/components/Meeting.d.ts.map +1 -1
  185. package/lib/typescript/components/PIPView.d.ts.map +1 -1
  186. package/lib/typescript/components/Participants/ParticipantsItemOptions.d.ts.map +1 -1
  187. package/lib/typescript/components/PeerVideoTile/PeerAudioIndicator.d.ts.map +1 -1
  188. package/lib/typescript/components/PeerVideoTile/PeerVideoTileView.d.ts.map +1 -1
  189. package/lib/typescript/components/RoomSettingsModalContent.d.ts.map +1 -1
  190. package/lib/typescript/components/StopRecordingModalContent.d.ts.map +1 -1
  191. package/lib/typescript/hooks-util.d.ts +20 -7
  192. package/lib/typescript/hooks-util.d.ts.map +1 -1
  193. package/lib/typescript/index.d.ts +2 -0
  194. package/lib/typescript/index.d.ts.map +1 -1
  195. package/lib/typescript/redux/actionTypes.d.ts +3 -0
  196. package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
  197. package/lib/typescript/redux/actions/index.d.ts +23 -14
  198. package/lib/typescript/redux/actions/index.d.ts.map +1 -1
  199. package/lib/typescript/redux/index.d.ts +5 -7
  200. package/lib/typescript/redux/index.d.ts.map +1 -1
  201. package/lib/typescript/redux/reducers/appState.d.ts +4 -5
  202. package/lib/typescript/redux/reducers/appState.d.ts.map +1 -1
  203. package/lib/typescript/redux/reducers/index.d.ts +5 -7
  204. package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
  205. package/lib/typescript/redux/reducers/userState.d.ts +2 -2
  206. package/lib/typescript/redux/reducers/userState.d.ts.map +1 -1
  207. package/lib/typescript/types.d.ts +79 -0
  208. package/lib/typescript/types.d.ts.map +1 -1
  209. package/lib/typescript/utils/types.d.ts +24 -0
  210. package/lib/typescript/utils/types.d.ts.map +1 -1
  211. package/lib/typescript/utils.d.ts +0 -5
  212. package/lib/typescript/utils.d.ts.map +1 -1
  213. package/package.json +2 -2
  214. package/src/HMSPrebuilt.tsx +32 -23
  215. package/src/HMSRoomSetup.tsx +105 -53
  216. package/src/Icons/Hand/assets/hand-off.png +0 -0
  217. package/src/Icons/Hand/assets/hand-off@2x.png +0 -0
  218. package/src/Icons/Hand/assets/hand-off@3x.png +0 -0
  219. package/src/Icons/Hand/index.tsx +13 -3
  220. package/src/Icons/Recording/assets/recording-off.png +0 -0
  221. package/src/Icons/Recording/assets/recording-off@2x.png +0 -0
  222. package/src/Icons/Recording/assets/recording-off@3x.png +0 -0
  223. package/src/Icons/Recording/index.tsx +9 -2
  224. package/src/components/DisplayView.tsx +6 -0
  225. package/src/components/EndRoomModal.tsx +24 -0
  226. package/src/components/EndRoomModalContent.tsx +9 -2
  227. package/src/components/Footer.tsx +18 -2
  228. package/src/components/HMSKeyboardAvoidingView.tsx +5 -23
  229. package/src/components/HMSLocalScreenshareNotification.tsx +1 -1
  230. package/src/components/HMSManageLeave.tsx +4 -228
  231. package/src/components/HMSNotification.tsx +4 -2
  232. package/src/components/HMSNotifications.tsx +41 -7
  233. package/src/components/HMSOverlayChatView.tsx +6 -1
  234. package/src/components/HMSReconnectingNotification.tsx +27 -0
  235. package/src/components/HMSRecordingIndicator.tsx +1 -1
  236. package/src/components/HMSTerminalErrorNotification.tsx +70 -0
  237. package/src/components/LeaveRoomBottomSheet.tsx +199 -0
  238. package/src/components/Meeting.tsx +7 -0
  239. package/src/components/MeetingScreenContent.tsx +2 -2
  240. package/src/components/PIPView.tsx +113 -25
  241. package/src/components/Participants/ParticipantsItemOptions.tsx +26 -4
  242. package/src/components/PeerVideoTile/AvatarView.tsx +4 -4
  243. package/src/components/PeerVideoTile/PeerAudioIndicator.tsx +6 -1
  244. package/src/components/PeerVideoTile/PeerVideoTileView.tsx +4 -2
  245. package/src/components/PreviewForRoleChangeModal.tsx +1 -1
  246. package/src/components/RoomSettingsModalContent.tsx +5 -9
  247. package/src/components/StopRecordingModalContent.tsx +3 -1
  248. package/src/hooks-util.ts +240 -23
  249. package/src/index.ts +2 -0
  250. package/src/redux/actionTypes.ts +7 -0
  251. package/src/redux/actions/index.ts +19 -7
  252. package/src/redux/reducers/appState.ts +18 -1
  253. package/src/redux/reducers/userState.ts +7 -3
  254. package/src/types.ts +71 -0
  255. package/src/utils/types.ts +27 -0
  256. package/src/utils.ts +0 -6
@@ -0,0 +1,199 @@
1
+ import * as React from 'react';
2
+ import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
3
+ import { useSelector } from 'react-redux';
4
+
5
+ import { LeaveIcon } from '../Icons';
6
+ import { useHMSRoomStyleSheet, useLeaveMethods, useModalType } from '../hooks-util';
7
+ import type { RootState } from '../redux';
8
+ import { BottomSheet } from './BottomSheet';
9
+ import { StopIcon } from '../Icons';
10
+ import { ModalTypes, OnLeaveReason } from '../utils/types';
11
+
12
+ // const HEADER_CONTENT_HEIGHT = 24 + 8 + 8 + 2; // ICON_SIZE + TOP_PADDING + BOTTOM_PADDING + TOP&BOTTOM_BORDER_WIDTH
13
+ // const HEADER_HEIGHT = 8 + HEADER_CONTENT_HEIGHT + 8; // TOP_HEADER_PADDING + HEADER_CONTENT_HEIGHT + BOTTOM_HEADER_PADDING
14
+
15
+ interface LeaveRoomBottomSheetProps {}
16
+
17
+ export const LeaveRoomBottomSheet: React.FC<LeaveRoomBottomSheetProps> = () => {
18
+ const canEndRoom = useSelector(
19
+ (state: RootState) => state.hmsStates.localPeer?.role?.permissions?.endRoom
20
+ );
21
+ const canStream = useSelector(
22
+ (state: RootState) =>
23
+ state.hmsStates.localPeer?.role?.permissions?.hlsStreaming
24
+ );
25
+
26
+ const isStreaming = useSelector(
27
+ (state: RootState) =>
28
+ state.hmsStates.room?.hlsStreamingState?.running ?? false
29
+ );
30
+
31
+ const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
32
+ text: {
33
+ color: theme.palette.on_surface_high,
34
+ fontFamily: `${typography.font_family}-SemiBold`,
35
+ },
36
+ subtext: {
37
+ color: theme.palette.on_surface_low,
38
+ fontFamily: `${typography.font_family}-Regular`,
39
+ },
40
+ endButton: {
41
+ backgroundColor: theme.palette.alert_error_dim,
42
+ },
43
+ endText: {
44
+ color: theme.palette.alert_error_brighter,
45
+ fontFamily: `${typography.font_family}-SemiBold`,
46
+ },
47
+ endSubtext: {
48
+ color: theme.palette.alert_error_bright,
49
+ fontFamily: `${typography.font_family}-Regular`,
50
+ },
51
+ endIcon: {
52
+ tintColor: theme.palette.alert_error_brighter,
53
+ },
54
+ }));
55
+
56
+ const leavePopCloseAction = React.useRef(ModalTypes.DEFAULT);
57
+
58
+ const { modalVisibleType, handleModalVisibleType } = useModalType();
59
+
60
+ const { leave } = useLeaveMethods();
61
+
62
+ /**
63
+ * Closes the Leave Popup Menu
64
+ * No action is taken when the popup is hidden
65
+ */
66
+ const onPopupDismiss = () => {
67
+ leavePopCloseAction.current = ModalTypes.DEFAULT;
68
+ handleModalVisibleType(ModalTypes.DEFAULT);
69
+ };
70
+
71
+ /**
72
+ * Closes the Leave Popup Menu
73
+ * Leave Modal will open after the popup is hidden
74
+ */
75
+ const onLeavePress = async () => {
76
+ leavePopCloseAction.current = ModalTypes.DEFAULT;
77
+ handleModalVisibleType(ModalTypes.DEFAULT);
78
+ await leave(OnLeaveReason.LEAVE);
79
+ };
80
+
81
+ /**
82
+ * Closes the Leave Popup Menu
83
+ * End Session Modal will open after the popup is hidden
84
+ */
85
+ const onEndSessionPress = async () => {
86
+ leavePopCloseAction.current = ModalTypes.END_ROOM;
87
+ handleModalVisibleType(ModalTypes.DEFAULT);
88
+ };
89
+
90
+ const onEndStreamPress = async () => {
91
+ leavePopCloseAction.current = ModalTypes.END_ROOM;
92
+ handleModalVisibleType(ModalTypes.DEFAULT);
93
+ };
94
+
95
+ /**
96
+ * Handles action to take when the leave popup is hidden
97
+ */
98
+ const handlePopupHide = () => {
99
+ if (leavePopCloseAction.current !== ModalTypes.DEFAULT) {
100
+ handleModalVisibleType(leavePopCloseAction.current);
101
+ }
102
+ };
103
+
104
+ return (
105
+ <BottomSheet
106
+ isVisible={modalVisibleType === ModalTypes.LEAVE_ROOM}
107
+ containerStyle={styles.container}
108
+ dismissModal={onPopupDismiss}
109
+ onModalHide={handlePopupHide}
110
+ animationOutTiming={700}
111
+ >
112
+ <View>
113
+ <TouchableOpacity
114
+ style={styles.button}
115
+ onPress={onLeavePress}
116
+ >
117
+ <LeaveIcon style={styles.icon} />
118
+
119
+ <View style={styles.textContainer}>
120
+ <Text style={[styles.text, hmsRoomStyles.text]}>
121
+ Leave
122
+ </Text>
123
+ <Text style={[styles.subtext, hmsRoomStyles.subtext]}>
124
+ Others will continue after you leave. You can join the session
125
+ again.
126
+ </Text>
127
+ </View>
128
+ </TouchableOpacity>
129
+
130
+ {canStream && isStreaming ? (
131
+ <TouchableOpacity
132
+ style={[styles.button, hmsRoomStyles.endButton]}
133
+ onPress={onEndStreamPress}
134
+ >
135
+ <StopIcon style={[styles.icon, hmsRoomStyles.endIcon]} />
136
+
137
+ <View style={styles.textContainer}>
138
+ <Text style={[styles.text, hmsRoomStyles.endText]}>
139
+ End Stream
140
+ </Text>
141
+ <Text
142
+ style={[styles.subtext, hmsRoomStyles.endSubtext]}
143
+ >
144
+ The stream will end for everyone after they’ve watched it.
145
+ </Text>
146
+ </View>
147
+ </TouchableOpacity>
148
+ ) : canEndRoom ? (
149
+ <TouchableOpacity
150
+ style={[styles.button, hmsRoomStyles.endButton]}
151
+ onPress={onEndSessionPress}
152
+ >
153
+ <StopIcon style={[styles.icon, hmsRoomStyles.endIcon]} />
154
+
155
+ <View style={styles.textContainer}>
156
+ <Text style={[styles.text, hmsRoomStyles.endText]}>
157
+ End Session
158
+ </Text>
159
+ <Text
160
+ style={[styles.subtext, hmsRoomStyles.endSubtext]}
161
+ >
162
+ The session will end for everyone in the room immediately.
163
+ </Text>
164
+ </View>
165
+ </TouchableOpacity>
166
+ ) : null}
167
+ </View>
168
+ </BottomSheet>
169
+ );
170
+ };
171
+
172
+ const styles = StyleSheet.create({
173
+ container: {
174
+ paddingBottom: 0,
175
+ },
176
+ button: {
177
+ flexDirection: 'row',
178
+ padding: 24,
179
+ },
180
+ icon: {
181
+ width: 24,
182
+ height: 24,
183
+ marginRight: 16,
184
+ },
185
+ textContainer: {
186
+ flex: 1,
187
+ },
188
+ text: {
189
+ fontSize: 20,
190
+ lineHeight: 24,
191
+ letterSpacing: 0.15,
192
+ },
193
+ subtext: {
194
+ fontSize: 14,
195
+ lineHeight: 20,
196
+ letterSpacing: 0.25,
197
+ marginTop: 4,
198
+ },
199
+ });
@@ -7,6 +7,8 @@ import type { PeerTrackNode } from '../utils/types';
7
7
  import { useRTCStatsListeners } from '../utils/hooks';
8
8
  import {
9
9
  clearPendingModalTasks,
10
+ useAutoPip,
11
+ useBackButtonPress,
10
12
  useFetchHMSRoles,
11
13
  useHMSMessages,
12
14
  useHMSNetworkQualityUpdate,
@@ -54,6 +56,11 @@ export const Meeting: React.FC<MeetingProps> = ({ peerTrackNodes }) => {
54
56
  // Subscribe to Peers Network quality updates
55
57
  useHMSNetworkQualityUpdate();
56
58
 
59
+ useAutoPip(peerTrackNodes.length === 1);
60
+
61
+ // Handle Back button press and show leave room modal
62
+ useBackButtonPress();
63
+
57
64
  // Clearing any pending modal opening tasks
58
65
  React.useEffect(() => {
59
66
  return () => {
@@ -20,7 +20,7 @@ import { HMSStatusBar } from './StatusBar';
20
20
  import { AnimatedFooter } from './AnimatedFooter';
21
21
  import { HLSFooter } from './HLSFooter';
22
22
  import { AnimatedHeader } from './AnimatedHeader';
23
- import { ReconnectionView } from './ReconnectionView';
23
+ // import { ReconnectionView } from './ReconnectionView';
24
24
 
25
25
  interface MeetingScreenContentProps {
26
26
  peerTrackNodes: Array<PeerTrackNode>;
@@ -98,7 +98,7 @@ export const MeetingScreenContent: React.FC<MeetingScreenContentProps> = ({
98
98
 
99
99
  <DisplayView offset={offset} peerTrackNodes={peerTrackNodes} />
100
100
 
101
- <ReconnectionView />
101
+ {/* <ReconnectionView /> */}
102
102
  </View>
103
103
 
104
104
  {isPipModeActive ? null : isHLSViewer ? (
@@ -1,9 +1,11 @@
1
1
  import * as React from 'react';
2
- import { useSelector } from 'react-redux';
2
+ import { shallowEqual, useSelector } from 'react-redux';
3
+ import { View } from 'react-native';
3
4
 
4
5
  import type { PeerTrackNode } from '../utils/types';
5
6
  import { PeerVideoTileView } from './PeerVideoTile/PeerVideoTileView';
6
7
  import type { RootState } from '../redux';
8
+ import { COLORS } from '../utils/theme';
7
9
 
8
10
  type PIPViewProps = {
9
11
  peerTrackNodes: PeerTrackNode[];
@@ -11,41 +13,127 @@ type PIPViewProps = {
11
13
  };
12
14
 
13
15
  const PIPView: React.FC<PIPViewProps> = ({ peerTrackNodes, customView }) => {
14
- const memoDominantSpeakerIdRef = React.useRef<string | null>(null);
15
-
16
- const dominantSpeakerId = useSelector((state: RootState) => {
17
- const dominantSpeaker = state.hmsStates.activeSpeakers[0];
18
-
19
- return dominantSpeaker?.peer.peerID ?? null;
20
- });
21
-
22
- if (dominantSpeakerId) {
23
- memoDominantSpeakerIdRef.current = dominantSpeakerId;
24
- }
16
+ const firstSSNode = useSelector(
17
+ (state: RootState) => state.app.screensharePeerTrackNodes[0]
18
+ );
25
19
 
26
20
  if (customView) {
27
21
  return customView;
28
22
  }
29
23
 
30
- const firstPeerTrackNode = peerTrackNodes[0];
24
+ if (firstSSNode) {
25
+ return (
26
+ <PeerVideoTileView key={firstSSNode.id} peerTrackNode={firstSSNode} />
27
+ );
28
+ }
29
+
30
+ return <PIPPeerTiles peerTrackNodes={peerTrackNodes} />;
31
+ };
32
+
33
+ export default PIPView;
34
+
35
+ type PIPPeerTilesProps = {
36
+ peerTrackNodes: PeerTrackNode[];
37
+ };
38
+
39
+ const PIPPeerTiles: React.FC<PIPPeerTilesProps> = ({ peerTrackNodes }) => {
40
+ const memoDominantSpeakerIdsRef = React.useRef<string[]>([]);
41
+
42
+ const dominantSpeakerIds = useSelector((state: RootState) => {
43
+ return state.hmsStates.activeSpeakers
44
+ .slice(0, 3)
45
+ .map((speaker) => speaker.peer.peerID);
46
+ }, shallowEqual);
47
+
48
+ if (
49
+ dominantSpeakerIds.length > 0 &&
50
+ anyNewDominantSpeaker(memoDominantSpeakerIdsRef.current, dominantSpeakerIds)
51
+ ) {
52
+ memoDominantSpeakerIdsRef.current = dominantSpeakerIds;
53
+ }
31
54
 
32
- const preferedPeerTrack =
33
- (memoDominantSpeakerIdRef.current
34
- ? peerTrackNodes.find(
35
- (node) => node.peer.peerID === memoDominantSpeakerIdRef.current
36
- )
37
- : firstPeerTrackNode) ?? firstPeerTrackNode;
55
+ const preferredPeerTrackNodes = React.useMemo(() => {
56
+ return getDominantSpeakers(
57
+ memoDominantSpeakerIdsRef.current,
58
+ peerTrackNodes
59
+ );
60
+ }, [memoDominantSpeakerIdsRef.current, peerTrackNodes]);
38
61
 
39
- if (!preferedPeerTrack) {
62
+ if (preferredPeerTrackNodes.length === 0) {
40
63
  return null;
41
64
  }
42
65
 
43
66
  return (
44
- <PeerVideoTileView
45
- key={preferedPeerTrack.id}
46
- peerTrackNode={preferedPeerTrack}
47
- />
67
+ <View
68
+ style={{
69
+ flex: 1,
70
+ flexDirection: 'row',
71
+ backgroundColor: COLORS.BLACK,
72
+ }}
73
+ >
74
+ {preferredPeerTrackNodes.map((node, index, arr) => {
75
+ const isFirst = index === 0;
76
+ const dividerWidth = arr.length > 2 ? 4 : 5;
77
+
78
+ return (
79
+ <React.Fragment key={node.id}>
80
+ {isFirst ? null : (
81
+ <View style={{ height: '100%', width: dividerWidth }} />
82
+ )}
83
+
84
+ <View style={{ flex: 1 }}>
85
+ <PeerVideoTileView peerTrackNode={node} />
86
+ </View>
87
+ </React.Fragment>
88
+ );
89
+ })}
90
+ </View>
48
91
  );
49
92
  };
50
93
 
51
- export default PIPView;
94
+ function anyNewDominantSpeaker(
95
+ oldSpeakers: string[],
96
+ newSpeakers: string[]
97
+ ): boolean {
98
+ if (newSpeakers.length !== oldSpeakers.length) {
99
+ return true;
100
+ }
101
+
102
+ const uniques = new Set([...oldSpeakers, ...newSpeakers]);
103
+
104
+ return uniques.size > oldSpeakers.length;
105
+ }
106
+
107
+ function getDominantSpeakers(
108
+ dominantSpeakerIds: string[],
109
+ peerTrackNodes: PeerTrackNode[]
110
+ ): PeerTrackNode[] {
111
+ if (peerTrackNodes.length <= 3) {
112
+ return peerTrackNodes;
113
+ }
114
+
115
+ const list = peerTrackNodes.slice(0, 3);
116
+
117
+ let dominantSpeakerIdsCopy = dominantSpeakerIds.slice();
118
+
119
+ for (let i = 3; i < peerTrackNodes.length; i++) {
120
+ const peerTrackNode = peerTrackNodes[i];
121
+
122
+ if (dominantSpeakerIdsCopy.length <= 0 || !peerTrackNode) {
123
+ break;
124
+ }
125
+
126
+ if (dominantSpeakerIdsCopy.includes(peerTrackNode.peer.peerID)) {
127
+ dominantSpeakerIdsCopy = dominantSpeakerIdsCopy.filter(
128
+ (speakerId) => speakerId !== peerTrackNode.peer.peerID
129
+ );
130
+ list.unshift(peerTrackNode);
131
+ }
132
+ }
133
+
134
+ if (list.length > 3) {
135
+ list.length = 3;
136
+ }
137
+
138
+ return list;
139
+ }
@@ -8,7 +8,7 @@ import {
8
8
  useHMSLayoutConfig,
9
9
  useHMSRoomStyleSheet,
10
10
  } from '../../hooks-util';
11
- import { CameraIcon, MicIcon, PersonIcon } from '../../Icons';
11
+ import { CameraIcon, HandIcon, MicIcon, PersonIcon } from '../../Icons';
12
12
  import { ParticipantsItemOption } from './ParticipantsItemOption';
13
13
  import type { RootState } from '../../redux';
14
14
  import { selectCanPublishTrackForRole } from '../../hooks-sdk-selectors';
@@ -88,6 +88,18 @@ const _ParticipantsItemOptions: React.FC<ParticipantsItemOptionsProps> = ({
88
88
  onItemPress();
89
89
  };
90
90
 
91
+ const handleLowerHandPress = () => {
92
+ if (peer.isHandRaised) {
93
+ hmsInstance
94
+ .lowerRemotePeerHand(peer)
95
+ .then((d) => console.log('Lower Remote Peer hand Success: ', d))
96
+ .catch((e) => console.log('Lower Remote Peer hand Error: ', e));
97
+ } else {
98
+ console.warn(`peer.isHandRaised = ${peer.isHandRaised} | peer's hand is not raised`);
99
+ }
100
+ onItemPress();
101
+ };
102
+
91
103
  const handleAudioTogglePress = () => {
92
104
  if (peer.audioTrack) {
93
105
  hmsInstance
@@ -157,10 +169,10 @@ const _ParticipantsItemOptions: React.FC<ParticipantsItemOptionsProps> = ({
157
169
  peer.videoTrack?.isMute();
158
170
 
159
171
  const showBringOnStageOptions =
160
- insideHandRaiseGroup &&
161
172
  offStageRoles &&
162
- offStageRoles.includes(peer.role?.name || '') &&
163
- peer.isHandRaised;
173
+ offStageRoles.includes(peer.role?.name || '');
174
+
175
+ const showLowerHandOption = peer.isHandRaised;
164
176
 
165
177
  return (
166
178
  <>
@@ -175,6 +187,16 @@ const _ParticipantsItemOptions: React.FC<ParticipantsItemOptionsProps> = ({
175
187
  isActive: false,
176
188
  hide: !showBringOnStageOptions,
177
189
  },
190
+ {
191
+ id: 'lower-hand',
192
+ icon: (
193
+ <HandIcon type="off" style={{ width: 20, height: 20 }} />
194
+ ),
195
+ label: 'Lower Hand',
196
+ pressHandler: handleLowerHandPress,
197
+ isActive: false,
198
+ hide: !showLowerHandOption,
199
+ },
178
200
  {
179
201
  id: 'mute-audio',
180
202
  icon: <MicIcon muted={true} style={{ width: 20, height: 20 }} />,
@@ -93,9 +93,9 @@ const styles = StyleSheet.create({
93
93
  alignItems: 'center',
94
94
  },
95
95
  insetAvatar: {
96
- width: 64,
96
+ width: 44,
97
97
  aspectRatio: 1,
98
- borderRadius: 44,
98
+ borderRadius: 22,
99
99
  justifyContent: 'center',
100
100
  alignItems: 'center',
101
101
  },
@@ -109,8 +109,8 @@ const styles = StyleSheet.create({
109
109
  letterSpacing: 0.25,
110
110
  },
111
111
  insetText: {
112
- fontSize: 24,
113
- lineHeight: 32,
112
+ fontSize: 18,
113
+ lineHeight: 24,
114
114
  },
115
115
  });
116
116
 
@@ -7,6 +7,7 @@ import LottieView from 'lottie-react-native';
7
7
  import { MicIcon } from '../../Icons';
8
8
  import { useHMSRoomStyleSheet } from '../../hooks-util';
9
9
  import type { RootState } from '../../redux';
10
+ import { PipModes } from '../../utils/types';
10
11
 
11
12
  export interface PeerAudioIndicatorProps {
12
13
  peer: HMSPeer;
@@ -24,6 +25,10 @@ export const PeerAudioIndicator: React.FC<PeerAudioIndicatorProps> = ({
24
25
  ) >= 0
25
26
  );
26
27
 
28
+ const isPipModeActive = useSelector(
29
+ (state: RootState) => state.app.pipModeStatus === PipModes.ACTIVE
30
+ );
31
+
27
32
  const hmsRoomStyles = useHMSRoomStyleSheet((theme) => ({
28
33
  iconWrapper: {
29
34
  backgroundColor: theme.palette.secondary_dim,
@@ -41,7 +46,7 @@ export const PeerAudioIndicator: React.FC<PeerAudioIndicatorProps> = ({
41
46
  );
42
47
  }
43
48
 
44
- if (activeSpeaker) {
49
+ if (activeSpeaker && !isPipModeActive) {
45
50
  return (
46
51
  <View style={[styles.speakerIconWrapper, hmsRoomStyles.iconWrapper]}>
47
52
  <LottieView
@@ -177,13 +177,15 @@ export const _PeerVideoTileView = React.forwardRef<
177
177
 
178
178
  {/* Handling Peer Audio Mute indicator */}
179
179
  {screenShareTile && showingVideoTrack ? (
180
- <HMSFullScreenButton peerTrackNode={peerTrackNode} />
180
+ isPipModeActive ? null : (
181
+ <HMSFullScreenButton peerTrackNode={peerTrackNode} />
182
+ )
181
183
  ) : peerCanPublishAudio ? (
182
184
  <PeerAudioIndicator isMuted={peer.audioTrack?.isMute()} peer={peer} />
183
185
  ) : null}
184
186
 
185
187
  {/* Handling showing Peer name */}
186
- {(insetMode || isPipModeActive) ? null : (
188
+ {insetMode || isPipModeActive ? null : (
187
189
  <PeerNameAndNetwork
188
190
  name={peer.name}
189
191
  isLocal={peer.isLocal}
@@ -17,7 +17,7 @@ import {
17
17
  import { setRoleChangeRequest } from '../redux/actions';
18
18
  import { useHMSActions } from '../hooks-sdk';
19
19
  import { parseMetadata } from '../utils/functions';
20
- import { NotificationTypes } from '../utils';
20
+ import { NotificationTypes } from '../types';
21
21
  import { Header } from './Header';
22
22
  import { selectCanPublishTrackForRole } from '../hooks-sdk-selectors';
23
23
  import { HMSPrimaryButton } from './HMSPrimaryButton';
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Text, TouchableOpacity } from 'react-native';
3
3
  import type { HMSAudioMixingMode } from '@100mslive/react-native-hms';
4
- import { useDispatch, useSelector } from 'react-redux';
4
+ import { useSelector } from 'react-redux';
5
5
 
6
6
  import type { RootState } from '../redux';
7
7
  import { ModalTypes } from '../utils/types';
@@ -17,14 +17,13 @@ import {
17
17
  import { BottomSheet, useBottomSheetActions } from './BottomSheet';
18
18
  import {
19
19
  isPublishingAllowed,
20
- useHMSInstance,
21
20
  useHMSLayoutConfig,
22
21
  useHMSRoomStyleSheet,
23
22
  useShowChatAndParticipants,
23
+ useStartRecording,
24
24
  } from '../hooks-util';
25
25
  import { useCanPublishScreen, useHMSActions } from '../hooks-sdk';
26
26
  import { RoomSettingsModalDebugModeContent } from './RoomSettingsModalDebugModeContent';
27
- import { setStartingOrStoppingRecording } from '../redux/actions';
28
27
  import { ParticipantsCount } from './ParticipantsCount';
29
28
  import { selectAllowedTracksToPublish } from '../hooks-sdk-selectors';
30
29
 
@@ -45,8 +44,6 @@ export const RoomSettingsModalContent: React.FC<
45
44
  > = (props) => {
46
45
  const { closeRoomSettingsModal, setModalVisible } = props;
47
46
 
48
- const dispatch = useDispatch();
49
- const hmsInstance = useHMSInstance();
50
47
  const debugMode = useSelector((state: RootState) => state.user.debugMode);
51
48
 
52
49
  const hmsActions = useHMSActions();
@@ -134,6 +131,8 @@ export const RoomSettingsModalContent: React.FC<
134
131
  (state: RootState) => !!state.hmsStates.room?.browserRecordingState?.running
135
132
  );
136
133
 
134
+ const { startRecording } = useStartRecording();
135
+
137
136
  const handleRecordingTogglePress = () => {
138
137
  if (isRecordingOn) {
139
138
  registerOnModalHideAction(() => {
@@ -141,10 +140,7 @@ export const RoomSettingsModalContent: React.FC<
141
140
  });
142
141
  closeRoomSettingsModal();
143
142
  } else {
144
- dispatch(setStartingOrStoppingRecording(true));
145
- hmsInstance
146
- .startRTMPOrRecording({ record: true })
147
- .catch(() => dispatch(setStartingOrStoppingRecording(false)));
143
+ startRecording();
148
144
  closeRoomSettingsModal();
149
145
  }
150
146
  };
@@ -18,7 +18,9 @@ export const StopRecordingModalContent: React.FC<
18
18
  const dispatch = useDispatch();
19
19
  const hmsInstance = useHMSInstance();
20
20
  const startingOrStoppingRecording = useSelector(
21
- (state: RootState) => state.app.startingOrStoppingRecording
21
+ (state: RootState) =>
22
+ state.app.startingOrStoppingRecording ||
23
+ (state.hmsStates.room?.browserRecordingState.initialising ?? false)
22
24
  );
23
25
 
24
26
  const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({