@applicaster/quick-brick-player 14.0.0-rc.8 → 14.0.0-rc.80

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.
Files changed (34) hide show
  1. package/package.json +6 -11
  2. package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +28 -88
  3. package/src/Player/AudioLayer/Layout/Controls/index.tsx +8 -18
  4. package/src/Player/AudioLayer/Layout/DockedControls/index.tsx +119 -125
  5. package/src/Player/AudioLayer/Layout/MobileLayout.tsx +5 -38
  6. package/src/Player/AudioLayer/Layout/PlayerImage/AnimatedImage.tsx +3 -8
  7. package/src/Player/AudioLayer/Layout/PlayerImage/FlexImage.tsx +5 -9
  8. package/src/Player/AudioLayer/Layout/PlayerImage/index.tsx +22 -72
  9. package/src/Player/AudioLayer/Layout/TabletLandscapeLayout.tsx +1 -58
  10. package/src/Player/AudioLayer/Layout/TabletPortraitLayout.tsx +0 -33
  11. package/src/Player/AudioLayer/Layout/TransportInfo/index.tsx +6 -18
  12. package/src/Player/AudioLayer/components/SleepTimerModalHeader/SleepTimerModalHeader.tsx +1 -1
  13. package/src/Player/PlayerModal/GestureAnimatedScrollView.ts +7 -0
  14. package/src/Player/PlayerModal/PlayerModal.tsx +115 -0
  15. package/src/Player/PlayerModal/VideoPlayerModal.tsx +271 -0
  16. package/src/Player/PlayerModal/consts/index.ts +17 -0
  17. package/src/Player/PlayerModal/context/index.ts +6 -0
  18. package/src/Player/PlayerModal/hooks/index.ts +201 -0
  19. package/src/Player/PlayerModal/index.ts +3 -0
  20. package/src/Player/PlayerModal/index.web.ts +5 -0
  21. package/src/Player/PlayerModal/styles.ts +104 -0
  22. package/src/Player/PlayerModal/utils/index.ts +29 -0
  23. package/src/Player/PlayerView/GenericTVPlayerView.tsx +42 -0
  24. package/src/Player/PlayerView/TVPlayerView.tsx +26 -0
  25. package/src/Player/PlayerView/TvOSPlayerView.tsx +51 -0
  26. package/src/Player/PlayerView/types.ts +41 -0
  27. package/src/Player/index.tsx +574 -380
  28. package/src/QuickBrickPlayer.tsx +16 -10
  29. package/src/utils/dimensions.ts +29 -0
  30. package/src/utils/index.ts +12 -0
  31. package/src/utils/logger.ts +6 -0
  32. package/src/utils/playerHelpers.ts +11 -0
  33. package/src/utils/playerStyles.ts +50 -0
  34. /package/src/Player/AudioLayer/Layout/{Debug → DebugComponent}/index.tsx +0 -0
@@ -0,0 +1,104 @@
1
+ import { useConfiguration } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/utils";
2
+ import {
3
+ useIsTablet,
4
+ useNavigation,
5
+ } from "@applicaster/zapp-react-native-utils/reactHooks";
6
+ import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
7
+ import { useMemo } from "react";
8
+ import { StyleSheet } from "react-native";
9
+
10
+ export const useBackgroundColor = (): string => {
11
+ const {
12
+ modal_background_color: modalBackgroundColor,
13
+ tablet_landscape_player_container_background_color: tabletBackgroundColor,
14
+ } = useConfiguration();
15
+
16
+ const {
17
+ videoModalState: { mode },
18
+ } = useNavigation();
19
+
20
+ const isTablet = useIsTablet();
21
+
22
+ const theme = useTheme<BaseThemePropertiesMobile>();
23
+ const isFullscreen = mode === "FULLSCREEN";
24
+
25
+ /**
26
+ * For the new audio player, the background color setting work that way
27
+ * Layer 0 - modal_background_color
28
+ * Layer 1 - screen_background_color ( can be combined with layer 0 ), If the parameter is not set, it will be a solid black.
29
+ * audio_player_background_color is used only in the old player when the background image is not set
30
+ * modal_background_color is used as the background for player details, and in useBackgroundColor to set a background for a video modal.
31
+ * If it’s not set, theme?.status_background_color will be used instead
32
+ *
33
+ * This hook cover only case with layer 0: modal_background_color, layer 1: screen_background_color is used in the styles.expandedContentContainer
34
+ *
35
+ * For the video player, inline player will use tablet_landscape_player_container_background_color as background color, and transparent for fullscreen.
36
+ * Mobile player will use
37
+ * modal_background_color as background color.
38
+ */
39
+
40
+ return isTablet
41
+ ? !isFullscreen
42
+ ? tabletBackgroundColor
43
+ : "transparent"
44
+ : modalBackgroundColor || theme?.status_background_color;
45
+ };
46
+
47
+ export const useStyles = ({ height }: { height: number }) => {
48
+ const COLLAPSED_HEIGHT = height;
49
+
50
+ const backgroundColor = useBackgroundColor();
51
+
52
+ const BG_COLOR_DEFAULT_BLACK = "black";
53
+ const BG_COLOR_DEFAULT_TRANSPARENT = "transparent";
54
+
55
+ return useMemo(
56
+ () =>
57
+ StyleSheet.create({
58
+ modal: {
59
+ position: "absolute",
60
+ left: 0,
61
+ right: 0,
62
+ top: 0,
63
+ backgroundColor,
64
+ elevation: 10,
65
+ zIndex: 100,
66
+ overflow: "hidden",
67
+ },
68
+ modalWrapper: {
69
+ backgroundColor: BG_COLOR_DEFAULT_BLACK,
70
+ },
71
+ collapsedModalBg: {
72
+ backgroundColor: BG_COLOR_DEFAULT_BLACK,
73
+ },
74
+ modalContent: {
75
+ flex: 1,
76
+ alignItems: "center",
77
+ },
78
+ expandedContentContainer: {
79
+ justifyContent: "flex-start",
80
+ backgroundColor: BG_COLOR_DEFAULT_TRANSPARENT,
81
+ zIndex: 1,
82
+ flex: 0,
83
+ },
84
+ extraContentScrollView: {
85
+ width: "100%",
86
+ backgroundColor: BG_COLOR_DEFAULT_TRANSPARENT,
87
+ },
88
+ collapsedBarContainer: {
89
+ ...StyleSheet.absoluteFillObject,
90
+ height: COLLAPSED_HEIGHT,
91
+ zIndex: 90,
92
+ justifyContent: "flex-end",
93
+ },
94
+ collapsedBarWrapper: {
95
+ flex: 1,
96
+ },
97
+ flexNone: {
98
+ ...StyleSheet.absoluteFillObject,
99
+ flex: -1,
100
+ },
101
+ }),
102
+ [backgroundColor, COLLAPSED_HEIGHT]
103
+ );
104
+ };
@@ -0,0 +1,29 @@
1
+ import { StatusBar, Dimensions } from "react-native";
2
+
3
+ import {
4
+ isAndroidPlatform,
5
+ isAndroidVersionAtLeast,
6
+ } from "@applicaster/zapp-react-native-utils/reactUtils";
7
+ import { isAndroidTablet } from "@applicaster/zapp-react-native-utils/reactHooks/layout/isTablet";
8
+
9
+ const MIN_SUPPORTED_ANDROID_API = 34;
10
+
11
+ const isOldAndroidDevice =
12
+ isAndroidPlatform() &&
13
+ !isAndroidVersionAtLeast(MIN_SUPPORTED_ANDROID_API) &&
14
+ !isAndroidTablet();
15
+
16
+ export const getWindowHeight = (): number => {
17
+ const windowDimensions = Dimensions.get("window");
18
+
19
+ return (
20
+ windowDimensions.height +
21
+ (isOldAndroidDevice ? (StatusBar.currentHeight ?? 0) : 0)
22
+ );
23
+ };
24
+
25
+ export const getWindowWidth = (): number => {
26
+ const windowDimensions = Dimensions.get("window");
27
+
28
+ return windowDimensions.width;
29
+ };
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ import { PlayNextOverlay } from "../PlayNextOverlay";
3
+ import { GenericTVPlayerViewProps } from "./types";
4
+ import { AudioPlayer } from "@applicaster/zapp-react-native-ui-components/Components/AudioPlayer";
5
+
6
+ export const GenericTVPlayerView: React.FC<GenericTVPlayerViewProps> = ({
7
+ children,
8
+ type,
9
+ PlayerComponent,
10
+ pluginConfiguration,
11
+ playerProps,
12
+ playNextProps,
13
+ audioPlayerProps,
14
+ transportControls,
15
+ entry,
16
+ }) => {
17
+ return (
18
+ <>
19
+ {type === "audio" ? (
20
+ <AudioPlayer
21
+ audio_item={entry}
22
+ plugin_configuration={pluginConfiguration}
23
+ {...audioPlayerProps}
24
+ />
25
+ ) : null}
26
+ <PlayerComponent
27
+ pluginConfiguration={pluginConfiguration}
28
+ {...playerProps}
29
+ >
30
+ {children}
31
+ </PlayerComponent>
32
+ {transportControls}
33
+ {playNextProps.playNextData ? (
34
+ <PlayNextOverlay
35
+ item={entry}
36
+ pluginConfiguration={pluginConfiguration}
37
+ {...playNextProps}
38
+ />
39
+ ) : null}
40
+ </>
41
+ );
42
+ };
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import { isTvOSPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
3
+ import { TvOSPlayerView } from "./TvOSPlayerView";
4
+ import { GenericTVPlayerView } from "./GenericTVPlayerView";
5
+ import {
6
+ GenericTVPlayerViewProps,
7
+ TvOSPlayerViewProps,
8
+ TVPlayerViewProps,
9
+ } from "./types";
10
+
11
+ const isTvOS = isTvOSPlatform();
12
+
13
+ const shouldRenderTvOSPlayerView = (
14
+ isTvOS: boolean,
15
+ inline: boolean
16
+ ): boolean => {
17
+ return isTvOS && !inline;
18
+ };
19
+
20
+ export const TVPlayerView: React.FC<TVPlayerViewProps> = (props) => {
21
+ return shouldRenderTvOSPlayerView(isTvOS, props.inline) ? (
22
+ <TvOSPlayerView {...(props as TvOSPlayerViewProps)} />
23
+ ) : (
24
+ <GenericTVPlayerView {...(props as GenericTVPlayerViewProps)} />
25
+ );
26
+ };
@@ -0,0 +1,51 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import { PlayNextOverlay } from "../PlayNextOverlay";
4
+ import { TvOSPlayerViewProps } from "./types";
5
+
6
+ const AUDIO_PLAYER_NATIVE_ID = "audio-player-view";
7
+
8
+ export const TvOSPlayerView: React.FC<TvOSPlayerViewProps> = ({
9
+ children,
10
+ type,
11
+ PlayerComponent,
12
+ pluginConfiguration,
13
+ playerProps,
14
+ playNextProps,
15
+ nativePlayerIsReady,
16
+ transportControls,
17
+ entry,
18
+ inline,
19
+ }) => {
20
+ return (
21
+ <>
22
+ <PlayerComponent
23
+ pluginConfiguration={pluginConfiguration}
24
+ {...playerProps}
25
+ >
26
+ {!inline ? (
27
+ <>
28
+ {type === "audio" && nativePlayerIsReady ? (
29
+ <View
30
+ nativeID={AUDIO_PLAYER_NATIVE_ID}
31
+ key={AUDIO_PLAYER_NATIVE_ID}
32
+ >
33
+ {children}
34
+ </View>
35
+ ) : (
36
+ children
37
+ )}
38
+ {playNextProps.playNextData ? (
39
+ <PlayNextOverlay
40
+ item={entry}
41
+ pluginConfiguration={pluginConfiguration}
42
+ {...playNextProps}
43
+ />
44
+ ) : null}
45
+ </>
46
+ ) : null}
47
+ </PlayerComponent>
48
+ {transportControls}
49
+ </>
50
+ );
51
+ };
@@ -0,0 +1,41 @@
1
+ import { ReactNode, ComponentType } from "react";
2
+ import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
3
+ import { ViewStyle } from "react-native";
4
+
5
+ export interface PlayNextOverlayProps {
6
+ playerIsDocked: boolean;
7
+ playerId?: string;
8
+ playNextData: PlayNextData;
9
+ setNextVideoPreloadThresholdPercentage: (percentage: number) => void;
10
+ }
11
+
12
+ export interface PlayerComponentProps {
13
+ ref: React.Ref<any>;
14
+ listener: Record<string, any>;
15
+ style: ViewStyle;
16
+ }
17
+
18
+ export interface AudioPlayerProps {
19
+ style: ViewStyle;
20
+ }
21
+
22
+ export interface PlayerViewBaseProps {
23
+ children?: ReactNode;
24
+ type: "audio" | "video";
25
+ entry: ZappEntry;
26
+ pluginConfiguration: Record<string, any>;
27
+ PlayerComponent: ComponentType<any>;
28
+ playerProps: PlayerComponentProps;
29
+ playNextProps: PlayNextOverlayProps;
30
+ audioPlayerProps: AudioPlayerProps;
31
+ transportControls?: ReactNode;
32
+ inline?: boolean;
33
+ }
34
+
35
+ export interface TvOSPlayerViewProps extends PlayerViewBaseProps {
36
+ nativePlayerIsReady: boolean;
37
+ }
38
+
39
+ export type GenericTVPlayerViewProps = PlayerViewBaseProps;
40
+
41
+ export type TVPlayerViewProps = TvOSPlayerViewProps | GenericTVPlayerViewProps;