@applicaster/quick-brick-player 14.0.0-rc.9 → 14.0.0-rc.90
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 +6 -11
- package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +44 -88
- package/src/Player/AudioLayer/Layout/Controls/index.tsx +8 -18
- package/src/Player/AudioLayer/Layout/DockedControls/index.tsx +169 -161
- package/src/Player/AudioLayer/Layout/MobileLayout.tsx +4 -42
- package/src/Player/AudioLayer/Layout/PlayerImage/FlexImage.tsx +5 -9
- package/src/Player/AudioLayer/Layout/PlayerImage/index.tsx +35 -83
- package/src/Player/AudioLayer/Layout/PlayerImage/styles.ts +6 -1
- package/src/Player/AudioLayer/Layout/TabletLandscapeLayout.tsx +6 -66
- package/src/Player/AudioLayer/Layout/TabletPortraitLayout.tsx +1 -39
- package/src/Player/AudioLayer/Layout/TransportInfo/index.tsx +6 -18
- package/src/Player/AudioLayer/components/SleepTimerModalHeader/SleepTimerModalHeader.tsx +1 -1
- package/src/Player/AudioLayer/utils.ts +1 -27
- package/src/Player/PlayerModal/GestureAnimatedScrollView.ts +7 -0
- package/src/Player/PlayerModal/PlayerModal.tsx +110 -0
- package/src/Player/PlayerModal/VideoPlayerModal.tsx +289 -0
- package/src/Player/PlayerModal/consts/index.ts +17 -0
- package/src/Player/PlayerModal/context/index.ts +6 -0
- package/src/Player/PlayerModal/hooks/index.ts +169 -0
- package/src/Player/PlayerModal/index.ts +3 -0
- package/src/Player/PlayerModal/index.web.ts +5 -0
- package/src/Player/PlayerModal/styles.ts +109 -0
- package/src/Player/PlayerModal/utils/index.ts +111 -0
- package/src/Player/PlayerView/GenericTVPlayerView.tsx +42 -0
- package/src/Player/PlayerView/TVPlayerView.tsx +26 -0
- package/src/Player/PlayerView/TvOSPlayerView.tsx +51 -0
- package/src/Player/PlayerView/types.ts +41 -0
- package/src/Player/index.tsx +575 -380
- package/src/QuickBrickPlayer.tsx +16 -10
- 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
- package/src/Player/AudioLayer/Layout/PlayerImage/AnimatedImage.tsx +0 -87
- package/src/Player/AudioLayer/Layout/PlayerImage/hooks/index.ts +0 -1
- package/src/Player/AudioLayer/Layout/PlayerImage/hooks/useChangePlayerState.ts +0 -99
- /package/src/Player/AudioLayer/Layout/{Debug → DebugComponent}/index.tsx +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { StyleSheet, Dimensions, ViewStyle } from "react-native";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
isAndroidPlatform,
|
|
5
|
+
isAndroidVersionAtLeast,
|
|
6
|
+
isTV,
|
|
7
|
+
} from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
8
|
+
import { useIsTablet as getIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
9
|
+
|
|
10
|
+
const SAFE_AREA_BREAKING_API_VERSION = 35;
|
|
11
|
+
|
|
12
|
+
export const isOldAndroidDevice =
|
|
13
|
+
isAndroidPlatform() &&
|
|
14
|
+
!isAndroidVersionAtLeast(SAFE_AREA_BREAKING_API_VERSION);
|
|
15
|
+
|
|
16
|
+
export const getWindowHeight = (
|
|
17
|
+
isTablet: boolean,
|
|
18
|
+
landscape: boolean
|
|
19
|
+
): number => {
|
|
20
|
+
const windowDimensions = Dimensions.get("window");
|
|
21
|
+
|
|
22
|
+
if (isTablet && landscape) {
|
|
23
|
+
return windowDimensions.height;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (windowDimensions.width > windowDimensions.height) {
|
|
27
|
+
return windowDimensions.width;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return windowDimensions.height;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const getScreenHeight = (): number => {
|
|
34
|
+
const screenDimensions = Dimensions.get("screen");
|
|
35
|
+
|
|
36
|
+
return screenDimensions.height;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const getWindowWidth = (
|
|
40
|
+
isTablet: boolean,
|
|
41
|
+
landscape: boolean
|
|
42
|
+
): number => {
|
|
43
|
+
const windowDimensions = Dimensions.get("window");
|
|
44
|
+
|
|
45
|
+
if (isTablet && landscape) {
|
|
46
|
+
return windowDimensions.width;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (windowDimensions.width > windowDimensions.height) {
|
|
50
|
+
return windowDimensions.height;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return windowDimensions.width;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const getIsTabletLandscape = (isTabletPortrait: boolean): boolean => {
|
|
57
|
+
return !isTV() && getIsTablet() && !isTabletPortrait;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const getInsetsOffset = (
|
|
61
|
+
insets: { top: number; bottom: number },
|
|
62
|
+
isTabletPortrait: boolean
|
|
63
|
+
): number => {
|
|
64
|
+
const isTabletLandscape = getIsTabletLandscape(isTabletPortrait);
|
|
65
|
+
|
|
66
|
+
return getIsTablet() && isTabletLandscape
|
|
67
|
+
? isOldAndroidDevice
|
|
68
|
+
? insets.top / 2
|
|
69
|
+
: 0
|
|
70
|
+
: insets.top / 2;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const orientationStyles = StyleSheet.create({
|
|
74
|
+
landscape: { flexDirection: "row" },
|
|
75
|
+
portrait: { flexDirection: "column" },
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export const directionStyles = (isTabletPortrait: boolean): ViewStyle => {
|
|
79
|
+
const isTabletLandscape = getIsTabletLandscape(isTabletPortrait);
|
|
80
|
+
|
|
81
|
+
return isTabletLandscape
|
|
82
|
+
? orientationStyles.landscape
|
|
83
|
+
: orientationStyles.portrait;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const getScaledPos = (
|
|
87
|
+
height,
|
|
88
|
+
vidHeight,
|
|
89
|
+
minimisedHeight,
|
|
90
|
+
isTabletPortrait
|
|
91
|
+
) => {
|
|
92
|
+
const isTabletLandscape = getIsTabletLandscape(isTabletPortrait);
|
|
93
|
+
|
|
94
|
+
const SCALE_FACTOR = minimisedHeight / vidHeight; // Scale factor for expanded content
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
((isTabletLandscape ? height : vidHeight) - vidHeight * SCALE_FACTOR) / 2
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const getExtraContentPadding = (insets: {
|
|
102
|
+
top: number;
|
|
103
|
+
bottom: number;
|
|
104
|
+
}): ViewStyle => {
|
|
105
|
+
const isTablet = getIsTablet(); // not a hook, just a utility function
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
paddingTop: isTablet ? insets.top : 0,
|
|
109
|
+
paddingBottom: insets.bottom,
|
|
110
|
+
};
|
|
111
|
+
};
|
|
@@ -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;
|