@applicaster/quick-brick-player 14.0.0-rc.78 → 14.0.0-rc.79

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.
@@ -0,0 +1,29 @@
1
+ import { Dimensions } from "react-native";
2
+
3
+ export const getWindowDimensions = () => {
4
+ const { width, height } = Dimensions.get("window");
5
+
6
+ return { width, height };
7
+ };
8
+
9
+ export const getMaxWindowDimension = () => {
10
+ const { width, height } = getWindowDimensions();
11
+
12
+ return Math.max(width, height);
13
+ };
14
+
15
+ export const getMinWindowDimension = () => {
16
+ const { width, height } = getWindowDimensions();
17
+
18
+ return Math.min(width, height);
19
+ };
20
+
21
+ /**
22
+ * Calculates the screen aspect ratio (long edge / short edge)
23
+ */
24
+ export const getScreenAspectRatio = () => {
25
+ const longEdge = getMaxWindowDimension();
26
+ const shortEdge = getMinWindowDimension();
27
+
28
+ return longEdge / shortEdge;
29
+ };
@@ -0,0 +1,12 @@
1
+ export * as const from "./const";
2
+
3
+ export * from "./dimensions";
4
+
5
+ export * from "./playerHelpers";
6
+
7
+ export * from "./playerStyles";
8
+
9
+ /**
10
+ * Logger instance for the player
11
+ */
12
+ export { logger } from "./logger";
@@ -0,0 +1,6 @@
1
+ import { Categories, createLogger, Subsystem } from "../logger";
2
+
3
+ export const logger = createLogger({
4
+ category: Categories.PLAYER,
5
+ subsystem: Subsystem,
6
+ });
@@ -0,0 +1,11 @@
1
+ import { logger } from "./logger";
2
+
3
+ export const createUnhandledEventHandler = (eventName: string) => {
4
+ return function dispatchUnhandledEvent({ nativeEvent = null }) {
5
+ logger.warning({
6
+ message:
7
+ "You have invoked an event that is being deprecated or unhandled",
8
+ data: { eventName, nativeEvent },
9
+ });
10
+ };
11
+ };
@@ -0,0 +1,50 @@
1
+ import { ViewStyle } from "react-native";
2
+ import {
3
+ isApplePlatform,
4
+ isTV,
5
+ isAndroidPlatform,
6
+ } from "@applicaster/zapp-react-native-utils/reactUtils";
7
+
8
+ export const PLAYER_CONTAINER_STYLES = {
9
+ playerContainerBlack: { backgroundColor: "#000000" },
10
+ playerContainerTransparent: { backgroundColor: "transparent" },
11
+ audio: {
12
+ overflow: "hidden" as const,
13
+ position: "absolute" as const,
14
+ zIndex: 1,
15
+ },
16
+ } as const;
17
+
18
+ export const getPlayerContainerStyles = (
19
+ isAudioItem: boolean,
20
+ styles: typeof PLAYER_CONTAINER_STYLES
21
+ ) => {
22
+ return isApplePlatform()
23
+ ? styles.playerContainerBlack
24
+ : isTV() && isAudioItem
25
+ ? styles.playerContainerTransparent
26
+ : styles.playerContainerBlack;
27
+ };
28
+
29
+ export const getBackgroundImageStyle = (
30
+ dimensions: any,
31
+ isAudioItem: boolean,
32
+ styles: typeof PLAYER_CONTAINER_STYLES
33
+ ): ViewStyle => ({
34
+ ...(isAudioItem ? styles.audio : { position: "absolute" }),
35
+ ...dimensions,
36
+ });
37
+
38
+ export const getPlayerViewStyle = (
39
+ dimensions: ViewStyle,
40
+ isAudioItem: boolean,
41
+ styles: typeof PLAYER_CONTAINER_STYLES
42
+ ): ViewStyle => {
43
+ const generalStyles = isAudioItem ? styles.audio : {};
44
+
45
+ if (isAndroidPlatform() && isAudioItem) {
46
+ return generalStyles;
47
+ }
48
+
49
+ return { ...generalStyles, ...dimensions };
50
+ };