@applicaster/quick-brick-player 14.0.0-rc.50 → 14.0.0-rc.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-player",
|
|
3
|
-
"version": "14.0.0-rc.
|
|
3
|
+
"version": "14.0.0-rc.52",
|
|
4
4
|
"description": "Quick Brick Player",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@applicaster/quick-brick-mobile-transport-controls": "14.0.0-rc.48",
|
|
39
39
|
"@applicaster/quick-brick-tv-transport-controls": "14.0.0-rc.48",
|
|
40
|
-
"@applicaster/zapp-react-native-tvos-app": "14.0.0-rc.
|
|
41
|
-
"@applicaster/zapp-react-native-ui-components": "14.0.0-rc.
|
|
42
|
-
"@applicaster/zapp-react-native-utils": "14.0.0-rc.
|
|
40
|
+
"@applicaster/zapp-react-native-tvos-app": "14.0.0-rc.52",
|
|
41
|
+
"@applicaster/zapp-react-native-ui-components": "14.0.0-rc.52",
|
|
42
|
+
"@applicaster/zapp-react-native-utils": "14.0.0-rc.52",
|
|
43
43
|
"query-string": "7.1.3",
|
|
44
44
|
"shaka-player": "4.3.5",
|
|
45
45
|
"typeface-montserrat": "^0.0.54",
|
|
@@ -18,12 +18,14 @@ import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Compo
|
|
|
18
18
|
|
|
19
19
|
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
20
20
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
21
|
+
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
|
|
21
22
|
import { getTabBarHeight } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/getTabBarHeight";
|
|
22
23
|
import { useTitleSummaryOverlay } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerTitleSummaryOverlay";
|
|
23
24
|
import { usePlayerState } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerState";
|
|
24
25
|
import { useConfiguration } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/utils";
|
|
25
26
|
import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
26
27
|
import { PROGRESS_BAR_HEIGHT } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/utils";
|
|
28
|
+
import { isMenuVisible } from "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler";
|
|
27
29
|
|
|
28
30
|
const bottomTabBarHeight = getTabBarHeight();
|
|
29
31
|
|
|
@@ -172,6 +174,10 @@ export const DockedControls = (props: Props) => {
|
|
|
172
174
|
playerManager.close();
|
|
173
175
|
}, []);
|
|
174
176
|
|
|
177
|
+
const { currentRoute, screenData } = useNavigation();
|
|
178
|
+
|
|
179
|
+
const menuVisible = isMenuVisible(currentRoute, screenData);
|
|
180
|
+
|
|
175
181
|
const { minimised_height: minimisedHeight } = useConfiguration();
|
|
176
182
|
|
|
177
183
|
const configuration = useZStore("playerConfiguration")();
|
|
@@ -220,7 +226,10 @@ export const DockedControls = (props: Props) => {
|
|
|
220
226
|
style={[
|
|
221
227
|
styles.container,
|
|
222
228
|
{
|
|
223
|
-
height:
|
|
229
|
+
height:
|
|
230
|
+
minimisedHeight +
|
|
231
|
+
(menuVisible ? bottomTabBarHeight : 0) +
|
|
232
|
+
insets.bottom,
|
|
224
233
|
},
|
|
225
234
|
]}
|
|
226
235
|
>
|
|
@@ -295,7 +304,7 @@ export const DockedControls = (props: Props) => {
|
|
|
295
304
|
</View>
|
|
296
305
|
<View
|
|
297
306
|
style={{
|
|
298
|
-
height: insets.bottom + bottomTabBarHeight,
|
|
307
|
+
height: insets.bottom + (menuVisible ? bottomTabBarHeight : 0),
|
|
299
308
|
backgroundColor: dockedBackgroundColor,
|
|
300
309
|
}}
|
|
301
310
|
/>
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
2
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
3
|
+
import { State } from "react-native-gesture-handler";
|
|
4
|
+
import { Animated } from "react-native";
|
|
5
|
+
|
|
1
6
|
import { VideoModalMode } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
|
|
2
7
|
import { useConfiguration } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/utils";
|
|
3
8
|
import { getTabBarHeight } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/getTabBarHeight";
|
|
4
9
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
|
|
5
|
-
import {
|
|
6
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
10
|
+
import { isMenuVisible } from "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler";
|
|
7
11
|
import {
|
|
8
12
|
ANIMATION_DURATION,
|
|
9
13
|
DRAG_TO_COLLAPSE,
|
|
10
14
|
DRAG_TO_EXPAND,
|
|
11
15
|
SCREEN_HEIGHT,
|
|
12
16
|
} from "../consts";
|
|
13
|
-
import { State } from "react-native-gesture-handler";
|
|
14
|
-
import { Animated } from "react-native";
|
|
15
17
|
import { PROGRESS_BAR_HEIGHT } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/utils";
|
|
16
18
|
|
|
17
19
|
const bottomTabBarHeight = getTabBarHeight();
|
|
@@ -21,15 +23,25 @@ export const useVideoModalState = (
|
|
|
21
23
|
) => {
|
|
22
24
|
const { minimised_height: minimisedHeight } = useConfiguration();
|
|
23
25
|
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
+
const {
|
|
27
|
+
maximiseVideoModal,
|
|
28
|
+
minimiseVideoModal,
|
|
29
|
+
videoModalState,
|
|
30
|
+
currentRoute,
|
|
31
|
+
screenData,
|
|
32
|
+
} = useNavigation();
|
|
33
|
+
|
|
34
|
+
const menuVisible = isMenuVisible(currentRoute, screenData);
|
|
26
35
|
|
|
27
36
|
const collapsed = videoModalState.mode === VideoModalMode.MINIMIZED;
|
|
28
37
|
|
|
29
38
|
const { bottom } = useSafeAreaInsets();
|
|
30
39
|
|
|
31
40
|
const collapsedHeight =
|
|
32
|
-
minimisedHeight +
|
|
41
|
+
minimisedHeight +
|
|
42
|
+
bottom +
|
|
43
|
+
(menuVisible ? bottomTabBarHeight : 0) +
|
|
44
|
+
PROGRESS_BAR_HEIGHT;
|
|
33
45
|
|
|
34
46
|
const translateY = translateYRef.current;
|
|
35
47
|
|
|
@@ -58,74 +70,80 @@ export const useVideoModalState = (
|
|
|
58
70
|
const offset = useRef(SCREEN_HEIGHT - collapsedHeight);
|
|
59
71
|
|
|
60
72
|
// Gesture handler for modal
|
|
61
|
-
const onGestureEvent = (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
newY
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const onHandlerStateChange = (event: any) => {
|
|
76
|
-
if (event.nativeEvent.oldState === State.ACTIVE) {
|
|
77
|
-
const { translationY } = event.nativeEvent;
|
|
78
|
-
let newY = offset.current + translationY;
|
|
79
|
-
if (newY < 0) newY = 0;
|
|
80
|
-
|
|
81
|
-
if (newY > SCREEN_HEIGHT - collapsedHeight) {
|
|
82
|
-
newY = SCREEN_HEIGHT - collapsedHeight;
|
|
73
|
+
const onGestureEvent = useCallback(
|
|
74
|
+
(event: any) => {
|
|
75
|
+
if (event.nativeEvent.state === State.ACTIVE) {
|
|
76
|
+
const y = event.nativeEvent.translationY;
|
|
77
|
+
let newY = offset.current + y;
|
|
78
|
+
if (newY < 0) newY = 0;
|
|
79
|
+
|
|
80
|
+
if (newY > SCREEN_HEIGHT - collapsedHeight) {
|
|
81
|
+
newY = SCREEN_HEIGHT - collapsedHeight;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
translateY.setValue(newY);
|
|
83
85
|
}
|
|
86
|
+
},
|
|
87
|
+
[collapsedHeight, translateY]
|
|
88
|
+
);
|
|
84
89
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
90
|
+
const onHandlerStateChange = useCallback(
|
|
91
|
+
(event: any) => {
|
|
92
|
+
if (event.nativeEvent.oldState === State.ACTIVE) {
|
|
93
|
+
const { translationY } = event.nativeEvent;
|
|
94
|
+
let newY = offset.current + translationY;
|
|
95
|
+
if (newY < 0) newY = 0;
|
|
96
|
+
|
|
97
|
+
if (newY > SCREEN_HEIGHT - collapsedHeight) {
|
|
98
|
+
newY = SCREEN_HEIGHT - collapsedHeight;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const shouldCollapse =
|
|
102
|
+
translationY > (SCREEN_HEIGHT - collapsedHeight) * DRAG_TO_COLLAPSE;
|
|
103
|
+
|
|
104
|
+
const shouldExpand =
|
|
105
|
+
translationY < -(SCREEN_HEIGHT - collapsedHeight) * DRAG_TO_EXPAND;
|
|
106
|
+
|
|
107
|
+
if (!collapsed && shouldCollapse) {
|
|
108
|
+
// Collapse
|
|
109
|
+
Animated.timing(translateY, {
|
|
110
|
+
toValue: SCREEN_HEIGHT - collapsedHeight,
|
|
111
|
+
duration: ANIMATION_DURATION,
|
|
112
|
+
useNativeDriver: true,
|
|
113
|
+
}).start(() => {
|
|
114
|
+
minimiseVideoModal();
|
|
115
|
+
offset.current = SCREEN_HEIGHT - collapsedHeight;
|
|
116
|
+
});
|
|
117
|
+
} else if (collapsed && shouldExpand) {
|
|
118
|
+
// Expand
|
|
119
|
+
Animated.timing(translateY, {
|
|
120
|
+
toValue: 0,
|
|
121
|
+
duration: ANIMATION_DURATION,
|
|
122
|
+
useNativeDriver: true,
|
|
123
|
+
}).start(() => {
|
|
124
|
+
maximiseVideoModal();
|
|
125
|
+
offset.current = 0;
|
|
126
|
+
translateY.setValue(0);
|
|
127
|
+
});
|
|
128
|
+
} else {
|
|
129
|
+
// Snap back to current state
|
|
130
|
+
Animated.spring(translateY, {
|
|
131
|
+
toValue: collapsed ? SCREEN_HEIGHT - collapsedHeight : 0,
|
|
132
|
+
useNativeDriver: true,
|
|
133
|
+
}).start(() => {
|
|
134
|
+
offset.current = collapsed ? SCREEN_HEIGHT - collapsedHeight : 0;
|
|
135
|
+
translateY.setValue(offset.current);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
} else if (event.nativeEvent.state === State.BEGAN) {
|
|
139
|
+
// Gesture started, set offset
|
|
140
|
+
translateY.stopAnimation((value: number) => {
|
|
141
|
+
offset.current = value;
|
|
120
142
|
});
|
|
121
143
|
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
offset.current = value;
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
};
|
|
144
|
+
},
|
|
145
|
+
[collapsedHeight, translateY]
|
|
146
|
+
);
|
|
129
147
|
|
|
130
148
|
const gestureHandlerProps = useMemo(() => {
|
|
131
149
|
return {
|
|
@@ -148,14 +166,23 @@ export const useVideoModalState = (
|
|
|
148
166
|
translateY.setValue(SCREEN_HEIGHT - collapsedHeight);
|
|
149
167
|
});
|
|
150
168
|
}
|
|
151
|
-
}, [videoModalState.visible, videoModalState.mode]);
|
|
152
|
-
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
169
|
+
}, [videoModalState.visible, videoModalState.mode, collapsedHeight]);
|
|
170
|
+
|
|
171
|
+
return useMemo(
|
|
172
|
+
() => ({
|
|
173
|
+
collapsed,
|
|
174
|
+
collapsedHeight,
|
|
175
|
+
offset,
|
|
176
|
+
gestureHandlerProps,
|
|
177
|
+
translateY,
|
|
178
|
+
expand: maximiseVideoModal,
|
|
179
|
+
}),
|
|
180
|
+
[
|
|
181
|
+
collapsed,
|
|
182
|
+
collapsedHeight,
|
|
183
|
+
gestureHandlerProps,
|
|
184
|
+
translateY,
|
|
185
|
+
maximiseVideoModal,
|
|
186
|
+
]
|
|
187
|
+
);
|
|
161
188
|
};
|
|
@@ -52,50 +52,52 @@ export const useStyles = ({ height }: { height: number }) => {
|
|
|
52
52
|
const BG_COLOR_DEFAULT_BLACK = "black";
|
|
53
53
|
const BG_COLOR_DEFAULT_TRANSPARENT = "transparent";
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
55
|
+
return useMemo(
|
|
56
|
+
() =>
|
|
57
|
+
StyleSheet.create({
|
|
58
|
+
modal: {
|
|
59
|
+
position: "absolute",
|
|
60
|
+
left: 0,
|
|
61
|
+
right: 0,
|
|
62
|
+
top: 0,
|
|
63
|
+
backgroundColor,
|
|
64
|
+
elevation: 10,
|
|
65
|
+
zIndex: 100,
|
|
66
|
+
overflow: "hidden",
|
|
67
|
+
},
|
|
68
|
+
modalWrapper: {
|
|
69
|
+
backgroundColor: BG_COLOR_DEFAULT_BLACK,
|
|
70
|
+
},
|
|
71
|
+
collapsedModalBg: {
|
|
72
|
+
backgroundColor: BG_COLOR_DEFAULT_BLACK,
|
|
73
|
+
},
|
|
74
|
+
modalContent: {
|
|
75
|
+
flex: 1,
|
|
76
|
+
alignItems: "center",
|
|
77
|
+
},
|
|
78
|
+
expandedContentContainer: {
|
|
79
|
+
justifyContent: "flex-start",
|
|
80
|
+
backgroundColor: BG_COLOR_DEFAULT_TRANSPARENT,
|
|
81
|
+
zIndex: 1,
|
|
82
|
+
flex: 0,
|
|
83
|
+
},
|
|
84
|
+
extraContentScrollView: {
|
|
85
|
+
width: "100%",
|
|
86
|
+
backgroundColor: BG_COLOR_DEFAULT_TRANSPARENT,
|
|
87
|
+
},
|
|
88
|
+
collapsedBarContainer: {
|
|
89
|
+
...StyleSheet.absoluteFillObject,
|
|
90
|
+
height: COLLAPSED_HEIGHT,
|
|
91
|
+
justifyContent: "flex-end",
|
|
92
|
+
},
|
|
93
|
+
collapsedBarWrapper: {
|
|
94
|
+
flex: 1,
|
|
95
|
+
},
|
|
96
|
+
flexNone: {
|
|
97
|
+
...StyleSheet.absoluteFillObject,
|
|
98
|
+
flex: -1,
|
|
99
|
+
},
|
|
100
|
+
}),
|
|
101
|
+
[backgroundColor, COLLAPSED_HEIGHT]
|
|
102
|
+
);
|
|
101
103
|
};
|