@applicaster/quick-brick-player 13.0.0-rc.65 → 13.0.0-rc.67

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-player",
3
- "version": "13.0.0-rc.65",
3
+ "version": "13.0.0-rc.67",
4
4
  "description": "Quick Brick Player",
5
5
  "main": "./src/index.ts",
6
6
  "types": "index.d.ts",
@@ -36,11 +36,11 @@
36
36
  },
37
37
  "homepage": "https://github.com/applicaster/quickbrick#readme",
38
38
  "dependencies": {
39
- "@applicaster/quick-brick-mobile-transport-controls": "13.0.0-rc.63",
39
+ "@applicaster/quick-brick-mobile-transport-controls": "13.0.0-rc.66",
40
40
  "@applicaster/quick-brick-tv-transport-controls": "13.0.0-rc.56",
41
- "@applicaster/zapp-react-native-tvos-app": "13.0.0-rc.65",
42
- "@applicaster/zapp-react-native-ui-components": "13.0.0-rc.65",
43
- "@applicaster/zapp-react-native-utils": "13.0.0-rc.65",
41
+ "@applicaster/zapp-react-native-tvos-app": "13.0.0-rc.67",
42
+ "@applicaster/zapp-react-native-ui-components": "13.0.0-rc.67",
43
+ "@applicaster/zapp-react-native-utils": "13.0.0-rc.67",
44
44
  "keymirror": "^0.1.1",
45
45
  "query-string": "7.1.3",
46
46
  "react-native-web-linear-gradient": "1.1.2",
@@ -41,6 +41,7 @@ import {
41
41
  } from "./SleepTimerManager";
42
42
  import { SpeedController, PlaybackSpeed, DEFAULT_SPEED } from "./SpeedManager";
43
43
  import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
44
+ import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
44
45
 
45
46
  const { log_debug } = createLogger({
46
47
  subsystem: "UIComponent",
@@ -58,6 +59,7 @@ type Configuration = {
58
59
  [key: string]: any;
59
60
  magic_background?: boolean;
60
61
  audio_player_background_image_query?: string;
62
+ audio_player_background_image_default_color?: string;
61
63
  tablet_landscape_sidebar_width?: string;
62
64
  tablet_landscape_player_container_background_color?: string;
63
65
  };
@@ -130,6 +132,7 @@ const sleeps = [
130
132
  export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
131
133
  const player = usePlayer();
132
134
  const playerState = usePlayerState("audio-player-wrapper");
135
+ const theme = useTheme();
133
136
 
134
137
  const {
135
138
  docked,
@@ -451,6 +454,10 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
451
454
  const queryParamName =
452
455
  configuration.audio_player_background_image_query || "width";
453
456
 
457
+ const defaultBackgroundColor =
458
+ configuration.audio_player_background_image_default_color ||
459
+ theme?.app_background_color;
460
+
454
461
  const queryParamValue = 15;
455
462
 
456
463
  const url =
@@ -461,7 +468,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
461
468
  image={url}
462
469
  fallbackUrl={baseUrl}
463
470
  colors={entry?.extensions?.backgroundColors}
464
- defaultColor="#000000"
471
+ defaultColor={defaultBackgroundColor}
465
472
  >
466
473
  {MainContent}
467
474
  </MagicBG>
@@ -33,8 +33,13 @@ import {
33
33
  ComponentAnimationType,
34
34
  useModalAnimationContext,
35
35
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
36
+ import { PlayerAnimationStateT } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/ModalAnimationContext";
36
37
  import DockedLayout from "./DockedLayout";
37
38
  import { isValidDate } from "../../Utils";
39
+ import { calculateBorderRadius } from "../utils";
40
+
41
+ const getAudioPlayerWidthForTablet = (isPortraitMode: boolean) =>
42
+ isPortraitMode ? 463 : 350;
38
43
 
39
44
  type Dimensions = {
40
45
  width: number;
@@ -79,7 +84,8 @@ type LayoutProps = {
79
84
  defaultDimensions: Dimensions;
80
85
  };
81
86
 
82
- const { width: SCREEN_WIDTH } = ScreenDimensions.get("screen");
87
+ const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } =
88
+ ScreenDimensions.get("screen");
83
89
 
84
90
  const Styles = {
85
91
  container: { flex: 1 },
@@ -88,47 +94,63 @@ const Styles = {
88
94
  alignItems: "center",
89
95
  justifyContent: isPortraitMode ? "center" : "flex-start",
90
96
  }),
91
- playerImageWrapper: {
97
+ playerImageWrapper: (docked: boolean) => ({
92
98
  width: "100%",
93
99
  maxHeight: 750,
94
- marginTop: 80,
95
- },
100
+ marginTop: docked ? 80 : 20,
101
+ }),
96
102
  playerInfoWrapper: {
97
103
  flex: 1,
98
104
  alignItems: "center",
99
105
  justifyContent: "space-between",
100
106
  },
101
- tabletLayout: {
102
- width: 463,
107
+ tabletLayout: (isPortraitMode: boolean) => ({
108
+ width: getAudioPlayerWidthForTablet(isPortraitMode),
103
109
  marginBottom: 80,
104
- },
110
+ paddingHorizontal: undefined, // override paddingHorizontal
111
+ }),
105
112
  controls: (isTablet: boolean, isLiveShowFullControls: boolean) => ({
106
113
  height: isTablet ? 64 : 50,
107
- marginHorizontal: 10,
114
+ marginHorizontal: isTablet ? undefined : 10,
108
115
  justifyContent: isLiveShowFullControls ? "space-between" : "space-evenly",
109
116
  }),
110
- backgroundImageContainer: (dimensions: Dimensions, isTablet: boolean) => {
117
+ backgroundImageContainer: (
118
+ dimensions: Dimensions,
119
+ isTablet: boolean,
120
+ isPortraitMode: boolean
121
+ ) => {
122
+ if (isTablet) {
123
+ const size = getAudioPlayerWidthForTablet(isPortraitMode);
124
+
125
+ return {
126
+ width: size,
127
+ height: size,
128
+ };
129
+ }
130
+
111
131
  const mobileValue = dimensions?.width
112
132
  ? dimensions.width - PADDING_HORIZONTAL * 2
113
133
  : SCREEN_WIDTH - PADDING_HORIZONTAL * 2;
114
134
 
115
135
  return {
116
- width: isTablet ? 463 : mobileValue,
117
- height: isTablet ? 463 : mobileValue,
136
+ width: mobileValue,
137
+ height: mobileValue,
118
138
  };
119
139
  },
120
140
  backgroundImageContainerImageStyle: (
121
141
  isTablet: boolean,
122
142
  docked: boolean,
123
143
  startComponentsAnimation: boolean,
124
- isActiveGesture: boolean
144
+ isActiveGesture: boolean,
145
+ playerAnimationState: PlayerAnimationStateT
125
146
  ) => ({
126
- borderRadius:
127
- (startComponentsAnimation && isActiveGesture) || docked
128
- ? 0
129
- : isTablet
130
- ? 24
131
- : 10,
147
+ borderRadius: calculateBorderRadius(
148
+ isTablet,
149
+ docked,
150
+ startComponentsAnimation,
151
+ isActiveGesture,
152
+ playerAnimationState
153
+ ),
132
154
  }),
133
155
 
134
156
  paddingHorizontal: {
@@ -180,8 +202,7 @@ export default function DefaultLayout(props: LayoutProps) {
180
202
  } = props;
181
203
 
182
204
  const isTablet = useIsTablet();
183
- const { width, height } = dimensions;
184
- const isPortraitMode = width < height;
205
+ const isPortraitMode = SCREEN_WIDTH < SCREEN_HEIGHT;
185
206
  const isLiveContent = playerState.isLive;
186
207
  const docked = layoutState.docked;
187
208
 
@@ -336,11 +357,16 @@ export default function DefaultLayout(props: LayoutProps) {
336
357
  const Separator = () => <View style={Styles.separator} />;
337
358
 
338
359
  const defaultImageDimensions = React.useMemo(
339
- () => Styles.backgroundImageContainer(defaultDimensions, isTablet),
340
- [defaultDimensions, isTablet]
360
+ () =>
361
+ Styles.backgroundImageContainer(
362
+ defaultDimensions,
363
+ isTablet,
364
+ isPortraitMode
365
+ ),
366
+ [defaultDimensions, isTablet, isPortraitMode]
341
367
  );
342
368
 
343
- const { isActiveGesture, startComponentsAnimation } =
369
+ const { isActiveGesture, startComponentsAnimation, playerAnimationState } =
344
370
  useModalAnimationContext();
345
371
 
346
372
  return (
@@ -364,13 +390,16 @@ export default function DefaultLayout(props: LayoutProps) {
364
390
  </AnimationComponent>
365
391
  <AnimationComponent
366
392
  animationType={ComponentAnimationType.moveUpComponent}
367
- style={isTablet ? Styles.playerImageWrapper : undefined}
393
+ style={isTablet ? Styles.playerImageWrapper(docked) : undefined}
368
394
  >
369
395
  <AnimationComponent
370
396
  animationType={ComponentAnimationType.moveComponentHorizontal}
371
397
  additionalData={{
372
398
  disableAnimatedComponent: !isTablet,
373
- moveValue: (dimensions.width - 463) / 2,
399
+ moveValue:
400
+ (dimensions.width -
401
+ getAudioPlayerWidthForTablet(isPortraitMode)) /
402
+ 2,
374
403
  extraAnimation: !isTablet
375
404
  ? {
376
405
  [ComponentAnimationType.audioPlayerPaddingHorizontal]: {
@@ -383,12 +412,17 @@ export default function DefaultLayout(props: LayoutProps) {
383
412
  >
384
413
  <PlayerImageBackground
385
414
  entry={entry}
386
- style={Styles.backgroundImageContainer(dimensions, isTablet)}
415
+ style={Styles.backgroundImageContainer(
416
+ dimensions,
417
+ isTablet,
418
+ isPortraitMode
419
+ )}
387
420
  imageStyle={Styles.backgroundImageContainerImageStyle(
388
421
  isTablet,
389
422
  docked,
390
423
  startComponentsAnimation,
391
- isActiveGesture
424
+ isActiveGesture,
425
+ playerAnimationState
392
426
  )}
393
427
  defaultImageDimensions={defaultImageDimensions}
394
428
  />
@@ -399,7 +433,7 @@ export default function DefaultLayout(props: LayoutProps) {
399
433
  <View
400
434
  style={[
401
435
  Styles.paddingHorizontal,
402
- isTablet ? Styles.tabletLayout : undefined,
436
+ isTablet ? Styles.tabletLayout(isPortraitMode) : undefined,
403
437
  ]}
404
438
  >
405
439
  {!docked && (
@@ -230,7 +230,7 @@ export default function DockedLayout(props: LayoutProps) {
230
230
  } = useModalAnimationContext();
231
231
 
232
232
  const maximazeVideoModal = React.useCallback(
233
- () => setPlayerAnimationState(PlayerAnimationStateEnum.maximaze),
233
+ () => setPlayerAnimationState(PlayerAnimationStateEnum.maximize),
234
234
  []
235
235
  );
236
236
 
@@ -17,7 +17,7 @@ const playbackButtonMargins = (
17
17
  isTablet: boolean,
18
18
  isLiveShowFullControls: boolean
19
19
  ): number =>
20
- isLiveShowFullControls ? (isTablet ? 65 : 10) : isTablet ? 95 : 40;
20
+ isLiveShowFullControls ? (isTablet ? 65 : 10) : isTablet ? undefined : 40;
21
21
 
22
22
  export const PADDING_HORIZONTAL = 15;
23
23
 
@@ -1,4 +1,8 @@
1
1
  import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
2
+ import {
3
+ PlayerAnimationStateEnum,
4
+ PlayerAnimationStateT,
5
+ } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/ModalAnimationContext";
2
6
  import { parseJsonIfNeeded } from "@applicaster/zapp-react-native-utils/functionUtils";
3
7
 
4
8
  export const NAMESPACE = "audio-player";
@@ -31,3 +35,23 @@ export const formatSpeed = (value: number) => {
31
35
  // Return the formatted string with "speed_" prefix
32
36
  return `speed_${formattedValue}`;
33
37
  };
38
+
39
+ export const calculateBorderRadius = (
40
+ isTablet: boolean,
41
+ docked: boolean,
42
+ startComponentsAnimation: boolean,
43
+ isActiveGesture: boolean,
44
+ playerAnimationState: PlayerAnimationStateT
45
+ ): number => {
46
+ const shouldRemoveBorderRadius =
47
+ (startComponentsAnimation &&
48
+ isActiveGesture &&
49
+ playerAnimationState !== PlayerAnimationStateEnum.maximize) ||
50
+ docked;
51
+
52
+ if (shouldRemoveBorderRadius) {
53
+ return 0;
54
+ }
55
+
56
+ return isTablet ? 24 : 10;
57
+ };