@applicaster/quick-brick-player 13.0.0-alpha.2545325570 → 13.0.0-alpha.2614386581
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 +5 -5
- package/src/Player/AudioLayer/AudioDescription.tsx +4 -6
- package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +12 -20
- package/src/Player/AudioLayer/Layout/Controls/VerticalGutter.tsx +27 -0
- package/src/Player/AudioLayer/Layout/Controls/index.tsx +305 -0
- package/src/Player/AudioLayer/Layout/{defaultLayoutsConts.ts → Controls/utils.ts} +2 -12
- package/src/Player/AudioLayer/Layout/{DockedLayout.tsx → DockedControls/index.tsx} +27 -39
- package/src/Player/AudioLayer/Layout/MobileLayout.tsx +212 -0
- package/src/Player/AudioLayer/Layout/PlayerImage/AnimatedImage.tsx +83 -0
- package/src/Player/AudioLayer/Layout/PlayerImage/FlexImage.tsx +32 -0
- package/src/Player/AudioLayer/Layout/PlayerImage/index.tsx +91 -0
- package/src/Player/AudioLayer/Layout/PlayerImage/styles.ts +17 -0
- package/src/Player/AudioLayer/Layout/TabletLandscapeLayout.tsx +207 -0
- package/src/Player/AudioLayer/Layout/TabletPortraitLayout.tsx +224 -0
- package/src/Player/AudioLayer/Layout/TransportInfo/index.tsx +102 -0
- package/src/Player/AudioLayer/Layout/VerticalGutter/index.tsx +8 -0
- package/src/Player/AudioLayer/Layout/const.ts +20 -0
- package/src/Player/AudioLayer/Layout/debug.ts +6 -0
- package/src/Player/AudioLayer/Layout/hooks/index.ts +3 -0
- package/src/Player/AudioLayer/Layout/hooks/useImageSize.ts +100 -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 +5 -0
- package/src/Player/index.tsx +4 -1
- package/src/Player/AudioLayer/Layout/DefaultLayout.tsx +0 -495
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-player",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.2614386581",
|
|
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": "13.0.0-
|
|
38
|
+
"@applicaster/quick-brick-mobile-transport-controls": "13.0.0-alpha.2614386581",
|
|
39
39
|
"@applicaster/quick-brick-tv-transport-controls": "13.0.0-rc.56",
|
|
40
|
-
"@applicaster/zapp-react-native-tvos-app": "13.0.0-alpha.
|
|
41
|
-
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.
|
|
42
|
-
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.
|
|
40
|
+
"@applicaster/zapp-react-native-tvos-app": "13.0.0-alpha.2614386581",
|
|
41
|
+
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.2614386581",
|
|
42
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.2614386581",
|
|
43
43
|
"keymirror": "^0.1.1",
|
|
44
44
|
"query-string": "7.1.3",
|
|
45
45
|
"react-native-web-linear-gradient": "1.1.2",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Text, TextStyle
|
|
2
|
+
import { Text, TextStyle } from "react-native";
|
|
3
3
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
4
4
|
|
|
5
5
|
type AudioDescriptionProps = {
|
|
@@ -13,8 +13,6 @@ type AudioDescriptionProps = {
|
|
|
13
13
|
value: GetValue;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
const containerStyles = { paddingTop: 32, paddingBottom: 12 };
|
|
17
|
-
|
|
18
16
|
const titleStyles = (value: GetValue, prefix: string): TextStyle => ({
|
|
19
17
|
textAlign: "left",
|
|
20
18
|
color: value(`${prefix}title_color`),
|
|
@@ -83,13 +81,13 @@ export const AudioDescription = (props: AudioDescriptionProps) => {
|
|
|
83
81
|
const prefix = layoutState.docked ? "docked_player_" : "";
|
|
84
82
|
|
|
85
83
|
return (
|
|
86
|
-
|
|
84
|
+
<>
|
|
87
85
|
<Text style={titleStyles(value, prefix)} numberOfLines={1}>
|
|
88
86
|
{title}
|
|
89
87
|
</Text>
|
|
90
|
-
<Text style={summaryStyles(value, prefix)} numberOfLines={
|
|
88
|
+
<Text style={summaryStyles(value, prefix)} numberOfLines={1}>
|
|
91
89
|
{summary}
|
|
92
90
|
</Text>
|
|
93
|
-
|
|
91
|
+
</>
|
|
94
92
|
);
|
|
95
93
|
};
|
|
@@ -25,15 +25,9 @@ import {
|
|
|
25
25
|
ComponentAnimationType,
|
|
26
26
|
AnimatedScrollModal,
|
|
27
27
|
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
28
|
-
import { PADDING_HORIZONTAL } from "./Layout/
|
|
28
|
+
import { PADDING_HORIZONTAL } from "./Layout/const";
|
|
29
29
|
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
30
|
-
|
|
31
|
-
speed_0_8,
|
|
32
|
-
speed_1,
|
|
33
|
-
speed_1_2,
|
|
34
|
-
speed_1_5,
|
|
35
|
-
speed_2,
|
|
36
|
-
} from "@applicaster/quick-brick-mobile-transport-controls";
|
|
30
|
+
|
|
37
31
|
import {
|
|
38
32
|
SleepTimerController,
|
|
39
33
|
SleepTimerState,
|
|
@@ -129,6 +123,14 @@ const sleeps = [
|
|
|
129
123
|
{ label: "2 hours", value: 120 },
|
|
130
124
|
];
|
|
131
125
|
|
|
126
|
+
const speeds = [
|
|
127
|
+
{ label: "0.8x", value: 0.8 },
|
|
128
|
+
{ label: "1x", value: 1.0 },
|
|
129
|
+
{ label: "1.2x", value: 1.2 },
|
|
130
|
+
{ label: "1.5x", value: 1.5 },
|
|
131
|
+
{ label: "2x", value: 2.0 },
|
|
132
|
+
];
|
|
133
|
+
|
|
132
134
|
const edges: Edge[] = ["right", "left", "top"];
|
|
133
135
|
|
|
134
136
|
export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
@@ -147,14 +149,6 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
147
149
|
isTabletPortrait,
|
|
148
150
|
} = props;
|
|
149
151
|
|
|
150
|
-
const speeds = [
|
|
151
|
-
{ asset: configuration["speed_0_8"] || speed_0_8, value: 0.8 },
|
|
152
|
-
{ asset: configuration["speed_1"] || speed_1, value: 1.0 },
|
|
153
|
-
{ asset: configuration["speed_1_2"] || speed_1_2, value: 1.2 },
|
|
154
|
-
{ asset: configuration["speed_1_5"] || speed_1_5, value: 1.5 },
|
|
155
|
-
{ asset: configuration["speed_2"] || speed_2, value: 2.0 },
|
|
156
|
-
];
|
|
157
|
-
|
|
158
152
|
const isTablet = useIsTablet();
|
|
159
153
|
|
|
160
154
|
const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
|
|
@@ -364,11 +358,9 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
364
358
|
player?.seekTo(0);
|
|
365
359
|
}, [player]);
|
|
366
360
|
|
|
367
|
-
const ContainerView = SafeAreaView;
|
|
368
|
-
|
|
369
361
|
const MainContent = React.useMemo(() => {
|
|
370
362
|
return (
|
|
371
|
-
<
|
|
363
|
+
<SafeAreaView style={Styles.mainContainer(style)} edges={edges}>
|
|
372
364
|
<AnimationComponent
|
|
373
365
|
animationType={ComponentAnimationType.moveUpComponent}
|
|
374
366
|
additionalData={{ saveArea: true }}
|
|
@@ -423,7 +415,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
423
415
|
</View>
|
|
424
416
|
</AnimatedScrollModal>
|
|
425
417
|
</AnimationComponent>
|
|
426
|
-
</
|
|
418
|
+
</SafeAreaView>
|
|
427
419
|
);
|
|
428
420
|
}, [
|
|
429
421
|
docked,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
5
|
+
|
|
6
|
+
import { TABLET_VERTICAL_SEPARATOR_HEIGHT } from "../const";
|
|
7
|
+
|
|
8
|
+
import { withDebug } from "../debug";
|
|
9
|
+
|
|
10
|
+
const styles = StyleSheet.create({
|
|
11
|
+
flexingHeight: {
|
|
12
|
+
flex: 1,
|
|
13
|
+
|
|
14
|
+
...withDebug({ backgroundColor: "red" }),
|
|
15
|
+
},
|
|
16
|
+
fixedHeight: {
|
|
17
|
+
height: TABLET_VERTICAL_SEPARATOR_HEIGHT,
|
|
18
|
+
|
|
19
|
+
...withDebug({ backgroundColor: "red" }),
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const VerticalGutter = () => {
|
|
24
|
+
const isTablet = useIsTablet();
|
|
25
|
+
|
|
26
|
+
return <View style={isTablet ? styles.fixedHeight : styles.flexingHeight} />;
|
|
27
|
+
};
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { dayjs } from "@applicaster/zapp-react-native-utils/dateUtils";
|
|
5
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
6
|
+
import {
|
|
7
|
+
Controls as MobileTransportControls,
|
|
8
|
+
CountDown,
|
|
9
|
+
ProgressBar,
|
|
10
|
+
} from "@applicaster/quick-brick-mobile-transport-controls";
|
|
11
|
+
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
AnimationComponent,
|
|
15
|
+
ComponentAnimationType,
|
|
16
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
17
|
+
|
|
18
|
+
import { AudioDescription } from "../../AudioDescription";
|
|
19
|
+
import { isValidDate } from "../../../Utils";
|
|
20
|
+
import { VerticalGutter } from "./VerticalGutter";
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
forwardButton,
|
|
24
|
+
playbackButton,
|
|
25
|
+
rewindButton,
|
|
26
|
+
skipToLiveButton,
|
|
27
|
+
skipToStartButton,
|
|
28
|
+
sleepButton,
|
|
29
|
+
speedButton,
|
|
30
|
+
} from "./utils";
|
|
31
|
+
|
|
32
|
+
const styles = StyleSheet.create({
|
|
33
|
+
flex: {
|
|
34
|
+
flex: 1,
|
|
35
|
+
},
|
|
36
|
+
nonFlex: {
|
|
37
|
+
flex: 0,
|
|
38
|
+
},
|
|
39
|
+
progressBar: {
|
|
40
|
+
flex: 0,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const controlsStyles = ({
|
|
45
|
+
isTablet,
|
|
46
|
+
isLiveShowFullControls,
|
|
47
|
+
}: {
|
|
48
|
+
isTablet: boolean;
|
|
49
|
+
isLiveShowFullControls: boolean;
|
|
50
|
+
}) => ({
|
|
51
|
+
height: isTablet ? undefined : 50,
|
|
52
|
+
marginHorizontal: isTablet ? undefined : 10,
|
|
53
|
+
justifyContent: isLiveShowFullControls ? "space-between" : "space-evenly",
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
type Props = {
|
|
57
|
+
entry: ZappEntry;
|
|
58
|
+
layoutState: QuickBrickPlayer.LayoutState;
|
|
59
|
+
playerState: QuickBrickPlayer.PlayerState;
|
|
60
|
+
value: GetValue;
|
|
61
|
+
title: string | number;
|
|
62
|
+
summary: string | number;
|
|
63
|
+
sleepTimerDate: number;
|
|
64
|
+
cancelSleepTimer: Callback;
|
|
65
|
+
|
|
66
|
+
playbackSpeedName: string;
|
|
67
|
+
playbackSleepName: string;
|
|
68
|
+
|
|
69
|
+
onPlaybackButtonPress: Callback;
|
|
70
|
+
onRewindButtonPress: Callback;
|
|
71
|
+
onForwardButtonPress: Callback;
|
|
72
|
+
onPlayerSeek: (targetTime: number) => void;
|
|
73
|
+
onSkipStart: Callback;
|
|
74
|
+
onSkipLive: Callback;
|
|
75
|
+
onSpeedButtonPress: Callback;
|
|
76
|
+
onSleepButtonPress: Callback;
|
|
77
|
+
|
|
78
|
+
docked: boolean;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const Controls = (props: Props) => {
|
|
82
|
+
const {
|
|
83
|
+
entry,
|
|
84
|
+
layoutState,
|
|
85
|
+
playerState,
|
|
86
|
+
value,
|
|
87
|
+
title,
|
|
88
|
+
summary,
|
|
89
|
+
sleepTimerDate,
|
|
90
|
+
cancelSleepTimer,
|
|
91
|
+
|
|
92
|
+
playbackSpeedName,
|
|
93
|
+
playbackSleepName,
|
|
94
|
+
|
|
95
|
+
onPlaybackButtonPress,
|
|
96
|
+
onRewindButtonPress,
|
|
97
|
+
onForwardButtonPress,
|
|
98
|
+
onPlayerSeek,
|
|
99
|
+
onSkipStart,
|
|
100
|
+
onSkipLive,
|
|
101
|
+
onSpeedButtonPress,
|
|
102
|
+
onSleepButtonPress,
|
|
103
|
+
|
|
104
|
+
docked,
|
|
105
|
+
} = props;
|
|
106
|
+
|
|
107
|
+
const isTablet = useIsTablet();
|
|
108
|
+
const controller = playerManager.getActivePlayer();
|
|
109
|
+
let showFullControls = !controller?.isAd();
|
|
110
|
+
const liveButton = Boolean(value("live_badge_enabled"));
|
|
111
|
+
|
|
112
|
+
const isLiveContent = playerState.isLive;
|
|
113
|
+
|
|
114
|
+
if (isLiveContent) {
|
|
115
|
+
const seekEnabled = Boolean(value("liveSeekingEnabled"));
|
|
116
|
+
|
|
117
|
+
showFullControls = !!(controller?.hasSeekableDuration?.() && seekEnabled);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const sleepTitle = value("playback_sleep_countdown_label");
|
|
121
|
+
|
|
122
|
+
const [timeLeft, setTimeLeft] = React.useState(
|
|
123
|
+
sleepTimerDate !== 0 ? sleepTimerDate - Date.now() : 0
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const showCounter = React.useMemo(() => sleepTimerDate > 0, [sleepTimerDate]);
|
|
127
|
+
|
|
128
|
+
React.useEffect(() => {
|
|
129
|
+
if (showCounter && sleepTimerDate !== 0) {
|
|
130
|
+
setTimeLeft(sleepTimerDate - Date.now());
|
|
131
|
+
|
|
132
|
+
const intervalId = setInterval(() => {
|
|
133
|
+
setTimeLeft(() => {
|
|
134
|
+
const newTimeLeft = sleepTimerDate - Date.now();
|
|
135
|
+
|
|
136
|
+
if (newTimeLeft <= 0) {
|
|
137
|
+
clearInterval(intervalId);
|
|
138
|
+
|
|
139
|
+
cancelSleepTimer();
|
|
140
|
+
|
|
141
|
+
return 0;
|
|
142
|
+
} else {
|
|
143
|
+
return newTimeLeft;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}, 1000);
|
|
147
|
+
|
|
148
|
+
return () => clearInterval(intervalId);
|
|
149
|
+
} else {
|
|
150
|
+
setTimeLeft(0);
|
|
151
|
+
}
|
|
152
|
+
}, [sleepTimerDate, showCounter, cancelSleepTimer]);
|
|
153
|
+
|
|
154
|
+
const startTime = entry.extensions?.live?.start_time;
|
|
155
|
+
const endTime = entry.extensions?.live?.end_time;
|
|
156
|
+
|
|
157
|
+
const hasValidStartTime = isValidDate(startTime);
|
|
158
|
+
const hasValidEndTime = isValidDate(endTime);
|
|
159
|
+
|
|
160
|
+
const isDateBasedLiveContent =
|
|
161
|
+
isLiveContent && hasValidStartTime && hasValidEndTime;
|
|
162
|
+
|
|
163
|
+
const needsToShowProgressBar =
|
|
164
|
+
(isLiveContent &&
|
|
165
|
+
(Boolean(value("liveSeekingEnabled")) || isDateBasedLiveContent)) ||
|
|
166
|
+
!isLiveContent;
|
|
167
|
+
|
|
168
|
+
const startTimestamp = hasValidStartTime
|
|
169
|
+
? dayjs.utc(startTime!).valueOf()
|
|
170
|
+
: undefined;
|
|
171
|
+
|
|
172
|
+
const endTimestamp = hasValidEndTime
|
|
173
|
+
? dayjs.utc(endTime!).valueOf()
|
|
174
|
+
: undefined;
|
|
175
|
+
|
|
176
|
+
const isLiveShowFullControls = showFullControls && isLiveContent;
|
|
177
|
+
|
|
178
|
+
const controlButtons = React.useCallback((): Array<ControlsButton> => {
|
|
179
|
+
const play = playbackButton({
|
|
180
|
+
playerState,
|
|
181
|
+
liveButton,
|
|
182
|
+
isTablet,
|
|
183
|
+
isLiveShowFullControls,
|
|
184
|
+
onPress: onPlaybackButtonPress,
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
if (!showFullControls) {
|
|
188
|
+
return [play];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const rewind = rewindButton({
|
|
192
|
+
isTablet,
|
|
193
|
+
onPress: controller?.hasSeekableDuration?.() ? onRewindButtonPress : null,
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
const forward = forwardButton({
|
|
197
|
+
isTablet,
|
|
198
|
+
onPress: controller?.hasSeekableDuration?.()
|
|
199
|
+
? onForwardButtonPress
|
|
200
|
+
: null,
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
const speed = speedButton({
|
|
204
|
+
isTablet,
|
|
205
|
+
onPress: onSpeedButtonPress,
|
|
206
|
+
name: playbackSpeedName,
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
const sleep = sleepButton({
|
|
210
|
+
isTablet,
|
|
211
|
+
onPress: onSleepButtonPress,
|
|
212
|
+
name: playbackSleepName,
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
if (isLiveContent) {
|
|
216
|
+
const skipToStart = skipToStartButton({
|
|
217
|
+
isTablet,
|
|
218
|
+
onPress: onSkipStart,
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
const skipToLive = skipToLiveButton({
|
|
222
|
+
isTablet,
|
|
223
|
+
onPress: onSkipLive,
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
return [skipToStart, rewind, play, forward, skipToLive];
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return [speed, rewind, play, forward, sleep];
|
|
230
|
+
}, [
|
|
231
|
+
playerState,
|
|
232
|
+
liveButton,
|
|
233
|
+
isTablet,
|
|
234
|
+
onPlaybackButtonPress,
|
|
235
|
+
onRewindButtonPress,
|
|
236
|
+
onForwardButtonPress,
|
|
237
|
+
onSpeedButtonPress,
|
|
238
|
+
showFullControls,
|
|
239
|
+
onSkipStart,
|
|
240
|
+
onSkipLive,
|
|
241
|
+
isLiveContent,
|
|
242
|
+
playbackSpeedName,
|
|
243
|
+
playbackSleepName,
|
|
244
|
+
controller,
|
|
245
|
+
isLiveShowFullControls,
|
|
246
|
+
]);
|
|
247
|
+
|
|
248
|
+
if (docked) {
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return (
|
|
253
|
+
<AnimationComponent
|
|
254
|
+
animationType={ComponentAnimationType.componentFade}
|
|
255
|
+
style={isTablet ? styles.nonFlex : styles.flex}
|
|
256
|
+
>
|
|
257
|
+
<VerticalGutter />
|
|
258
|
+
|
|
259
|
+
<AudioDescription
|
|
260
|
+
title={title}
|
|
261
|
+
summary={summary}
|
|
262
|
+
value={value}
|
|
263
|
+
layoutState={layoutState}
|
|
264
|
+
/>
|
|
265
|
+
|
|
266
|
+
<VerticalGutter />
|
|
267
|
+
|
|
268
|
+
{needsToShowProgressBar ? (
|
|
269
|
+
<>
|
|
270
|
+
<ProgressBar
|
|
271
|
+
name={"audio-default-layout"}
|
|
272
|
+
content={entry}
|
|
273
|
+
value={value}
|
|
274
|
+
visible
|
|
275
|
+
layoutState={layoutState}
|
|
276
|
+
onPlayerSeek={onPlayerSeek}
|
|
277
|
+
playerState={playerState}
|
|
278
|
+
disableFullscreen
|
|
279
|
+
sliderStyle={2}
|
|
280
|
+
startTimestamp={startTimestamp}
|
|
281
|
+
endTimestamp={endTimestamp}
|
|
282
|
+
isDateBasedLiveContent={isDateBasedLiveContent}
|
|
283
|
+
onSkipLive={onSkipLive}
|
|
284
|
+
progressBarStyles={styles.progressBar}
|
|
285
|
+
/>
|
|
286
|
+
|
|
287
|
+
{showCounter && timeLeft >= 0 ? (
|
|
288
|
+
<CountDown timeLeft={timeLeft} value={value} title={sleepTitle} />
|
|
289
|
+
) : null}
|
|
290
|
+
|
|
291
|
+
<VerticalGutter />
|
|
292
|
+
</>
|
|
293
|
+
) : null}
|
|
294
|
+
|
|
295
|
+
<MobileTransportControls
|
|
296
|
+
value={value}
|
|
297
|
+
visible={true}
|
|
298
|
+
keepAlive={null}
|
|
299
|
+
buttons={controlButtons}
|
|
300
|
+
style={controlsStyles({ isTablet, isLiveShowFullControls })}
|
|
301
|
+
playerState={playerState}
|
|
302
|
+
/>
|
|
303
|
+
</AnimationComponent>
|
|
304
|
+
);
|
|
305
|
+
};
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
type PlayerState = {
|
|
2
|
-
currentTime: number;
|
|
3
|
-
duration: number;
|
|
4
|
-
seekableDuration: number;
|
|
5
|
-
isLive: boolean;
|
|
6
|
-
isPaused: boolean;
|
|
7
|
-
isBuffering: boolean;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
1
|
const rewindButtonSize = (isTablet: boolean): keyof ButtonSizeStyles =>
|
|
11
2
|
isTablet ? "big" : "smallMargins";
|
|
12
3
|
|
|
@@ -19,8 +10,6 @@ const playbackButtonMargins = (
|
|
|
19
10
|
): number =>
|
|
20
11
|
isLiveShowFullControls ? (isTablet ? 65 : 10) : isTablet ? undefined : 40;
|
|
21
12
|
|
|
22
|
-
export const PADDING_HORIZONTAL = 15;
|
|
23
|
-
|
|
24
13
|
export const playbackButton = ({
|
|
25
14
|
playerState,
|
|
26
15
|
liveButton,
|
|
@@ -28,7 +17,7 @@ export const playbackButton = ({
|
|
|
28
17
|
isLiveShowFullControls,
|
|
29
18
|
onPress,
|
|
30
19
|
}: {
|
|
31
|
-
playerState: PlayerState;
|
|
20
|
+
playerState: QuickBrickPlayer.PlayerState;
|
|
32
21
|
liveButton: boolean;
|
|
33
22
|
isTablet: boolean;
|
|
34
23
|
isLiveShowFullControls: boolean;
|
|
@@ -57,6 +46,7 @@ type ButtonsProps = {
|
|
|
57
46
|
style?: any;
|
|
58
47
|
name?: string;
|
|
59
48
|
};
|
|
49
|
+
|
|
60
50
|
type ButtonsByNameProps = ButtonsProps & { name?: string };
|
|
61
51
|
|
|
62
52
|
const rewindButtonByName = ({
|
|
@@ -16,43 +16,24 @@ import {
|
|
|
16
16
|
} from "@applicaster/quick-brick-mobile-transport-controls";
|
|
17
17
|
|
|
18
18
|
import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
|
|
19
|
+
|
|
19
20
|
import {
|
|
20
21
|
AnimationComponent,
|
|
21
22
|
ComponentAnimationType,
|
|
22
|
-
defaultAspectRatioWidth,
|
|
23
23
|
PlayerAnimationStateEnum,
|
|
24
24
|
useModalAnimationContext,
|
|
25
25
|
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
26
|
+
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
26
27
|
|
|
27
|
-
type
|
|
28
|
-
width: number;
|
|
29
|
-
height: number;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
type LayoutProps = {
|
|
28
|
+
type Props = {
|
|
33
29
|
entry: ZappEntry;
|
|
34
|
-
layoutState:
|
|
35
|
-
|
|
36
|
-
docked: boolean;
|
|
37
|
-
isModal: boolean;
|
|
38
|
-
};
|
|
39
|
-
playerState: {
|
|
40
|
-
currentTime: number;
|
|
41
|
-
duration: number;
|
|
42
|
-
seekableDuration: number;
|
|
43
|
-
isLive: boolean;
|
|
44
|
-
isPaused: boolean;
|
|
45
|
-
isBuffering: boolean;
|
|
46
|
-
};
|
|
30
|
+
layoutState: QuickBrickPlayer.LayoutState;
|
|
31
|
+
playerState: QuickBrickPlayer.PlayerState;
|
|
47
32
|
value: GetValue;
|
|
48
|
-
configuration:
|
|
49
|
-
|
|
50
|
-
onRewindButtonPress: () => void;
|
|
51
|
-
onForwardButtonPress: () => void;
|
|
52
|
-
onPlayerSeek: (targetTime: number) => void;
|
|
33
|
+
configuration: QuickBrickPlayer.AudioPlayerProps["configuration"];
|
|
34
|
+
dimensions: QuickBrickPlayer.AudioPlayerProps["dimensions"];
|
|
53
35
|
onCloseVideoModal: () => void;
|
|
54
|
-
|
|
55
|
-
dimensions: Dimensions;
|
|
36
|
+
onPlayerSeek: (targetTime: number) => void;
|
|
56
37
|
playNextData: PlayNextData;
|
|
57
38
|
title: string | number;
|
|
58
39
|
summary: string | number;
|
|
@@ -114,17 +95,21 @@ const playerDimensionsStyle = (
|
|
|
114
95
|
minimisedHeight: number,
|
|
115
96
|
addPadding: boolean
|
|
116
97
|
): ViewStyle => ({
|
|
117
|
-
paddingLeft: addPadding ?
|
|
98
|
+
paddingLeft: addPadding ? toNumberWithDefault(100, minimisedHeight) : 0,
|
|
118
99
|
});
|
|
119
100
|
|
|
120
|
-
const animatedContainerStyle = (
|
|
101
|
+
const animatedContainerStyle = (
|
|
102
|
+
docked: boolean,
|
|
103
|
+
progressBarHeight: number
|
|
104
|
+
): ViewStyle => ({
|
|
105
|
+
top: progressBarHeight,
|
|
121
106
|
position: "absolute",
|
|
122
107
|
width: "100%",
|
|
123
108
|
zIndex: docked ? 1 : -1,
|
|
124
109
|
});
|
|
125
110
|
|
|
126
111
|
const backgroundImageStyle = (
|
|
127
|
-
dimensions:
|
|
112
|
+
dimensions: QuickBrickPlayer.AudioPlayerProps["dimensions"],
|
|
128
113
|
minimisedHeight: number,
|
|
129
114
|
isActiveGesture: boolean
|
|
130
115
|
): ViewStyle => ({
|
|
@@ -190,16 +175,16 @@ const controlButtons = (
|
|
|
190
175
|
];
|
|
191
176
|
};
|
|
192
177
|
|
|
193
|
-
export
|
|
178
|
+
export const DockedControls = (props: Props) => {
|
|
194
179
|
const {
|
|
180
|
+
entry,
|
|
195
181
|
layoutState,
|
|
182
|
+
playerState,
|
|
196
183
|
value,
|
|
184
|
+
configuration,
|
|
197
185
|
dimensions,
|
|
198
|
-
entry,
|
|
199
186
|
onCloseVideoModal,
|
|
200
187
|
onPlayerSeek,
|
|
201
|
-
playerState,
|
|
202
|
-
configuration,
|
|
203
188
|
playNextData,
|
|
204
189
|
title,
|
|
205
190
|
summary,
|
|
@@ -207,7 +192,6 @@ export default function DockedLayout(props: LayoutProps) {
|
|
|
207
192
|
|
|
208
193
|
const isTablet = useIsTablet();
|
|
209
194
|
|
|
210
|
-
const visible = true;
|
|
211
195
|
const liveButton = Boolean(value("live_badge_enabled"));
|
|
212
196
|
|
|
213
197
|
const {
|
|
@@ -215,6 +199,7 @@ export default function DockedLayout(props: LayoutProps) {
|
|
|
215
199
|
setPlayerAnimationState,
|
|
216
200
|
startComponentsAnimation,
|
|
217
201
|
minimisedHeight,
|
|
202
|
+
progressBarHeight,
|
|
218
203
|
} = useModalAnimationContext();
|
|
219
204
|
|
|
220
205
|
const maximazeVideoModal = React.useCallback(
|
|
@@ -229,7 +214,10 @@ export default function DockedLayout(props: LayoutProps) {
|
|
|
229
214
|
animationType={ComponentAnimationType.componentAppears}
|
|
230
215
|
style={[
|
|
231
216
|
styles.container,
|
|
232
|
-
animatedContainerStyle(
|
|
217
|
+
animatedContainerStyle(
|
|
218
|
+
isActiveGesture || layoutState.docked,
|
|
219
|
+
progressBarHeight
|
|
220
|
+
),
|
|
233
221
|
]}
|
|
234
222
|
>
|
|
235
223
|
{!playerState.isLive &&
|
|
@@ -238,7 +226,7 @@ export default function DockedLayout(props: LayoutProps) {
|
|
|
238
226
|
name={"audio-docked-layout"}
|
|
239
227
|
content={entry}
|
|
240
228
|
value={value}
|
|
241
|
-
visible
|
|
229
|
+
visible
|
|
242
230
|
layoutState={layoutState}
|
|
243
231
|
onPlayerSeek={onPlayerSeek}
|
|
244
232
|
playerState={playerState}
|
|
@@ -289,7 +277,7 @@ export default function DockedLayout(props: LayoutProps) {
|
|
|
289
277
|
>
|
|
290
278
|
<Controls
|
|
291
279
|
value={value}
|
|
292
|
-
visible
|
|
280
|
+
visible
|
|
293
281
|
buttons={R.partial(controlButtons, [
|
|
294
282
|
playerState.isLive && liveButton,
|
|
295
283
|
])}
|
|
@@ -308,4 +296,4 @@ export default function DockedLayout(props: LayoutProps) {
|
|
|
308
296
|
</View>
|
|
309
297
|
</AnimationComponent>
|
|
310
298
|
);
|
|
311
|
-
}
|
|
299
|
+
};
|