@applicaster/quick-brick-player 14.0.0-alpha.5333112458 → 14.0.0-alpha.5351122050
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 +6 -8
- package/src/Player/AudioLayer/Layout/Controls/index.tsx +8 -18
- package/src/Player/AudioLayer/Layout/DockedControls/index.tsx +13 -2
- package/src/Player/PlayerModal/VideoPlayerModal.tsx +92 -75
- package/src/Player/PlayerModal/hooks/index.ts +110 -81
- package/src/Player/PlayerModal/index.web.ts +5 -0
- package/src/Player/PlayerModal/styles.ts +48 -46
- package/src/Player/index.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-player",
|
|
3
|
-
"version": "14.0.0-alpha.
|
|
3
|
+
"version": "14.0.0-alpha.5351122050",
|
|
4
4
|
"description": "Quick Brick Player",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@applicaster/quick-brick-mobile-transport-controls": "14.0.0-
|
|
39
|
-
"@applicaster/quick-brick-tv-transport-controls": "14.0.0-
|
|
40
|
-
"@applicaster/zapp-react-native-tvos-app": "14.0.0-alpha.
|
|
41
|
-
"@applicaster/zapp-react-native-ui-components": "14.0.0-alpha.
|
|
42
|
-
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.
|
|
38
|
+
"@applicaster/quick-brick-mobile-transport-controls": "14.0.0-rc.56",
|
|
39
|
+
"@applicaster/quick-brick-tv-transport-controls": "14.0.0-rc.48",
|
|
40
|
+
"@applicaster/zapp-react-native-tvos-app": "14.0.0-alpha.5351122050",
|
|
41
|
+
"@applicaster/zapp-react-native-ui-components": "14.0.0-alpha.5351122050",
|
|
42
|
+
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.5351122050",
|
|
43
43
|
"query-string": "7.1.3",
|
|
44
44
|
"shaka-player": "4.3.5",
|
|
45
45
|
"typeface-montserrat": "^0.0.54",
|
|
@@ -57,12 +57,10 @@
|
|
|
57
57
|
"@applicaster/zapp-react-native-tvos-ui-components": "*",
|
|
58
58
|
"@babel/runtime": "*",
|
|
59
59
|
"@react-native-community/netinfo": "*",
|
|
60
|
-
"immer": "*",
|
|
61
60
|
"react": "*",
|
|
62
61
|
"react-native": "*",
|
|
63
62
|
"react-native-fs": "*",
|
|
64
63
|
"react-native-linear-gradient": "*",
|
|
65
|
-
"react-native-safe-area-context": "*",
|
|
66
64
|
"react-native-svg": "*",
|
|
67
65
|
"react-native-webview": "*",
|
|
68
66
|
"uglify-js": "*",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { StyleSheet } from "react-native";
|
|
2
|
+
import { StyleSheet, View } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { dayjs } from "@applicaster/zapp-react-native-utils/dateUtils";
|
|
5
5
|
import {
|
|
@@ -12,11 +12,6 @@ import {
|
|
|
12
12
|
} from "@applicaster/quick-brick-mobile-transport-controls";
|
|
13
13
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
AnimationComponent,
|
|
17
|
-
ComponentAnimationType,
|
|
18
|
-
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
19
|
-
|
|
20
15
|
import { AudioDescription } from "../../AudioDescription";
|
|
21
16
|
import { isValidDate } from "../../../Utils";
|
|
22
17
|
import { VerticalGutter } from "./VerticalGutter";
|
|
@@ -103,8 +98,6 @@ export const Controls = (props: Props) => {
|
|
|
103
98
|
onSkipLive,
|
|
104
99
|
onSpeedButtonPress,
|
|
105
100
|
maxWidth = 320,
|
|
106
|
-
|
|
107
|
-
docked,
|
|
108
101
|
} = props;
|
|
109
102
|
|
|
110
103
|
const configuration = useZStore("playerConfiguration");
|
|
@@ -229,15 +222,8 @@ export const Controls = (props: Props) => {
|
|
|
229
222
|
isLiveShowFullControls,
|
|
230
223
|
]);
|
|
231
224
|
|
|
232
|
-
if (docked) {
|
|
233
|
-
return null;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
225
|
return (
|
|
237
|
-
<
|
|
238
|
-
animationType={ComponentAnimationType.componentFade}
|
|
239
|
-
style={isTablet ? styles.nonFlex : styles.flex}
|
|
240
|
-
>
|
|
226
|
+
<View style={isTablet ? styles.nonFlex : styles.flex}>
|
|
241
227
|
<VerticalGutter />
|
|
242
228
|
|
|
243
229
|
<AudioDescription
|
|
@@ -257,7 +243,11 @@ export const Controls = (props: Props) => {
|
|
|
257
243
|
content={entry}
|
|
258
244
|
value={value}
|
|
259
245
|
visible
|
|
260
|
-
layoutState={
|
|
246
|
+
layoutState={{
|
|
247
|
+
...layoutState,
|
|
248
|
+
docked: false, // always use non-docked layout for audio (to show time labels
|
|
249
|
+
inline: true, // always use inline layout for audio (to show time labels)
|
|
250
|
+
}}
|
|
261
251
|
onPlayerSeek={onPlayerSeek}
|
|
262
252
|
playerState={playerState}
|
|
263
253
|
disableFullscreen
|
|
@@ -286,6 +276,6 @@ export const Controls = (props: Props) => {
|
|
|
286
276
|
}}
|
|
287
277
|
playerState={playerState}
|
|
288
278
|
/>
|
|
289
|
-
</
|
|
279
|
+
</View>
|
|
290
280
|
);
|
|
291
281
|
};
|
|
@@ -18,12 +18,15 @@ 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";
|
|
29
|
+
import { usePlugins } from "@applicaster/zapp-react-native-redux";
|
|
27
30
|
|
|
28
31
|
const bottomTabBarHeight = getTabBarHeight();
|
|
29
32
|
|
|
@@ -172,6 +175,11 @@ export const DockedControls = (props: Props) => {
|
|
|
172
175
|
playerManager.close();
|
|
173
176
|
}, []);
|
|
174
177
|
|
|
178
|
+
const { currentRoute, screenData } = useNavigation();
|
|
179
|
+
|
|
180
|
+
const plugins = usePlugins();
|
|
181
|
+
const menuVisible = isMenuVisible(currentRoute, screenData, plugins);
|
|
182
|
+
|
|
175
183
|
const { minimised_height: minimisedHeight } = useConfiguration();
|
|
176
184
|
|
|
177
185
|
const configuration = useZStore("playerConfiguration")();
|
|
@@ -220,7 +228,10 @@ export const DockedControls = (props: Props) => {
|
|
|
220
228
|
style={[
|
|
221
229
|
styles.container,
|
|
222
230
|
{
|
|
223
|
-
height:
|
|
231
|
+
height:
|
|
232
|
+
minimisedHeight +
|
|
233
|
+
(menuVisible ? bottomTabBarHeight : 0) +
|
|
234
|
+
insets.bottom,
|
|
224
235
|
},
|
|
225
236
|
]}
|
|
226
237
|
>
|
|
@@ -295,7 +306,7 @@ export const DockedControls = (props: Props) => {
|
|
|
295
306
|
</View>
|
|
296
307
|
<View
|
|
297
308
|
style={{
|
|
298
|
-
height: insets.bottom + bottomTabBarHeight,
|
|
309
|
+
height: insets.bottom + (menuVisible ? bottomTabBarHeight : 0),
|
|
299
310
|
backgroundColor: dockedBackgroundColor,
|
|
300
311
|
}}
|
|
301
312
|
/>
|
|
@@ -32,14 +32,15 @@ const directionStyles = (isLandscape: boolean): ViewStyle => {
|
|
|
32
32
|
type AnimatedModalProps = {
|
|
33
33
|
enabled?: boolean;
|
|
34
34
|
pip?: boolean;
|
|
35
|
+
fullscreen?: boolean;
|
|
35
36
|
content?: (
|
|
36
|
-
opacity: Animated.Value | Animated.AnimatedInterpolation
|
|
37
|
+
opacity: Animated.Value | Animated.AnimatedInterpolation<number>
|
|
37
38
|
) => ReactElement;
|
|
38
39
|
collapsedContent?: (
|
|
39
|
-
opacity: Animated.Value | Animated.AnimatedInterpolation
|
|
40
|
+
opacity: Animated.Value | Animated.AnimatedInterpolation<number>
|
|
40
41
|
) => ReactElement;
|
|
41
42
|
extraContent?: (
|
|
42
|
-
opacity: Animated.Value | Animated.AnimatedInterpolation
|
|
43
|
+
opacity: Animated.Value | Animated.AnimatedInterpolation<number>
|
|
43
44
|
) => ReactElement;
|
|
44
45
|
aspectRatio?: number;
|
|
45
46
|
isTabletPortrait?: boolean;
|
|
@@ -61,6 +62,7 @@ export function VideoPlayerModal({
|
|
|
61
62
|
isTabletPortrait,
|
|
62
63
|
style,
|
|
63
64
|
pip = false,
|
|
65
|
+
fullscreen = false,
|
|
64
66
|
}: AnimatedModalProps) {
|
|
65
67
|
const isTablet = useIsTablet();
|
|
66
68
|
|
|
@@ -91,65 +93,78 @@ export function VideoPlayerModal({
|
|
|
91
93
|
|
|
92
94
|
const insets = useSafeAreaInsets();
|
|
93
95
|
|
|
96
|
+
const isFullScreenOrPIP = fullscreen || pip;
|
|
97
|
+
|
|
94
98
|
// Interpolated opacities for smooth cross-fade
|
|
95
|
-
const collapsedOpacity =
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
99
|
+
const collapsedOpacity = !isFullScreenOrPIP
|
|
100
|
+
? translateY.interpolate({
|
|
101
|
+
inputRange: [MODAL_COLLAPSE_START, height - collapsedHeight],
|
|
102
|
+
outputRange: [0, 1],
|
|
103
|
+
extrapolate: "clamp",
|
|
104
|
+
})
|
|
105
|
+
: new Animated.Value(0);
|
|
106
|
+
|
|
107
|
+
const expandedOpacity = !isFullScreenOrPIP
|
|
108
|
+
? translateY.interpolate({
|
|
109
|
+
inputRange: [0, height - collapsedHeight],
|
|
110
|
+
outputRange: [1, 0],
|
|
111
|
+
extrapolate: "clamp",
|
|
112
|
+
})
|
|
113
|
+
: new Animated.Value(1);
|
|
114
|
+
|
|
115
|
+
const xPosition = !isFullScreenOrPIP
|
|
116
|
+
? translateY.interpolate({
|
|
117
|
+
inputRange: [
|
|
118
|
+
height * VIDEO_TRANSITION_THRESHOLD,
|
|
119
|
+
height - collapsedHeight,
|
|
120
|
+
],
|
|
121
|
+
outputRange: [0, -(width - width * SCALE_FACTOR) / 2],
|
|
122
|
+
extrapolate: "clamp",
|
|
123
|
+
})
|
|
124
|
+
: new Animated.Value(0);
|
|
112
125
|
|
|
113
126
|
const vidHeight = width / aspectRatio;
|
|
114
127
|
|
|
115
|
-
const yPosition =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
128
|
+
const yPosition = !isFullScreenOrPIP
|
|
129
|
+
? translateY.interpolate({
|
|
130
|
+
inputRange: [
|
|
131
|
+
height * VIDEO_TRANSITION_THRESHOLD,
|
|
132
|
+
height - collapsedHeight,
|
|
133
|
+
],
|
|
134
|
+
outputRange: [
|
|
135
|
+
0,
|
|
136
|
+
isTablet && isTabletLandscape
|
|
137
|
+
? -((-PROGRESS_BAR_HEIGHT + height - vidHeight * SCALE_FACTOR) / 2)
|
|
138
|
+
: -(
|
|
139
|
+
PROGRESS_BAR_HEIGHT +
|
|
140
|
+
insets.top / 2 +
|
|
141
|
+
(SCREEN_WIDTH / aspectRatio -
|
|
142
|
+
(SCREEN_WIDTH / aspectRatio) * SCALE_FACTOR) /
|
|
143
|
+
2
|
|
144
|
+
),
|
|
145
|
+
],
|
|
146
|
+
extrapolate: "clamp",
|
|
147
|
+
})
|
|
148
|
+
: new Animated.Value(0);
|
|
149
|
+
|
|
150
|
+
const scalePosition = !isFullScreenOrPIP
|
|
151
|
+
? translateY.interpolate({
|
|
152
|
+
inputRange: [
|
|
153
|
+
height * VIDEO_TRANSITION_THRESHOLD,
|
|
154
|
+
height - collapsedHeight,
|
|
155
|
+
],
|
|
156
|
+
outputRange: [1, SCALE_FACTOR],
|
|
157
|
+
extrapolate: "clamp",
|
|
158
|
+
})
|
|
159
|
+
: new Animated.Value(1);
|
|
160
|
+
|
|
161
|
+
const borderTopRadiusAnimated = !isFullScreenOrPIP
|
|
162
|
+
? translateY.interpolate({
|
|
163
|
+
inputRange: [0, height - collapsedHeight],
|
|
164
|
+
outputRange: [MODAL_RADIUS, 0],
|
|
165
|
+
extrapolate: "clamp",
|
|
166
|
+
})
|
|
167
|
+
: new Animated.Value(0);
|
|
153
168
|
|
|
154
169
|
return (
|
|
155
170
|
<PanGestureHandler
|
|
@@ -164,8 +179,8 @@ export function VideoPlayerModal({
|
|
|
164
179
|
{
|
|
165
180
|
borderTopLeftRadius: borderTopRadiusAnimated,
|
|
166
181
|
borderTopRightRadius: borderTopRadiusAnimated,
|
|
167
|
-
transform: [{ translateY }],
|
|
168
|
-
height:
|
|
182
|
+
transform: [{ translateY: isFullScreenOrPIP ? 0 : translateY }],
|
|
183
|
+
height: height,
|
|
169
184
|
},
|
|
170
185
|
]}
|
|
171
186
|
>
|
|
@@ -177,7 +192,7 @@ export function VideoPlayerModal({
|
|
|
177
192
|
{
|
|
178
193
|
borderTopLeftRadius: borderTopRadiusAnimated,
|
|
179
194
|
borderTopRightRadius: borderTopRadiusAnimated,
|
|
180
|
-
height:
|
|
195
|
+
height: height,
|
|
181
196
|
},
|
|
182
197
|
]}
|
|
183
198
|
>
|
|
@@ -215,21 +230,23 @@ export function VideoPlayerModal({
|
|
|
215
230
|
) : null}
|
|
216
231
|
</Animated.View>
|
|
217
232
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
<Pressable
|
|
226
|
-
testID="collapsedBarWrapper"
|
|
227
|
-
onPress={expand}
|
|
228
|
-
style={styles.collapsedBarWrapper}
|
|
233
|
+
{!isFullScreenOrPIP ? (
|
|
234
|
+
<Animated.View
|
|
235
|
+
pointerEvents={collapsed ? "box-none" : "none"}
|
|
236
|
+
style={[
|
|
237
|
+
styles.collapsedBarContainer,
|
|
238
|
+
{ opacity: collapsedOpacity },
|
|
239
|
+
]}
|
|
229
240
|
>
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
241
|
+
<Pressable
|
|
242
|
+
testID="collapsedBarWrapper"
|
|
243
|
+
onPress={expand}
|
|
244
|
+
style={styles.collapsedBarWrapper}
|
|
245
|
+
>
|
|
246
|
+
{collapsedContent}
|
|
247
|
+
</Pressable>
|
|
248
|
+
</Animated.View>
|
|
249
|
+
) : null}
|
|
233
250
|
</Animated.View>
|
|
234
251
|
</Animated.View>
|
|
235
252
|
</PanGestureHandler>
|
|
@@ -1,18 +1,21 @@
|
|
|
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";
|
|
18
|
+
import { usePlugins } from "@applicaster/zapp-react-native-redux";
|
|
16
19
|
|
|
17
20
|
const bottomTabBarHeight = getTabBarHeight();
|
|
18
21
|
|
|
@@ -21,15 +24,26 @@ export const useVideoModalState = (
|
|
|
21
24
|
) => {
|
|
22
25
|
const { minimised_height: minimisedHeight } = useConfiguration();
|
|
23
26
|
|
|
24
|
-
const {
|
|
25
|
-
|
|
27
|
+
const {
|
|
28
|
+
maximiseVideoModal,
|
|
29
|
+
minimiseVideoModal,
|
|
30
|
+
videoModalState,
|
|
31
|
+
currentRoute,
|
|
32
|
+
screenData,
|
|
33
|
+
} = useNavigation();
|
|
34
|
+
|
|
35
|
+
const plugins = usePlugins();
|
|
36
|
+
const menuVisible = isMenuVisible(currentRoute, screenData, plugins);
|
|
26
37
|
|
|
27
38
|
const collapsed = videoModalState.mode === VideoModalMode.MINIMIZED;
|
|
28
39
|
|
|
29
40
|
const { bottom } = useSafeAreaInsets();
|
|
30
41
|
|
|
31
42
|
const collapsedHeight =
|
|
32
|
-
minimisedHeight +
|
|
43
|
+
minimisedHeight +
|
|
44
|
+
bottom +
|
|
45
|
+
(menuVisible ? bottomTabBarHeight : 0) +
|
|
46
|
+
PROGRESS_BAR_HEIGHT;
|
|
33
47
|
|
|
34
48
|
const translateY = translateYRef.current;
|
|
35
49
|
|
|
@@ -58,74 +72,80 @@ export const useVideoModalState = (
|
|
|
58
72
|
const offset = useRef(SCREEN_HEIGHT - collapsedHeight);
|
|
59
73
|
|
|
60
74
|
// 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;
|
|
75
|
+
const onGestureEvent = useCallback(
|
|
76
|
+
(event: any) => {
|
|
77
|
+
if (event.nativeEvent.state === State.ACTIVE) {
|
|
78
|
+
const y = event.nativeEvent.translationY;
|
|
79
|
+
let newY = offset.current + y;
|
|
80
|
+
if (newY < 0) newY = 0;
|
|
81
|
+
|
|
82
|
+
if (newY > SCREEN_HEIGHT - collapsedHeight) {
|
|
83
|
+
newY = SCREEN_HEIGHT - collapsedHeight;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
translateY.setValue(newY);
|
|
83
87
|
}
|
|
88
|
+
},
|
|
89
|
+
[collapsedHeight, translateY]
|
|
90
|
+
);
|
|
84
91
|
|
|
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
|
-
|
|
92
|
+
const onHandlerStateChange = useCallback(
|
|
93
|
+
(event: any) => {
|
|
94
|
+
if (event.nativeEvent.oldState === State.ACTIVE) {
|
|
95
|
+
const { translationY } = event.nativeEvent;
|
|
96
|
+
let newY = offset.current + translationY;
|
|
97
|
+
if (newY < 0) newY = 0;
|
|
98
|
+
|
|
99
|
+
if (newY > SCREEN_HEIGHT - collapsedHeight) {
|
|
100
|
+
newY = SCREEN_HEIGHT - collapsedHeight;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const shouldCollapse =
|
|
104
|
+
translationY > (SCREEN_HEIGHT - collapsedHeight) * DRAG_TO_COLLAPSE;
|
|
105
|
+
|
|
106
|
+
const shouldExpand =
|
|
107
|
+
translationY < -(SCREEN_HEIGHT - collapsedHeight) * DRAG_TO_EXPAND;
|
|
108
|
+
|
|
109
|
+
if (!collapsed && shouldCollapse) {
|
|
110
|
+
// Collapse
|
|
111
|
+
Animated.timing(translateY, {
|
|
112
|
+
toValue: SCREEN_HEIGHT - collapsedHeight,
|
|
113
|
+
duration: ANIMATION_DURATION,
|
|
114
|
+
useNativeDriver: true,
|
|
115
|
+
}).start(() => {
|
|
116
|
+
minimiseVideoModal();
|
|
117
|
+
offset.current = SCREEN_HEIGHT - collapsedHeight;
|
|
118
|
+
});
|
|
119
|
+
} else if (collapsed && shouldExpand) {
|
|
120
|
+
// Expand
|
|
121
|
+
Animated.timing(translateY, {
|
|
122
|
+
toValue: 0,
|
|
123
|
+
duration: ANIMATION_DURATION,
|
|
124
|
+
useNativeDriver: true,
|
|
125
|
+
}).start(() => {
|
|
126
|
+
maximiseVideoModal();
|
|
127
|
+
offset.current = 0;
|
|
128
|
+
translateY.setValue(0);
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
// Snap back to current state
|
|
132
|
+
Animated.spring(translateY, {
|
|
133
|
+
toValue: collapsed ? SCREEN_HEIGHT - collapsedHeight : 0,
|
|
134
|
+
useNativeDriver: true,
|
|
135
|
+
}).start(() => {
|
|
136
|
+
offset.current = collapsed ? SCREEN_HEIGHT - collapsedHeight : 0;
|
|
137
|
+
translateY.setValue(offset.current);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
} else if (event.nativeEvent.state === State.BEGAN) {
|
|
141
|
+
// Gesture started, set offset
|
|
142
|
+
translateY.stopAnimation((value: number) => {
|
|
143
|
+
offset.current = value;
|
|
120
144
|
});
|
|
121
145
|
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
offset.current = value;
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
};
|
|
146
|
+
},
|
|
147
|
+
[collapsedHeight, translateY]
|
|
148
|
+
);
|
|
129
149
|
|
|
130
150
|
const gestureHandlerProps = useMemo(() => {
|
|
131
151
|
return {
|
|
@@ -148,14 +168,23 @@ export const useVideoModalState = (
|
|
|
148
168
|
translateY.setValue(SCREEN_HEIGHT - collapsedHeight);
|
|
149
169
|
});
|
|
150
170
|
}
|
|
151
|
-
}, [videoModalState.visible, videoModalState.mode]);
|
|
152
|
-
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
171
|
+
}, [videoModalState.visible, videoModalState.mode, collapsedHeight]);
|
|
172
|
+
|
|
173
|
+
return useMemo(
|
|
174
|
+
() => ({
|
|
175
|
+
collapsed,
|
|
176
|
+
collapsedHeight,
|
|
177
|
+
offset,
|
|
178
|
+
gestureHandlerProps,
|
|
179
|
+
translateY,
|
|
180
|
+
expand: maximiseVideoModal,
|
|
181
|
+
}),
|
|
182
|
+
[
|
|
183
|
+
collapsed,
|
|
184
|
+
collapsedHeight,
|
|
185
|
+
gestureHandlerProps,
|
|
186
|
+
translateY,
|
|
187
|
+
maximiseVideoModal,
|
|
188
|
+
]
|
|
189
|
+
);
|
|
161
190
|
};
|
|
@@ -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
|
};
|
package/src/Player/index.tsx
CHANGED
|
@@ -1036,6 +1036,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
1036
1036
|
isTabletPortrait={isTabletPortrait}
|
|
1037
1037
|
aspectRatio={aspectRatio}
|
|
1038
1038
|
pip={this.state.piped}
|
|
1039
|
+
fullscreen={fullscreen}
|
|
1039
1040
|
style={{
|
|
1040
1041
|
tabletLandscapeWidth: getTabletWidth(
|
|
1041
1042
|
this.getPluginConfiguration().tablet_landscape_sidebar_width,
|