@applicaster/quick-brick-player 13.0.0-alpha.1524165353 → 13.0.0-alpha.1545345200

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-alpha.1524165353",
3
+ "version": "13.0.0-alpha.1545345200",
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-alpha.1524165353",
38
+ "@applicaster/quick-brick-mobile-transport-controls": "13.0.0-alpha.1545345200",
39
39
  "@applicaster/quick-brick-tv-transport-controls": "13.0.0-rc.56",
40
- "@applicaster/zapp-react-native-tvos-app": "13.0.0-alpha.1524165353",
41
- "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.1524165353",
42
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1524165353",
43
- "keymirror": "^0.1.1",
40
+ "@applicaster/zapp-react-native-tvos-app": "13.0.0-alpha.1545345200",
41
+ "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.1545345200",
42
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1545345200",
44
43
  "query-string": "7.1.3",
45
44
  "react-native-web-linear-gradient": "1.1.2",
46
45
  "shaka-player": "4.3.5",
@@ -1,5 +1,10 @@
1
1
  import * as React from "react";
2
- import { ViewStyle, View, Dimensions as ScreenDimensions } from "react-native";
2
+ import {
3
+ StyleSheet,
4
+ ViewStyle,
5
+ View,
6
+ Dimensions as ScreenDimensions,
7
+ } from "react-native";
3
8
 
4
9
  import { SafeAreaView, Edge } from "react-native-safe-area-context";
5
10
  import { usePlayerState } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerState";
@@ -18,7 +23,14 @@ import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
18
23
  import { useEffect, useState } from "react";
19
24
  import { MagicBG } from "./MagicBG";
20
25
  import { formatSpeed } from "./utils";
21
- import { addQueryParam, getLiveUrl } from "../Utils";
26
+ import {
27
+ addQueryParam,
28
+ getBottomSheetModalDefaultItemIcon,
29
+ getBottomSheetModalIconProps,
30
+ getBottomSheetModalItemProps,
31
+ getBottomSheetModalLabelProps,
32
+ getBottomSheetModalSelectedItemIcon,
33
+ } from "../Utils";
22
34
  import { useTitleSummaryOverlay } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerTitleSummaryOverlay";
23
35
  import {
24
36
  AnimationComponent,
@@ -27,7 +39,6 @@ import {
27
39
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
28
40
  import { PADDING_HORIZONTAL } from "./Layout/const";
29
41
  import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
30
-
31
42
  import {
32
43
  SleepTimerController,
33
44
  SleepTimerState,
@@ -37,6 +48,8 @@ import { SpeedController, PlaybackSpeed, DEFAULT_SPEED } from "./SpeedManager";
37
48
  import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
38
49
  import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
39
50
  import { openBottomSheetModal } from "@applicaster/zapp-react-native-utils/modalState";
51
+ import { getSleepTimerOptions } from "../Const/sleepTimerOptions";
52
+ import { speedOptions } from "../Const/speedOptions";
40
53
 
41
54
  const { log_debug } = createLogger({
42
55
  subsystem: "UIComponent",
@@ -78,59 +91,17 @@ type Props = {
78
91
 
79
92
  const { width: SCREEN_WIDTH } = ScreenDimensions.get("screen");
80
93
 
81
- const Styles = {
82
- mainContainer: (style: ViewStyle) => {
83
- const combinedStyle: ViewStyle = {
84
- flex: 1,
85
- };
86
-
87
- return {
88
- ...combinedStyle,
89
- ...style,
90
- };
91
- },
94
+ const Styles = StyleSheet.create({
92
95
  playerContainer: {
93
96
  flex: 1,
94
97
  },
95
98
  paddingHorizontal: { paddingTop: 0, paddingHorizontal: PADDING_HORIZONTAL },
96
-
97
- controlsMobile: {
98
- height: 50,
99
- marginHorizontal: 24,
100
- },
101
- controlsTablet: {
102
- height: 96,
103
- marginHorizontal: 24,
104
- },
105
99
  playerDetails: {
106
100
  marginTop: 60,
107
101
  alignSelf: "center",
108
102
  width: SCREEN_WIDTH - PADDING_HORIZONTAL * 2,
109
103
  },
110
-
111
- linearGradient: {
112
- flex: 1,
113
- },
114
- };
115
-
116
- const sleeps = [
117
- // { label: "End of episode", value: "episode" },
118
- { label: "5 minutes", value: 5 },
119
- { label: "10 minutes", value: 10 },
120
- { label: "15 minutes", value: 15 },
121
- { label: "30 minutes", value: 30 },
122
- { label: "45 minutes", value: 45 },
123
- { label: "1 hour", value: 60 },
124
- { label: "2 hours", value: 120 },
125
- ];
126
-
127
- const speeds = [
128
- { label: "0.8x", value: 0.8 },
129
- { label: "1x", value: 1.0 },
130
- { label: "1.2x", value: 1.2 },
131
- { label: "1.5x", value: 1.5 },
132
- { label: "2x", value: 2.0 },
133
- ];
104
+ });
134
105
 
135
106
  const edges: Edge[] = ["right", "left", "top"];
136
107
 
@@ -154,12 +125,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
154
125
 
155
126
  const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
156
127
 
157
- // TODO: Have generic place for live url from configuration. Currently its hardcoded for client.
158
-
159
- const feedUrl = getLiveUrl(entry?.extensions?.live?.channel_src ?? "");
160
-
161
128
  const { title, summary } = useTitleSummaryOverlay(
162
- feedUrl,
163
129
  entry,
164
130
  playerState?.isLive,
165
131
  configuration?.audio_live_player_update_interval
@@ -288,34 +254,35 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
288
254
  const onSpeedButtonPress = React.useCallback(() => {
289
255
  openBottomSheetModal({
290
256
  modalBottomSheetContentProps: {
291
- items: speeds,
257
+ items: speedOptions,
292
258
  current_selection: playbackSpeed,
293
259
  onPress: onSpeedSelect,
294
260
  title: configuration["playback_speed_title"],
261
+ itemProps: getBottomSheetModalItemProps,
262
+ iconProps: getBottomSheetModalIconProps,
263
+ labelProps: getBottomSheetModalLabelProps,
264
+ getSelectedItemIcon: getBottomSheetModalSelectedItemIcon,
265
+ getDefaultItemIcon: getBottomSheetModalDefaultItemIcon,
266
+ iconPlacement: "right",
295
267
  },
296
268
  options: {
297
269
  supportedOrientations: ["portrait"],
298
270
  },
299
271
  });
300
- }, [
301
- playbackSpeed,
302
- setPlaybackSpeed,
303
- onSpeedSelect,
304
- configuration["playback_speed_title"],
305
- ]);
272
+ }, [playbackSpeed, onSpeedSelect, configuration["playback_speed_title"]]);
306
273
 
307
274
  const onSleepButtonPress = React.useCallback(() => {
308
275
  openBottomSheetModal({
309
276
  modalBottomSheetContentProps: {
310
- items: [
311
- {
312
- label: configuration["playback_sleep_off_label"],
313
- value: 0,
314
- },
315
- ].concat(sleeps),
277
+ items: getSleepTimerOptions(configuration),
316
278
  current_selection: sleepTimerState.timer,
317
279
  onPress: onSleepSelect,
318
280
  title: configuration["playback_sleep_title"],
281
+ itemProps: getBottomSheetModalItemProps,
282
+ iconProps: getBottomSheetModalIconProps,
283
+ labelProps: getBottomSheetModalLabelProps,
284
+ getSelectedItemIcon: getBottomSheetModalSelectedItemIcon,
285
+ iconPlacement: "right",
319
286
  },
320
287
  options: {
321
288
  supportedOrientations: ["portrait"],
@@ -357,7 +324,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
357
324
 
358
325
  const MainContent = React.useMemo(() => {
359
326
  return (
360
- <SafeAreaView style={Styles.mainContainer(style)} edges={edges}>
327
+ <SafeAreaView style={[style, Styles.playerContainer]} edges={edges}>
361
328
  <AnimationComponent
362
329
  animationType={ComponentAnimationType.moveUpComponent}
363
330
  additionalData={{ saveArea: true }}
@@ -401,11 +368,11 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
401
368
  animationType={ComponentAnimationType.componentFade}
402
369
  >
403
370
  <PlayerDetails
371
+ isAudioPlayer
404
372
  configuration={configuration}
405
373
  style={Styles.playerDetails}
406
374
  entry={entry}
407
375
  isTabletLandscape={isTabletLandscape}
408
- isAudioPlayer={true}
409
376
  />
410
377
  </AnimationComponent>
411
378
  </View>
@@ -1,7 +1,5 @@
1
1
  import * as React from "react";
2
2
 
3
- import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
4
-
5
3
  import {
6
4
  AnimationComponent,
7
5
  ComponentAnimationType,
@@ -13,6 +11,7 @@ import { FlexImage } from "./FlexImage";
13
11
 
14
12
  import { styles } from "./styles";
15
13
  import { calculateBorderRadius } from "../../utils";
14
+ import { PlayNextData } from "../types";
16
15
 
17
16
  type Props = {
18
17
  entry: ZappEntry;
@@ -23,7 +22,7 @@ type Props = {
23
22
  dimensions: QuickBrickPlayer.AudioPlayerProps["dimensions"];
24
23
  onCloseVideoModal: Callback;
25
24
  onPlayerSeek: (targetTime: number) => void;
26
- playNextData: QuickBrickPlayer.AudioPlayerProps["playNextData"];
25
+ playNextData: PlayNextData;
27
26
  title: string | number;
28
27
  summary: string | number;
29
28
  docked: boolean;
@@ -32,9 +31,14 @@ type Props = {
32
31
  };
33
32
 
34
33
  export const PlayerImage = (props: Props) => {
35
- const { entry, dimensions, docked, imageWidth, verticalOffset } = props;
36
-
37
- const isTablet = useIsTablet();
34
+ const {
35
+ entry,
36
+ dimensions,
37
+ docked,
38
+ imageWidth,
39
+ verticalOffset,
40
+ configuration,
41
+ } = props;
38
42
 
39
43
  const {
40
44
  isActiveGesture,
@@ -44,11 +48,11 @@ export const PlayerImage = (props: Props) => {
44
48
  } = useModalAnimationContext();
45
49
 
46
50
  const borderRadius = calculateBorderRadius(
47
- isTablet,
48
51
  docked,
49
52
  startComponentsAnimation,
50
53
  isActiveGesture,
51
- playerAnimationState
54
+ playerAnimationState,
55
+ configuration
52
56
  );
53
57
 
54
58
  return (
@@ -71,7 +71,7 @@ const withAdditionalOffset = ({ progressBarHeight, bottomInset }) => {
71
71
  }
72
72
 
73
73
  // android
74
- return progressBarHeight === 0 ? 4 : 2;
74
+ return progressBarHeight === 0 ? 4 : 0.5;
75
75
  };
76
76
 
77
77
  export function TabletLandscapeLayout({
@@ -1,12 +1,5 @@
1
1
  import * as React from "react";
2
- import {
3
- compose,
4
- take,
5
- map,
6
- split,
7
- propOr,
8
- trim,
9
- } from "@applicaster/zapp-react-native-utils/utils";
2
+ import { compose, take, map, split, propOr, trim } from "ramda";
10
3
  import { StyleSheet, View, LayoutChangeEvent } from "react-native";
11
4
 
12
5
  import { TransportInfo as MobileTransportInfo } from "@applicaster/quick-brick-mobile-transport-controls";
@@ -3,3 +3,5 @@ import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Compo
3
3
  export type Props = QuickBrickPlayer.AudioPlayerProps & {
4
4
  playNextData: PlayNextData;
5
5
  };
6
+
7
+ export { PlayNextData };
@@ -4,6 +4,7 @@ import {
4
4
  PlayerAnimationStateT,
5
5
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/ModalAnimationContext";
6
6
  import { parseJsonIfNeeded } from "@applicaster/zapp-react-native-utils/functionUtils";
7
+ import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
7
8
 
8
9
  export const NAMESPACE = "audio-player";
9
10
 
@@ -37,11 +38,11 @@ export const formatSpeed = (value: number) => {
37
38
  };
38
39
 
39
40
  export const calculateBorderRadius = (
40
- isTablet: boolean,
41
41
  docked: boolean,
42
42
  startComponentsAnimation: boolean,
43
43
  isActiveGesture: boolean,
44
- playerAnimationState: PlayerAnimationStateT
44
+ playerAnimationState: PlayerAnimationStateT,
45
+ configuration: Record<string, any>
45
46
  ): number => {
46
47
  const shouldRemoveBorderRadius =
47
48
  (startComponentsAnimation &&
@@ -53,5 +54,7 @@ export const calculateBorderRadius = (
53
54
  return 0;
54
55
  }
55
56
 
56
- return isTablet ? 24 : 10;
57
+ return toNumberWithDefaultZero(
58
+ configuration.audio_player_artwork_border_radius
59
+ );
57
60
  };
@@ -0,0 +1,39 @@
1
+ import { toDayJSLocaleMap } from "@applicaster/zapp-react-native-utils/appUtils/localizationsHelper";
2
+ import { dayjs } from "@applicaster/zapp-react-native-utils/dateUtils";
3
+ import { getUILanguage } from "@applicaster/zapp-react-native-utils/localizationUtils";
4
+
5
+ const createTimerOptions = (value) => {
6
+ let label = "";
7
+
8
+ const str = dayjs
9
+ .duration(value, "minute")
10
+ .locale(toDayJSLocaleMap(getUILanguage()))
11
+ .humanize();
12
+
13
+ if (value === 60) {
14
+ /** Skipping prefix "an"/"un"/"una" for 1 hour */
15
+
16
+ if (str.includes(" ")) {
17
+ label = `1 ${str.split(" ")[1]}`; // Combine "1" with second part of the string
18
+ } else {
19
+ label = `1 ${str}`; // Use dayjs provided translation
20
+ }
21
+ } else {
22
+ label = str;
23
+ }
24
+
25
+ return {
26
+ label,
27
+ value,
28
+ };
29
+ };
30
+
31
+ export const getSleepTimerOptions = (configuration) => {
32
+ return [
33
+ {
34
+ label: configuration["playback_sleep_off_label"],
35
+ value: 0,
36
+ },
37
+ ...[5, 10, 15, 30, 45, 60, 120].map(createTimerOptions),
38
+ ];
39
+ };
@@ -0,0 +1,4 @@
1
+ export const speedOptions = [0.8, 1, 1.2, 1.5, 2].map((v) => ({
2
+ label: v + "x",
3
+ value: v,
4
+ }));
@@ -1,11 +1,6 @@
1
1
  import queryString from "query-string";
2
2
  import { dayjs } from "@applicaster/zapp-react-native-utils/dateUtils";
3
3
 
4
- export const getLiveUrl = (url: string) => {
5
- // Use the replace method with a regular expression to replace all instances of subClass with livePage
6
- return url.replace(new RegExp("subClass", "g"), "livePage");
7
- };
8
-
9
4
  export const addQueryParam = (
10
5
  baseUrl: string,
11
6
  paramName: string,
@@ -1 +1,118 @@
1
+ import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
2
+
1
3
  export * from "./Utils";
4
+
5
+ export const getBottomSheetModalIconProps = (theme) => ({
6
+ height: theme["audio_modal_bottom_sheet_item_icon_height"],
7
+ width: theme["audio_modal_bottom_sheet_item_icon_width"],
8
+ marginBottom: theme["audio_modal_bottom_sheet_item_icon_margin_bottom"],
9
+ marginLeft: theme["audio_modal_bottom_sheet_item_icon_margin_left"],
10
+ marginRight: theme["audio_modal_bottom_sheet_item_icon_margin_right"],
11
+ marginTop: theme["audio_modal_bottom_sheet_item_icon_margin_top"],
12
+ flavour: theme["modal_bottom_sheet_item_icon_flavour"],
13
+ });
14
+
15
+ export const getBottomSheetModalLabelProps = (theme, width: number) => {
16
+ const {
17
+ audio_modal_bottom_sheet_item_label_android_letter_spacing,
18
+ audio_modal_bottom_sheet_item_label_ios_letter_spacing,
19
+ audio_modal_bottom_sheet_item_label_family_ios_font_selector,
20
+ audio_modal_bottom_sheet_item_label_family_android_font_selector,
21
+ audio_modal_bottom_sheet_item_label_focus_font_color,
22
+ audio_modal_bottom_sheet_item_label_font_color,
23
+ audio_modal_bottom_sheet_item_label_selected_font_color,
24
+ audio_modal_bottom_sheet_item_label_hover_selected_font_color,
25
+ audio_modal_bottom_sheet_item_label_font_size,
26
+ audio_modal_bottom_sheet_item_label_line_height,
27
+ audio_modal_bottom_sheet_item_label_margin_bottom,
28
+ audio_modal_bottom_sheet_item_label_margin_top,
29
+ audio_modal_bottom_sheet_item_label_margin_left,
30
+ audio_modal_bottom_sheet_item_label_margin_right,
31
+ audio_modal_bottom_sheet_item_label_transform,
32
+ audio_modal_bottom_sheet_item_icon_width,
33
+ audio_modal_bottom_sheet_item_icon_margin_left,
34
+ audio_modal_bottom_sheet_item_icon_margin_right,
35
+ audio_modal_bottom_sheet_item_margin_left,
36
+ audio_modal_bottom_sheet_item_margin_right,
37
+ audio_modal_bottom_sheet_item_padding_left,
38
+ audio_modal_bottom_sheet_item_padding_right,
39
+ } = theme;
40
+
41
+ const maxWidth =
42
+ width -
43
+ (audio_modal_bottom_sheet_item_icon_width +
44
+ audio_modal_bottom_sheet_item_icon_margin_left +
45
+ audio_modal_bottom_sheet_item_icon_margin_right +
46
+ audio_modal_bottom_sheet_item_margin_left +
47
+ audio_modal_bottom_sheet_item_margin_right +
48
+ audio_modal_bottom_sheet_item_padding_left +
49
+ audio_modal_bottom_sheet_item_padding_right);
50
+
51
+ return {
52
+ fontFamily: platformSelect({
53
+ ios: audio_modal_bottom_sheet_item_label_family_ios_font_selector,
54
+ android: audio_modal_bottom_sheet_item_label_family_android_font_selector,
55
+ }),
56
+ letterSpacing: platformSelect({
57
+ ios: audio_modal_bottom_sheet_item_label_ios_letter_spacing,
58
+ android: audio_modal_bottom_sheet_item_label_android_letter_spacing,
59
+ }),
60
+ fontSize: audio_modal_bottom_sheet_item_label_font_size,
61
+ color: audio_modal_bottom_sheet_item_label_font_color,
62
+ focusColor: audio_modal_bottom_sheet_item_label_focus_font_color,
63
+ hoverSelectedColor:
64
+ audio_modal_bottom_sheet_item_label_hover_selected_font_color,
65
+ selectedColor: audio_modal_bottom_sheet_item_label_selected_font_color,
66
+ lineHeight: audio_modal_bottom_sheet_item_label_line_height,
67
+ marginBottom: audio_modal_bottom_sheet_item_label_margin_bottom,
68
+ marginTop: audio_modal_bottom_sheet_item_label_margin_top,
69
+ marginLeft: audio_modal_bottom_sheet_item_label_margin_left,
70
+ marginRight: audio_modal_bottom_sheet_item_label_margin_right,
71
+ transform: audio_modal_bottom_sheet_item_label_transform,
72
+ maxWidth,
73
+ };
74
+ };
75
+
76
+ export const getBottomSheetModalItemProps = (theme, width: number) => {
77
+ const {
78
+ audio_modal_bottom_sheet_item_background_color,
79
+ audio_modal_bottom_sheet_item_focus_background_color,
80
+ audio_modal_bottom_sheet_item_selected_background_color,
81
+ audio_modal_bottom_sheet_item_focused_selected_background_color,
82
+ audio_modal_bottom_sheet_item_corner_radius,
83
+ audio_modal_bottom_sheet_item_margin_bottom,
84
+ audio_modal_bottom_sheet_item_margin_left,
85
+ audio_modal_bottom_sheet_item_margin_right,
86
+ audio_modal_bottom_sheet_item_margin_top,
87
+ audio_modal_bottom_sheet_item_padding_bottom,
88
+ audio_modal_bottom_sheet_item_padding_left,
89
+ audio_modal_bottom_sheet_item_padding_right,
90
+ audio_modal_bottom_sheet_item_padding_top,
91
+ } = theme;
92
+
93
+ return {
94
+ backgroundColor: audio_modal_bottom_sheet_item_background_color,
95
+ focusedBackgroundColor:
96
+ audio_modal_bottom_sheet_item_focus_background_color,
97
+ selectedBackgroundColor:
98
+ audio_modal_bottom_sheet_item_selected_background_color,
99
+ focusedSelectedBackgroundColor:
100
+ audio_modal_bottom_sheet_item_focused_selected_background_color,
101
+ borderRadius: audio_modal_bottom_sheet_item_corner_radius,
102
+ marginBottom: audio_modal_bottom_sheet_item_margin_bottom,
103
+ marginTop: audio_modal_bottom_sheet_item_margin_top,
104
+ marginLeft: audio_modal_bottom_sheet_item_margin_left,
105
+ marginRight: audio_modal_bottom_sheet_item_margin_right,
106
+ paddingTop: audio_modal_bottom_sheet_item_padding_top,
107
+ paddingBottom: audio_modal_bottom_sheet_item_padding_bottom,
108
+ paddingRight: audio_modal_bottom_sheet_item_padding_right,
109
+ paddingLeft: audio_modal_bottom_sheet_item_padding_left,
110
+ maxWidth: width,
111
+ };
112
+ };
113
+
114
+ export const getBottomSheetModalSelectedItemIcon = (theme) =>
115
+ theme["audio_modal_bottom_sheet_item_selected_icon"] || null;
116
+
117
+ export const getBottomSheetModalDefaultItemIcon = (theme) =>
118
+ theme["audio_modal_bottom_sheet_item_default_icon"] || null;
@@ -1,7 +0,0 @@
1
- import keyMirror from "keymirror";
2
-
3
- export default keyMirror({
4
- contain: null,
5
- cover: null,
6
- stretch: null,
7
- });