@applicaster/quick-brick-player 13.0.0-rc.93 → 13.0.0-rc.95
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 -6
- package/src/Player/AudioLayer/AudioDescription.tsx +4 -6
- package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +36 -66
- 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} +28 -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 +95 -0
- package/src/Player/AudioLayer/Layout/PlayerImage/styles.ts +17 -0
- package/src/Player/AudioLayer/Layout/TabletLandscapeLayout.tsx +214 -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 +101 -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 +7 -0
- package/src/Player/AudioLayer/utils.ts +6 -3
- package/src/Player/Const/sleepTimerOptions.ts +10 -0
- package/src/Player/Const/speedOptions.ts +4 -0
- package/src/Player/Utils/Utils.ts +0 -5
- package/src/Player/Utils/index.tsx +117 -0
- package/src/Player/AudioLayer/Layout/DefaultLayout.tsx +0 -495
- package/src/Player/Helpers/VideoResizeMode.ts +0 -7
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { LayoutChangeEvent } from "react-native";
|
|
3
|
+
import { toNumber } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
4
|
+
import { Subject } from "rxjs";
|
|
5
|
+
import { first } from "rxjs/operators";
|
|
6
|
+
import { useRefWithInitialValue } from "@applicaster/zapp-react-native-utils/reactHooks/state/useRefWithInitialValue";
|
|
7
|
+
|
|
8
|
+
const builder = () => {
|
|
9
|
+
const layoutChange$ = new Subject<number>();
|
|
10
|
+
|
|
11
|
+
const emitLayoutChange = (height: number): void => {
|
|
12
|
+
layoutChange$.next(height);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
emitLayoutChange,
|
|
17
|
+
layoutChange$,
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const useTransportInfoHeight = () => {
|
|
22
|
+
const [height, setHeight] = React.useState(undefined);
|
|
23
|
+
|
|
24
|
+
const layoutRef = useRefWithInitialValue<ReturnType<typeof builder>>(builder);
|
|
25
|
+
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
const subscription = layoutRef.current.layoutChange$
|
|
28
|
+
// skip first layout and take the second with proper size
|
|
29
|
+
// then ignore any layout update
|
|
30
|
+
.pipe(first())
|
|
31
|
+
.subscribe({
|
|
32
|
+
next: (size: number) => {
|
|
33
|
+
setHeight(size);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return () => {
|
|
38
|
+
subscription.unsubscribe();
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
42
|
+
const handleLayout = React.useCallback((event: LayoutChangeEvent) => {
|
|
43
|
+
const height = toNumber(event?.nativeEvent?.layout?.height);
|
|
44
|
+
|
|
45
|
+
if (height) {
|
|
46
|
+
layoutRef.current.emitLayoutChange(height);
|
|
47
|
+
}
|
|
48
|
+
}, []);
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
height,
|
|
52
|
+
onLayout: handleLayout,
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -1,52 +1,25 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import DefaultLayout from "./DefaultLayout";
|
|
3
|
-
import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
|
|
1
|
+
import * as React from "react";
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
height: number;
|
|
8
|
-
};
|
|
3
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
4
|
+
import { useIsTabletLandscape } from "@applicaster/zapp-react-native-utils/reactHooks/device/useMemoizedIsTablet";
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
inline: boolean;
|
|
14
|
-
docked: boolean;
|
|
15
|
-
isModal: boolean;
|
|
16
|
-
};
|
|
17
|
-
playerState: {
|
|
18
|
-
currentTime: number;
|
|
19
|
-
duration: number;
|
|
20
|
-
seekableDuration: number;
|
|
21
|
-
isLive: boolean;
|
|
22
|
-
isPaused: boolean;
|
|
23
|
-
isBuffering: boolean;
|
|
24
|
-
};
|
|
25
|
-
value: GetValue;
|
|
26
|
-
sleepTimerDate: number;
|
|
27
|
-
playbackSpeedName: string;
|
|
28
|
-
playbackSleepName: string;
|
|
29
|
-
configuration: { [key: string]: any };
|
|
30
|
-
onPlaybackButtonPress: () => void;
|
|
31
|
-
onRewindButtonPress: () => void;
|
|
32
|
-
onForwardButtonPress: () => void;
|
|
33
|
-
onSpeedButtonPress: () => void;
|
|
34
|
-
onSleepButtonPress: () => void;
|
|
35
|
-
onCloseVideoModal: () => void;
|
|
36
|
-
cancelSleepTimer: () => void;
|
|
37
|
-
onPlayerSeek: (targetTime: number) => void;
|
|
38
|
-
onSkipStart: () => void;
|
|
39
|
-
onSkipLive: () => void;
|
|
40
|
-
maximiseVideoModal: () => void;
|
|
41
|
-
dimensions: Dimensions;
|
|
42
|
-
defaultDimensions: Dimensions;
|
|
43
|
-
playNextData: PlayNextData;
|
|
44
|
-
title: string | number;
|
|
45
|
-
summary: string | number;
|
|
46
|
-
};
|
|
6
|
+
import { TabletPortraitLayout } from "./TabletPortraitLayout";
|
|
7
|
+
import { TabletLandscapeLayout } from "./TabletLandscapeLayout";
|
|
8
|
+
import { MobileLayout } from "./MobileLayout";
|
|
47
9
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
10
|
+
import { Props } from "./types";
|
|
11
|
+
|
|
12
|
+
export default function Layout(props: Props) {
|
|
13
|
+
const isTablet = useIsTablet();
|
|
14
|
+
const isTabletLandscape = useIsTabletLandscape();
|
|
15
|
+
|
|
16
|
+
if (!isTablet) {
|
|
17
|
+
return <MobileLayout {...props} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (isTabletLandscape) {
|
|
21
|
+
return <TabletLandscapeLayout {...props} />;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return <TabletPortraitLayout {...props} />;
|
|
52
25
|
}
|
|
@@ -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
|
|
57
|
+
return toNumberWithDefaultZero(
|
|
58
|
+
configuration.audio_player_artwork_border_radius
|
|
59
|
+
);
|
|
57
60
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const sleepTimerOptions = [
|
|
2
|
+
// { label: "End of episode", value: "episode" },
|
|
3
|
+
{ label: "5 minutes", value: 5 },
|
|
4
|
+
{ label: "10 minutes", value: 10 },
|
|
5
|
+
{ label: "15 minutes", value: 15 },
|
|
6
|
+
{ label: "30 minutes", value: 30 },
|
|
7
|
+
{ label: "45 minutes", value: 45 },
|
|
8
|
+
{ label: "1 hour", value: 60 },
|
|
9
|
+
{ label: "2 hours", value: 120 },
|
|
10
|
+
];
|
|
@@ -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;
|