@applicaster/quick-brick-player 14.0.0-alpha.4385101226 → 14.0.0-alpha.4520122433
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 -6
- package/src/Player/AudioLayer/Layout/Controls/index.tsx +8 -18
- package/src/Player/AudioLayer/Layout/DockedControls/index.tsx +85 -70
- package/src/Player/PlayerModal/VideoPlayerModal.tsx +11 -14
- package/src/Player/PlayerModal/hooks/index.ts +113 -81
- package/src/Player/PlayerModal/index.web.ts +5 -0
- package/src/Player/PlayerModal/styles.ts +49 -46
- package/src/Player/index.tsx +19 -28
- package/src/QuickBrickPlayer.tsx +3 -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.4520122433",
|
|
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-rc.
|
|
39
|
-
"@applicaster/quick-brick-tv-transport-controls": "14.0.0-rc.
|
|
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.60",
|
|
40
|
+
"@applicaster/zapp-react-native-tvos-app": "14.0.0-alpha.4520122433",
|
|
41
|
+
"@applicaster/zapp-react-native-ui-components": "14.0.0-alpha.4520122433",
|
|
42
|
+
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.4520122433",
|
|
43
43
|
"query-string": "7.1.3",
|
|
44
44
|
"shaka-player": "4.3.5",
|
|
45
45
|
"typeface-montserrat": "^0.0.54",
|
|
@@ -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,13 +175,20 @@ 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")();
|
|
178
186
|
const playerState = usePlayerState("shared-player-wrapper-docked");
|
|
179
187
|
|
|
180
|
-
const getValue = (
|
|
181
|
-
R.propOr(null, key, stylesObj)
|
|
188
|
+
const getValue = React.useCallback(
|
|
189
|
+
(key: string, stylesObj: {}) => R.propOr(null, key, stylesObj),
|
|
190
|
+
[]
|
|
191
|
+
);
|
|
182
192
|
|
|
183
193
|
const value = React.useCallback(
|
|
184
194
|
(key: string) => {
|
|
@@ -198,7 +208,7 @@ export const DockedControls = (props: Props) => {
|
|
|
198
208
|
|
|
199
209
|
return retVal;
|
|
200
210
|
},
|
|
201
|
-
[...Object.values(configuration), playerState]
|
|
211
|
+
[...Object.values(configuration), playerState.seekableDuration, getValue]
|
|
202
212
|
);
|
|
203
213
|
|
|
204
214
|
const { title, summary } = useTitleSummaryOverlay(
|
|
@@ -216,89 +226,94 @@ export const DockedControls = (props: Props) => {
|
|
|
216
226
|
const insets = useSafeAreaInsets();
|
|
217
227
|
|
|
218
228
|
return (
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
229
|
+
<>
|
|
230
|
+
<View
|
|
231
|
+
style={[
|
|
232
|
+
styles.container,
|
|
233
|
+
{
|
|
234
|
+
height: minimisedHeight,
|
|
235
|
+
maxHeight: minimisedHeight,
|
|
236
|
+
},
|
|
237
|
+
]}
|
|
238
|
+
>
|
|
239
|
+
{!playerState.isLive ? (
|
|
240
|
+
<ProgressBar
|
|
241
|
+
name={"shared-docked-layout"}
|
|
242
|
+
content={entry}
|
|
243
|
+
value={value}
|
|
244
|
+
visible
|
|
245
|
+
layoutState={layoutState}
|
|
246
|
+
onPlayerSeek={onPlayerSeek}
|
|
247
|
+
playerState={playerState}
|
|
248
|
+
startComponentsAnimation={noop}
|
|
249
|
+
docked
|
|
250
|
+
/>
|
|
251
|
+
) : null}
|
|
240
252
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
253
|
+
<View style={styles.content}>
|
|
254
|
+
<View style={styles.touchableArea}>
|
|
255
|
+
{isActiveGesture || layoutState.docked ? (
|
|
256
|
+
<View
|
|
257
|
+
style={{ aspectRatio: aspectRatio, height: minimisedHeight }}
|
|
258
|
+
>
|
|
259
|
+
{ImageComponent || null}
|
|
260
|
+
</View>
|
|
261
|
+
) : (
|
|
262
|
+
<View
|
|
263
|
+
style={playerDimensionsStyle(
|
|
264
|
+
minimisedHeight,
|
|
265
|
+
isActiveGesture || layoutState.docked
|
|
266
|
+
)}
|
|
267
|
+
/>
|
|
268
|
+
)}
|
|
248
269
|
<View
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
270
|
+
testID="content-info"
|
|
271
|
+
style={[
|
|
272
|
+
styles.contentInfo,
|
|
273
|
+
{ backgroundColor: dockedBackgroundColor },
|
|
274
|
+
]}
|
|
275
|
+
>
|
|
276
|
+
<ContentInfo
|
|
277
|
+
content={{ ...entry, title, summary }}
|
|
278
|
+
value={value}
|
|
279
|
+
docked
|
|
280
|
+
/>
|
|
281
|
+
</View>
|
|
282
|
+
</View>
|
|
255
283
|
<View
|
|
256
|
-
testID="content-info"
|
|
257
284
|
style={[
|
|
258
|
-
|
|
285
|
+
isTablet
|
|
286
|
+
? styles.controlsContainerForTablet
|
|
287
|
+
: styles.controlsContainerForMobile,
|
|
259
288
|
{ backgroundColor: dockedBackgroundColor },
|
|
260
289
|
]}
|
|
261
290
|
>
|
|
262
|
-
<
|
|
263
|
-
|
|
291
|
+
<Controls
|
|
292
|
+
value={value}
|
|
293
|
+
visible
|
|
294
|
+
buttons={R.partial(controlButtons, [
|
|
295
|
+
playerState.isLive && liveButton,
|
|
296
|
+
])}
|
|
297
|
+
style={styles.playPauseButton}
|
|
298
|
+
playNextData={playNextData}
|
|
299
|
+
playerState={playerState}
|
|
300
|
+
/>
|
|
301
|
+
<Button
|
|
302
|
+
icon={"close_mini"}
|
|
303
|
+
size={"medium"}
|
|
264
304
|
value={value}
|
|
265
|
-
|
|
305
|
+
onPress={onCloseVideoModal}
|
|
306
|
+
style={styles.buttons}
|
|
266
307
|
/>
|
|
267
308
|
</View>
|
|
268
309
|
</View>
|
|
269
|
-
<View
|
|
270
|
-
style={[
|
|
271
|
-
isTablet
|
|
272
|
-
? styles.controlsContainerForTablet
|
|
273
|
-
: styles.controlsContainerForMobile,
|
|
274
|
-
{ backgroundColor: dockedBackgroundColor },
|
|
275
|
-
]}
|
|
276
|
-
>
|
|
277
|
-
<Controls
|
|
278
|
-
value={value}
|
|
279
|
-
visible
|
|
280
|
-
buttons={R.partial(controlButtons, [
|
|
281
|
-
playerState.isLive && liveButton,
|
|
282
|
-
])}
|
|
283
|
-
style={styles.playPauseButton}
|
|
284
|
-
playNextData={playNextData}
|
|
285
|
-
playerState={playerState}
|
|
286
|
-
/>
|
|
287
|
-
<Button
|
|
288
|
-
icon={"close_mini"}
|
|
289
|
-
size={"medium"}
|
|
290
|
-
value={value}
|
|
291
|
-
onPress={onCloseVideoModal}
|
|
292
|
-
style={styles.buttons}
|
|
293
|
-
/>
|
|
294
|
-
</View>
|
|
295
310
|
</View>
|
|
296
311
|
<View
|
|
297
312
|
style={{
|
|
298
|
-
height: insets.bottom + bottomTabBarHeight,
|
|
313
|
+
height: insets.bottom + (menuVisible ? bottomTabBarHeight : 0),
|
|
299
314
|
backgroundColor: dockedBackgroundColor,
|
|
300
315
|
}}
|
|
301
316
|
/>
|
|
302
|
-
|
|
317
|
+
</>
|
|
303
318
|
);
|
|
304
319
|
};
|
|
@@ -30,18 +30,12 @@ const directionStyles = (isLandscape: boolean): ViewStyle => {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
type AnimatedModalProps = {
|
|
33
|
-
enabled?: boolean;
|
|
34
33
|
pip?: boolean;
|
|
35
34
|
fullscreen?: boolean;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
opacity: Animated.Value | Animated.AnimatedInterpolation<number>
|
|
41
|
-
) => ReactElement;
|
|
42
|
-
extraContent?: (
|
|
43
|
-
opacity: Animated.Value | Animated.AnimatedInterpolation<number>
|
|
44
|
-
) => ReactElement;
|
|
35
|
+
modal?: boolean;
|
|
36
|
+
content?: ReactElement;
|
|
37
|
+
collapsedContent?: ReactElement;
|
|
38
|
+
extraContent?: ReactElement;
|
|
45
39
|
aspectRatio?: number;
|
|
46
40
|
isTabletPortrait?: boolean;
|
|
47
41
|
style?: {
|
|
@@ -54,7 +48,6 @@ type AnimatedModalProps = {
|
|
|
54
48
|
const height = SCREEN_HEIGHT;
|
|
55
49
|
|
|
56
50
|
export function VideoPlayerModal({
|
|
57
|
-
enabled = true,
|
|
58
51
|
aspectRatio = DEFAULT_IMAGE_RATIO_VIDEO,
|
|
59
52
|
content,
|
|
60
53
|
extraContent,
|
|
@@ -63,7 +56,9 @@ export function VideoPlayerModal({
|
|
|
63
56
|
style,
|
|
64
57
|
pip = false,
|
|
65
58
|
fullscreen = false,
|
|
59
|
+
modal = true,
|
|
66
60
|
}: AnimatedModalProps) {
|
|
61
|
+
const enabled = !!modal && !fullscreen;
|
|
67
62
|
const isTablet = useIsTablet();
|
|
68
63
|
|
|
69
64
|
let width = SCREEN_WIDTH;
|
|
@@ -76,6 +71,8 @@ export function VideoPlayerModal({
|
|
|
76
71
|
const scrollViewRef = useRef<typeof Animated.ScrollView | null>(null);
|
|
77
72
|
|
|
78
73
|
const translateYRef = useModalAnimationContext().yTranslate;
|
|
74
|
+
// used when modal is false, should not be used in animation
|
|
75
|
+
const dummyRef = useRef(new Animated.Value(0));
|
|
79
76
|
|
|
80
77
|
const {
|
|
81
78
|
translateY,
|
|
@@ -83,7 +80,7 @@ export function VideoPlayerModal({
|
|
|
83
80
|
collapsedHeight,
|
|
84
81
|
gestureHandlerProps,
|
|
85
82
|
expand,
|
|
86
|
-
} = useVideoModalState(translateYRef);
|
|
83
|
+
} = useVideoModalState(modal ? translateYRef : dummyRef);
|
|
87
84
|
|
|
88
85
|
const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
|
|
89
86
|
|
|
@@ -212,7 +209,7 @@ export function VideoPlayerModal({
|
|
|
212
209
|
},
|
|
213
210
|
]}
|
|
214
211
|
>
|
|
215
|
-
{content
|
|
212
|
+
{content}
|
|
216
213
|
</Animated.View>
|
|
217
214
|
{extraContent ? (
|
|
218
215
|
<GestureAnimatedScrollView
|
|
@@ -225,7 +222,7 @@ export function VideoPlayerModal({
|
|
|
225
222
|
{ opacity: expandedOpacity },
|
|
226
223
|
]}
|
|
227
224
|
>
|
|
228
|
-
{extraContent
|
|
225
|
+
{extraContent || null}
|
|
229
226
|
</GestureAnimatedScrollView>
|
|
230
227
|
) : null}
|
|
231
228
|
</Animated.View>
|
|
@@ -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,29 @@ 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
|
+
|
|
37
|
+
const menuVisible = isMenuVisible(currentRoute, screenData, plugins);
|
|
26
38
|
|
|
27
39
|
const collapsed = videoModalState.mode === VideoModalMode.MINIMIZED;
|
|
28
40
|
|
|
29
41
|
const { bottom } = useSafeAreaInsets();
|
|
30
42
|
|
|
43
|
+
const initialBottomOffset = useRef(bottom).current;
|
|
44
|
+
|
|
31
45
|
const collapsedHeight =
|
|
32
|
-
minimisedHeight +
|
|
46
|
+
minimisedHeight +
|
|
47
|
+
initialBottomOffset +
|
|
48
|
+
(menuVisible ? bottomTabBarHeight : 0) +
|
|
49
|
+
PROGRESS_BAR_HEIGHT;
|
|
33
50
|
|
|
34
51
|
const translateY = translateYRef.current;
|
|
35
52
|
|
|
@@ -58,74 +75,80 @@ export const useVideoModalState = (
|
|
|
58
75
|
const offset = useRef(SCREEN_HEIGHT - collapsedHeight);
|
|
59
76
|
|
|
60
77
|
// 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;
|
|
78
|
+
const onGestureEvent = useCallback(
|
|
79
|
+
(event: any) => {
|
|
80
|
+
if (event.nativeEvent.state === State.ACTIVE) {
|
|
81
|
+
const y = event.nativeEvent.translationY;
|
|
82
|
+
let newY = offset.current + y;
|
|
83
|
+
if (newY < 0) newY = 0;
|
|
84
|
+
|
|
85
|
+
if (newY > SCREEN_HEIGHT - collapsedHeight) {
|
|
86
|
+
newY = SCREEN_HEIGHT - collapsedHeight;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
translateY.setValue(newY);
|
|
83
90
|
}
|
|
91
|
+
},
|
|
92
|
+
[collapsedHeight, translateY]
|
|
93
|
+
);
|
|
84
94
|
|
|
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
|
-
|
|
95
|
+
const onHandlerStateChange = useCallback(
|
|
96
|
+
(event: any) => {
|
|
97
|
+
if (event.nativeEvent.oldState === State.ACTIVE) {
|
|
98
|
+
const { translationY } = event.nativeEvent;
|
|
99
|
+
let newY = offset.current + translationY;
|
|
100
|
+
if (newY < 0) newY = 0;
|
|
101
|
+
|
|
102
|
+
if (newY > SCREEN_HEIGHT - collapsedHeight) {
|
|
103
|
+
newY = SCREEN_HEIGHT - collapsedHeight;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const shouldCollapse =
|
|
107
|
+
translationY > (SCREEN_HEIGHT - collapsedHeight) * DRAG_TO_COLLAPSE;
|
|
108
|
+
|
|
109
|
+
const shouldExpand =
|
|
110
|
+
translationY < -(SCREEN_HEIGHT - collapsedHeight) * DRAG_TO_EXPAND;
|
|
111
|
+
|
|
112
|
+
if (!collapsed && shouldCollapse) {
|
|
113
|
+
// Collapse
|
|
114
|
+
Animated.timing(translateY, {
|
|
115
|
+
toValue: SCREEN_HEIGHT - collapsedHeight,
|
|
116
|
+
duration: ANIMATION_DURATION,
|
|
117
|
+
useNativeDriver: true,
|
|
118
|
+
}).start(() => {
|
|
119
|
+
minimiseVideoModal();
|
|
120
|
+
offset.current = SCREEN_HEIGHT - collapsedHeight;
|
|
121
|
+
});
|
|
122
|
+
} else if (collapsed && shouldExpand) {
|
|
123
|
+
// Expand
|
|
124
|
+
Animated.timing(translateY, {
|
|
125
|
+
toValue: 0,
|
|
126
|
+
duration: ANIMATION_DURATION,
|
|
127
|
+
useNativeDriver: true,
|
|
128
|
+
}).start(() => {
|
|
129
|
+
maximiseVideoModal();
|
|
130
|
+
offset.current = 0;
|
|
131
|
+
translateY.setValue(0);
|
|
132
|
+
});
|
|
133
|
+
} else {
|
|
134
|
+
// Snap back to current state
|
|
135
|
+
Animated.spring(translateY, {
|
|
136
|
+
toValue: collapsed ? SCREEN_HEIGHT - collapsedHeight : 0,
|
|
137
|
+
useNativeDriver: true,
|
|
138
|
+
}).start(() => {
|
|
139
|
+
offset.current = collapsed ? SCREEN_HEIGHT - collapsedHeight : 0;
|
|
140
|
+
translateY.setValue(offset.current);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
} else if (event.nativeEvent.state === State.BEGAN) {
|
|
144
|
+
// Gesture started, set offset
|
|
145
|
+
translateY.stopAnimation((value: number) => {
|
|
146
|
+
offset.current = value;
|
|
120
147
|
});
|
|
121
148
|
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
offset.current = value;
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
};
|
|
149
|
+
},
|
|
150
|
+
[collapsedHeight, translateY, collapsed, videoModalState]
|
|
151
|
+
);
|
|
129
152
|
|
|
130
153
|
const gestureHandlerProps = useMemo(() => {
|
|
131
154
|
return {
|
|
@@ -148,14 +171,23 @@ export const useVideoModalState = (
|
|
|
148
171
|
translateY.setValue(SCREEN_HEIGHT - collapsedHeight);
|
|
149
172
|
});
|
|
150
173
|
}
|
|
151
|
-
}, [videoModalState.visible, videoModalState.mode]);
|
|
152
|
-
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
174
|
+
}, [videoModalState.visible, videoModalState.mode, collapsedHeight]);
|
|
175
|
+
|
|
176
|
+
return useMemo(
|
|
177
|
+
() => ({
|
|
178
|
+
collapsed,
|
|
179
|
+
collapsedHeight,
|
|
180
|
+
offset,
|
|
181
|
+
gestureHandlerProps,
|
|
182
|
+
translateY,
|
|
183
|
+
expand: maximiseVideoModal,
|
|
184
|
+
}),
|
|
185
|
+
[
|
|
186
|
+
collapsed,
|
|
187
|
+
collapsedHeight,
|
|
188
|
+
gestureHandlerProps,
|
|
189
|
+
translateY,
|
|
190
|
+
maximiseVideoModal,
|
|
191
|
+
]
|
|
192
|
+
);
|
|
161
193
|
};
|
|
@@ -52,50 +52,53 @@ 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
|
+
zIndex: 90,
|
|
92
|
+
justifyContent: "flex-end",
|
|
93
|
+
},
|
|
94
|
+
collapsedBarWrapper: {
|
|
95
|
+
flex: 1,
|
|
96
|
+
},
|
|
97
|
+
flexNone: {
|
|
98
|
+
...StyleSheet.absoluteFillObject,
|
|
99
|
+
flex: -1,
|
|
100
|
+
},
|
|
101
|
+
}),
|
|
102
|
+
[backgroundColor, COLLAPSED_HEIGHT]
|
|
103
|
+
);
|
|
101
104
|
};
|
package/src/Player/index.tsx
CHANGED
|
@@ -793,7 +793,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
793
793
|
};
|
|
794
794
|
|
|
795
795
|
const isFullScreenAudioPlayer =
|
|
796
|
-
this.getPluginConfiguration()?.
|
|
796
|
+
this.getPluginConfiguration()?.full_screen_audio_player || false;
|
|
797
797
|
|
|
798
798
|
const isAudioPlayer = isFullScreenAudioPlayer && isAudioItem;
|
|
799
799
|
|
|
@@ -835,7 +835,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
835
835
|
this.isReactNativeMethodsSupported() &&
|
|
836
836
|
RNPlayerManager?.[this.playerPluginId]?.play
|
|
837
837
|
) {
|
|
838
|
-
delete nativeProps
|
|
838
|
+
delete nativeProps.paused;
|
|
839
839
|
}
|
|
840
840
|
|
|
841
841
|
const adEvents = {
|
|
@@ -1032,11 +1032,11 @@ export default class VideoPlayer extends React.Component<
|
|
|
1032
1032
|
/>
|
|
1033
1033
|
) : (
|
|
1034
1034
|
<VideoPlayerModal
|
|
1035
|
-
enabled={!!isModal && !fullscreen}
|
|
1036
1035
|
isTabletPortrait={isTabletPortrait}
|
|
1037
1036
|
aspectRatio={aspectRatio}
|
|
1038
1037
|
pip={this.state.piped}
|
|
1039
1038
|
fullscreen={fullscreen}
|
|
1039
|
+
modal={isModal}
|
|
1040
1040
|
style={{
|
|
1041
1041
|
tabletLandscapeWidth: getTabletWidth(
|
|
1042
1042
|
this.getPluginConfiguration().tablet_landscape_sidebar_width,
|
|
@@ -1045,9 +1045,10 @@ export default class VideoPlayer extends React.Component<
|
|
|
1045
1045
|
width: style.width,
|
|
1046
1046
|
height: style.height,
|
|
1047
1047
|
}}
|
|
1048
|
-
content={
|
|
1048
|
+
content={
|
|
1049
1049
|
<PlayerWrapper
|
|
1050
1050
|
{...sharedWrapperViewProps}
|
|
1051
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
1051
1052
|
playerContent={(playerDimensions) => {
|
|
1052
1053
|
const shouldRenderBackground =
|
|
1053
1054
|
!R.isNil(backgroundImageKey) &&
|
|
@@ -1060,11 +1061,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
1060
1061
|
<View style={[playerContainerStyles, playerDimensions]}>
|
|
1061
1062
|
{isAudioItem ? (
|
|
1062
1063
|
<AudioPlayer
|
|
1063
|
-
style={
|
|
1064
|
-
isTV()
|
|
1065
|
-
? getStyle(playerDimensions)
|
|
1066
|
-
: styles.playerSize
|
|
1067
|
-
}
|
|
1064
|
+
style={styles.playerSize}
|
|
1068
1065
|
audio_item={entry}
|
|
1069
1066
|
plugin_configuration={this.getPluginConfiguration()}
|
|
1070
1067
|
/>
|
|
@@ -1086,11 +1083,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
1086
1083
|
{...nativeEvents}
|
|
1087
1084
|
{...nativeProps}
|
|
1088
1085
|
listener={this.props.listener}
|
|
1089
|
-
style={
|
|
1090
|
-
isTV()
|
|
1091
|
-
? getStyle(playerDimensions)
|
|
1092
|
-
: styles.playerSize
|
|
1093
|
-
}
|
|
1086
|
+
style={styles.playerSize}
|
|
1094
1087
|
pluginConfiguration={this.getPluginConfiguration()}
|
|
1095
1088
|
controller={this.props.controller}
|
|
1096
1089
|
>
|
|
@@ -1117,8 +1110,8 @@ export default class VideoPlayer extends React.Component<
|
|
|
1117
1110
|
);
|
|
1118
1111
|
}}
|
|
1119
1112
|
/>
|
|
1120
|
-
|
|
1121
|
-
extraContent={
|
|
1113
|
+
}
|
|
1114
|
+
extraContent={
|
|
1122
1115
|
<PlayerDetails
|
|
1123
1116
|
configuration={this.getPluginConfiguration()}
|
|
1124
1117
|
style={{ flex: 1 }}
|
|
@@ -1129,18 +1122,16 @@ export default class VideoPlayer extends React.Component<
|
|
|
1129
1122
|
isModal={isModal}
|
|
1130
1123
|
pip={this.state.piped}
|
|
1131
1124
|
/>
|
|
1132
|
-
|
|
1133
|
-
collapsedContent={
|
|
1134
|
-
|
|
1135
|
-
<
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
</View>
|
|
1143
|
-
)
|
|
1125
|
+
}
|
|
1126
|
+
collapsedContent={
|
|
1127
|
+
<View style={styles.container}>
|
|
1128
|
+
<DockedControls
|
|
1129
|
+
entry={entry}
|
|
1130
|
+
aspectRatio={aspectRatio}
|
|
1131
|
+
layoutState={sharedWrapperViewProps.layoutState}
|
|
1132
|
+
playNextData={sharedWrapperViewProps.playNextData}
|
|
1133
|
+
/>
|
|
1134
|
+
</View>
|
|
1144
1135
|
}
|
|
1145
1136
|
/>
|
|
1146
1137
|
);
|
package/src/QuickBrickPlayer.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import Player from "./Player";
|
|
|
5
5
|
import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
|
|
6
6
|
import { isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
7
7
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
8
|
+
import { usePlayerTTS } from "@applicaster/zapp-react-native-utils/playerUtils/usePlayerTTS";
|
|
8
9
|
import { useIsCasting } from "./Player/hooks/useIsCasting";
|
|
9
10
|
|
|
10
11
|
const CHROMECAST_IDENTIFIER = "quick-brick-chromecast-action";
|
|
@@ -45,6 +46,8 @@ const QuickBrickPlayerComponent = (
|
|
|
45
46
|
isRunningPlayNext: !!props?.playNextData,
|
|
46
47
|
});
|
|
47
48
|
|
|
49
|
+
usePlayerTTS();
|
|
50
|
+
|
|
48
51
|
return (
|
|
49
52
|
<Player
|
|
50
53
|
{...props}
|