@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.
- package/package.json +4 -4
- package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +3 -7
- package/src/Player/AudioLayer/Layout/DockedControls/index.tsx +1 -7
- package/src/Player/PlayerModal/PlayerModal.tsx +12 -6
- package/src/Player/PlayerModal/VideoPlayerModal.tsx +15 -15
- package/src/Player/PlayerModal/consts/index.ts +2 -19
- package/src/Player/PlayerModal/hooks/index.ts +33 -25
- package/src/Player/PlayerModal/utils/index.ts +29 -0
- package/src/Player/PlayerView/types.ts +1 -2
- package/src/Player/index.tsx +553 -356
- package/src/utils/dimensions.ts +29 -0
- package/src/utils/index.ts +12 -0
- package/src/utils/logger.ts +6 -0
- package/src/utils/playerHelpers.ts +11 -0
- package/src/utils/playerStyles.ts +50 -0
|
@@ -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,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
|
+
};
|