@applicaster/quick-brick-player 13.0.0-alpha.5375459737 → 13.0.0-alpha.5406200595

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 (31) hide show
  1. package/package.json +5 -6
  2. package/src/Player/AudioLayer/AudioDescription.tsx +109 -68
  3. package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +88 -126
  4. package/src/Player/AudioLayer/Layout/Controls/VerticalGutter.tsx +23 -5
  5. package/src/Player/AudioLayer/Layout/Controls/index.tsx +34 -19
  6. package/src/Player/AudioLayer/Layout/Controls/utils.ts +3 -11
  7. package/src/Player/AudioLayer/Layout/Debug/index.tsx +55 -0
  8. package/src/Player/AudioLayer/Layout/DockedControls/index.tsx +21 -19
  9. package/src/Player/AudioLayer/Layout/MobileLayout.tsx +35 -17
  10. package/src/Player/AudioLayer/Layout/PlayerImage/AnimatedImage.tsx +12 -12
  11. package/src/Player/AudioLayer/Layout/PlayerImage/FlexImage.tsx +4 -16
  12. package/src/Player/AudioLayer/Layout/PlayerImage/index.tsx +30 -20
  13. package/src/Player/AudioLayer/Layout/PlayerImage/styles.ts +15 -0
  14. package/src/Player/AudioLayer/Layout/TabletLandscapeLayout.tsx +105 -99
  15. package/src/Player/AudioLayer/Layout/TabletPortraitLayout.tsx +5 -6
  16. package/src/Player/AudioLayer/Layout/TransportInfo/index.tsx +39 -13
  17. package/src/Player/AudioLayer/Layout/const.ts +6 -0
  18. package/src/Player/AudioLayer/Layout/debug.ts +1 -1
  19. package/src/Player/AudioLayer/Layout/hooks/index.ts +3 -1
  20. package/src/Player/AudioLayer/Layout/hooks/useMobileLayoutImageSize.ts +14 -0
  21. package/src/Player/AudioLayer/Layout/hooks/{useImageSize.ts → useTabletLayoutImageSize.ts} +10 -5
  22. package/src/Player/AudioLayer/Layout/hooks/useTransportInfoHeight.ts +1 -1
  23. package/src/Player/AudioLayer/Layout/utils.ts +7 -0
  24. package/src/Player/hooks/useIsCasting.tsx +57 -0
  25. package/src/Player/index.tsx +10 -5
  26. package/src/QuickBrickPlayer.tsx +3 -0
  27. package/src/Player/AudioLayer/LinearGradient/LinearGradientProxy.ts +0 -3
  28. package/src/Player/AudioLayer/LinearGradient/LinearGradientProxy.web.ts +0 -3
  29. package/src/Player/AudioLayer/LinearGradient/index.ts +0 -1
  30. package/src/Player/AudioLayer/MagicBG/index.tsx +0 -155
  31. 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.5375459737",
3
+ "version": "13.0.0-alpha.5406200595",
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-rc.95",
38
+ "@applicaster/quick-brick-mobile-transport-controls": "13.0.0-rc.112",
39
39
  "@applicaster/quick-brick-tv-transport-controls": "13.0.0-rc.56",
40
- "@applicaster/zapp-react-native-tvos-app": "13.0.0-alpha.5375459737",
41
- "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.5375459737",
42
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.5375459737",
40
+ "@applicaster/zapp-react-native-tvos-app": "13.0.0-alpha.5406200595",
41
+ "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.5406200595",
42
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.5406200595",
43
43
  "query-string": "7.1.3",
44
44
  "react-native-web-linear-gradient": "1.1.2",
45
45
  "shaka-player": "4.3.5",
@@ -52,7 +52,6 @@
52
52
  "@applicaster/applicaster-types": "*",
53
53
  "@applicaster/blur": "*",
54
54
  "@applicaster/quick-brick-xray": "*",
55
- "@applicaster/react-native-color-thief": "*",
56
55
  "@applicaster/zapp-pipes-v2-client": "*",
57
56
  "@applicaster/zapp-react-dom-ui-components": "*",
58
57
  "@applicaster/zapp-react-native-redux": "*",
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { Text, TextStyle } 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,84 +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 titleStyles = (value: GetValue, prefix: string): TextStyle => ({
17
- textAlign: "left",
18
- color: value(`${prefix}title_color`),
19
- alignSelf: "center",
20
- paddingBottom: 5,
21
- lineHeight:
22
- Number(
23
- platformSelect({
24
- ios: value(`${prefix}title_lineheight_ios`),
25
- android: value(`${prefix}title_lineheight_android`),
26
- })
27
- ) || 18,
28
- letterSpacing:
29
- Number(
30
- platformSelect({
31
- ios: value(`${prefix}title_letterspacing_ios`),
32
- android: value(`${prefix}title_letterspacing_android`),
33
- })
34
- ) || 0,
35
- fontSize:
36
- Number(
37
- platformSelect({
38
- ios: value(`${prefix}title_fontsize_ios`),
39
- android: value(`${prefix}title_fontsize_android`),
40
- })
41
- ) || 16,
42
- fontFamily: platformSelect({
43
- ios: value(`${prefix}title_font_ios`),
44
- android: value(`${prefix}title_font_android`),
45
- }),
46
- });
17
+ const TITLE_PADDING_BOTTOM = 5;
18
+ const TITLE_LINES = 2;
19
+ const SUBTITLE_LINES = 1;
47
20
 
48
- const summaryStyles = (value: GetValue, prefix: string): TextStyle => ({
49
- textAlign: "left",
50
- color: value(`${prefix}subtitle_color`),
51
- alignSelf: "center",
52
- lineHeight:
53
- Number(
54
- platformSelect({
55
- ios: value(`${prefix}subtitle_lineheight_ios`),
56
- android: value(`${prefix}subtitle_lineheight_android`),
57
- })
58
- ) || 18,
59
- letterSpacing:
60
- Number(
61
- platformSelect({
62
- ios: value(`${prefix}subtitle_letterspacing_ios`),
63
- android: value(`${prefix}subtitle_letterspacing_android`),
64
- })
65
- ) || 0,
66
- fontSize:
67
- Number(
68
- platformSelect({
69
- ios: value(`${prefix}subtitle_fontsize_ios`),
70
- android: value(`${prefix}subtitle_fontsize_android`),
71
- })
72
- ) || 13,
73
- fontFamily: platformSelect({
74
- ios: value(`${prefix}subtitle_font_ios`),
75
- android: value(`${prefix}subtitle_font_android`),
76
- }),
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
+ },
77
37
  });
78
38
 
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;
101
+
79
102
  export const AudioDescription = (props: AudioDescriptionProps) => {
80
- const { title, summary, layoutState, value } = props;
103
+ const { title, summary, layoutState, value, maxWidth } = props;
81
104
  const prefix = layoutState.docked ? "docked_player_" : "";
82
105
 
106
+ const summaryStyles = getSummaryStyles(value, prefix);
107
+ const titleStyles = getTitleStyles(value, prefix);
108
+
109
+ const height = getHeight(titleStyles.lineHeight, summaryStyles.lineHeight);
110
+
83
111
  return (
84
- <>
85
- <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}>
86
122
  {title}
87
123
  </Text>
88
- <Text style={summaryStyles(value, prefix)} numberOfLines={1}>
89
- {summary}
90
- </Text>
91
- </>
124
+ {summary ? (
125
+ <Text
126
+ style={[styles.summaryText, summaryStyles]}
127
+ numberOfLines={SUBTITLE_LINES}
128
+ >
129
+ {summary}
130
+ </Text>
131
+ ) : null}
132
+ </View>
92
133
  );
93
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,11 +21,8 @@ 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,
@@ -33,21 +31,23 @@ import {
33
31
  } from "../Utils";
34
32
  import { useTitleSummaryOverlay } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerTitleSummaryOverlay";
35
33
  import {
34
+ AnimatedScrollModal,
36
35
  AnimationComponent,
37
36
  ComponentAnimationType,
38
- AnimatedScrollModal,
39
37
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
40
38
  import { PADDING_HORIZONTAL } from "./Layout/const";
41
39
  import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
42
40
  import {
41
+ SLEEP_TIMER_OFF,
43
42
  SleepTimerController,
44
43
  SleepTimerState,
45
- SLEEP_TIMER_OFF,
46
44
  } from "./SleepTimerManager";
47
- import { SpeedController, PlaybackSpeed, DEFAULT_SPEED } from "./SpeedManager";
48
- import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
49
- import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
50
- import { openBottomSheetModal } from "@applicaster/zapp-react-native-utils/modalState";
45
+ import { DEFAULT_SPEED, PlaybackSpeed, SpeedController } from "./SpeedManager";
46
+ import {
47
+ openBottomSheetModal,
48
+ dismissModal as dismissBottomSheetModal,
49
+ useModalStoreState,
50
+ } from "@applicaster/zapp-react-native-utils/modalState";
51
51
  import { getSleepTimerOptions } from "../Const/sleepTimerOptions";
52
52
  import { speedOptions } from "../Const/speedOptions";
53
53
 
@@ -65,8 +65,6 @@ type Dimensions = {
65
65
 
66
66
  type Configuration = {
67
67
  [key: string]: any;
68
- magic_background?: boolean;
69
- audio_player_background_image_query?: string;
70
68
  audio_player_background_image_default_color?: string;
71
69
  tablet_landscape_sidebar_width?: string;
72
70
  tablet_landscape_player_container_background_color?: string;
@@ -75,7 +73,6 @@ type Configuration = {
75
73
  type Props = {
76
74
  children: React.ReactNode;
77
75
  inline?: boolean;
78
- docked?: boolean;
79
76
  configuration: Configuration;
80
77
  style: ViewStyle & Dimensions;
81
78
  entry: ZappEntry;
@@ -108,10 +105,10 @@ const edges: Edge[] = ["right", "left", "top"];
108
105
  export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
109
106
  const player = usePlayer();
110
107
  const playerState = usePlayerState("audio-player-wrapper");
111
- const theme = useTheme();
108
+
109
+ const modalBottomSheetState = useModalStoreState();
112
110
 
113
111
  const {
114
- docked,
115
112
  configuration,
116
113
  style,
117
114
  entry,
@@ -148,6 +145,24 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
148
145
  }
149
146
  }, [player]);
150
147
 
148
+ useEffect(() => {
149
+ if (!player) return;
150
+
151
+ const unsubscribe = player.addListener({
152
+ id: "audio-player-wrapper-bottom-sheet-modal",
153
+ listener: {
154
+ onVideoEnd: () => {
155
+ // Dismiss the bottom sheet modal when the video ends to avoid audio breaks and app freeze
156
+ if (modalBottomSheetState.visible) {
157
+ dismissBottomSheetModal();
158
+ }
159
+ },
160
+ },
161
+ });
162
+
163
+ return () => unsubscribe?.();
164
+ }, [player, modalBottomSheetState.visible]);
165
+
151
166
  const [playbackSpeed, setPlaybackSpeed] =
152
167
  useState<PlaybackSpeed>(DEFAULT_SPEED);
153
168
 
@@ -330,114 +345,61 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
330
345
  player?.seekTo(0);
331
346
  }, [player]);
332
347
 
333
- const MainContent = React.useMemo(() => {
334
- return (
335
- <SafeAreaView style={[style, Styles.playerContainer]} edges={edges}>
336
- <AnimationComponent
337
- animationType={ComponentAnimationType.moveUpComponent}
338
- additionalData={{ saveArea: true }}
339
- style={Styles.playerContainer}
340
- >
341
- <AnimatedScrollModal>
342
- <View style={Styles.playerContainer} onLayout={onLayout}>
343
- <Layout
344
- entry={entry}
345
- playerState={playerState}
346
- layoutState={layoutState}
347
- value={value}
348
- onPlaybackButtonPress={onPlaybackButtonPress}
349
- onRewindButtonPress={onRewindButtonPress}
350
- onForwardButtonPress={onForwardButtonPress}
351
- onPlayerSeek={onPlayerSeek}
352
- onSkipStart={onSkipStart}
353
- onSpeedButtonPress={onSpeedButtonPress}
354
- onSleepButtonPress={onSleepButtonPress}
355
- playbackSpeedName={formatSpeed(playbackSpeed.value)}
356
- playbackSleepName={
357
- sleepTimerState.timer.value === 0
358
- ? "sleep_timer"
359
- : "sleep_timer_active"
360
- }
361
- sleepTimerDate={sleepTimerState.timerDate}
362
- cancelSleepTimer={cancelSleepTimer}
363
- onSkipLive={onSkipLive}
364
- onCloseVideoModal={onCloseVideoModal}
365
- maximiseVideoModal={maximiseVideoModal}
366
- configuration={configuration}
367
- dimensions={dimensions}
368
- playNextData={playNextData}
369
- title={title}
370
- summary={summary}
371
- defaultDimensions={defaultDimensions}
372
- />
373
- <View style={Styles.paddingHorizontal}>
374
- {children}
375
- <AnimationComponent
376
- animationType={ComponentAnimationType.componentFade}
377
- >
378
- <PlayerDetails
379
- isAudioPlayer
380
- configuration={configuration}
381
- style={Styles.playerDetails}
382
- entry={entry}
383
- isTabletLandscape={isTabletLandscape}
384
- />
385
- </AnimationComponent>
386
- </View>
387
- </View>
388
- </AnimatedScrollModal>
389
- </AnimationComponent>
390
- </SafeAreaView>
391
- );
392
- }, [
393
- docked,
394
- style,
395
- entry,
396
- playerState,
397
- layoutState,
398
- value,
399
- onPlaybackButtonPress,
400
- onRewindButtonPress,
401
- onForwardButtonPress,
402
- onPlayerSeek,
403
- onCloseVideoModal,
404
- maximiseVideoModal,
405
- configuration,
406
- dimensions,
407
- children,
408
- playNextData,
409
- onSkipStart,
410
- onSkipLive,
411
- sleepTimerState.timer.value,
412
- sleepTimerState.timerDate,
413
- ]);
414
-
415
- if (configuration.magic_background) {
416
- const baseUrl = imageSrcFromMediaItem(entry, null);
417
-
418
- const queryParamName =
419
- configuration.audio_player_background_image_query || "width";
420
-
421
- const defaultBackgroundColor =
422
- configuration.audio_player_background_image_default_color ||
423
- theme?.app_background_color;
424
-
425
- const queryParamValue = 15;
426
-
427
- const url =
428
- baseUrl && addQueryParam(baseUrl, queryParamName, queryParamValue);
429
-
430
- return (
431
- <MagicBG
432
- image={url}
433
- fallbackUrl={baseUrl}
434
- colors={entry?.extensions?.backgroundColors}
435
- defaultColor={defaultBackgroundColor}
348
+ return (
349
+ <SafeAreaView style={[style, Styles.playerContainer]} edges={edges}>
350
+ <AnimationComponent
351
+ animationType={ComponentAnimationType.moveUpComponent}
352
+ additionalData={{ saveArea: true }}
353
+ style={Styles.playerContainer}
436
354
  >
437
- {MainContent}
438
- </MagicBG>
439
- );
440
- }
441
-
442
- return MainContent;
355
+ <AnimatedScrollModal>
356
+ <View style={Styles.playerContainer} onLayout={onLayout}>
357
+ <Layout
358
+ entry={entry}
359
+ playerState={playerState}
360
+ layoutState={layoutState}
361
+ value={value}
362
+ onPlaybackButtonPress={onPlaybackButtonPress}
363
+ onRewindButtonPress={onRewindButtonPress}
364
+ onForwardButtonPress={onForwardButtonPress}
365
+ onPlayerSeek={onPlayerSeek}
366
+ onSkipStart={onSkipStart}
367
+ onSpeedButtonPress={onSpeedButtonPress}
368
+ onSleepButtonPress={onSleepButtonPress}
369
+ playbackSpeedName={formatSpeed(playbackSpeed.value)}
370
+ playbackSleepName={
371
+ sleepTimerState.timer.value === 0
372
+ ? "sleep_timer"
373
+ : "sleep_timer_active"
374
+ }
375
+ sleepTimerDate={sleepTimerState.timerDate}
376
+ cancelSleepTimer={cancelSleepTimer}
377
+ onSkipLive={onSkipLive}
378
+ onCloseVideoModal={onCloseVideoModal}
379
+ maximiseVideoModal={maximiseVideoModal}
380
+ configuration={configuration}
381
+ dimensions={dimensions}
382
+ playNextData={playNextData}
383
+ title={title}
384
+ summary={summary}
385
+ />
386
+ <View style={Styles.paddingHorizontal}>
387
+ {children}
388
+ <AnimationComponent
389
+ animationType={ComponentAnimationType.componentFade}
390
+ >
391
+ <PlayerDetails
392
+ isAudioPlayer
393
+ configuration={configuration}
394
+ style={Styles.playerDetails}
395
+ entry={entry}
396
+ isTabletLandscape={isTabletLandscape}
397
+ />
398
+ </AnimationComponent>
399
+ </View>
400
+ </View>
401
+ </AnimatedScrollModal>
402
+ </AnimationComponent>
403
+ </SafeAreaView>
404
+ );
443
405
  };
@@ -3,25 +3,43 @@ import { View, StyleSheet } from "react-native";
3
3
 
4
4
  import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
5
5
 
6
- import { TABLET_VERTICAL_SEPARATOR_HEIGHT } from "../const";
6
+ import {
7
+ TABLET_VERTICAL_SEPARATOR_HEIGHT,
8
+ TABLET_VERTICAL_SEPARATOR_HEIGHT_S,
9
+ } from "../const";
7
10
 
8
11
  import { withDebug } from "../debug";
12
+ import { useSafeAreaFrame } from "react-native-safe-area-context";
13
+ import { isSmallTabletHeight } from "../utils";
9
14
 
10
15
  const styles = StyleSheet.create({
11
16
  flexingHeight: {
12
17
  flex: 1,
13
-
14
18
  ...withDebug({ backgroundColor: "red" }),
15
19
  },
16
20
  fixedHeight: {
17
21
  height: TABLET_VERTICAL_SEPARATOR_HEIGHT,
18
-
22
+ ...withDebug({ backgroundColor: "red" }),
23
+ },
24
+ fixedHeightSmall: {
25
+ height: TABLET_VERTICAL_SEPARATOR_HEIGHT_S,
19
26
  ...withDebug({ backgroundColor: "red" }),
20
27
  },
21
28
  });
22
29
 
23
30
  export const VerticalGutter = () => {
24
31
  const isTablet = useIsTablet();
25
-
26
- return <View style={isTablet ? styles.fixedHeight : styles.flexingHeight} />;
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
+ );
27
45
  };
@@ -5,7 +5,6 @@ import { dayjs } from "@applicaster/zapp-react-native-utils/dateUtils";
5
5
  import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
6
6
  import {
7
7
  Controls as MobileTransportControls,
8
- CountDown,
9
8
  ProgressBar,
10
9
  } from "@applicaster/quick-brick-mobile-transport-controls";
11
10
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
@@ -39,19 +38,24 @@ const styles = StyleSheet.create({
39
38
  progressBar: {
40
39
  flex: 0,
41
40
  },
41
+ progressBarTrackStyles: {
42
+ borderRadius: 3,
43
+ height: 6,
44
+ },
45
+ progressBarThumbStyles: {
46
+ width: 14,
47
+ height: 14,
48
+ borderRadius: 7,
49
+ },
50
+ progressBarThumbStyles_pressed: {
51
+ width: 20,
52
+ height: 20,
53
+ borderRadius: 10,
54
+ },
42
55
  });
43
56
 
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
- });
57
+ const getControlJustifyContent = (countOfButtons: number) =>
58
+ countOfButtons <= 1 ? "center" : "space-between";
55
59
 
56
60
  type Props = {
57
61
  entry: ZappEntry;
@@ -75,6 +79,8 @@ type Props = {
75
79
  onSpeedButtonPress: Callback;
76
80
  onSleepButtonPress: Callback;
77
81
 
82
+ maxWidth?: number;
83
+
78
84
  docked: boolean;
79
85
  };
80
86
 
@@ -100,6 +106,7 @@ export const Controls = (props: Props) => {
100
106
  onSkipLive,
101
107
  onSpeedButtonPress,
102
108
  onSleepButtonPress,
109
+ maxWidth = 320,
103
110
 
104
111
  docked,
105
112
  } = props;
@@ -117,14 +124,19 @@ export const Controls = (props: Props) => {
117
124
  showFullControls = !!(controller?.hasSeekableDuration?.() && seekEnabled);
118
125
  }
119
126
 
120
- const sleepTitle = value("playback_sleep_countdown_label");
121
-
122
127
  const [timeLeft, setTimeLeft] = React.useState(
123
128
  sleepTimerDate !== 0 ? sleepTimerDate - Date.now() : 0
124
129
  );
125
130
 
126
131
  const showCounter = React.useMemo(() => sleepTimerDate > 0, [sleepTimerDate]);
127
132
 
133
+ const countDownOptions = React.useMemo(() => {
134
+ return {
135
+ showCounter: showCounter && timeLeft >= 0,
136
+ timeLeft,
137
+ };
138
+ }, [showCounter, timeLeft]);
139
+
128
140
  React.useEffect(() => {
129
141
  if (showCounter && sleepTimerDate !== 0) {
130
142
  setTimeLeft(sleepTimerDate - Date.now());
@@ -261,6 +273,7 @@ export const Controls = (props: Props) => {
261
273
  summary={summary}
262
274
  value={value}
263
275
  layoutState={layoutState}
276
+ maxWidth={maxWidth}
264
277
  />
265
278
 
266
279
  <VerticalGutter />
@@ -282,12 +295,12 @@ export const Controls = (props: Props) => {
282
295
  isDateBasedLiveContent={isDateBasedLiveContent}
283
296
  onSkipLive={onSkipLive}
284
297
  progressBarStyles={styles.progressBar}
298
+ countDownOptions={countDownOptions}
299
+ thumbStyles={styles.progressBarThumbStyles}
300
+ thumbStylesPressed={styles.progressBarThumbStyles_pressed}
301
+ trackStyles={styles.progressBarTrackStyles}
285
302
  />
286
303
 
287
- {showCounter && timeLeft >= 0 ? (
288
- <CountDown timeLeft={timeLeft} value={value} title={sleepTitle} />
289
- ) : null}
290
-
291
304
  <VerticalGutter />
292
305
  </>
293
306
  ) : null}
@@ -297,7 +310,9 @@ export const Controls = (props: Props) => {
297
310
  visible={true}
298
311
  keepAlive={null}
299
312
  buttons={controlButtons}
300
- style={controlsStyles({ isTablet, isLiveShowFullControls })}
313
+ style={{
314
+ justifyContent: getControlJustifyContent(controlButtons().length),
315
+ }}
301
316
  playerState={playerState}
302
317
  />
303
318
  </AnimationComponent>