@100mslive/react-native-room-kit 1.1.6 → 1.1.7

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 (222) hide show
  1. package/lib/commonjs/Icons/Pause/assets/pause-med.png +0 -0
  2. package/lib/commonjs/Icons/Pause/assets/pause-med@2x.png +0 -0
  3. package/lib/commonjs/Icons/Pause/assets/pause-med@3x.png +0 -0
  4. package/lib/commonjs/Icons/Pause/index.js +35 -0
  5. package/lib/commonjs/Icons/Pause/index.js.map +1 -0
  6. package/lib/commonjs/Icons/Play/assets/play-med.png +0 -0
  7. package/lib/commonjs/Icons/Play/assets/play-med@2x.png +0 -0
  8. package/lib/commonjs/Icons/Play/assets/play-med@3x.png +0 -0
  9. package/lib/commonjs/Icons/Play/index.js +35 -0
  10. package/lib/commonjs/Icons/Play/index.js.map +1 -0
  11. package/lib/commonjs/Icons/SeekArrow/assets/seek-backward-arrow.png +0 -0
  12. package/lib/commonjs/Icons/SeekArrow/assets/seek-backward-arrow@2x.png +0 -0
  13. package/lib/commonjs/Icons/SeekArrow/assets/seek-backward-arrow@3x.png +0 -0
  14. package/lib/commonjs/Icons/SeekArrow/assets/seek-forward-arrow.png +0 -0
  15. package/lib/commonjs/Icons/SeekArrow/assets/seek-forward-arrow@2x.png +0 -0
  16. package/lib/commonjs/Icons/SeekArrow/assets/seek-forward-arrow@3x.png +0 -0
  17. package/lib/commonjs/Icons/SeekArrow/index.js +34 -0
  18. package/lib/commonjs/Icons/SeekArrow/index.js.map +1 -0
  19. package/lib/commonjs/Icons/index.js +33 -0
  20. package/lib/commonjs/Icons/index.js.map +1 -1
  21. package/lib/commonjs/components/HLSChatMessages.js +4 -5
  22. package/lib/commonjs/components/HLSChatMessages.js.map +1 -1
  23. package/lib/commonjs/components/HLSCloseMeetingControl.js +41 -0
  24. package/lib/commonjs/components/HLSCloseMeetingControl.js.map +1 -0
  25. package/lib/commonjs/components/HLSClosedCaptionControl.js +109 -0
  26. package/lib/commonjs/components/HLSClosedCaptionControl.js.map +1 -0
  27. package/lib/commonjs/components/HLSDistanceFromLive.js +56 -0
  28. package/lib/commonjs/components/HLSDistanceFromLive.js.map +1 -0
  29. package/lib/commonjs/components/HLSFullScreenControl.js +42 -0
  30. package/lib/commonjs/components/HLSFullScreenControl.js.map +1 -0
  31. package/lib/commonjs/components/HLSGoLiveControl.js +78 -0
  32. package/lib/commonjs/components/HLSGoLiveControl.js.map +1 -0
  33. package/lib/commonjs/components/HLSPlayPauseControl.js +62 -0
  34. package/lib/commonjs/components/HLSPlayPauseControl.js.map +1 -0
  35. package/lib/commonjs/components/HLSPlayer.js +82 -81
  36. package/lib/commonjs/components/HLSPlayer.js.map +1 -1
  37. package/lib/commonjs/components/HLSPlayerContainer.js +62 -3
  38. package/lib/commonjs/components/HLSPlayerContainer.js.map +1 -1
  39. package/lib/commonjs/components/HLSPlayerControls.js +89 -46
  40. package/lib/commonjs/components/HLSPlayerControls.js.map +1 -1
  41. package/lib/commonjs/components/HLSSeekbackwardControl.js +67 -0
  42. package/lib/commonjs/components/HLSSeekbackwardControl.js.map +1 -0
  43. package/lib/commonjs/components/HLSSeekbar.js +285 -0
  44. package/lib/commonjs/components/HLSSeekbar.js.map +1 -0
  45. package/lib/commonjs/components/HLSSeekforwardControl.js +71 -0
  46. package/lib/commonjs/components/HLSSeekforwardControl.js.map +1 -0
  47. package/lib/commonjs/components/HMSHLSMessage.js +19 -41
  48. package/lib/commonjs/components/HMSHLSMessage.js.map +1 -1
  49. package/lib/commonjs/components/HMSHLSMessageList.js +2 -2
  50. package/lib/commonjs/components/HMSHLSMessageList.js.map +1 -1
  51. package/lib/commonjs/components/HMSOverlayMessageView.js +150 -0
  52. package/lib/commonjs/components/HMSOverlayMessageView.js.map +1 -0
  53. package/lib/commonjs/components/Participants/ParticipantsList.js +4 -4
  54. package/lib/commonjs/components/Participants/ParticipantsList.js.map +1 -1
  55. package/lib/commonjs/hooks-util.js +30 -2
  56. package/lib/commonjs/hooks-util.js.map +1 -1
  57. package/lib/commonjs/redux/actionTypes.js +2 -0
  58. package/lib/commonjs/redux/actionTypes.js.map +1 -1
  59. package/lib/commonjs/redux/actions/index.js +10 -3
  60. package/lib/commonjs/redux/actions/index.js.map +1 -1
  61. package/lib/commonjs/redux/reducers/appState.js +9 -1
  62. package/lib/commonjs/redux/reducers/appState.js.map +1 -1
  63. package/lib/module/Icons/Pause/assets/pause-med.png +0 -0
  64. package/lib/module/Icons/Pause/assets/pause-med@2x.png +0 -0
  65. package/lib/module/Icons/Pause/assets/pause-med@3x.png +0 -0
  66. package/lib/module/Icons/Pause/index.js +27 -0
  67. package/lib/module/Icons/Pause/index.js.map +1 -0
  68. package/lib/module/Icons/Play/assets/play-med.png +0 -0
  69. package/lib/module/Icons/Play/assets/play-med@2x.png +0 -0
  70. package/lib/module/Icons/Play/assets/play-med@3x.png +0 -0
  71. package/lib/module/Icons/Play/index.js +27 -0
  72. package/lib/module/Icons/Play/index.js.map +1 -0
  73. package/lib/module/Icons/SeekArrow/assets/seek-backward-arrow.png +0 -0
  74. package/lib/module/Icons/SeekArrow/assets/seek-backward-arrow@2x.png +0 -0
  75. package/lib/module/Icons/SeekArrow/assets/seek-backward-arrow@3x.png +0 -0
  76. package/lib/module/Icons/SeekArrow/assets/seek-forward-arrow.png +0 -0
  77. package/lib/module/Icons/SeekArrow/assets/seek-forward-arrow@2x.png +0 -0
  78. package/lib/module/Icons/SeekArrow/assets/seek-forward-arrow@3x.png +0 -0
  79. package/lib/module/Icons/SeekArrow/index.js +26 -0
  80. package/lib/module/Icons/SeekArrow/index.js.map +1 -0
  81. package/lib/module/Icons/index.js +3 -0
  82. package/lib/module/Icons/index.js.map +1 -1
  83. package/lib/module/components/HLSChatMessages.js +5 -6
  84. package/lib/module/components/HLSChatMessages.js.map +1 -1
  85. package/lib/module/components/HLSCloseMeetingControl.js +33 -0
  86. package/lib/module/components/HLSCloseMeetingControl.js.map +1 -0
  87. package/lib/module/components/HLSClosedCaptionControl.js +100 -0
  88. package/lib/module/components/HLSClosedCaptionControl.js.map +1 -0
  89. package/lib/module/components/HLSDistanceFromLive.js +48 -0
  90. package/lib/module/components/HLSDistanceFromLive.js.map +1 -0
  91. package/lib/module/components/HLSFullScreenControl.js +34 -0
  92. package/lib/module/components/HLSFullScreenControl.js.map +1 -0
  93. package/lib/module/components/HLSGoLiveControl.js +70 -0
  94. package/lib/module/components/HLSGoLiveControl.js.map +1 -0
  95. package/lib/module/components/HLSPlayPauseControl.js +54 -0
  96. package/lib/module/components/HLSPlayPauseControl.js.map +1 -0
  97. package/lib/module/components/HLSPlayer.js +83 -81
  98. package/lib/module/components/HLSPlayer.js.map +1 -1
  99. package/lib/module/components/HLSPlayerContainer.js +62 -3
  100. package/lib/module/components/HLSPlayerContainer.js.map +1 -1
  101. package/lib/module/components/HLSPlayerControls.js +89 -50
  102. package/lib/module/components/HLSPlayerControls.js.map +1 -1
  103. package/lib/module/components/HLSSeekbackwardControl.js +59 -0
  104. package/lib/module/components/HLSSeekbackwardControl.js.map +1 -0
  105. package/lib/module/components/HLSSeekbar.js +276 -0
  106. package/lib/module/components/HLSSeekbar.js.map +1 -0
  107. package/lib/module/components/HLSSeekforwardControl.js +63 -0
  108. package/lib/module/components/HLSSeekforwardControl.js.map +1 -0
  109. package/lib/module/components/HMSHLSMessage.js +19 -41
  110. package/lib/module/components/HMSHLSMessage.js.map +1 -1
  111. package/lib/module/components/HMSHLSMessageList.js +2 -2
  112. package/lib/module/components/HMSHLSMessageList.js.map +1 -1
  113. package/lib/module/components/HMSOverlayMessageView.js +142 -0
  114. package/lib/module/components/HMSOverlayMessageView.js.map +1 -0
  115. package/lib/module/components/Participants/ParticipantsList.js +4 -4
  116. package/lib/module/components/Participants/ParticipantsList.js.map +1 -1
  117. package/lib/module/hooks-util.js +30 -3
  118. package/lib/module/hooks-util.js.map +1 -1
  119. package/lib/module/redux/actionTypes.js +2 -0
  120. package/lib/module/redux/actionTypes.js.map +1 -1
  121. package/lib/module/redux/actions/index.js +6 -0
  122. package/lib/module/redux/actions/index.js.map +1 -1
  123. package/lib/module/redux/reducers/appState.js +9 -1
  124. package/lib/module/redux/reducers/appState.js.map +1 -1
  125. package/lib/typescript/Icons/Pause/index.d.ts +8 -0
  126. package/lib/typescript/Icons/Pause/index.d.ts.map +1 -0
  127. package/lib/typescript/Icons/Play/index.d.ts +8 -0
  128. package/lib/typescript/Icons/Play/index.d.ts.map +1 -0
  129. package/lib/typescript/Icons/SeekArrow/index.d.ts +8 -0
  130. package/lib/typescript/Icons/SeekArrow/index.d.ts.map +1 -0
  131. package/lib/typescript/Icons/index.d.ts +3 -0
  132. package/lib/typescript/Icons/index.d.ts.map +1 -1
  133. package/lib/typescript/components/CustomButton.d.ts +5 -5
  134. package/lib/typescript/components/CustomButton.d.ts.map +1 -1
  135. package/lib/typescript/components/HLSChatMessages.d.ts.map +1 -1
  136. package/lib/typescript/components/HLSCloseMeetingControl.d.ts +8 -0
  137. package/lib/typescript/components/HLSCloseMeetingControl.d.ts.map +1 -0
  138. package/lib/typescript/components/HLSClosedCaptionControl.d.ts +10 -0
  139. package/lib/typescript/components/HLSClosedCaptionControl.d.ts.map +1 -0
  140. package/lib/typescript/components/HLSDistanceFromLive.d.ts +8 -0
  141. package/lib/typescript/components/HLSDistanceFromLive.d.ts.map +1 -0
  142. package/lib/typescript/components/HLSFullScreenControl.d.ts +8 -0
  143. package/lib/typescript/components/HLSFullScreenControl.d.ts.map +1 -0
  144. package/lib/typescript/components/HLSGoLiveControl.d.ts +10 -0
  145. package/lib/typescript/components/HLSGoLiveControl.d.ts.map +1 -0
  146. package/lib/typescript/components/HLSPlayPauseControl.d.ts +8 -0
  147. package/lib/typescript/components/HLSPlayPauseControl.d.ts.map +1 -0
  148. package/lib/typescript/components/HLSPlayer.d.ts +4 -2
  149. package/lib/typescript/components/HLSPlayer.d.ts.map +1 -1
  150. package/lib/typescript/components/HLSPlayerContainer.d.ts.map +1 -1
  151. package/lib/typescript/components/HLSPlayerControls.d.ts +12 -2
  152. package/lib/typescript/components/HLSPlayerControls.d.ts.map +1 -1
  153. package/lib/typescript/components/HLSSeekbackwardControl.d.ts +8 -0
  154. package/lib/typescript/components/HLSSeekbackwardControl.d.ts.map +1 -0
  155. package/lib/typescript/components/HLSSeekbar.d.ts +66 -0
  156. package/lib/typescript/components/HLSSeekbar.d.ts.map +1 -0
  157. package/lib/typescript/components/HLSSeekforwardControl.d.ts +8 -0
  158. package/lib/typescript/components/HLSSeekforwardControl.d.ts.map +1 -0
  159. package/lib/typescript/components/HMSHLSMessage.d.ts.map +1 -1
  160. package/lib/typescript/components/HMSOverlayMessageView.d.ts +8 -0
  161. package/lib/typescript/components/HMSOverlayMessageView.d.ts.map +1 -0
  162. package/lib/typescript/components/Modals.d.ts +3 -3
  163. package/lib/typescript/components/Modals.d.ts.map +1 -1
  164. package/lib/typescript/components/Participants/ParticipantsList.d.ts.map +1 -1
  165. package/lib/typescript/components/Preview.d.ts.map +1 -1
  166. package/lib/typescript/hooks-util.d.ts +12 -7
  167. package/lib/typescript/hooks-util.d.ts.map +1 -1
  168. package/lib/typescript/redux/actionTypes.d.ts +1 -0
  169. package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
  170. package/lib/typescript/redux/actions/index.d.ts +6 -0
  171. package/lib/typescript/redux/actions/index.d.ts.map +1 -1
  172. package/lib/typescript/redux/index.d.ts +17 -16
  173. package/lib/typescript/redux/index.d.ts.map +1 -1
  174. package/lib/typescript/redux/reducers/appState.d.ts +1 -0
  175. package/lib/typescript/redux/reducers/appState.d.ts.map +1 -1
  176. package/lib/typescript/redux/reducers/index.d.ts +17 -16
  177. package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
  178. package/package.json +2 -2
  179. package/src/Icons/Pause/assets/pause-med.png +0 -0
  180. package/src/Icons/Pause/assets/pause-med@2x.png +0 -0
  181. package/src/Icons/Pause/assets/pause-med@3x.png +0 -0
  182. package/src/Icons/Pause/index.tsx +36 -0
  183. package/src/Icons/Play/assets/play-med.png +0 -0
  184. package/src/Icons/Play/assets/play-med@2x.png +0 -0
  185. package/src/Icons/Play/assets/play-med@3x.png +0 -0
  186. package/src/Icons/Play/index.tsx +36 -0
  187. package/src/Icons/SeekArrow/assets/seek-backward-arrow.png +0 -0
  188. package/src/Icons/SeekArrow/assets/seek-backward-arrow@2x.png +0 -0
  189. package/src/Icons/SeekArrow/assets/seek-backward-arrow@3x.png +0 -0
  190. package/src/Icons/SeekArrow/assets/seek-forward-arrow.png +0 -0
  191. package/src/Icons/SeekArrow/assets/seek-forward-arrow@2x.png +0 -0
  192. package/src/Icons/SeekArrow/assets/seek-forward-arrow@3x.png +0 -0
  193. package/src/Icons/SeekArrow/index.tsx +40 -0
  194. package/src/Icons/index.ts +3 -0
  195. package/src/components/HLSChatMessages.tsx +4 -6
  196. package/src/components/HLSCloseMeetingControl.tsx +39 -0
  197. package/src/components/HLSClosedCaptionControl.tsx +140 -0
  198. package/src/components/HLSDistanceFromLive.tsx +69 -0
  199. package/src/components/HLSFullScreenControl.tsx +46 -0
  200. package/src/components/HLSGoLiveControl.tsx +104 -0
  201. package/src/components/HLSPlayPauseControl.tsx +69 -0
  202. package/src/components/HLSPlayer.tsx +98 -88
  203. package/src/components/HLSPlayerContainer.tsx +81 -14
  204. package/src/components/HLSPlayerControls.tsx +137 -58
  205. package/src/components/HLSSeekbackwardControl.tsx +88 -0
  206. package/src/components/HLSSeekbar.tsx +381 -0
  207. package/src/components/HLSSeekforwardControl.tsx +97 -0
  208. package/src/components/HMSHLSMessage.tsx +32 -49
  209. package/src/components/HMSHLSMessageList.tsx +2 -2
  210. package/src/components/HMSOverlayMessageView.tsx +189 -0
  211. package/src/components/Participants/ParticipantsList.tsx +12 -10
  212. package/src/hooks-util.ts +39 -1
  213. package/src/redux/actionTypes.ts +3 -0
  214. package/src/redux/actions/index.ts +5 -0
  215. package/src/redux/reducers/appState.ts +8 -0
  216. package/lib/commonjs/components/CustomHLSPlayerControls.js +0 -80
  217. package/lib/commonjs/components/CustomHLSPlayerControls.js.map +0 -1
  218. package/lib/module/components/CustomHLSPlayerControls.js +0 -72
  219. package/lib/module/components/CustomHLSPlayerControls.js.map +0 -1
  220. package/lib/typescript/components/CustomHLSPlayerControls.d.ts +0 -7
  221. package/lib/typescript/components/CustomHLSPlayerControls.d.ts.map +0 -1
  222. package/src/components/CustomHLSPlayerControls.tsx +0 -92
@@ -1,29 +1,96 @@
1
1
  import React from 'react';
2
2
  import { View, StyleSheet } from 'react-native';
3
+ import type { HMSHLSPlayer } from '@100mslive/react-native-hms';
4
+ import { Gesture, GestureDetector } from 'react-native-gesture-handler';
5
+ import {
6
+ Easing,
7
+ cancelAnimation,
8
+ useSharedValue,
9
+ withDelay,
10
+ withTiming,
11
+ } from 'react-native-reanimated';
3
12
 
4
13
  import { useHLSViewsConstraints } from '../hooks-util';
5
14
  import { HLSPlayer } from './HLSPlayer';
6
15
  import { HLSPlayerControls } from './HLSPlayerControls';
7
16
 
8
17
  export const _HLSPlayerContainer: React.FC = () => {
9
- // const hlsPlayerRef = useRef(null);
18
+ const hlsPlayerRef =
19
+ React.useRef<React.ElementRef<typeof HMSHLSPlayer>>(null);
10
20
  const { playerWrapperConstraints } = useHLSViewsConstraints();
11
21
 
22
+ const animatedValue = useSharedValue(1);
23
+
24
+ const cancelCurrentControlAnimation = React.useCallback(() => {
25
+ 'worklet';
26
+ cancelAnimation(animatedValue);
27
+ }, []);
28
+
29
+ const hideControlsAfterDelay = React.useCallback((duration = 500) => {
30
+ 'worklet';
31
+ animatedValue.value = withDelay(
32
+ 5000,
33
+ withTiming(0, { duration, easing: Easing.ease })
34
+ );
35
+ }, []);
36
+
37
+ const resetHideControlAnimation = React.useCallback(() => {
38
+ cancelCurrentControlAnimation();
39
+ hideControlsAfterDelay();
40
+ }, [cancelCurrentControlAnimation, hideControlsAfterDelay]);
41
+
42
+ const hideControls = React.useCallback((duration = 500) => {
43
+ 'worklet';
44
+ animatedValue.value = withTiming(0, { duration, easing: Easing.ease });
45
+ }, []);
46
+
47
+ React.useEffect(() => {
48
+ resetHideControlAnimation();
49
+ }, [resetHideControlAnimation]);
50
+
51
+ const tapGesture = React.useMemo(() => {
52
+ return Gesture.Tap().onStart(() => {
53
+ cancelCurrentControlAnimation();
54
+ if (animatedValue.value < 1) {
55
+ animatedValue.value = withTiming(
56
+ 1,
57
+ { duration: 200, easing: Easing.ease },
58
+ (finished) => {
59
+ if (finished) {
60
+ hideControlsAfterDelay();
61
+ }
62
+ }
63
+ );
64
+ } else {
65
+ hideControls(200);
66
+ }
67
+ });
68
+ }, [cancelCurrentControlAnimation, hideControls, hideControlsAfterDelay]);
69
+
12
70
  return (
13
- <View
14
- style={[
15
- styles.hlsPlayerContainer,
16
- {
17
- backgroundColor: 'black',
18
- width: playerWrapperConstraints.width,
19
- height: playerWrapperConstraints.height,
20
- },
21
- ]}
22
- >
23
- <HLSPlayer />
71
+ <GestureDetector gesture={tapGesture}>
72
+ <View
73
+ collapsable={false}
74
+ style={[
75
+ styles.hlsPlayerContainer,
76
+ {
77
+ backgroundColor: 'black',
78
+ width: playerWrapperConstraints.width,
79
+ height: playerWrapperConstraints.height,
80
+ },
81
+ ]}
82
+ >
83
+ <HLSPlayer ref={hlsPlayerRef} />
24
84
 
25
- <HLSPlayerControls />
26
- </View>
85
+ <HLSPlayerControls
86
+ playerRef={hlsPlayerRef}
87
+ animatedValue={animatedValue}
88
+ cancelCurrentControlAnimation={cancelCurrentControlAnimation}
89
+ hideControlsAfterDelay={hideControlsAfterDelay}
90
+ resetHideControlAnimation={resetHideControlAnimation}
91
+ />
92
+ </View>
93
+ </GestureDetector>
27
94
  );
28
95
  };
29
96
 
@@ -1,85 +1,164 @@
1
1
  import React from 'react';
2
- import { View, StyleSheet, TouchableOpacity } from 'react-native';
3
- import { useDispatch, useSelector } from 'react-redux';
2
+ import { View, StyleSheet } from 'react-native';
3
+ import type { ViewProps, ViewStyle } from 'react-native';
4
+ import { useSelector } from 'react-redux';
5
+ import Animated, {
6
+ useAnimatedProps,
7
+ useAnimatedStyle,
8
+ } from 'react-native-reanimated';
9
+ import type { SharedValue } from 'react-native-reanimated';
10
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
11
+ import type { HMSHLSPlayer } from '@100mslive/react-native-hms';
4
12
 
5
- import {
6
- // CCIcon,
7
- CloseIcon,
8
- MaximizeIcon,
9
- MinimizeIcon,
10
- } from '../Icons';
11
- import { ModalTypes } from '../utils/types';
12
- import { useModalType } from '../hooks-util';
13
13
  import type { RootState } from '../redux';
14
- import { setHlsFullScreen } from '../redux/actions';
14
+ import { HLSGoLiveControl } from './HLSGoLiveControl';
15
+ import { HLSSeekbar } from './HLSSeekbar';
16
+ import { useIsLandscapeOrientation } from '../utils/dimension';
17
+ import { HLSCloseMeetingControl } from './HLSCloseMeetingControl';
18
+ import { HLSClosedCaptionControl } from './HLSClosedCaptionControl';
19
+ import { HLSFullScreenControl } from './HLSFullScreenControl';
20
+ import { HLSDistanceFromLive } from './HLSDistanceFromLive';
21
+ import { HLSPlayPauseControl } from './HLSPlayPauseControl';
22
+ import { HLSSeekbackwardControl } from './HLSSeekbackwardControl';
23
+ import { HLSSeekforwardControl } from './HLSSeekforwardControl';
15
24
 
16
- export const _HLSPlayerControls: React.FC = () => {
17
- // const isHLSStreaming = useIsHLSStreamingOn();
18
- // const isStreamUrlPresent = useSelector(
19
- // (state: RootState) =>
20
- // !!state.hmsStates.room?.hlsStreamingState.variants?.[0]?.hlsStreamUrl
21
- // );
22
- const dispatch = useDispatch();
25
+ interface HLSPlayerControlsProps {
26
+ playerRef: React.RefObject<React.ElementRef<typeof HMSHLSPlayer>>;
27
+ cancelCurrentControlAnimation: () => void;
28
+ hideControlsAfterDelay: () => void;
29
+ resetHideControlAnimation: () => void;
30
+ animatedValue: SharedValue<number>;
31
+ }
32
+
33
+ export const _HLSPlayerControls: React.FC<HLSPlayerControlsProps> = ({
34
+ playerRef,
35
+ cancelCurrentControlAnimation,
36
+ hideControlsAfterDelay,
37
+ animatedValue,
38
+ resetHideControlAnimation,
39
+ }) => {
40
+ const { bottom: bottomSafeInset } = useSafeAreaInsets();
41
+ const isLandscapeOrientation = useIsLandscapeOrientation();
23
42
  const hlsFullScreen = useSelector(
24
43
  (state: RootState) => state.app.hlsFullScreen
25
44
  );
26
- const { handleModalVisibleType } = useModalType();
27
-
28
- const handleCloseBtnPress = () => {
29
- handleModalVisibleType(ModalTypes.LEAVE_ROOM);
30
- };
31
45
 
32
- // const handleCCBtnPress = () => {
33
- // //
34
- // };
46
+ const hideControlsStyles: ViewStyle = useAnimatedStyle(
47
+ () => ({
48
+ opacity: animatedValue.value,
49
+ }),
50
+ []
51
+ );
35
52
 
36
- const toggleFullScreen = () => {
37
- dispatch(setHlsFullScreen(!hlsFullScreen));
38
- };
53
+ const hideControlsProps: ViewProps = useAnimatedProps(
54
+ () => ({
55
+ pointerEvents: animatedValue.value < 0.8 ? 'none' : 'auto',
56
+ }),
57
+ []
58
+ );
39
59
 
40
60
  return (
41
- <View style={styles.container}>
42
- <View style={styles.controlsRow}>
43
- <TouchableOpacity onPress={handleCloseBtnPress} style={styles.icon}>
44
- <CloseIcon size="medium" />
45
- </TouchableOpacity>
61
+ <React.Fragment>
62
+ {/* Play/Pause Controls */}
63
+ <Animated.View
64
+ animatedProps={hideControlsProps}
65
+ style={[
66
+ { height: '100%' },
67
+ styles.floatingContainer,
68
+ hideControlsStyles,
69
+ ]}
70
+ >
71
+ <View
72
+ style={{
73
+ flex: 1,
74
+ flexDirection: 'row',
75
+ alignItems: 'center',
76
+ justifyContent: 'center',
77
+ }}
78
+ >
79
+ <HLSSeekbackwardControl
80
+ playerRef={playerRef}
81
+ onPress={resetHideControlAnimation}
82
+ />
83
+
84
+ <HLSPlayPauseControl
85
+ playerRef={playerRef}
86
+ onPress={resetHideControlAnimation}
87
+ />
46
88
 
47
- {/* <View style={[styles.normalRow, styles.gap]}>
48
- <TouchableOpacity
49
- onPress={handleCCBtnPress}
50
- style={[styles.icon, styles.gap]}
51
- >
52
- <CCIcon size="medium" enabled={true} />
53
- </TouchableOpacity>
54
- </View> */}
55
- </View>
89
+ <HLSSeekforwardControl
90
+ playerRef={playerRef}
91
+ onPress={resetHideControlAnimation}
92
+ />
93
+ </View>
94
+ </Animated.View>
56
95
 
57
- <View style={styles.controlsRow}>
58
- <View />
96
+ {/* Header Controls */}
97
+ <Animated.View
98
+ animatedProps={hideControlsProps}
99
+ style={[{ top: 0 }, styles.floatingContainer, hideControlsStyles]}
100
+ >
101
+ <View style={styles.controlsRow}>
102
+ <HLSCloseMeetingControl onPress={resetHideControlAnimation} />
59
103
 
60
- <View style={[styles.normalRow, styles.gap]}>
61
- <TouchableOpacity onPress={toggleFullScreen} style={styles.icon}>
62
- {hlsFullScreen ? (
63
- <MinimizeIcon size="medium" />
64
- ) : (
65
- <MaximizeIcon size="medium" />
66
- )}
67
- </TouchableOpacity>
104
+ <View style={[styles.normalRow, styles.gap]}>
105
+ <HLSClosedCaptionControl
106
+ playerRef={playerRef}
107
+ onPress={resetHideControlAnimation}
108
+ />
109
+ </View>
68
110
  </View>
69
- </View>
70
- </View>
111
+ </Animated.View>
112
+
113
+ {/* Footer Controls */}
114
+ <Animated.View
115
+ animatedProps={hideControlsProps}
116
+ style={[
117
+ { bottom: isLandscapeOrientation ? bottomSafeInset : 0 },
118
+ styles.floatingContainer,
119
+ hideControlsStyles,
120
+ ]}
121
+ >
122
+ <View
123
+ style={{
124
+ flexDirection:
125
+ isLandscapeOrientation || hlsFullScreen
126
+ ? 'column-reverse'
127
+ : 'column',
128
+ }}
129
+ >
130
+ <View style={styles.controlsRow}>
131
+ <View style={styles.normalRow}>
132
+ <HLSGoLiveControl
133
+ playerRef={playerRef}
134
+ onPress={resetHideControlAnimation}
135
+ />
136
+ <HLSDistanceFromLive />
137
+ </View>
138
+
139
+ <View style={[styles.normalRow, styles.gap]}>
140
+ <HLSFullScreenControl onPress={resetHideControlAnimation} />
141
+ </View>
142
+ </View>
143
+
144
+ <HLSSeekbar
145
+ playerRef={playerRef}
146
+ onStart={cancelCurrentControlAnimation}
147
+ onEnd={hideControlsAfterDelay}
148
+ />
149
+ </View>
150
+ </Animated.View>
151
+ </React.Fragment>
71
152
  );
72
153
  };
73
154
 
74
155
  export const HLSPlayerControls = React.memo(_HLSPlayerControls);
75
156
 
76
157
  const styles = StyleSheet.create({
77
- container: {
158
+ floatingContainer: {
78
159
  position: 'absolute',
79
160
  width: '100%',
80
- height: '100%',
81
161
  zIndex: 5,
82
- justifyContent: 'space-between',
83
162
  },
84
163
  controlsRow: {
85
164
  flexDirection: 'row',
@@ -0,0 +1,88 @@
1
+ import { HMSHLSPlaylistType } from '@100mslive/react-native-hms';
2
+ import type { HMSHLSPlayer } from '@100mslive/react-native-hms';
3
+ import * as React from 'react';
4
+ import { useSelector } from 'react-redux';
5
+ import { GestureDetector, Gesture } from 'react-native-gesture-handler';
6
+
7
+ import { useIsHLSStreamingOn } from '../hooks-sdk';
8
+ import type { RootState } from '../redux';
9
+ import { SeekArrowIcon } from '../Icons';
10
+ import Animated, {
11
+ Easing,
12
+ cancelAnimation,
13
+ interpolate,
14
+ runOnJS,
15
+ useAnimatedStyle,
16
+ useSharedValue,
17
+ withTiming,
18
+ } from 'react-native-reanimated';
19
+
20
+ export interface HLSSeekbackwardControlProps {
21
+ playerRef: React.RefObject<React.ElementRef<typeof HMSHLSPlayer>>;
22
+ onPress?: () => void;
23
+ }
24
+
25
+ const _HLSSeekbackwardControl: React.FC<HLSSeekbackwardControlProps> = ({
26
+ playerRef,
27
+ onPress,
28
+ }) => {
29
+ const animatedValue = useSharedValue(0);
30
+ const isHLSStreamingOn = useIsHLSStreamingOn();
31
+ const isDVRStream = useSelector((state: RootState) => {
32
+ return (
33
+ state.hmsStates.room?.hlsStreamingState.variants?.[0]?.playlistType ===
34
+ HMSHLSPlaylistType.DVR
35
+ );
36
+ });
37
+
38
+ const handdleSeekBackward = () => {
39
+ onPress?.();
40
+ playerRef.current?.seekBackward(10);
41
+ };
42
+
43
+ const tapGestureHandler = React.useMemo(() => {
44
+ return Gesture.Tap().onStart(() => {
45
+ cancelAnimation(animatedValue);
46
+ animatedValue.value = withTiming(
47
+ 1,
48
+ { duration: 200, easing: Easing.ease },
49
+ (finished) => {
50
+ if (finished) {
51
+ animatedValue.value = withTiming(0, {
52
+ duration: 100,
53
+ easing: Easing.ease,
54
+ });
55
+ }
56
+ }
57
+ );
58
+ runOnJS(handdleSeekBackward)();
59
+ });
60
+ }, []);
61
+
62
+ const animatedStyle = useAnimatedStyle(
63
+ () => ({
64
+ opacity: interpolate(animatedValue.value, [0, 1], [1, 0.8]),
65
+ transform: [
66
+ {
67
+ rotateZ: `${interpolate(animatedValue.value, [0, 1], [0, -17])} deg`,
68
+ },
69
+ ],
70
+ }),
71
+ []
72
+ );
73
+
74
+ if (!isHLSStreamingOn || !isDVRStream) return null;
75
+
76
+ return (
77
+ <GestureDetector gesture={tapGestureHandler}>
78
+ <Animated.View
79
+ collapsable={false}
80
+ style={[{ marginRight: 24 }, animatedStyle]}
81
+ >
82
+ <SeekArrowIcon type="backward" />
83
+ </Animated.View>
84
+ </GestureDetector>
85
+ );
86
+ };
87
+
88
+ export const HLSSeekbackwardControl = React.memo(_HLSSeekbackwardControl);