@applicaster/quick-brick-player 13.0.0-rc.13 → 13.0.0-rc.131
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 +27 -14
- package/src/CellPlayer/Assets/AssetsComponent.tsx +17 -3
- package/src/Player/AudioLayer/AudioDescription.tsx +107 -68
- package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +142 -295
- package/src/Player/AudioLayer/Layout/Controls/VerticalGutter.tsx +45 -0
- package/src/Player/AudioLayer/Layout/Controls/index.tsx +291 -0
- package/src/Player/AudioLayer/Layout/{defaultLayoutsConts.ts → Controls/utils.ts} +9 -27
- package/src/Player/AudioLayer/Layout/Debug/index.tsx +55 -0
- package/src/Player/AudioLayer/Layout/{DockedLayout.tsx → DockedControls/index.tsx} +77 -81
- package/src/Player/AudioLayer/Layout/MobileLayout.tsx +222 -0
- package/src/Player/AudioLayer/Layout/PlayerImage/AnimatedImage.tsx +87 -0
- package/src/Player/AudioLayer/Layout/PlayerImage/FlexImage.tsx +20 -0
- package/src/Player/AudioLayer/Layout/PlayerImage/hooks/index.ts +1 -0
- package/src/Player/AudioLayer/Layout/PlayerImage/hooks/useChangePlayerState.ts +99 -0
- package/src/Player/AudioLayer/Layout/PlayerImage/index.tsx +112 -0
- package/src/Player/AudioLayer/Layout/PlayerImage/styles.ts +36 -0
- package/src/Player/AudioLayer/Layout/TabletLandscapeLayout.tsx +212 -0
- package/src/Player/AudioLayer/Layout/TabletPortraitLayout.tsx +215 -0
- package/src/Player/AudioLayer/Layout/TransportInfo/index.tsx +128 -0
- package/src/Player/AudioLayer/Layout/VerticalGutter/index.tsx +8 -0
- package/src/Player/AudioLayer/Layout/const.ts +26 -0
- package/src/Player/AudioLayer/Layout/debug.ts +6 -0
- package/src/Player/AudioLayer/Layout/hooks/index.ts +5 -0
- package/src/Player/AudioLayer/Layout/hooks/useMobileLayoutImageSize.ts +14 -0
- package/src/Player/AudioLayer/Layout/hooks/useTabletLayoutImageSize.ts +105 -0
- package/src/Player/AudioLayer/Layout/hooks/useTransportInfoHeight.ts +54 -0
- package/src/Player/AudioLayer/Layout/index.tsx +21 -48
- package/src/Player/AudioLayer/Layout/types.ts +7 -0
- package/src/Player/AudioLayer/Layout/utils.ts +7 -0
- package/src/Player/AudioLayer/SleepTimerManager.ts +130 -0
- package/src/Player/AudioLayer/SpeedManager.ts +52 -0
- package/src/Player/AudioLayer/components/SleepTimerModalHeader/SleepTimerModalHeader.tsx +66 -0
- package/src/Player/AudioLayer/components/SleepTimerModalHeader/index.ts +1 -0
- package/src/Player/AudioLayer/useSleepTimerModal.ts +109 -0
- package/src/Player/AudioLayer/utils.ts +27 -0
- package/src/Player/Const/sleepTimerOptions.ts +41 -0
- package/src/Player/Const/speedOptions.ts +4 -0
- package/src/Player/Utils/Utils.ts +0 -5
- package/src/Player/Utils/index.tsx +123 -0
- package/src/Player/hooks/useIsCasting.tsx +57 -0
- package/src/Player/index.tsx +106 -49
- package/src/QuickBrickPlayer.tsx +3 -0
- package/src/Player/AudioLayer/Layout/DefaultLayout.tsx +0 -452
- package/src/Player/AudioLayer/LinearGradient/LinearGradientProxy.ts +0 -3
- package/src/Player/AudioLayer/LinearGradient/LinearGradientProxy.web.ts +0 -3
- package/src/Player/AudioLayer/LinearGradient/index.ts +0 -1
- package/src/Player/AudioLayer/MagicBG/index.tsx +0 -155
- package/src/Player/Helpers/VideoResizeMode.ts +0 -7
- package/src/utils/utils.ts +0 -25
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import * as React from "react";
|
|
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";
|
|
9
|
+
|
|
10
|
+
import { TransportInfo } from "./TransportInfo";
|
|
11
|
+
import { PlayerImage } from "./PlayerImage";
|
|
12
|
+
import { Controls } from "./Controls";
|
|
13
|
+
|
|
14
|
+
import { DockedControls } from "./DockedControls";
|
|
15
|
+
import { withDebug } from "./debug";
|
|
16
|
+
|
|
17
|
+
import { Props } from "./types";
|
|
18
|
+
import { isSmallTabletHeight as getIsSmallTabletHeight } from "./utils";
|
|
19
|
+
import { NAVBAR_HEIGHT, TABLET_LANDSCAPE } from "./const";
|
|
20
|
+
import { FlexImage } from "./PlayerImage/FlexImage";
|
|
21
|
+
|
|
22
|
+
const isIOS = isApplePlatform();
|
|
23
|
+
|
|
24
|
+
const MIN_WIDTH = TABLET_LANDSCAPE.MIN_WIDTH; // Minimum width for the audio player container
|
|
25
|
+
const MAX_SPACING = TABLET_LANDSCAPE.MARGIN_VERTICAL; // Maximum spacing for the audio player container
|
|
26
|
+
const MIN_SPACING = TABLET_LANDSCAPE.MARGIN_VERTICAL_S; // Minimum spacing for the audio player container
|
|
27
|
+
const transportInfoHeight = NAVBAR_HEIGHT;
|
|
28
|
+
|
|
29
|
+
const styles = StyleSheet.create({
|
|
30
|
+
container: {
|
|
31
|
+
flex: 1,
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
height: "100%",
|
|
34
|
+
...withDebug({
|
|
35
|
+
borderWidth: 2,
|
|
36
|
+
borderColor: "magenta",
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
flex: {
|
|
40
|
+
flex: 1,
|
|
41
|
+
},
|
|
42
|
+
audioPlayerContainer: {
|
|
43
|
+
flexDirection: "column",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
justifyContent: "center",
|
|
46
|
+
minWidth: MIN_WIDTH,
|
|
47
|
+
|
|
48
|
+
...withDebug({
|
|
49
|
+
borderWidth: 2,
|
|
50
|
+
borderColor: "blue",
|
|
51
|
+
}),
|
|
52
|
+
},
|
|
53
|
+
audioPlayerContainerHeightLimit: {
|
|
54
|
+
maxHeight: 750,
|
|
55
|
+
},
|
|
56
|
+
audioPlayerContainerPaddings: {
|
|
57
|
+
paddingBottom: MAX_SPACING,
|
|
58
|
+
paddingTop: MAX_SPACING,
|
|
59
|
+
},
|
|
60
|
+
// For small screens, we reduce the padding to fit better
|
|
61
|
+
audioPlayerContainerPaddingsSmall: {
|
|
62
|
+
paddingBottom: MIN_SPACING,
|
|
63
|
+
paddingTop: MIN_SPACING,
|
|
64
|
+
},
|
|
65
|
+
controlsContainer: { flexGrow: 0, alignSelf: "stretch" },
|
|
66
|
+
// eslint-disable-next-line react-native/no-color-literals
|
|
67
|
+
debugYellow: {
|
|
68
|
+
borderWidth: 2,
|
|
69
|
+
borderColor: "yellow",
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const isTabletWithHomeButton = (bottomInset: number): boolean =>
|
|
74
|
+
bottomInset === 0;
|
|
75
|
+
|
|
76
|
+
const withAdditionalOffset = ({ progressBarHeight, bottomInset }) => {
|
|
77
|
+
if (isIOS && isTabletWithHomeButton(bottomInset)) {
|
|
78
|
+
return progressBarHeight === 0 ? 8 : progressBarHeight + 2;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (isIOS && !isTabletWithHomeButton(bottomInset)) {
|
|
82
|
+
return progressBarHeight === 0 ? 4 : 1;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// android
|
|
86
|
+
return progressBarHeight === 0 ? 4 : 0.5;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export function TabletLandscapeLayout({
|
|
90
|
+
entry,
|
|
91
|
+
layoutState,
|
|
92
|
+
playerState,
|
|
93
|
+
value,
|
|
94
|
+
onPlaybackButtonPress,
|
|
95
|
+
onRewindButtonPress,
|
|
96
|
+
onForwardButtonPress,
|
|
97
|
+
onPlayerSeek,
|
|
98
|
+
onSkipStart,
|
|
99
|
+
onSkipLive,
|
|
100
|
+
onSpeedButtonPress,
|
|
101
|
+
onCloseVideoModal,
|
|
102
|
+
playbackSpeedName,
|
|
103
|
+
configuration,
|
|
104
|
+
dimensions,
|
|
105
|
+
playNextData,
|
|
106
|
+
title,
|
|
107
|
+
summary,
|
|
108
|
+
}: Props) {
|
|
109
|
+
const [imageWidth, setImageWidth] = React.useState(0);
|
|
110
|
+
const { docked } = layoutState;
|
|
111
|
+
|
|
112
|
+
const { bottom: bottomInset } = useSafeAreaInsets();
|
|
113
|
+
const { height: screenHeight } = useSafeAreaFrame();
|
|
114
|
+
const isSmallScreen = getIsSmallTabletHeight(screenHeight);
|
|
115
|
+
const { progressBarHeight } = useModalAnimationContext();
|
|
116
|
+
|
|
117
|
+
const onLayoutImage = React.useCallback((e) => {
|
|
118
|
+
setImageWidth(e.nativeEvent.layout.width);
|
|
119
|
+
}, []);
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<View style={styles.container}>
|
|
123
|
+
{/* TransportInfo */}
|
|
124
|
+
<TransportInfo
|
|
125
|
+
entry={entry}
|
|
126
|
+
layoutState={layoutState}
|
|
127
|
+
value={value}
|
|
128
|
+
configuration={configuration}
|
|
129
|
+
/>
|
|
130
|
+
|
|
131
|
+
{/* TransportInfo */}
|
|
132
|
+
|
|
133
|
+
<View
|
|
134
|
+
style={[
|
|
135
|
+
styles.audioPlayerContainer,
|
|
136
|
+
{
|
|
137
|
+
marginTop: isSmallScreen
|
|
138
|
+
? -TABLET_LANDSCAPE.MARGIN_VERTICAL_S
|
|
139
|
+
: -TABLET_LANDSCAPE.MARGIN_VERTICAL,
|
|
140
|
+
height: screenHeight - transportInfoHeight,
|
|
141
|
+
},
|
|
142
|
+
isSmallScreen
|
|
143
|
+
? styles.audioPlayerContainerPaddingsSmall
|
|
144
|
+
: styles.audioPlayerContainerPaddings,
|
|
145
|
+
]}
|
|
146
|
+
>
|
|
147
|
+
<View style={[styles.flex, styles.audioPlayerContainerHeightLimit]}>
|
|
148
|
+
{/* PlayerImage non-docked */}
|
|
149
|
+
<View style={[styles.flex, withDebug(styles.debugYellow)]}>
|
|
150
|
+
{!docked ? (
|
|
151
|
+
<PlayerImage
|
|
152
|
+
docked={false}
|
|
153
|
+
entry={entry}
|
|
154
|
+
layoutState={layoutState}
|
|
155
|
+
playerState={playerState}
|
|
156
|
+
value={value}
|
|
157
|
+
configuration={configuration}
|
|
158
|
+
onPlayerSeek={onPlayerSeek}
|
|
159
|
+
onCloseVideoModal={onCloseVideoModal}
|
|
160
|
+
dimensions={dimensions}
|
|
161
|
+
playNextData={playNextData}
|
|
162
|
+
title={title}
|
|
163
|
+
summary={summary}
|
|
164
|
+
verticalOffset={withAdditionalOffset({
|
|
165
|
+
progressBarHeight,
|
|
166
|
+
bottomInset,
|
|
167
|
+
})}
|
|
168
|
+
onLayoutImage={onLayoutImage}
|
|
169
|
+
/>
|
|
170
|
+
) : null}
|
|
171
|
+
</View>
|
|
172
|
+
{/* PlayerImage */}
|
|
173
|
+
|
|
174
|
+
<View style={styles.controlsContainer}>
|
|
175
|
+
<Controls
|
|
176
|
+
maxWidth={imageWidth}
|
|
177
|
+
entry={entry}
|
|
178
|
+
layoutState={layoutState}
|
|
179
|
+
playerState={playerState}
|
|
180
|
+
value={value}
|
|
181
|
+
title={title}
|
|
182
|
+
summary={summary}
|
|
183
|
+
playbackSpeedName={playbackSpeedName}
|
|
184
|
+
onPlaybackButtonPress={onPlaybackButtonPress}
|
|
185
|
+
onRewindButtonPress={onRewindButtonPress}
|
|
186
|
+
onForwardButtonPress={onForwardButtonPress}
|
|
187
|
+
onPlayerSeek={onPlayerSeek}
|
|
188
|
+
onSkipStart={onSkipStart}
|
|
189
|
+
onSkipLive={onSkipLive}
|
|
190
|
+
onSpeedButtonPress={onSpeedButtonPress}
|
|
191
|
+
docked={docked}
|
|
192
|
+
/>
|
|
193
|
+
</View>
|
|
194
|
+
</View>
|
|
195
|
+
</View>
|
|
196
|
+
|
|
197
|
+
<DockedControls
|
|
198
|
+
ImageComponent={<FlexImage entry={entry} style={styles.flex} />}
|
|
199
|
+
entry={entry}
|
|
200
|
+
layoutState={layoutState}
|
|
201
|
+
playerState={playerState}
|
|
202
|
+
value={value}
|
|
203
|
+
dimensions={dimensions}
|
|
204
|
+
onCloseVideoModal={onCloseVideoModal}
|
|
205
|
+
onPlayerSeek={onPlayerSeek}
|
|
206
|
+
playNextData={playNextData}
|
|
207
|
+
title={title}
|
|
208
|
+
summary={summary}
|
|
209
|
+
/>
|
|
210
|
+
</View>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StyleSheet, View, ViewStyle } 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 { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
9
|
+
|
|
10
|
+
import { withDebug } from "./debug";
|
|
11
|
+
import { TABLET_PORTRAIT } from "./const";
|
|
12
|
+
|
|
13
|
+
import { TransportInfo } from "./TransportInfo";
|
|
14
|
+
import { PlayerImage } from "./PlayerImage";
|
|
15
|
+
import { Controls } from "./Controls";
|
|
16
|
+
|
|
17
|
+
import { useTabletLayoutImageSize } from "./hooks";
|
|
18
|
+
import { DockedControls } from "./DockedControls";
|
|
19
|
+
import { VerticalGutter } from "./VerticalGutter";
|
|
20
|
+
|
|
21
|
+
import { Props } from "./types";
|
|
22
|
+
|
|
23
|
+
const styles = StyleSheet.create({
|
|
24
|
+
container: {
|
|
25
|
+
flex: 1,
|
|
26
|
+
|
|
27
|
+
...withDebug({
|
|
28
|
+
borderWidth: 2,
|
|
29
|
+
borderColor: "magenta",
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
flex: {
|
|
34
|
+
flex: 1,
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
fillContainer: {
|
|
38
|
+
...StyleSheet.absoluteFillObject,
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
...withDebug({
|
|
41
|
+
borderWidth: 2,
|
|
42
|
+
borderColor: "red",
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
audioPlayerContainer: {
|
|
47
|
+
flex: 1,
|
|
48
|
+
maxWidth: TABLET_PORTRAIT.MAX_WIDTH,
|
|
49
|
+
marginLeft: TABLET_PORTRAIT.MARGIN_HORIZONTAL,
|
|
50
|
+
marginRight: TABLET_PORTRAIT.MARGIN_HORIZONTAL,
|
|
51
|
+
|
|
52
|
+
...withDebug({
|
|
53
|
+
borderWidth: 2,
|
|
54
|
+
borderColor: "blue",
|
|
55
|
+
}),
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const tabletStyles = ({
|
|
60
|
+
screenHeight,
|
|
61
|
+
topInset,
|
|
62
|
+
bottomInset,
|
|
63
|
+
topOffset,
|
|
64
|
+
}): ViewStyle => ({
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
height: screenHeight - topInset - bottomInset,
|
|
67
|
+
opacity: topOffset ? 1 : 0, // hide content until topOffset is calculated
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const justifyContent = (topOffset: Option<number>) =>
|
|
71
|
+
topOffset ? "flex-start" : "center";
|
|
72
|
+
|
|
73
|
+
export function TabletPortraitLayout({
|
|
74
|
+
entry,
|
|
75
|
+
layoutState,
|
|
76
|
+
playerState,
|
|
77
|
+
value,
|
|
78
|
+
onPlaybackButtonPress,
|
|
79
|
+
onRewindButtonPress,
|
|
80
|
+
onForwardButtonPress,
|
|
81
|
+
onPlayerSeek,
|
|
82
|
+
onSkipStart,
|
|
83
|
+
onSkipLive,
|
|
84
|
+
onSpeedButtonPress,
|
|
85
|
+
onCloseVideoModal,
|
|
86
|
+
playbackSpeedName,
|
|
87
|
+
configuration,
|
|
88
|
+
dimensions,
|
|
89
|
+
playNextData,
|
|
90
|
+
title,
|
|
91
|
+
summary,
|
|
92
|
+
}: Props) {
|
|
93
|
+
const { docked } = layoutState;
|
|
94
|
+
|
|
95
|
+
const { bottom: bottomInset, top: topInset } = useSafeAreaInsets();
|
|
96
|
+
const { height: screenHeight } = useSafeAreaFrame();
|
|
97
|
+
const { progressBarHeight } = useModalAnimationContext();
|
|
98
|
+
|
|
99
|
+
const {
|
|
100
|
+
imageSize,
|
|
101
|
+
offsetY: topOffset,
|
|
102
|
+
onLayout,
|
|
103
|
+
} = useTabletLayoutImageSize({ isPortraitMode: true });
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<View
|
|
107
|
+
style={[
|
|
108
|
+
styles.container,
|
|
109
|
+
tabletStyles({
|
|
110
|
+
screenHeight,
|
|
111
|
+
topInset,
|
|
112
|
+
bottomInset,
|
|
113
|
+
topOffset,
|
|
114
|
+
}),
|
|
115
|
+
]}
|
|
116
|
+
>
|
|
117
|
+
{/* TransportInfo */}
|
|
118
|
+
<TransportInfo
|
|
119
|
+
entry={entry}
|
|
120
|
+
layoutState={layoutState}
|
|
121
|
+
value={value}
|
|
122
|
+
configuration={configuration}
|
|
123
|
+
/>
|
|
124
|
+
|
|
125
|
+
{/* TransportInfo */}
|
|
126
|
+
|
|
127
|
+
{/* PlayerImage */}
|
|
128
|
+
<View style={styles.fillContainer} pointerEvents="box-none">
|
|
129
|
+
<View
|
|
130
|
+
style={[
|
|
131
|
+
styles.audioPlayerContainer,
|
|
132
|
+
{
|
|
133
|
+
justifyContent: justifyContent(topOffset),
|
|
134
|
+
width: imageSize,
|
|
135
|
+
},
|
|
136
|
+
]}
|
|
137
|
+
>
|
|
138
|
+
{topOffset ? <VerticalGutter height={topOffset} /> : null}
|
|
139
|
+
|
|
140
|
+
<View
|
|
141
|
+
style={[
|
|
142
|
+
styles.flex,
|
|
143
|
+
{
|
|
144
|
+
maxHeight: imageSize,
|
|
145
|
+
|
|
146
|
+
...withDebug({
|
|
147
|
+
borderWidth: 2,
|
|
148
|
+
borderColor: "yellow",
|
|
149
|
+
}),
|
|
150
|
+
},
|
|
151
|
+
]}
|
|
152
|
+
onLayout={onLayout}
|
|
153
|
+
>
|
|
154
|
+
<PlayerImage
|
|
155
|
+
entry={entry}
|
|
156
|
+
layoutState={layoutState}
|
|
157
|
+
playerState={playerState}
|
|
158
|
+
value={value}
|
|
159
|
+
configuration={configuration}
|
|
160
|
+
onPlayerSeek={onPlayerSeek}
|
|
161
|
+
onCloseVideoModal={onCloseVideoModal}
|
|
162
|
+
dimensions={dimensions}
|
|
163
|
+
playNextData={playNextData}
|
|
164
|
+
title={title}
|
|
165
|
+
summary={summary}
|
|
166
|
+
docked={docked}
|
|
167
|
+
imageWidth={imageSize}
|
|
168
|
+
verticalOffset={
|
|
169
|
+
toNumberWithDefaultZero(topOffset) - progressBarHeight
|
|
170
|
+
}
|
|
171
|
+
/>
|
|
172
|
+
</View>
|
|
173
|
+
|
|
174
|
+
<View
|
|
175
|
+
style={{
|
|
176
|
+
maxWidth: imageSize,
|
|
177
|
+
}}
|
|
178
|
+
>
|
|
179
|
+
<Controls
|
|
180
|
+
entry={entry}
|
|
181
|
+
layoutState={layoutState}
|
|
182
|
+
playerState={playerState}
|
|
183
|
+
value={value}
|
|
184
|
+
title={title}
|
|
185
|
+
summary={summary}
|
|
186
|
+
playbackSpeedName={playbackSpeedName}
|
|
187
|
+
onPlaybackButtonPress={onPlaybackButtonPress}
|
|
188
|
+
onRewindButtonPress={onRewindButtonPress}
|
|
189
|
+
onForwardButtonPress={onForwardButtonPress}
|
|
190
|
+
onPlayerSeek={onPlayerSeek}
|
|
191
|
+
onSkipStart={onSkipStart}
|
|
192
|
+
onSkipLive={onSkipLive}
|
|
193
|
+
onSpeedButtonPress={onSpeedButtonPress}
|
|
194
|
+
docked={docked}
|
|
195
|
+
/>
|
|
196
|
+
</View>
|
|
197
|
+
</View>
|
|
198
|
+
</View>
|
|
199
|
+
{/* PlayerImage */}
|
|
200
|
+
|
|
201
|
+
<DockedControls
|
|
202
|
+
entry={entry}
|
|
203
|
+
layoutState={layoutState}
|
|
204
|
+
playerState={playerState}
|
|
205
|
+
value={value}
|
|
206
|
+
dimensions={dimensions}
|
|
207
|
+
onCloseVideoModal={onCloseVideoModal}
|
|
208
|
+
onPlayerSeek={onPlayerSeek}
|
|
209
|
+
playNextData={playNextData}
|
|
210
|
+
title={title}
|
|
211
|
+
summary={summary}
|
|
212
|
+
/>
|
|
213
|
+
</View>
|
|
214
|
+
);
|
|
215
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { compose, map, propOr, split, take, trim } from "ramda";
|
|
3
|
+
import { LayoutChangeEvent, StyleSheet, View } from "react-native";
|
|
4
|
+
|
|
5
|
+
import { TransportInfo as MobileTransportInfo } from "@applicaster/quick-brick-mobile-transport-controls";
|
|
6
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
7
|
+
import { useLanguageData } from "@applicaster/zapp-react-native-utils/reactHooks/player";
|
|
8
|
+
import {
|
|
9
|
+
AnimationComponent,
|
|
10
|
+
ComponentAnimationType,
|
|
11
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
12
|
+
import { toPositiveNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
13
|
+
import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
14
|
+
|
|
15
|
+
import { NAVBAR_HEIGHT, TABLET_LANDSCAPE } from "../const";
|
|
16
|
+
import { withDebug } from "../debug";
|
|
17
|
+
import { useSafeAreaFrame } from "react-native-safe-area-context";
|
|
18
|
+
import { isSmallTabletHeight } from "../utils";
|
|
19
|
+
|
|
20
|
+
const styles = StyleSheet.create({
|
|
21
|
+
container: {
|
|
22
|
+
height: NAVBAR_HEIGHT,
|
|
23
|
+
justifyContent: "center",
|
|
24
|
+
marginHorizontal: 10,
|
|
25
|
+
},
|
|
26
|
+
animatedContainer: {
|
|
27
|
+
width: "100%",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
justifyContent: "space-between",
|
|
30
|
+
|
|
31
|
+
...withDebug({
|
|
32
|
+
borderWidth: 2,
|
|
33
|
+
borderColor: "yellow",
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const applyMarginBottom = ({ isTablet, marginBottom }) =>
|
|
39
|
+
isTablet ? marginBottom : 0;
|
|
40
|
+
|
|
41
|
+
type Props = {
|
|
42
|
+
entry: ZappEntry;
|
|
43
|
+
layoutState: QuickBrickPlayer.LayoutState;
|
|
44
|
+
value: GetValue;
|
|
45
|
+
configuration: QuickBrickPlayer.AudioPlayerProps["configuration"];
|
|
46
|
+
onLayout?: (event: LayoutChangeEvent) => void;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const TransportInfo = ({
|
|
50
|
+
entry,
|
|
51
|
+
layoutState,
|
|
52
|
+
value,
|
|
53
|
+
configuration,
|
|
54
|
+
onLayout = noop,
|
|
55
|
+
}: Props) => {
|
|
56
|
+
const isTablet = useIsTablet();
|
|
57
|
+
const safeAreaFrame = useSafeAreaFrame();
|
|
58
|
+
const languageData = useLanguageData("audio-player");
|
|
59
|
+
|
|
60
|
+
const [marginBottom, setMarginBottom] = React.useState(0);
|
|
61
|
+
|
|
62
|
+
const handleLayout = React.useCallback(
|
|
63
|
+
(event: LayoutChangeEvent) => {
|
|
64
|
+
const height = toPositiveNumberWithDefaultZero(
|
|
65
|
+
event?.nativeEvent?.layout?.height
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const minHeight = Math.min(
|
|
69
|
+
height,
|
|
70
|
+
isTablet && isSmallTabletHeight(safeAreaFrame.height)
|
|
71
|
+
? TABLET_LANDSCAPE.MARGIN_VERTICAL_S
|
|
72
|
+
: TABLET_LANDSCAPE.MARGIN_VERTICAL
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
setMarginBottom(
|
|
76
|
+
(isTablet && isSmallTabletHeight(safeAreaFrame.height)
|
|
77
|
+
? TABLET_LANDSCAPE.MARGIN_VERTICAL_S
|
|
78
|
+
: TABLET_LANDSCAPE.MARGIN_VERTICAL) - minHeight
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// pass layoutChangeEvent to upper level
|
|
82
|
+
onLayout(event);
|
|
83
|
+
},
|
|
84
|
+
[onLayout]
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const actionButtons = React.useMemo(
|
|
88
|
+
() =>
|
|
89
|
+
compose(
|
|
90
|
+
take(2),
|
|
91
|
+
map(trim),
|
|
92
|
+
split(","),
|
|
93
|
+
propOr("", "player_action_buttons")
|
|
94
|
+
)(configuration),
|
|
95
|
+
[configuration.player_action_buttons]
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<View
|
|
100
|
+
style={[
|
|
101
|
+
styles.container,
|
|
102
|
+
{
|
|
103
|
+
marginBottom: applyMarginBottom({ isTablet, marginBottom }),
|
|
104
|
+
|
|
105
|
+
...withDebug({
|
|
106
|
+
borderWidth: 2,
|
|
107
|
+
borderColor: "red",
|
|
108
|
+
}),
|
|
109
|
+
},
|
|
110
|
+
]}
|
|
111
|
+
onLayout={handleLayout}
|
|
112
|
+
>
|
|
113
|
+
<AnimationComponent
|
|
114
|
+
animationType={ComponentAnimationType.componentFade}
|
|
115
|
+
style={styles.animatedContainer}
|
|
116
|
+
>
|
|
117
|
+
<MobileTransportInfo
|
|
118
|
+
content={entry}
|
|
119
|
+
value={value}
|
|
120
|
+
visible
|
|
121
|
+
languageData={languageData}
|
|
122
|
+
layoutState={layoutState}
|
|
123
|
+
actionButtons={actionButtons}
|
|
124
|
+
/>
|
|
125
|
+
</AnimationComponent>
|
|
126
|
+
</View>
|
|
127
|
+
);
|
|
128
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const PADDING_HORIZONTAL = 15;
|
|
2
|
+
|
|
3
|
+
export const TABLET_VERTICAL_SEPARATOR_HEIGHT = 32;
|
|
4
|
+
|
|
5
|
+
export const TABLET_VERTICAL_SEPARATOR_HEIGHT_S = 16;
|
|
6
|
+
|
|
7
|
+
export const TABLET_LANDSCAPE = {
|
|
8
|
+
MARGIN_VERTICAL: 80, // gap between safe-area edge and audio-player container
|
|
9
|
+
MARGIN_VERTICAL_S: 60, // gap between safe-area edge and audio-player container
|
|
10
|
+
MAX_HEIGHT: 750,
|
|
11
|
+
MIN_WIDTH: 320, // Minimum width for the audio player container
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const TABLET_PORTRAIT = {
|
|
15
|
+
MARGIN_HORIZONTAL: 180,
|
|
16
|
+
MAX_WIDTH: 550,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const MOBILE = {
|
|
20
|
+
MARGIN_HORIZONTAL: 30,
|
|
21
|
+
MARGIN_BOTTOM: 48,
|
|
22
|
+
MARGIN_TOP: 10,
|
|
23
|
+
MIN_HEIGHT: 458,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const NAVBAR_HEIGHT = 60;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks/layout";
|
|
2
|
+
import { MOBILE } from "../const";
|
|
3
|
+
|
|
4
|
+
type Return = {
|
|
5
|
+
imageSize: Option<number>;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const useMobileLayoutImageSize = (): Return => {
|
|
9
|
+
const { width } = useDimensions("screen");
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
imageSize: width - 2 * MOBILE.MARGIN_HORIZONTAL,
|
|
13
|
+
};
|
|
14
|
+
};
|