@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.
- package/lib/commonjs/Icons/Pause/assets/pause-med.png +0 -0
- package/lib/commonjs/Icons/Pause/assets/pause-med@2x.png +0 -0
- package/lib/commonjs/Icons/Pause/assets/pause-med@3x.png +0 -0
- package/lib/commonjs/Icons/Pause/index.js +35 -0
- package/lib/commonjs/Icons/Pause/index.js.map +1 -0
- package/lib/commonjs/Icons/Play/assets/play-med.png +0 -0
- package/lib/commonjs/Icons/Play/assets/play-med@2x.png +0 -0
- package/lib/commonjs/Icons/Play/assets/play-med@3x.png +0 -0
- package/lib/commonjs/Icons/Play/index.js +35 -0
- package/lib/commonjs/Icons/Play/index.js.map +1 -0
- package/lib/commonjs/Icons/SeekArrow/assets/seek-backward-arrow.png +0 -0
- package/lib/commonjs/Icons/SeekArrow/assets/seek-backward-arrow@2x.png +0 -0
- package/lib/commonjs/Icons/SeekArrow/assets/seek-backward-arrow@3x.png +0 -0
- package/lib/commonjs/Icons/SeekArrow/assets/seek-forward-arrow.png +0 -0
- package/lib/commonjs/Icons/SeekArrow/assets/seek-forward-arrow@2x.png +0 -0
- package/lib/commonjs/Icons/SeekArrow/assets/seek-forward-arrow@3x.png +0 -0
- package/lib/commonjs/Icons/SeekArrow/index.js +34 -0
- package/lib/commonjs/Icons/SeekArrow/index.js.map +1 -0
- package/lib/commonjs/Icons/index.js +33 -0
- package/lib/commonjs/Icons/index.js.map +1 -1
- package/lib/commonjs/components/HLSChatMessages.js +4 -5
- package/lib/commonjs/components/HLSChatMessages.js.map +1 -1
- package/lib/commonjs/components/HLSCloseMeetingControl.js +41 -0
- package/lib/commonjs/components/HLSCloseMeetingControl.js.map +1 -0
- package/lib/commonjs/components/HLSClosedCaptionControl.js +109 -0
- package/lib/commonjs/components/HLSClosedCaptionControl.js.map +1 -0
- package/lib/commonjs/components/HLSDistanceFromLive.js +56 -0
- package/lib/commonjs/components/HLSDistanceFromLive.js.map +1 -0
- package/lib/commonjs/components/HLSFullScreenControl.js +42 -0
- package/lib/commonjs/components/HLSFullScreenControl.js.map +1 -0
- package/lib/commonjs/components/HLSGoLiveControl.js +78 -0
- package/lib/commonjs/components/HLSGoLiveControl.js.map +1 -0
- package/lib/commonjs/components/HLSPlayPauseControl.js +62 -0
- package/lib/commonjs/components/HLSPlayPauseControl.js.map +1 -0
- package/lib/commonjs/components/HLSPlayer.js +82 -81
- package/lib/commonjs/components/HLSPlayer.js.map +1 -1
- package/lib/commonjs/components/HLSPlayerContainer.js +62 -3
- package/lib/commonjs/components/HLSPlayerContainer.js.map +1 -1
- package/lib/commonjs/components/HLSPlayerControls.js +89 -46
- package/lib/commonjs/components/HLSPlayerControls.js.map +1 -1
- package/lib/commonjs/components/HLSSeekbackwardControl.js +67 -0
- package/lib/commonjs/components/HLSSeekbackwardControl.js.map +1 -0
- package/lib/commonjs/components/HLSSeekbar.js +285 -0
- package/lib/commonjs/components/HLSSeekbar.js.map +1 -0
- package/lib/commonjs/components/HLSSeekforwardControl.js +71 -0
- package/lib/commonjs/components/HLSSeekforwardControl.js.map +1 -0
- package/lib/commonjs/components/HMSHLSMessage.js +19 -41
- package/lib/commonjs/components/HMSHLSMessage.js.map +1 -1
- package/lib/commonjs/components/HMSHLSMessageList.js +2 -2
- package/lib/commonjs/components/HMSHLSMessageList.js.map +1 -1
- package/lib/commonjs/components/HMSOverlayMessageView.js +150 -0
- package/lib/commonjs/components/HMSOverlayMessageView.js.map +1 -0
- package/lib/commonjs/components/Participants/ParticipantsList.js +4 -4
- package/lib/commonjs/components/Participants/ParticipantsList.js.map +1 -1
- package/lib/commonjs/hooks-util.js +30 -2
- 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 +10 -3
- package/lib/commonjs/redux/actions/index.js.map +1 -1
- package/lib/commonjs/redux/reducers/appState.js +9 -1
- package/lib/commonjs/redux/reducers/appState.js.map +1 -1
- package/lib/module/Icons/Pause/assets/pause-med.png +0 -0
- package/lib/module/Icons/Pause/assets/pause-med@2x.png +0 -0
- package/lib/module/Icons/Pause/assets/pause-med@3x.png +0 -0
- package/lib/module/Icons/Pause/index.js +27 -0
- package/lib/module/Icons/Pause/index.js.map +1 -0
- package/lib/module/Icons/Play/assets/play-med.png +0 -0
- package/lib/module/Icons/Play/assets/play-med@2x.png +0 -0
- package/lib/module/Icons/Play/assets/play-med@3x.png +0 -0
- package/lib/module/Icons/Play/index.js +27 -0
- package/lib/module/Icons/Play/index.js.map +1 -0
- package/lib/module/Icons/SeekArrow/assets/seek-backward-arrow.png +0 -0
- package/lib/module/Icons/SeekArrow/assets/seek-backward-arrow@2x.png +0 -0
- package/lib/module/Icons/SeekArrow/assets/seek-backward-arrow@3x.png +0 -0
- package/lib/module/Icons/SeekArrow/assets/seek-forward-arrow.png +0 -0
- package/lib/module/Icons/SeekArrow/assets/seek-forward-arrow@2x.png +0 -0
- package/lib/module/Icons/SeekArrow/assets/seek-forward-arrow@3x.png +0 -0
- package/lib/module/Icons/SeekArrow/index.js +26 -0
- package/lib/module/Icons/SeekArrow/index.js.map +1 -0
- package/lib/module/Icons/index.js +3 -0
- package/lib/module/Icons/index.js.map +1 -1
- package/lib/module/components/HLSChatMessages.js +5 -6
- package/lib/module/components/HLSChatMessages.js.map +1 -1
- package/lib/module/components/HLSCloseMeetingControl.js +33 -0
- package/lib/module/components/HLSCloseMeetingControl.js.map +1 -0
- package/lib/module/components/HLSClosedCaptionControl.js +100 -0
- package/lib/module/components/HLSClosedCaptionControl.js.map +1 -0
- package/lib/module/components/HLSDistanceFromLive.js +48 -0
- package/lib/module/components/HLSDistanceFromLive.js.map +1 -0
- package/lib/module/components/HLSFullScreenControl.js +34 -0
- package/lib/module/components/HLSFullScreenControl.js.map +1 -0
- package/lib/module/components/HLSGoLiveControl.js +70 -0
- package/lib/module/components/HLSGoLiveControl.js.map +1 -0
- package/lib/module/components/HLSPlayPauseControl.js +54 -0
- package/lib/module/components/HLSPlayPauseControl.js.map +1 -0
- package/lib/module/components/HLSPlayer.js +83 -81
- package/lib/module/components/HLSPlayer.js.map +1 -1
- package/lib/module/components/HLSPlayerContainer.js +62 -3
- package/lib/module/components/HLSPlayerContainer.js.map +1 -1
- package/lib/module/components/HLSPlayerControls.js +89 -50
- package/lib/module/components/HLSPlayerControls.js.map +1 -1
- package/lib/module/components/HLSSeekbackwardControl.js +59 -0
- package/lib/module/components/HLSSeekbackwardControl.js.map +1 -0
- package/lib/module/components/HLSSeekbar.js +276 -0
- package/lib/module/components/HLSSeekbar.js.map +1 -0
- package/lib/module/components/HLSSeekforwardControl.js +63 -0
- package/lib/module/components/HLSSeekforwardControl.js.map +1 -0
- package/lib/module/components/HMSHLSMessage.js +19 -41
- package/lib/module/components/HMSHLSMessage.js.map +1 -1
- package/lib/module/components/HMSHLSMessageList.js +2 -2
- package/lib/module/components/HMSHLSMessageList.js.map +1 -1
- package/lib/module/components/HMSOverlayMessageView.js +142 -0
- package/lib/module/components/HMSOverlayMessageView.js.map +1 -0
- package/lib/module/components/Participants/ParticipantsList.js +4 -4
- package/lib/module/components/Participants/ParticipantsList.js.map +1 -1
- package/lib/module/hooks-util.js +30 -3
- 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 +6 -0
- package/lib/module/redux/actions/index.js.map +1 -1
- package/lib/module/redux/reducers/appState.js +9 -1
- package/lib/module/redux/reducers/appState.js.map +1 -1
- package/lib/typescript/Icons/Pause/index.d.ts +8 -0
- package/lib/typescript/Icons/Pause/index.d.ts.map +1 -0
- package/lib/typescript/Icons/Play/index.d.ts +8 -0
- package/lib/typescript/Icons/Play/index.d.ts.map +1 -0
- package/lib/typescript/Icons/SeekArrow/index.d.ts +8 -0
- package/lib/typescript/Icons/SeekArrow/index.d.ts.map +1 -0
- package/lib/typescript/Icons/index.d.ts +3 -0
- package/lib/typescript/Icons/index.d.ts.map +1 -1
- package/lib/typescript/components/CustomButton.d.ts +5 -5
- package/lib/typescript/components/CustomButton.d.ts.map +1 -1
- package/lib/typescript/components/HLSChatMessages.d.ts.map +1 -1
- package/lib/typescript/components/HLSCloseMeetingControl.d.ts +8 -0
- package/lib/typescript/components/HLSCloseMeetingControl.d.ts.map +1 -0
- package/lib/typescript/components/HLSClosedCaptionControl.d.ts +10 -0
- package/lib/typescript/components/HLSClosedCaptionControl.d.ts.map +1 -0
- package/lib/typescript/components/HLSDistanceFromLive.d.ts +8 -0
- package/lib/typescript/components/HLSDistanceFromLive.d.ts.map +1 -0
- package/lib/typescript/components/HLSFullScreenControl.d.ts +8 -0
- package/lib/typescript/components/HLSFullScreenControl.d.ts.map +1 -0
- package/lib/typescript/components/HLSGoLiveControl.d.ts +10 -0
- package/lib/typescript/components/HLSGoLiveControl.d.ts.map +1 -0
- package/lib/typescript/components/HLSPlayPauseControl.d.ts +8 -0
- package/lib/typescript/components/HLSPlayPauseControl.d.ts.map +1 -0
- package/lib/typescript/components/HLSPlayer.d.ts +4 -2
- package/lib/typescript/components/HLSPlayer.d.ts.map +1 -1
- package/lib/typescript/components/HLSPlayerContainer.d.ts.map +1 -1
- package/lib/typescript/components/HLSPlayerControls.d.ts +12 -2
- package/lib/typescript/components/HLSPlayerControls.d.ts.map +1 -1
- package/lib/typescript/components/HLSSeekbackwardControl.d.ts +8 -0
- package/lib/typescript/components/HLSSeekbackwardControl.d.ts.map +1 -0
- package/lib/typescript/components/HLSSeekbar.d.ts +66 -0
- package/lib/typescript/components/HLSSeekbar.d.ts.map +1 -0
- package/lib/typescript/components/HLSSeekforwardControl.d.ts +8 -0
- package/lib/typescript/components/HLSSeekforwardControl.d.ts.map +1 -0
- package/lib/typescript/components/HMSHLSMessage.d.ts.map +1 -1
- package/lib/typescript/components/HMSOverlayMessageView.d.ts +8 -0
- package/lib/typescript/components/HMSOverlayMessageView.d.ts.map +1 -0
- package/lib/typescript/components/Modals.d.ts +3 -3
- package/lib/typescript/components/Modals.d.ts.map +1 -1
- package/lib/typescript/components/Participants/ParticipantsList.d.ts.map +1 -1
- package/lib/typescript/components/Preview.d.ts.map +1 -1
- package/lib/typescript/hooks-util.d.ts +12 -7
- package/lib/typescript/hooks-util.d.ts.map +1 -1
- package/lib/typescript/redux/actionTypes.d.ts +1 -0
- package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
- package/lib/typescript/redux/actions/index.d.ts +6 -0
- package/lib/typescript/redux/actions/index.d.ts.map +1 -1
- package/lib/typescript/redux/index.d.ts +17 -16
- package/lib/typescript/redux/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/appState.d.ts +1 -0
- package/lib/typescript/redux/reducers/appState.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/index.d.ts +17 -16
- package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/Icons/Pause/assets/pause-med.png +0 -0
- package/src/Icons/Pause/assets/pause-med@2x.png +0 -0
- package/src/Icons/Pause/assets/pause-med@3x.png +0 -0
- package/src/Icons/Pause/index.tsx +36 -0
- package/src/Icons/Play/assets/play-med.png +0 -0
- package/src/Icons/Play/assets/play-med@2x.png +0 -0
- package/src/Icons/Play/assets/play-med@3x.png +0 -0
- package/src/Icons/Play/index.tsx +36 -0
- package/src/Icons/SeekArrow/assets/seek-backward-arrow.png +0 -0
- package/src/Icons/SeekArrow/assets/seek-backward-arrow@2x.png +0 -0
- package/src/Icons/SeekArrow/assets/seek-backward-arrow@3x.png +0 -0
- package/src/Icons/SeekArrow/assets/seek-forward-arrow.png +0 -0
- package/src/Icons/SeekArrow/assets/seek-forward-arrow@2x.png +0 -0
- package/src/Icons/SeekArrow/assets/seek-forward-arrow@3x.png +0 -0
- package/src/Icons/SeekArrow/index.tsx +40 -0
- package/src/Icons/index.ts +3 -0
- package/src/components/HLSChatMessages.tsx +4 -6
- package/src/components/HLSCloseMeetingControl.tsx +39 -0
- package/src/components/HLSClosedCaptionControl.tsx +140 -0
- package/src/components/HLSDistanceFromLive.tsx +69 -0
- package/src/components/HLSFullScreenControl.tsx +46 -0
- package/src/components/HLSGoLiveControl.tsx +104 -0
- package/src/components/HLSPlayPauseControl.tsx +69 -0
- package/src/components/HLSPlayer.tsx +98 -88
- package/src/components/HLSPlayerContainer.tsx +81 -14
- package/src/components/HLSPlayerControls.tsx +137 -58
- package/src/components/HLSSeekbackwardControl.tsx +88 -0
- package/src/components/HLSSeekbar.tsx +381 -0
- package/src/components/HLSSeekforwardControl.tsx +97 -0
- package/src/components/HMSHLSMessage.tsx +32 -49
- package/src/components/HMSHLSMessageList.tsx +2 -2
- package/src/components/HMSOverlayMessageView.tsx +189 -0
- package/src/components/Participants/ParticipantsList.tsx +12 -10
- package/src/hooks-util.ts +39 -1
- package/src/redux/actionTypes.ts +3 -0
- package/src/redux/actions/index.ts +5 -0
- package/src/redux/reducers/appState.ts +8 -0
- package/lib/commonjs/components/CustomHLSPlayerControls.js +0 -80
- package/lib/commonjs/components/CustomHLSPlayerControls.js.map +0 -1
- package/lib/module/components/CustomHLSPlayerControls.js +0 -72
- package/lib/module/components/CustomHLSPlayerControls.js.map +0 -1
- package/lib/typescript/components/CustomHLSPlayerControls.d.ts +0 -7
- package/lib/typescript/components/CustomHLSPlayerControls.d.ts.map +0 -1
- 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
|
-
|
|
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
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
26
|
-
|
|
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
|
|
3
|
-
import {
|
|
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 {
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
46
|
+
const hideControlsStyles: ViewStyle = useAnimatedStyle(
|
|
47
|
+
() => ({
|
|
48
|
+
opacity: animatedValue.value,
|
|
49
|
+
}),
|
|
50
|
+
[]
|
|
51
|
+
);
|
|
35
52
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
53
|
+
const hideControlsProps: ViewProps = useAnimatedProps(
|
|
54
|
+
() => ({
|
|
55
|
+
pointerEvents: animatedValue.value < 0.8 ? 'none' : 'auto',
|
|
56
|
+
}),
|
|
57
|
+
[]
|
|
58
|
+
);
|
|
39
59
|
|
|
40
60
|
return (
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
onPress={
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</TouchableOpacity>
|
|
54
|
-
</View> */}
|
|
55
|
-
</View>
|
|
89
|
+
<HLSSeekforwardControl
|
|
90
|
+
playerRef={playerRef}
|
|
91
|
+
onPress={resetHideControlAnimation}
|
|
92
|
+
/>
|
|
93
|
+
</View>
|
|
94
|
+
</Animated.View>
|
|
56
95
|
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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);
|