@applicaster/quick-brick-player 14.0.0-alpha.5621117258 → 14.0.0-alpha.5810348423
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 -11
- package/src/Player/AudioLayer/Layout/Controls/index.tsx +8 -18
- package/src/Player/AudioLayer/Layout/DockedControls/index.tsx +89 -75
- package/src/Player/AudioLayer/Layout/MobileLayout.tsx +4 -22
- package/src/Player/AudioLayer/Layout/PlayerImage/AnimatedImage.tsx +48 -8
- package/src/Player/AudioLayer/Layout/PlayerImage/FlexImage.tsx +5 -9
- package/src/Player/AudioLayer/Layout/PlayerImage/index.tsx +1 -0
- package/src/Player/AudioLayer/Layout/TabletLandscapeLayout.tsx +1 -42
- package/src/Player/AudioLayer/Layout/TabletPortraitLayout.tsx +0 -33
- package/src/Player/AudioLayer/Layout/TransportInfo/index.tsx +3 -9
- package/src/Player/AudioLayer/components/SleepTimerModalHeader/SleepTimerModalHeader.tsx +1 -1
- package/src/Player/PlayerModal/GestureAnimatedScrollView.ts +7 -0
- package/src/Player/PlayerModal/PlayerModal.tsx +42 -25
- package/src/Player/PlayerModal/VideoPlayerModal.tsx +163 -102
- package/src/Player/PlayerModal/consts/index.ts +20 -6
- package/src/Player/PlayerModal/hooks/index.ts +115 -90
- package/src/Player/PlayerModal/index.web.ts +5 -0
- package/src/Player/PlayerModal/styles.ts +51 -37
- package/src/Player/PlayerView/GenericTVPlayerView.tsx +42 -0
- package/src/Player/PlayerView/TVPlayerView.tsx +26 -0
- package/src/Player/PlayerView/TvOSPlayerView.tsx +51 -0
- package/src/Player/PlayerView/types.ts +42 -0
- package/src/Player/index.tsx +47 -114
- package/src/QuickBrickPlayer.tsx +16 -10
- /package/src/Player/AudioLayer/Layout/{Debug → DebugComponent}/index.tsx +0 -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.5810348423",
|
|
4
4
|
"description": "Quick Brick Player",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -35,13 +35,12 @@
|
|
|
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-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.5810348423",
|
|
41
|
+
"@applicaster/zapp-react-native-ui-components": "14.0.0-alpha.5810348423",
|
|
42
|
+
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.5810348423",
|
|
43
43
|
"query-string": "7.1.3",
|
|
44
|
-
"react-native-web-linear-gradient": "1.1.2",
|
|
45
44
|
"shaka-player": "4.3.5",
|
|
46
45
|
"typeface-montserrat": "^0.0.54",
|
|
47
46
|
"video.js": "7.14.3",
|
|
@@ -58,15 +57,11 @@
|
|
|
58
57
|
"@applicaster/zapp-react-native-tvos-ui-components": "*",
|
|
59
58
|
"@babel/runtime": "*",
|
|
60
59
|
"@react-native-community/netinfo": "*",
|
|
61
|
-
"immer": "*",
|
|
62
60
|
"react": "*",
|
|
63
61
|
"react-native": "*",
|
|
64
62
|
"react-native-fs": "*",
|
|
65
|
-
"react-native-gesture-handler": "*",
|
|
66
63
|
"react-native-linear-gradient": "*",
|
|
67
|
-
"react-native-safe-area-context": "*",
|
|
68
64
|
"react-native-svg": "*",
|
|
69
|
-
"react-native-web": "*",
|
|
70
65
|
"react-native-webview": "*",
|
|
71
66
|
"uglify-js": "*",
|
|
72
67
|
"validate-color": "*",
|
|
@@ -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,10 +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";
|
|
26
|
+
import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
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";
|
|
25
30
|
|
|
26
31
|
const bottomTabBarHeight = getTabBarHeight();
|
|
27
32
|
|
|
@@ -38,7 +43,6 @@ type Props = {
|
|
|
38
43
|
ImageComponent?: React.ReactNode;
|
|
39
44
|
isActiveGesture?: boolean;
|
|
40
45
|
minimisedHeight: number;
|
|
41
|
-
progressBarHeight: number;
|
|
42
46
|
aspectRatio?: number;
|
|
43
47
|
};
|
|
44
48
|
|
|
@@ -47,7 +51,7 @@ const styles = StyleSheet.create({
|
|
|
47
51
|
flex: 1,
|
|
48
52
|
flexDirection: "column",
|
|
49
53
|
alignItems: "stretch",
|
|
50
|
-
marginTop:
|
|
54
|
+
marginTop: PROGRESS_BAR_HEIGHT,
|
|
51
55
|
},
|
|
52
56
|
content: {
|
|
53
57
|
flex: 1,
|
|
@@ -160,7 +164,7 @@ export const DockedControls = (props: Props) => {
|
|
|
160
164
|
const {
|
|
161
165
|
entry,
|
|
162
166
|
layoutState,
|
|
163
|
-
onPlayerSeek,
|
|
167
|
+
onPlayerSeek = noop,
|
|
164
168
|
playNextData,
|
|
165
169
|
ImageComponent,
|
|
166
170
|
isActiveGesture = true,
|
|
@@ -171,13 +175,20 @@ export const DockedControls = (props: Props) => {
|
|
|
171
175
|
playerManager.close();
|
|
172
176
|
}, []);
|
|
173
177
|
|
|
178
|
+
const { currentRoute, screenData } = useNavigation();
|
|
179
|
+
|
|
180
|
+
const plugins = usePlugins();
|
|
181
|
+
const menuVisible = isMenuVisible(currentRoute, screenData, plugins);
|
|
182
|
+
|
|
174
183
|
const { minimised_height: minimisedHeight } = useConfiguration();
|
|
175
184
|
|
|
176
185
|
const configuration = useZStore("playerConfiguration")();
|
|
177
186
|
const playerState = usePlayerState("shared-player-wrapper-docked");
|
|
178
187
|
|
|
179
|
-
const getValue = (
|
|
180
|
-
R.propOr(null, key, stylesObj)
|
|
188
|
+
const getValue = React.useCallback(
|
|
189
|
+
(key: string, stylesObj: {}) => R.propOr(null, key, stylesObj),
|
|
190
|
+
[]
|
|
191
|
+
);
|
|
181
192
|
|
|
182
193
|
const value = React.useCallback(
|
|
183
194
|
(key: string) => {
|
|
@@ -197,7 +208,7 @@ export const DockedControls = (props: Props) => {
|
|
|
197
208
|
|
|
198
209
|
return retVal;
|
|
199
210
|
},
|
|
200
|
-
[...Object.values(configuration), playerState]
|
|
211
|
+
[...Object.values(configuration), playerState.seekableDuration, getValue]
|
|
201
212
|
);
|
|
202
213
|
|
|
203
214
|
const { title, summary } = useTitleSummaryOverlay(
|
|
@@ -210,96 +221,99 @@ export const DockedControls = (props: Props) => {
|
|
|
210
221
|
|
|
211
222
|
const liveButton = Boolean(value("live_badge_enabled"));
|
|
212
223
|
|
|
213
|
-
const startComponentsAnimation = () => {};
|
|
214
|
-
|
|
215
224
|
const dockedBackgroundColor = value("docked_player_background_color");
|
|
216
225
|
|
|
217
226
|
const insets = useSafeAreaInsets();
|
|
218
227
|
|
|
219
228
|
return (
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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}
|
|
241
252
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
+
)}
|
|
249
269
|
<View
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
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>
|
|
256
283
|
<View
|
|
257
|
-
testID="content-info"
|
|
258
284
|
style={[
|
|
259
|
-
|
|
285
|
+
isTablet
|
|
286
|
+
? styles.controlsContainerForTablet
|
|
287
|
+
: styles.controlsContainerForMobile,
|
|
260
288
|
{ backgroundColor: dockedBackgroundColor },
|
|
261
289
|
]}
|
|
262
290
|
>
|
|
263
|
-
<
|
|
264
|
-
|
|
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"}
|
|
265
304
|
value={value}
|
|
266
|
-
|
|
305
|
+
onPress={onCloseVideoModal}
|
|
306
|
+
style={styles.buttons}
|
|
267
307
|
/>
|
|
268
308
|
</View>
|
|
269
309
|
</View>
|
|
270
|
-
<View
|
|
271
|
-
style={[
|
|
272
|
-
isTablet
|
|
273
|
-
? styles.controlsContainerForTablet
|
|
274
|
-
: styles.controlsContainerForMobile,
|
|
275
|
-
{ backgroundColor: dockedBackgroundColor },
|
|
276
|
-
]}
|
|
277
|
-
>
|
|
278
|
-
<Controls
|
|
279
|
-
value={value}
|
|
280
|
-
visible
|
|
281
|
-
buttons={R.partial(controlButtons, [
|
|
282
|
-
playerState.isLive && liveButton,
|
|
283
|
-
])}
|
|
284
|
-
style={styles.playPauseButton}
|
|
285
|
-
playNextData={playNextData}
|
|
286
|
-
playerState={playerState}
|
|
287
|
-
/>
|
|
288
|
-
<Button
|
|
289
|
-
icon={"close_mini"}
|
|
290
|
-
size={"medium"}
|
|
291
|
-
value={value}
|
|
292
|
-
onPress={onCloseVideoModal}
|
|
293
|
-
style={styles.buttons}
|
|
294
|
-
/>
|
|
295
|
-
</View>
|
|
296
310
|
</View>
|
|
297
311
|
<View
|
|
298
312
|
style={{
|
|
299
|
-
height: insets.bottom + bottomTabBarHeight,
|
|
313
|
+
height: insets.bottom + (menuVisible ? bottomTabBarHeight : 0),
|
|
300
314
|
backgroundColor: dockedBackgroundColor,
|
|
301
315
|
}}
|
|
302
316
|
/>
|
|
303
|
-
|
|
317
|
+
</>
|
|
304
318
|
);
|
|
305
319
|
};
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
useSafeAreaFrame,
|
|
5
5
|
useSafeAreaInsets,
|
|
6
6
|
} from "react-native-safe-area-context";
|
|
7
|
-
import { useModalAnimationContext } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
8
7
|
|
|
9
8
|
import { MOBILE, NAVBAR_HEIGHT } from "./const";
|
|
10
9
|
import { TransportInfo } from "./TransportInfo";
|
|
@@ -17,7 +16,7 @@ import {
|
|
|
17
16
|
BottomDebugSquare,
|
|
18
17
|
LeftDebugSquare,
|
|
19
18
|
RightDebugSquare,
|
|
20
|
-
} from "./
|
|
19
|
+
} from "./DebugComponent";
|
|
21
20
|
|
|
22
21
|
import { Props } from "./types";
|
|
23
22
|
|
|
@@ -79,8 +78,6 @@ export function MobileLayout({
|
|
|
79
78
|
onSpeedButtonPress,
|
|
80
79
|
playbackSpeedName,
|
|
81
80
|
configuration,
|
|
82
|
-
dimensions,
|
|
83
|
-
playNextData,
|
|
84
81
|
title,
|
|
85
82
|
summary,
|
|
86
83
|
}: Props) {
|
|
@@ -88,12 +85,10 @@ export function MobileLayout({
|
|
|
88
85
|
|
|
89
86
|
const { bottom: bottomInset, top: topInset } = useSafeAreaInsets();
|
|
90
87
|
const { height: screenHeight } = useSafeAreaFrame();
|
|
91
|
-
const { progressBarHeight } = useModalAnimationContext();
|
|
92
88
|
|
|
93
89
|
const { imageSize } = useMobileLayoutImageSize();
|
|
94
90
|
|
|
95
|
-
const {
|
|
96
|
-
useTransportInfoHeight();
|
|
91
|
+
const { onLayout: onTransportInfoLayout } = useTransportInfoHeight();
|
|
97
92
|
|
|
98
93
|
const controlsContainerHeight = React.useMemo(() => {
|
|
99
94
|
return (
|
|
@@ -107,10 +102,6 @@ export function MobileLayout({
|
|
|
107
102
|
);
|
|
108
103
|
}, [screenHeight, topInset, imageSize, bottomInset]);
|
|
109
104
|
|
|
110
|
-
const verticalOffsetForImage = React.useMemo(() => {
|
|
111
|
-
return transportInfoHeight + MOBILE.MARGIN_TOP - progressBarHeight;
|
|
112
|
-
}, [transportInfoHeight, progressBarHeight]);
|
|
113
|
-
|
|
114
105
|
return (
|
|
115
106
|
<View
|
|
116
107
|
style={[
|
|
@@ -162,18 +153,9 @@ export function MobileLayout({
|
|
|
162
153
|
>
|
|
163
154
|
<PlayerImage
|
|
164
155
|
entry={entry}
|
|
165
|
-
|
|
166
|
-
playerState={playerState}
|
|
167
|
-
value={value}
|
|
168
|
-
configuration={configuration}
|
|
169
|
-
onPlayerSeek={onPlayerSeek}
|
|
170
|
-
dimensions={dimensions}
|
|
171
|
-
playNextData={playNextData}
|
|
172
|
-
title={title}
|
|
173
|
-
summary={summary}
|
|
174
|
-
docked={docked}
|
|
156
|
+
docked={false}
|
|
175
157
|
imageWidth={imageSize}
|
|
176
|
-
|
|
158
|
+
configuration={configuration}
|
|
177
159
|
/>
|
|
178
160
|
</View>
|
|
179
161
|
{/* PlayerImage */}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "react";
|
|
2
2
|
import { Image, Animated, StyleSheet, ImageStyle } from "react-native";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
useModalAnimationContext,
|
|
6
|
+
PlayerAnimationStateEnum,
|
|
7
|
+
DURATION_TO_MINIMIZE,
|
|
8
|
+
DURATION_TO_MAXIMIZE,
|
|
9
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
10
|
+
import { PlayerAnimationStateT } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/ModalAnimationContext";
|
|
11
|
+
import { useBackgroundImage } from "@applicaster/zapp-react-native-utils/audioPlayerUtils";
|
|
12
|
+
|
|
13
|
+
import { useChangePlayerState } from "./hooks";
|
|
5
14
|
|
|
6
15
|
const styles = StyleSheet.create({
|
|
7
16
|
container: {
|
|
@@ -15,17 +24,48 @@ type Props = PropsWithChildren<{
|
|
|
15
24
|
entry: ZappEntry;
|
|
16
25
|
style?: ImageStyle | ImageStyle[];
|
|
17
26
|
imageWidth: number;
|
|
27
|
+
docked: boolean;
|
|
18
28
|
}>;
|
|
19
29
|
|
|
20
|
-
export const AnimatedImage = ({ entry, style, imageWidth }: Props) => {
|
|
30
|
+
export const AnimatedImage = ({ entry, style, imageWidth, docked }: Props) => {
|
|
21
31
|
const heightAnim = React.useRef(new Animated.Value(imageWidth)).current;
|
|
22
32
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
const backgroundImageSource = useBackgroundImage(entry);
|
|
34
|
+
|
|
35
|
+
const { minimisedHeight } = useModalAnimationContext();
|
|
36
|
+
|
|
37
|
+
const changePlayerState$ = useChangePlayerState({ docked });
|
|
38
|
+
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
const subscription = changePlayerState$.subscribe({
|
|
41
|
+
next: (nextPlayerState: PlayerAnimationStateT) => {
|
|
42
|
+
if (nextPlayerState === PlayerAnimationStateEnum.minimize) {
|
|
43
|
+
Animated.timing(heightAnim, {
|
|
44
|
+
toValue: minimisedHeight,
|
|
45
|
+
duration: DURATION_TO_MINIMIZE,
|
|
46
|
+
useNativeDriver: false, // width/height can't use native driver
|
|
47
|
+
}).start();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (nextPlayerState === PlayerAnimationStateEnum.maximize) {
|
|
51
|
+
Animated.timing(heightAnim, {
|
|
52
|
+
toValue: imageWidth,
|
|
53
|
+
duration: DURATION_TO_MAXIMIZE,
|
|
54
|
+
useNativeDriver: false, // width/height can't use native driver
|
|
55
|
+
}).start();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (nextPlayerState === PlayerAnimationStateEnum.appear_as_docked) {
|
|
59
|
+
// minimize image immediatly
|
|
60
|
+
heightAnim.setValue(minimisedHeight);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
});
|
|
27
64
|
|
|
28
|
-
|
|
65
|
+
return () => {
|
|
66
|
+
subscription.unsubscribe();
|
|
67
|
+
};
|
|
68
|
+
}, [changePlayerState$, minimisedHeight, imageWidth]);
|
|
29
69
|
|
|
30
70
|
return (
|
|
31
71
|
<Animated.View
|
|
@@ -36,7 +76,7 @@ export const AnimatedImage = ({ entry, style, imageWidth }: Props) => {
|
|
|
36
76
|
},
|
|
37
77
|
]}
|
|
38
78
|
>
|
|
39
|
-
<Image resizeMode="cover" style={style} source={
|
|
79
|
+
<Image resizeMode="cover" style={style} source={backgroundImageSource} />
|
|
40
80
|
</Animated.View>
|
|
41
81
|
);
|
|
42
82
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Image, ImageStyle } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
3
|
+
import { useBackgroundImage } from "@applicaster/zapp-react-native-utils/audioPlayerUtils";
|
|
5
4
|
|
|
6
5
|
type Props = {
|
|
7
6
|
entry: ZappEntry;
|
|
@@ -9,12 +8,9 @@ type Props = {
|
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
export const FlexImage = ({ entry, style }: Props) => {
|
|
12
|
-
const
|
|
13
|
-
() => ({ uri: imageSrcFromMediaItem(entry, undefined) }),
|
|
14
|
-
[entry]
|
|
15
|
-
);
|
|
11
|
+
const backgroundImageSource = useBackgroundImage(entry);
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
return (
|
|
14
|
+
<Image resizeMode="cover" style={style} source={backgroundImageSource} />
|
|
15
|
+
);
|
|
20
16
|
};
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { StyleSheet, View } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
useSafeAreaFrame,
|
|
5
|
-
useSafeAreaInsets,
|
|
6
|
-
} from "react-native-safe-area-context";
|
|
7
|
-
import { useModalAnimationContext } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
8
|
-
import { isApplePlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
3
|
+
import { useSafeAreaFrame } from "react-native-safe-area-context";
|
|
9
4
|
|
|
10
5
|
import { TransportInfo } from "./TransportInfo";
|
|
11
6
|
import { PlayerImage } from "./PlayerImage";
|
|
@@ -17,8 +12,6 @@ import { Props } from "./types";
|
|
|
17
12
|
import { isSmallTabletHeight as getIsSmallTabletHeight } from "./utils";
|
|
18
13
|
import { NAVBAR_HEIGHT, TABLET_LANDSCAPE } from "./const";
|
|
19
14
|
|
|
20
|
-
const isIOS = isApplePlatform();
|
|
21
|
-
|
|
22
15
|
const MIN_WIDTH = TABLET_LANDSCAPE.MIN_WIDTH; // Minimum width for the audio player container
|
|
23
16
|
const MAX_SPACING = TABLET_LANDSCAPE.MARGIN_VERTICAL; // Maximum spacing for the audio player container
|
|
24
17
|
const MIN_SPACING = TABLET_LANDSCAPE.MARGIN_VERTICAL_S; // Minimum spacing for the audio player container
|
|
@@ -68,22 +61,6 @@ const styles = StyleSheet.create({
|
|
|
68
61
|
},
|
|
69
62
|
});
|
|
70
63
|
|
|
71
|
-
const isTabletWithHomeButton = (bottomInset: number): boolean =>
|
|
72
|
-
bottomInset === 0;
|
|
73
|
-
|
|
74
|
-
const withAdditionalOffset = ({ progressBarHeight, bottomInset }) => {
|
|
75
|
-
if (isIOS && isTabletWithHomeButton(bottomInset)) {
|
|
76
|
-
return progressBarHeight === 0 ? 8 : progressBarHeight + 2;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (isIOS && !isTabletWithHomeButton(bottomInset)) {
|
|
80
|
-
return progressBarHeight === 0 ? 4 : 1;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// android
|
|
84
|
-
return progressBarHeight === 0 ? 4 : 0.5;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
64
|
export function TabletLandscapeLayout({
|
|
88
65
|
entry,
|
|
89
66
|
layoutState,
|
|
@@ -96,21 +73,16 @@ export function TabletLandscapeLayout({
|
|
|
96
73
|
onSkipStart,
|
|
97
74
|
onSkipLive,
|
|
98
75
|
onSpeedButtonPress,
|
|
99
|
-
onCloseVideoModal,
|
|
100
76
|
playbackSpeedName,
|
|
101
77
|
configuration,
|
|
102
|
-
dimensions,
|
|
103
|
-
playNextData,
|
|
104
78
|
title,
|
|
105
79
|
summary,
|
|
106
80
|
}: Props) {
|
|
107
81
|
const [imageWidth, setImageWidth] = React.useState(0);
|
|
108
82
|
const { docked } = layoutState;
|
|
109
83
|
|
|
110
|
-
const { bottom: bottomInset } = useSafeAreaInsets();
|
|
111
84
|
const { height: screenHeight } = useSafeAreaFrame();
|
|
112
85
|
const isSmallScreen = getIsSmallTabletHeight(screenHeight);
|
|
113
|
-
const { progressBarHeight } = useModalAnimationContext();
|
|
114
86
|
|
|
115
87
|
const onLayoutImage = React.useCallback((e) => {
|
|
116
88
|
setImageWidth(e.nativeEvent.layout.width);
|
|
@@ -149,20 +121,7 @@ export function TabletLandscapeLayout({
|
|
|
149
121
|
<PlayerImage
|
|
150
122
|
docked={false}
|
|
151
123
|
entry={entry}
|
|
152
|
-
layoutState={layoutState}
|
|
153
|
-
playerState={playerState}
|
|
154
|
-
value={value}
|
|
155
124
|
configuration={configuration}
|
|
156
|
-
onPlayerSeek={onPlayerSeek}
|
|
157
|
-
onCloseVideoModal={onCloseVideoModal}
|
|
158
|
-
dimensions={dimensions}
|
|
159
|
-
playNextData={playNextData}
|
|
160
|
-
title={title}
|
|
161
|
-
summary={summary}
|
|
162
|
-
verticalOffset={withAdditionalOffset({
|
|
163
|
-
progressBarHeight,
|
|
164
|
-
bottomInset,
|
|
165
|
-
})}
|
|
166
125
|
onLayoutImage={onLayoutImage}
|
|
167
126
|
/>
|
|
168
127
|
) : null}
|