@applicaster/quick-brick-player 12.0.0-rc.24 → 12.0.0-rc.26
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": "12.0.0-rc.
|
|
3
|
+
"version": "12.0.0-rc.26",
|
|
4
4
|
"description": "Quick Brick Player",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -36,12 +36,13 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@applicaster/quick-brick-mobile-transport-controls": "12.0.0-rc.
|
|
39
|
+
"@applicaster/quick-brick-mobile-transport-controls": "12.0.0-rc.26",
|
|
40
40
|
"@applicaster/quick-brick-tv-transport-controls": "11.0.0-rc.133",
|
|
41
|
-
"@applicaster/zapp-react-native-tvos-app": "12.0.0-rc.
|
|
42
|
-
"@applicaster/zapp-react-native-ui-components": "12.0.0-rc.
|
|
43
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-rc.
|
|
41
|
+
"@applicaster/zapp-react-native-tvos-app": "12.0.0-rc.26",
|
|
42
|
+
"@applicaster/zapp-react-native-ui-components": "12.0.0-rc.26",
|
|
43
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-rc.26",
|
|
44
44
|
"keymirror": "^0.1.1",
|
|
45
|
+
"query-string": "7.1.3",
|
|
45
46
|
"react-native-web-linear-gradient": "1.1.2",
|
|
46
47
|
"shaka-player": "4.3.5",
|
|
47
48
|
"typeface-montserrat": "^0.0.54",
|
|
@@ -16,6 +16,7 @@ import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Compo
|
|
|
16
16
|
import { PlayerDetails } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/PlayerDetails";
|
|
17
17
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
18
18
|
import { MagicBG } from "./MagicBG";
|
|
19
|
+
import { addQueryParam } from "../Utils";
|
|
19
20
|
|
|
20
21
|
const { log_debug } = createLogger({
|
|
21
22
|
subsystem: "UIComponent",
|
|
@@ -32,6 +33,7 @@ type Dimensions = {
|
|
|
32
33
|
type Configuration = {
|
|
33
34
|
[key: string]: any;
|
|
34
35
|
magic_background?: boolean;
|
|
36
|
+
audio_player_background_image_query?: string;
|
|
35
37
|
tablet_landscape_sidebar_width?: string;
|
|
36
38
|
tablet_landscape_player_container_background_color?: string;
|
|
37
39
|
};
|
|
@@ -255,11 +257,17 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
255
257
|
]);
|
|
256
258
|
|
|
257
259
|
if (configuration.magic_background) {
|
|
260
|
+
const baseUrl = entry?.extensions?.audio_player_background_image ?? "";
|
|
261
|
+
|
|
262
|
+
const queryParamName =
|
|
263
|
+
configuration.audio_player_background_image_query || "width";
|
|
264
|
+
|
|
265
|
+
const queryParamValue = 15;
|
|
266
|
+
|
|
267
|
+
const url = addQueryParam(baseUrl, queryParamName, queryParamValue);
|
|
268
|
+
|
|
258
269
|
return (
|
|
259
|
-
<MagicBG
|
|
260
|
-
image={entry?.extensions?.audio_player_background_image}
|
|
261
|
-
defaultColor="#000000"
|
|
262
|
-
>
|
|
270
|
+
<MagicBG image={url} fallbackUrl={baseUrl} defaultColor="#000000">
|
|
263
271
|
{MainContent}
|
|
264
272
|
</MagicBG>
|
|
265
273
|
);
|
|
@@ -73,8 +73,8 @@ const Styles = {
|
|
|
73
73
|
}),
|
|
74
74
|
backgroundImageContainer: (dimensions: Dimensions, isTablet: boolean) => {
|
|
75
75
|
return {
|
|
76
|
-
width: isTablet ? 463 : dimensions.width,
|
|
77
|
-
height: isTablet ? 463 : dimensions.width,
|
|
76
|
+
width: isTablet ? 463 : dimensions.width || 330,
|
|
77
|
+
height: isTablet ? 463 : dimensions.width || 330,
|
|
78
78
|
};
|
|
79
79
|
},
|
|
80
80
|
backgroundImageContainerImageStyle: (isTablet) => ({
|
|
@@ -131,8 +131,7 @@ export default function DefaultLayout(props: LayoutProps) {
|
|
|
131
131
|
const controller = playerManager.getActivePlayer();
|
|
132
132
|
const liveButton = Boolean(value("live_badge_enabled"));
|
|
133
133
|
|
|
134
|
-
let showFullControls =
|
|
135
|
-
controller?.hasContentDuration?.() && !controller?.isAd();
|
|
134
|
+
let showFullControls = !controller?.isAd();
|
|
136
135
|
|
|
137
136
|
if (isLiveContent) {
|
|
138
137
|
const seekEnabled = Boolean(value("liveSeekingEnabled"));
|
|
@@ -163,8 +162,15 @@ export default function DefaultLayout(props: LayoutProps) {
|
|
|
163
162
|
return [play];
|
|
164
163
|
}
|
|
165
164
|
|
|
166
|
-
const rewind = rewindButton({
|
|
167
|
-
|
|
165
|
+
const rewind = rewindButton({
|
|
166
|
+
isTablet,
|
|
167
|
+
onPress: controller?.hasContentDuration?.() ? onRewindButtonPress : null,
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
const forward = forwardButton({
|
|
171
|
+
isTablet,
|
|
172
|
+
onPress: controller?.hasContentDuration?.() ? onForwardButtonPress : null,
|
|
173
|
+
});
|
|
168
174
|
|
|
169
175
|
if (isLiveContent) {
|
|
170
176
|
const skipToStart = skipToStartButton({
|
|
@@ -192,6 +198,7 @@ export default function DefaultLayout(props: LayoutProps) {
|
|
|
192
198
|
onSkipStart,
|
|
193
199
|
onSkipLive,
|
|
194
200
|
isLiveContent,
|
|
201
|
+
controller,
|
|
195
202
|
]);
|
|
196
203
|
|
|
197
204
|
const Separator = () => <View style={Styles.separator} />;
|
|
@@ -4,10 +4,12 @@ import * as React from "react";
|
|
|
4
4
|
import { StyleSheet, View } from "react-native";
|
|
5
5
|
import LinearGradient from "../LinearGradient";
|
|
6
6
|
import { getDominantColor, getPalettes } from "../../../utils/utils";
|
|
7
|
+
import { useEffect } from "react";
|
|
7
8
|
|
|
8
9
|
type MagicBGProps = {
|
|
9
10
|
children: React.ReactNode;
|
|
10
11
|
image: string;
|
|
12
|
+
fallbackUrl?: string;
|
|
11
13
|
defaultColor: string;
|
|
12
14
|
};
|
|
13
15
|
|
|
@@ -34,9 +36,24 @@ const styles = StyleSheet.create({
|
|
|
34
36
|
},
|
|
35
37
|
});
|
|
36
38
|
|
|
39
|
+
const fetchPaletteAndDominantColor = async (imageUrl: string) => {
|
|
40
|
+
const palette = await getPalettes(imageUrl);
|
|
41
|
+
|
|
42
|
+
const colors = palette.map(
|
|
43
|
+
(color: { r: number; g: number; b: number }) =>
|
|
44
|
+
`rgb(${color.r}, ${color.g}, ${color.b})`
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const dominant = await getDominantColor(imageUrl);
|
|
48
|
+
const dominantColor = `rgb(${dominant.r}, ${dominant.g}, ${dominant.b})`;
|
|
49
|
+
|
|
50
|
+
return { gradientColors: colors.slice(0, 2), dominantColor };
|
|
51
|
+
};
|
|
52
|
+
|
|
37
53
|
export const MagicBG: React.FC<MagicBGProps> = ({
|
|
38
54
|
children,
|
|
39
55
|
image,
|
|
56
|
+
fallbackUrl = "",
|
|
40
57
|
defaultColor,
|
|
41
58
|
}) => {
|
|
42
59
|
const [dominantColor, setDominantColor] =
|
|
@@ -47,22 +64,24 @@ export const MagicBG: React.FC<MagicBGProps> = ({
|
|
|
47
64
|
colors.defaultGradientEnd,
|
|
48
65
|
]);
|
|
49
66
|
|
|
50
|
-
|
|
67
|
+
useEffect(() => {
|
|
51
68
|
const fetchColors = async () => {
|
|
52
|
-
if (image)
|
|
53
|
-
try {
|
|
54
|
-
const palette = await getPalettes(image);
|
|
69
|
+
if (!image) return;
|
|
55
70
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
);
|
|
71
|
+
try {
|
|
72
|
+
const { gradientColors, dominantColor } =
|
|
73
|
+
await fetchPaletteAndDominantColor(image);
|
|
60
74
|
|
|
61
|
-
|
|
75
|
+
setGradientColors(gradientColors);
|
|
76
|
+
setDominantColor(dominantColor);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
try {
|
|
79
|
+
const { gradientColors, dominantColor } =
|
|
80
|
+
await fetchPaletteAndDominantColor(fallbackUrl);
|
|
62
81
|
|
|
63
|
-
|
|
64
|
-
setDominantColor(
|
|
65
|
-
} catch
|
|
82
|
+
setGradientColors(gradientColors);
|
|
83
|
+
setDominantColor(dominantColor);
|
|
84
|
+
} catch {
|
|
66
85
|
setGradientColors([
|
|
67
86
|
colors.defaultGradientStart,
|
|
68
87
|
colors.defaultGradientEnd,
|
|
@@ -74,7 +93,7 @@ export const MagicBG: React.FC<MagicBGProps> = ({
|
|
|
74
93
|
};
|
|
75
94
|
|
|
76
95
|
fetchColors();
|
|
77
|
-
}, [image, defaultColor]);
|
|
96
|
+
}, [image, fallbackUrl, colors, defaultColor]);
|
|
78
97
|
|
|
79
98
|
return (
|
|
80
99
|
<View style={[styles.container, { backgroundColor: dominantColor }]}>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import queryString from "query-string";
|
|
2
|
+
|
|
1
3
|
export const toTypeString = (obj) => {
|
|
2
4
|
switch (typeof obj) {
|
|
3
5
|
case "object":
|
|
@@ -19,3 +21,19 @@ export const stringsOnlyObject = (obj) => {
|
|
|
19
21
|
|
|
20
22
|
return strObj;
|
|
21
23
|
};
|
|
24
|
+
|
|
25
|
+
export const addQueryParam = (
|
|
26
|
+
baseUrl: string,
|
|
27
|
+
paramName: string,
|
|
28
|
+
paramValue: string | number
|
|
29
|
+
) => {
|
|
30
|
+
const [urlWithoutQuery, query] = baseUrl.split("?");
|
|
31
|
+
|
|
32
|
+
const parsedQuery = queryString.parse(query);
|
|
33
|
+
|
|
34
|
+
parsedQuery[paramName] = paramValue.toString();
|
|
35
|
+
|
|
36
|
+
const updatedQueryString = queryString.stringify(parsedQuery);
|
|
37
|
+
|
|
38
|
+
return `${urlWithoutQuery}?${updatedQueryString}`;
|
|
39
|
+
};
|