@applicaster/quick-brick-player 13.0.0-alpha.6400875052 → 13.0.0-alpha.6444233049

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.
Files changed (46) hide show
  1. package/package.json +5 -7
  2. package/src/Player/AudioLayer/AudioDescription.tsx +107 -68
  3. package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +87 -200
  4. package/src/Player/AudioLayer/Layout/Controls/VerticalGutter.tsx +45 -0
  5. package/src/Player/AudioLayer/Layout/Controls/index.tsx +286 -0
  6. package/src/Player/AudioLayer/Layout/{defaultLayoutsConts.ts → Controls/utils.ts} +7 -25
  7. package/src/Player/AudioLayer/Layout/Debug/index.tsx +55 -0
  8. package/src/Player/AudioLayer/Layout/{DockedLayout.tsx → DockedControls/index.tsx} +61 -53
  9. package/src/Player/AudioLayer/Layout/MobileLayout.tsx +222 -0
  10. package/src/Player/AudioLayer/Layout/PlayerImage/AnimatedImage.tsx +87 -0
  11. package/src/Player/AudioLayer/Layout/PlayerImage/FlexImage.tsx +20 -0
  12. package/src/Player/AudioLayer/Layout/PlayerImage/hooks/index.ts +1 -0
  13. package/src/Player/AudioLayer/Layout/PlayerImage/hooks/useChangePlayerState.ts +99 -0
  14. package/src/Player/AudioLayer/Layout/PlayerImage/index.tsx +112 -0
  15. package/src/Player/AudioLayer/Layout/PlayerImage/styles.ts +36 -0
  16. package/src/Player/AudioLayer/Layout/TabletLandscapeLayout.tsx +212 -0
  17. package/src/Player/AudioLayer/Layout/TabletPortraitLayout.tsx +215 -0
  18. package/src/Player/AudioLayer/Layout/TransportInfo/index.tsx +128 -0
  19. package/src/Player/AudioLayer/Layout/VerticalGutter/index.tsx +8 -0
  20. package/src/Player/AudioLayer/Layout/const.ts +26 -0
  21. package/src/Player/AudioLayer/Layout/debug.ts +6 -0
  22. package/src/Player/AudioLayer/Layout/hooks/index.ts +5 -0
  23. package/src/Player/AudioLayer/Layout/hooks/useMobileLayoutImageSize.ts +14 -0
  24. package/src/Player/AudioLayer/Layout/hooks/useTabletLayoutImageSize.ts +105 -0
  25. package/src/Player/AudioLayer/Layout/hooks/useTransportInfoHeight.ts +54 -0
  26. package/src/Player/AudioLayer/Layout/index.tsx +21 -48
  27. package/src/Player/AudioLayer/Layout/types.ts +7 -0
  28. package/src/Player/AudioLayer/Layout/utils.ts +7 -0
  29. package/src/Player/AudioLayer/SleepTimerManager.ts +22 -11
  30. package/src/Player/AudioLayer/components/SleepTimerModalHeader/SleepTimerModalHeader.tsx +66 -0
  31. package/src/Player/AudioLayer/components/SleepTimerModalHeader/index.ts +1 -0
  32. package/src/Player/AudioLayer/useSleepTimerModal.ts +109 -0
  33. package/src/Player/AudioLayer/utils.ts +6 -3
  34. package/src/Player/Const/sleepTimerOptions.ts +41 -10
  35. package/src/Player/Utils/Utils.ts +0 -5
  36. package/src/Player/Utils/index.tsx +9 -3
  37. package/src/Player/hooks/useIsCasting.tsx +57 -0
  38. package/src/Player/index.tsx +10 -5
  39. package/src/QuickBrickPlayer.tsx +3 -0
  40. package/src/Player/AudioLayer/Layout/DefaultLayout.tsx +0 -495
  41. package/src/Player/AudioLayer/LinearGradient/LinearGradientProxy.ts +0 -3
  42. package/src/Player/AudioLayer/LinearGradient/LinearGradientProxy.web.ts +0 -3
  43. package/src/Player/AudioLayer/LinearGradient/index.ts +0 -1
  44. package/src/Player/AudioLayer/MagicBG/index.tsx +0 -155
  45. package/src/Player/Helpers/VideoResizeMode.ts +0 -7
  46. package/src/utils/utils.ts +0 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-player",
3
- "version": "13.0.0-alpha.6400875052",
3
+ "version": "13.0.0-alpha.6444233049",
4
4
  "description": "Quick Brick Player",
5
5
  "main": "./src/index.ts",
6
6
  "types": "index.d.ts",
@@ -35,12 +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-rc.88",
38
+ "@applicaster/quick-brick-mobile-transport-controls": "13.0.0-rc.124",
39
39
  "@applicaster/quick-brick-tv-transport-controls": "13.0.0-rc.56",
40
- "@applicaster/zapp-react-native-tvos-app": "13.0.0-alpha.6400875052",
41
- "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.6400875052",
42
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.6400875052",
43
- "keymirror": "^0.1.1",
40
+ "@applicaster/zapp-react-native-tvos-app": "13.0.0-alpha.6444233049",
41
+ "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.6444233049",
42
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.6444233049",
44
43
  "query-string": "7.1.3",
45
44
  "react-native-web-linear-gradient": "1.1.2",
46
45
  "shaka-player": "4.3.5",
@@ -53,7 +52,6 @@
53
52
  "@applicaster/applicaster-types": "*",
54
53
  "@applicaster/blur": "*",
55
54
  "@applicaster/quick-brick-xray": "*",
56
- "@applicaster/react-native-color-thief": "*",
57
55
  "@applicaster/zapp-pipes-v2-client": "*",
58
56
  "@applicaster/zapp-react-dom-ui-components": "*",
59
57
  "@applicaster/zapp-react-native-redux": "*",
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { Text, TextStyle, View } from "react-native";
2
+ import { StyleSheet, Text, TextStyle, View } from "react-native";
3
3
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
4
4
 
5
5
  type AudioDescriptionProps = {
@@ -10,86 +10,125 @@ type AudioDescriptionProps = {
10
10
  docked: boolean;
11
11
  isModal: boolean;
12
12
  };
13
+ maxWidth?: number;
13
14
  value: GetValue;
14
15
  };
15
16
 
16
- const containerStyles = { paddingTop: 32, paddingBottom: 12 };
17
+ const TITLE_PADDING_BOTTOM = 5;
18
+ const TITLE_LINES = 2;
19
+ const SUBTITLE_LINES = 1;
17
20
 
18
- const titleStyles = (value: GetValue, prefix: string): TextStyle => ({
19
- textAlign: "left",
20
- color: value(`${prefix}title_color`),
21
- alignSelf: "center",
22
- paddingBottom: 5,
23
- lineHeight:
24
- Number(
25
- platformSelect({
26
- ios: value(`${prefix}title_lineheight_ios`),
27
- android: value(`${prefix}title_lineheight_android`),
28
- })
29
- ) || 18,
30
- letterSpacing:
31
- Number(
32
- platformSelect({
33
- ios: value(`${prefix}title_letterspacing_ios`),
34
- android: value(`${prefix}title_letterspacing_android`),
35
- })
36
- ) || 0,
37
- fontSize:
38
- Number(
39
- platformSelect({
40
- ios: value(`${prefix}title_fontsize_ios`),
41
- android: value(`${prefix}title_fontsize_android`),
42
- })
43
- ) || 16,
44
- fontFamily: platformSelect({
45
- ios: value(`${prefix}title_font_ios`),
46
- android: value(`${prefix}title_font_android`),
47
- }),
21
+ const styles = StyleSheet.create({
22
+ wrapper: {
23
+ width: "100%",
24
+ alignSelf: "center",
25
+ alignItems: "center",
26
+ justifyContent: "center",
27
+ },
28
+ titleText: {
29
+ textAlign: "center",
30
+ alignSelf: "center",
31
+ paddingBottom: TITLE_PADDING_BOTTOM,
32
+ },
33
+ summaryText: {
34
+ textAlign: "left",
35
+ alignSelf: "center",
36
+ },
48
37
  });
49
38
 
50
- const summaryStyles = (value: GetValue, prefix: string): TextStyle => ({
51
- textAlign: "left",
52
- color: value(`${prefix}subtitle_color`),
53
- alignSelf: "center",
54
- lineHeight:
55
- Number(
56
- platformSelect({
57
- ios: value(`${prefix}subtitle_lineheight_ios`),
58
- android: value(`${prefix}subtitle_lineheight_android`),
59
- })
60
- ) || 18,
61
- letterSpacing:
62
- Number(
63
- platformSelect({
64
- ios: value(`${prefix}subtitle_letterspacing_ios`),
65
- android: value(`${prefix}subtitle_letterspacing_android`),
66
- })
67
- ) || 0,
68
- fontSize:
69
- Number(
70
- platformSelect({
71
- ios: value(`${prefix}subtitle_fontsize_ios`),
72
- android: value(`${prefix}subtitle_fontsize_android`),
73
- })
74
- ) || 13,
75
- fontFamily: platformSelect({
76
- ios: value(`${prefix}subtitle_font_ios`),
77
- android: value(`${prefix}subtitle_font_android`),
78
- }),
79
- });
39
+ const getTitleStyles = (value: GetValue, prefix: string) =>
40
+ ({
41
+ color: value(`${prefix}title_color`),
42
+ lineHeight:
43
+ Number(
44
+ platformSelect({
45
+ ios: value(`${prefix}title_lineheight_ios`),
46
+ android: value(`${prefix}title_lineheight_android`),
47
+ })
48
+ ) || 18,
49
+ letterSpacing:
50
+ Number(
51
+ platformSelect({
52
+ ios: value(`${prefix}title_letterspacing_ios`),
53
+ android: value(`${prefix}title_letterspacing_android`),
54
+ })
55
+ ) || 0,
56
+ fontSize:
57
+ Number(
58
+ platformSelect({
59
+ ios: value(`${prefix}title_fontsize_ios`),
60
+ android: value(`${prefix}title_fontsize_android`),
61
+ })
62
+ ) || 16,
63
+ fontFamily: platformSelect({
64
+ ios: value(`${prefix}title_font_ios`),
65
+ android: value(`${prefix}title_font_android`),
66
+ }),
67
+ }) as const;
68
+
69
+ const getSummaryStyles = (value: GetValue, prefix: string): TextStyle =>
70
+ ({
71
+ color: value(`${prefix}subtitle_color`),
72
+ lineHeight:
73
+ Number(
74
+ platformSelect({
75
+ ios: value(`${prefix}subtitle_lineheight_ios`),
76
+ android: value(`${prefix}subtitle_lineheight_android`),
77
+ })
78
+ ) || 18,
79
+ letterSpacing:
80
+ Number(
81
+ platformSelect({
82
+ ios: value(`${prefix}subtitle_letterspacing_ios`),
83
+ android: value(`${prefix}subtitle_letterspacing_android`),
84
+ })
85
+ ) || 0,
86
+ fontSize:
87
+ Number(
88
+ platformSelect({
89
+ ios: value(`${prefix}subtitle_fontsize_ios`),
90
+ android: value(`${prefix}subtitle_fontsize_android`),
91
+ })
92
+ ) || 13,
93
+ fontFamily: platformSelect({
94
+ ios: value(`${prefix}subtitle_font_ios`),
95
+ android: value(`${prefix}subtitle_font_android`),
96
+ }),
97
+ }) as const;
98
+
99
+ const getHeight = (titleLineHeight: number, subtitleLineHeight) =>
100
+ titleLineHeight * TITLE_LINES + subtitleLineHeight + TITLE_PADDING_BOTTOM;
80
101
 
81
102
  export const AudioDescription = (props: AudioDescriptionProps) => {
82
- const { title, summary, layoutState, value } = props;
103
+ const { title, summary, layoutState, value, maxWidth } = props;
83
104
  const prefix = layoutState.docked ? "docked_player_" : "";
84
105
 
106
+ const summaryStyles = getSummaryStyles(value, prefix);
107
+ const titleStyles = getTitleStyles(value, prefix);
108
+
109
+ const height = getHeight(titleStyles.lineHeight, summaryStyles.lineHeight);
110
+
85
111
  return (
86
- <View style={containerStyles}>
87
- <Text style={titleStyles(value, prefix)} numberOfLines={1}>
112
+ <View
113
+ style={[
114
+ styles.wrapper,
115
+ {
116
+ maxWidth: Math.max(maxWidth, 320),
117
+ height,
118
+ },
119
+ ]}
120
+ >
121
+ <Text style={[styles.titleText, titleStyles]} numberOfLines={TITLE_LINES}>
88
122
  {title}
89
123
  </Text>
90
- <Text style={summaryStyles(value, prefix)} numberOfLines={2}>
91
- {summary}
92
- </Text>
124
+ {summary ? (
125
+ <Text
126
+ style={[styles.summaryText, summaryStyles]}
127
+ numberOfLines={SUBTITLE_LINES}
128
+ >
129
+ {summary}
130
+ </Text>
131
+ ) : null}
93
132
  </View>
94
133
  );
95
134
  };
@@ -1,12 +1,13 @@
1
1
  import * as React from "react";
2
+ import { useEffect, useState } from "react";
2
3
  import {
4
+ Dimensions as ScreenDimensions,
3
5
  StyleSheet,
4
- ViewStyle,
5
6
  View,
6
- Dimensions as ScreenDimensions,
7
+ ViewStyle,
7
8
  } from "react-native";
8
9
 
9
- import { SafeAreaView, Edge } from "react-native-safe-area-context";
10
+ import { Edge, SafeAreaView } from "react-native-safe-area-context";
10
11
  import { usePlayerState } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerState";
11
12
  import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
12
13
  import * as R from "ramda";
@@ -20,36 +21,29 @@ import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
20
21
  import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
21
22
  import { PlayerDetails } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/PlayerDetails";
22
23
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
23
- import { useEffect, useState } from "react";
24
- import { MagicBG } from "./MagicBG";
25
24
  import { formatSpeed } from "./utils";
26
25
  import {
27
- addQueryParam,
28
26
  getBottomSheetModalDefaultItemIcon,
29
27
  getBottomSheetModalIconProps,
30
28
  getBottomSheetModalItemProps,
31
29
  getBottomSheetModalLabelProps,
32
30
  getBottomSheetModalSelectedItemIcon,
33
- getLiveUrl,
34
31
  } from "../Utils";
35
32
  import { useTitleSummaryOverlay } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerTitleSummaryOverlay";
36
33
  import {
34
+ AnimatedScrollModal,
37
35
  AnimationComponent,
38
36
  ComponentAnimationType,
39
- AnimatedScrollModal,
40
37
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
41
- import { PADDING_HORIZONTAL } from "./Layout/defaultLayoutsConts";
38
+ import { PADDING_HORIZONTAL } from "./Layout/const";
42
39
  import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
40
+
41
+ import { DEFAULT_SPEED, PlaybackSpeed, SpeedController } from "./SpeedManager";
43
42
  import {
44
- SleepTimerController,
45
- SleepTimerState,
46
- SLEEP_TIMER_OFF,
47
- } from "./SleepTimerManager";
48
- import { SpeedController, PlaybackSpeed, DEFAULT_SPEED } from "./SpeedManager";
49
- import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
50
- import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
51
- import { openBottomSheetModal } from "@applicaster/zapp-react-native-utils/modalState";
52
- import { sleepTimerOptions } from "../Const/sleepTimerOptions";
43
+ dismissModal as dismissBottomSheetModal,
44
+ openBottomSheetModal,
45
+ useModalStoreState,
46
+ } from "@applicaster/zapp-react-native-utils/modalState";
53
47
  import { speedOptions } from "../Const/speedOptions";
54
48
 
55
49
  const { log_debug } = createLogger({
@@ -66,8 +60,6 @@ type Dimensions = {
66
60
 
67
61
  type Configuration = {
68
62
  [key: string]: any;
69
- magic_background?: boolean;
70
- audio_player_background_image_query?: string;
71
63
  audio_player_background_image_default_color?: string;
72
64
  tablet_landscape_sidebar_width?: string;
73
65
  tablet_landscape_player_container_background_color?: string;
@@ -76,7 +68,6 @@ type Configuration = {
76
68
  type Props = {
77
69
  children: React.ReactNode;
78
70
  inline?: boolean;
79
- docked?: boolean;
80
71
  configuration: Configuration;
81
72
  style: ViewStyle & Dimensions;
82
73
  entry: ZappEntry;
@@ -109,10 +100,10 @@ const edges: Edge[] = ["right", "left", "top"];
109
100
  export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
110
101
  const player = usePlayer();
111
102
  const playerState = usePlayerState("audio-player-wrapper");
112
- const theme = useTheme();
103
+
104
+ const modalBottomSheetState = useModalStoreState();
113
105
 
114
106
  const {
115
- docked,
116
107
  configuration,
117
108
  style,
118
109
  entry,
@@ -126,41 +117,45 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
126
117
 
127
118
  const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
128
119
 
129
- // TODO: Have generic place for live url from configuration. Currently its hardcoded for client.
130
-
131
- const feedUrl = getLiveUrl(entry?.extensions?.live?.channel_src ?? "");
132
-
133
120
  const { title, summary } = useTitleSummaryOverlay(
134
- feedUrl,
135
121
  entry,
136
122
  playerState?.isLive,
137
123
  configuration?.audio_live_player_update_interval
138
124
  );
139
125
 
140
- const [sleepTimerManager, setSleepTimerManager] =
141
- useState<SleepTimerController | null>(null);
142
-
143
126
  const [speedManager, setSpeedManager] = useState<SpeedController | null>(
144
127
  null
145
128
  );
146
129
 
147
130
  useEffect(() => {
148
131
  if (player) {
149
- setSleepTimerManager(new SleepTimerController(player));
150
132
  setSpeedManager(new SpeedController(player));
151
133
  } else {
152
- setSleepTimerManager(null);
153
134
  setSpeedManager(null);
154
135
  }
155
136
  }, [player]);
156
137
 
138
+ useEffect(() => {
139
+ if (!player) return;
140
+
141
+ const unsubscribe = player.addListener({
142
+ id: "audio-player-wrapper-bottom-sheet-modal",
143
+ listener: {
144
+ onVideoEnd: () => {
145
+ // Dismiss the bottom sheet modal when the video ends to avoid audio breaks and app freeze
146
+ if (modalBottomSheetState.visible) {
147
+ dismissBottomSheetModal();
148
+ }
149
+ },
150
+ },
151
+ });
152
+
153
+ return () => unsubscribe?.();
154
+ }, [player, modalBottomSheetState.visible]);
155
+
157
156
  const [playbackSpeed, setPlaybackSpeed] =
158
157
  useState<PlaybackSpeed>(DEFAULT_SPEED);
159
158
 
160
- const [sleepTimerState, setSleepTimerState] = useState<SleepTimerState>(
161
- new SleepTimerState(SLEEP_TIMER_OFF, 0)
162
- );
163
-
164
159
  const [defaultDimensions, setDefaultDimensions] =
165
160
  React.useState<Dimensions>(undefined);
166
161
 
@@ -183,17 +178,13 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
183
178
  };
184
179
 
185
180
  useEffect(() => {
186
- const sleepSubscription =
187
- sleepTimerManager?.sleepTimerState$.subscribe(setSleepTimerState);
188
-
189
181
  const speedSubscription =
190
182
  speedManager?.playbackSpeed$.subscribe(setPlaybackSpeed);
191
183
 
192
184
  return () => {
193
- sleepSubscription?.unsubscribe();
194
185
  speedSubscription?.unsubscribe();
195
186
  };
196
- }, [sleepTimerManager, speedManager]);
187
+ }, [speedManager]);
197
188
 
198
189
  useEffect(() => {
199
190
  if (!playerState.isReadyToPlay) {
@@ -201,8 +192,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
201
192
  }
202
193
 
203
194
  void speedManager?.loadSpeed();
204
- void sleepTimerManager?.loadSleep();
205
- }, [playerState.isReadyToPlay, speedManager, sleepTimerManager]);
195
+ }, [playerState.isReadyToPlay, speedManager]);
206
196
 
207
197
  const getValue = (key: string, stylesObj: {}) =>
208
198
  R.propOr(null, key, stylesObj);
@@ -250,13 +240,6 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
250
240
  [speedManager]
251
241
  );
252
242
 
253
- const onSleepSelect = React.useCallback(
254
- async (item) => {
255
- await sleepTimerManager?.setSleepTimer(item);
256
- },
257
- [sleepTimerManager]
258
- );
259
-
260
243
  const onSpeedButtonPress = React.useCallback(() => {
261
244
  openBottomSheetModal({
262
245
  modalBottomSheetContentProps: {
@@ -272,48 +255,15 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
272
255
  iconPlacement: "right",
273
256
  },
274
257
  options: {
275
- supportedOrientations: ["portrait"],
258
+ supportedOrientations: [
259
+ "portrait",
260
+ "landscape",
261
+ "portrait-upside-down",
262
+ ],
276
263
  },
277
264
  });
278
265
  }, [playbackSpeed, onSpeedSelect, configuration["playback_speed_title"]]);
279
266
 
280
- const onSleepButtonPress = React.useCallback(() => {
281
- openBottomSheetModal({
282
- modalBottomSheetContentProps: {
283
- items: [
284
- {
285
- label: configuration["playback_sleep_off_label"],
286
- value: 0,
287
- },
288
- ].concat(sleepTimerOptions),
289
- current_selection: sleepTimerState.timer,
290
- onPress: onSleepSelect,
291
- title: configuration["playback_sleep_title"],
292
- itemProps: getBottomSheetModalItemProps,
293
- iconProps: getBottomSheetModalIconProps,
294
- labelProps: getBottomSheetModalLabelProps,
295
- getSelectedItemIcon: getBottomSheetModalSelectedItemIcon,
296
- iconPlacement: "right",
297
- },
298
- options: {
299
- supportedOrientations: ["portrait"],
300
- },
301
- });
302
- }, [
303
- sleepTimerState.timer,
304
- configuration["playback_sleep_title"],
305
- configuration["playback_sleep_off_label"],
306
- onSleepSelect,
307
- ]);
308
-
309
- // This method does not actually cancel the sleep timer
310
- // (and should not to avoid race condition),
311
- // it just performs the cleanup when timer expires
312
- // TODO: rename it in code above
313
- const cancelSleepTimer = React.useCallback(() => {
314
- sleepTimerManager?.onTimerExpired();
315
- }, [sleepTimerManager]);
316
-
317
267
  const onCloseVideoModal = React.useCallback(() => {
318
268
  playerManager.close();
319
269
  }, [playerManager]);
@@ -333,116 +283,53 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
333
283
  player?.seekTo(0);
334
284
  }, [player]);
335
285
 
336
- const ContainerView = SafeAreaView;
337
-
338
- const MainContent = React.useMemo(() => {
339
- return (
340
- <ContainerView style={[style, Styles.playerContainer]} edges={edges}>
341
- <AnimationComponent
342
- animationType={ComponentAnimationType.moveUpComponent}
343
- additionalData={{ saveArea: true }}
344
- style={Styles.playerContainer}
345
- >
346
- <AnimatedScrollModal>
347
- <View style={Styles.playerContainer} onLayout={onLayout}>
348
- <Layout
349
- entry={entry}
350
- playerState={playerState}
351
- layoutState={layoutState}
352
- value={value}
353
- onPlaybackButtonPress={onPlaybackButtonPress}
354
- onRewindButtonPress={onRewindButtonPress}
355
- onForwardButtonPress={onForwardButtonPress}
356
- onPlayerSeek={onPlayerSeek}
357
- onSkipStart={onSkipStart}
358
- onSpeedButtonPress={onSpeedButtonPress}
359
- onSleepButtonPress={onSleepButtonPress}
360
- playbackSpeedName={formatSpeed(playbackSpeed.value)}
361
- playbackSleepName={
362
- sleepTimerState.timer.value === 0
363
- ? "sleep_timer"
364
- : "sleep_timer_active"
365
- }
366
- sleepTimerDate={sleepTimerState.timerDate}
367
- cancelSleepTimer={cancelSleepTimer}
368
- onSkipLive={onSkipLive}
369
- onCloseVideoModal={onCloseVideoModal}
370
- maximiseVideoModal={maximiseVideoModal}
371
- configuration={configuration}
372
- dimensions={dimensions}
373
- playNextData={playNextData}
374
- title={title}
375
- summary={summary}
376
- defaultDimensions={defaultDimensions}
377
- />
378
- <View style={Styles.paddingHorizontal}>
379
- {children}
380
- <AnimationComponent
381
- animationType={ComponentAnimationType.componentFade}
382
- >
383
- <PlayerDetails
384
- isAudioPlayer
385
- configuration={configuration}
386
- style={Styles.playerDetails}
387
- entry={entry}
388
- isTabletLandscape={isTabletLandscape}
389
- />
390
- </AnimationComponent>
391
- </View>
392
- </View>
393
- </AnimatedScrollModal>
394
- </AnimationComponent>
395
- </ContainerView>
396
- );
397
- }, [
398
- docked,
399
- style,
400
- entry,
401
- playerState,
402
- layoutState,
403
- value,
404
- onPlaybackButtonPress,
405
- onRewindButtonPress,
406
- onForwardButtonPress,
407
- onPlayerSeek,
408
- onCloseVideoModal,
409
- maximiseVideoModal,
410
- configuration,
411
- dimensions,
412
- children,
413
- playNextData,
414
- onSkipStart,
415
- onSkipLive,
416
- sleepTimerState.timer.value,
417
- sleepTimerState.timerDate,
418
- ]);
419
-
420
- if (configuration.magic_background) {
421
- const baseUrl = imageSrcFromMediaItem(entry, null);
422
-
423
- const queryParamName =
424
- configuration.audio_player_background_image_query || "width";
425
-
426
- const defaultBackgroundColor =
427
- configuration.audio_player_background_image_default_color ||
428
- theme?.app_background_color;
429
-
430
- const queryParamValue = 15;
431
-
432
- const url =
433
- baseUrl && addQueryParam(baseUrl, queryParamName, queryParamValue);
434
-
435
- return (
436
- <MagicBG
437
- image={url}
438
- fallbackUrl={baseUrl}
439
- colors={entry?.extensions?.backgroundColors}
440
- defaultColor={defaultBackgroundColor}
286
+ return (
287
+ <SafeAreaView style={[style, Styles.playerContainer]} edges={edges}>
288
+ <AnimationComponent
289
+ animationType={ComponentAnimationType.moveUpComponent}
290
+ additionalData={{ saveArea: true }}
291
+ style={Styles.playerContainer}
441
292
  >
442
- {MainContent}
443
- </MagicBG>
444
- );
445
- }
446
-
447
- return MainContent;
293
+ <AnimatedScrollModal>
294
+ <View style={Styles.playerContainer} onLayout={onLayout}>
295
+ <Layout
296
+ entry={entry}
297
+ playerState={playerState}
298
+ layoutState={layoutState}
299
+ value={value}
300
+ onPlaybackButtonPress={onPlaybackButtonPress}
301
+ onRewindButtonPress={onRewindButtonPress}
302
+ onForwardButtonPress={onForwardButtonPress}
303
+ onPlayerSeek={onPlayerSeek}
304
+ onSkipStart={onSkipStart}
305
+ onSpeedButtonPress={onSpeedButtonPress}
306
+ playbackSpeedName={formatSpeed(playbackSpeed.value)}
307
+ onSkipLive={onSkipLive}
308
+ onCloseVideoModal={onCloseVideoModal}
309
+ maximiseVideoModal={maximiseVideoModal}
310
+ configuration={configuration}
311
+ dimensions={dimensions}
312
+ playNextData={playNextData}
313
+ title={title}
314
+ summary={summary}
315
+ />
316
+ <View style={Styles.paddingHorizontal}>
317
+ {children}
318
+ <AnimationComponent
319
+ animationType={ComponentAnimationType.componentFade}
320
+ >
321
+ <PlayerDetails
322
+ isAudioPlayer
323
+ configuration={configuration}
324
+ style={Styles.playerDetails}
325
+ entry={entry}
326
+ isTabletLandscape={isTabletLandscape}
327
+ />
328
+ </AnimationComponent>
329
+ </View>
330
+ </View>
331
+ </AnimatedScrollModal>
332
+ </AnimationComponent>
333
+ </SafeAreaView>
334
+ );
448
335
  };
@@ -0,0 +1,45 @@
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 {
7
+ TABLET_VERTICAL_SEPARATOR_HEIGHT,
8
+ TABLET_VERTICAL_SEPARATOR_HEIGHT_S,
9
+ } from "../const";
10
+
11
+ import { withDebug } from "../debug";
12
+ import { useSafeAreaFrame } from "react-native-safe-area-context";
13
+ import { isSmallTabletHeight } from "../utils";
14
+
15
+ const styles = StyleSheet.create({
16
+ flexingHeight: {
17
+ flex: 1,
18
+ ...withDebug({ backgroundColor: "red" }),
19
+ },
20
+ fixedHeight: {
21
+ height: TABLET_VERTICAL_SEPARATOR_HEIGHT,
22
+ ...withDebug({ backgroundColor: "red" }),
23
+ },
24
+ fixedHeightSmall: {
25
+ height: TABLET_VERTICAL_SEPARATOR_HEIGHT_S,
26
+ ...withDebug({ backgroundColor: "red" }),
27
+ },
28
+ });
29
+
30
+ export const VerticalGutter = () => {
31
+ const isTablet = useIsTablet();
32
+ const { height } = useSafeAreaFrame();
33
+
34
+ return (
35
+ <View
36
+ style={
37
+ isTablet
38
+ ? isSmallTabletHeight(height)
39
+ ? styles.fixedHeightSmall
40
+ : styles.fixedHeight
41
+ : styles.flexingHeight
42
+ }
43
+ />
44
+ );
45
+ };