@applicaster/quick-brick-player 14.0.0-alpha.5621117258 → 14.0.0-alpha.6242515303

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.
@@ -1,6 +1,11 @@
1
1
  import * as React from "react";
2
2
  import { LayoutChangeEvent, View } from "react-native";
3
3
 
4
+ import {
5
+ AnimationComponent,
6
+ ComponentAnimationType,
7
+ useModalAnimationContext,
8
+ } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
4
9
  import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
5
10
  import { toBooleanWithDefaultTrue } from "@applicaster/zapp-react-native-utils/booleanUtils";
6
11
 
@@ -8,54 +13,100 @@ import { AnimatedImage } from "./AnimatedImage";
8
13
  import { FlexImage } from "./FlexImage";
9
14
 
10
15
  import { styles } from "./styles";
11
- import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
16
+ import { calculateBorderRadius } from "../../utils";
17
+ import { PlayNextData } from "../types";
12
18
 
13
19
  type Props = {
14
20
  entry: ZappEntry;
21
+ layoutState: QuickBrickPlayer.LayoutState;
22
+ playerState: QuickBrickPlayer.PlayerState;
23
+ value: GetValue;
15
24
  configuration: QuickBrickPlayer.AudioPlayerProps["configuration"];
25
+ dimensions: QuickBrickPlayer.AudioPlayerProps["dimensions"];
26
+ onCloseVideoModal: Callback;
27
+ onPlayerSeek: (targetTime: number) => void;
28
+ playNextData: PlayNextData;
29
+ title: string | number;
30
+ summary: string | number;
16
31
  docked: boolean;
17
32
  imageWidth?: Option<number>;
33
+ verticalOffset: number;
18
34
  onLayoutImage?: (event: LayoutChangeEvent) => void;
19
35
  };
20
36
 
21
37
  export const PlayerImage = (props: Props) => {
22
38
  const {
23
39
  entry,
40
+ dimensions,
24
41
  docked,
42
+ verticalOffset,
25
43
  imageWidth,
26
44
  configuration,
27
45
  onLayoutImage = noop,
28
46
  } = props;
29
47
 
48
+ const {
49
+ isActiveGesture,
50
+ startComponentsAnimation,
51
+ playerAnimationState,
52
+ minimisedHeight,
53
+ } = useModalAnimationContext();
54
+
30
55
  const isShadowEnabled = toBooleanWithDefaultTrue(
31
56
  configuration?.audio_player_artwork_shadow_enabled
32
57
  );
33
58
 
34
59
  const shouldShowShadow = !docked && isShadowEnabled;
35
60
 
36
- const borderRadius = toNumberWithDefaultZero(
37
- configuration.audio_player_artwork_border_radius
61
+ const borderRadius = calculateBorderRadius(
62
+ docked,
63
+ startComponentsAnimation,
64
+ isActiveGesture,
65
+ playerAnimationState,
66
+ configuration
38
67
  );
39
68
 
40
69
  return (
41
- <View style={styles.alignItemsCenter}>
42
- <View
43
- onLayout={onLayoutImage}
44
- style={[shouldShowShadow ? styles.shadow : undefined, { borderRadius }]}
70
+ <AnimationComponent
71
+ animationType={ComponentAnimationType.moveUpComponent}
72
+ additionalData={{
73
+ marginTop: verticalOffset,
74
+ }}
75
+ style={styles.flex}
76
+ >
77
+ <AnimationComponent
78
+ animationType={ComponentAnimationType.moveComponentHorizontal}
79
+ additionalData={{
80
+ // we move image horiontally to this value due artwork is centered
81
+ moveValue: (dimensions.width - minimisedHeight) / 2,
82
+ }}
83
+ style={styles.alignItemsCenter}
45
84
  >
46
- {!imageWidth ? (
47
- <View style={[styles.defaultImageWrapperView, { borderRadius }]}>
48
- <FlexImage entry={entry} style={styles.backgroundImageContainer} />
49
- </View>
50
- ) : (
51
- // we have imageSize here and now we could animate resizing of this image
52
- <AnimatedImage
53
- entry={entry}
54
- style={[styles.backgroundImageContainer, { borderRadius }]}
55
- imageWidth={imageWidth}
56
- />
57
- )}
58
- </View>
59
- </View>
85
+ <View
86
+ onLayout={onLayoutImage}
87
+ style={[
88
+ shouldShowShadow ? styles.shadow : undefined,
89
+ { borderRadius },
90
+ ]}
91
+ >
92
+ {!imageWidth ? (
93
+ <View style={[styles.defaultImageWrapperView, { borderRadius }]}>
94
+ <FlexImage
95
+ entry={entry}
96
+ style={styles.backgroundImageContainer}
97
+ />
98
+ </View>
99
+ ) : (
100
+ // we have imageSize here and now we could animate resizing of this image
101
+ <AnimatedImage
102
+ entry={entry}
103
+ style={[styles.backgroundImageContainer, { borderRadius }]}
104
+ imageWidth={imageWidth}
105
+ docked={docked}
106
+ />
107
+ )}
108
+ </View>
109
+ </AnimationComponent>
110
+ </AnimationComponent>
60
111
  );
61
112
  };
@@ -11,11 +11,13 @@ import { TransportInfo } from "./TransportInfo";
11
11
  import { PlayerImage } from "./PlayerImage";
12
12
  import { Controls } from "./Controls";
13
13
 
14
+ import { DockedControls } from "./DockedControls";
14
15
  import { withDebug } from "./debug";
15
16
 
16
17
  import { Props } from "./types";
17
18
  import { isSmallTabletHeight as getIsSmallTabletHeight } from "./utils";
18
19
  import { NAVBAR_HEIGHT, TABLET_LANDSCAPE } from "./const";
20
+ import { FlexImage } from "./PlayerImage/FlexImage";
19
21
 
20
22
  const isIOS = isApplePlatform();
21
23
 
@@ -191,6 +193,20 @@ export function TabletLandscapeLayout({
191
193
  </View>
192
194
  </View>
193
195
  </View>
196
+
197
+ <DockedControls
198
+ ImageComponent={<FlexImage entry={entry} style={styles.flex} />}
199
+ entry={entry}
200
+ layoutState={layoutState}
201
+ playerState={playerState}
202
+ value={value}
203
+ dimensions={dimensions}
204
+ onCloseVideoModal={onCloseVideoModal}
205
+ onPlayerSeek={onPlayerSeek}
206
+ playNextData={playNextData}
207
+ title={title}
208
+ summary={summary}
209
+ />
194
210
  </View>
195
211
  );
196
212
  }
@@ -1,11 +1,13 @@
1
1
  import * as React from "react";
2
- import { compose, map, propOr, split, take, trim } from "ramda";
3
2
  import { LayoutChangeEvent, StyleSheet, View } from "react-native";
4
3
 
5
4
  import { TransportInfo as MobileTransportInfo } from "@applicaster/quick-brick-mobile-transport-controls";
6
5
  import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
7
6
  import { useLanguageData } from "@applicaster/zapp-react-native-utils/reactHooks/player";
8
-
7
+ import {
8
+ AnimationComponent,
9
+ ComponentAnimationType,
10
+ } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
9
11
  import { toPositiveNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
10
12
  import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
11
13
 
@@ -13,6 +15,7 @@ import { NAVBAR_HEIGHT, TABLET_LANDSCAPE } from "../const";
13
15
  import { withDebug } from "../debug";
14
16
  import { useSafeAreaFrame } from "react-native-safe-area-context";
15
17
  import { isSmallTabletHeight } from "../utils";
18
+ import { getPlayerActionButtons } from "@applicaster/zapp-react-native-utils/playerUtils";
16
19
 
17
20
  const styles = StyleSheet.create({
18
21
  container: {
@@ -82,14 +85,8 @@ export const TransportInfo = ({
82
85
  );
83
86
 
84
87
  const actionButtons = React.useMemo(
85
- () =>
86
- compose(
87
- take(2),
88
- map(trim),
89
- split(","),
90
- propOr("", "player_action_buttons")
91
- )(configuration),
92
- [configuration.player_action_buttons]
88
+ () => getPlayerActionButtons(configuration),
89
+ [configuration]
93
90
  );
94
91
 
95
92
  return (
@@ -107,7 +104,10 @@ export const TransportInfo = ({
107
104
  ]}
108
105
  onLayout={handleLayout}
109
106
  >
110
- <View style={styles.animatedContainer}>
107
+ <AnimationComponent
108
+ animationType={ComponentAnimationType.componentFade}
109
+ style={styles.animatedContainer}
110
+ >
111
111
  <MobileTransportInfo
112
112
  content={entry}
113
113
  value={value}
@@ -116,7 +116,7 @@ export const TransportInfo = ({
116
116
  layoutState={layoutState}
117
117
  actionButtons={actionButtons}
118
118
  />
119
- </View>
119
+ </AnimationComponent>
120
120
  </View>
121
121
  );
122
122
  };
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { ModalHeader } from "@applicaster/zapp-react-native-ui-components/Components/ModalComponent/Header";
3
- import { isNil } from "lodash";
3
+ import { isNil } from "@applicaster/zapp-react-native-utils/utils";
4
4
 
5
5
  const formatTime = (milliseconds: number) => {
6
6
  const totalSeconds = Math.floor(milliseconds / 1000);
@@ -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,42 @@
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.RefObject<any>;
14
+ listener: Record<string, any>;
15
+ configuration: Record<string, any>;
16
+ style: ViewStyle;
17
+ }
18
+
19
+ export interface AudioPlayerProps {
20
+ style: ViewStyle;
21
+ }
22
+
23
+ export interface PlayerViewBaseProps {
24
+ children?: ReactNode;
25
+ type: "audio" | "video";
26
+ entry: ZappEntry;
27
+ pluginConfiguration: Record<string, any>;
28
+ PlayerComponent: ComponentType<any>;
29
+ playerProps: PlayerComponentProps;
30
+ playNextProps: PlayNextOverlayProps;
31
+ audioPlayerProps: AudioPlayerProps;
32
+ transportControls?: ReactNode;
33
+ inline?: boolean;
34
+ }
35
+
36
+ export interface TvOSPlayerViewProps extends PlayerViewBaseProps {
37
+ nativePlayerIsReady: boolean;
38
+ }
39
+
40
+ export type GenericTVPlayerViewProps = PlayerViewBaseProps;
41
+
42
+ export type TVPlayerViewProps = TvOSPlayerViewProps | GenericTVPlayerViewProps;