@applicaster/quick-brick-player 14.0.0-alpha.1355728993 → 14.0.0-alpha.1410953367

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 (33) hide show
  1. package/package.json +6 -11
  2. package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +20 -8
  3. package/src/Player/AudioLayer/Layout/Controls/index.tsx +8 -18
  4. package/src/Player/AudioLayer/Layout/DockedControls/index.tsx +118 -94
  5. package/src/Player/AudioLayer/Layout/MobileLayout.tsx +3 -26
  6. package/src/Player/AudioLayer/Layout/PlayerImage/FlexImage.tsx +5 -9
  7. package/src/Player/AudioLayer/Layout/PlayerImage/index.tsx +5 -22
  8. package/src/Player/AudioLayer/Layout/TabletLandscapeLayout.tsx +6 -50
  9. package/src/Player/AudioLayer/Layout/TabletPortraitLayout.tsx +1 -39
  10. package/src/Player/AudioLayer/Layout/TransportInfo/index.tsx +3 -9
  11. package/src/Player/AudioLayer/components/SleepTimerModalHeader/SleepTimerModalHeader.tsx +1 -1
  12. package/src/Player/AudioLayer/utils.ts +1 -27
  13. package/src/Player/PlayerModal/PlayerModal.tsx +17 -18
  14. package/src/Player/PlayerModal/VideoPlayerModal.tsx +202 -153
  15. package/src/Player/PlayerModal/consts/index.ts +5 -8
  16. package/src/Player/PlayerModal/context/index.ts +6 -0
  17. package/src/Player/PlayerModal/hooks/index.ts +127 -126
  18. package/src/Player/PlayerModal/index.web.ts +5 -0
  19. package/src/Player/PlayerModal/styles.ts +54 -45
  20. package/src/Player/PlayerModal/utils/index.ts +111 -0
  21. package/src/Player/PlayerView/GenericTVPlayerView.tsx +1 -2
  22. package/src/Player/PlayerView/types.ts +1 -2
  23. package/src/Player/index.tsx +559 -365
  24. package/src/QuickBrickPlayer.tsx +16 -10
  25. package/src/utils/dimensions.ts +29 -0
  26. package/src/utils/index.ts +12 -0
  27. package/src/utils/logger.ts +6 -0
  28. package/src/utils/playerHelpers.ts +11 -0
  29. package/src/utils/playerStyles.ts +50 -0
  30. package/src/Player/AudioLayer/Layout/PlayerImage/AnimatedImage.tsx +0 -42
  31. package/src/Player/AudioLayer/Layout/PlayerImage/hooks/index.ts +0 -1
  32. package/src/Player/AudioLayer/Layout/PlayerImage/hooks/useChangePlayerState.ts +0 -99
  33. /package/src/Player/AudioLayer/Layout/{Debug → DebugComponent}/index.tsx +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-player",
3
- "version": "14.0.0-alpha.1355728993",
3
+ "version": "14.0.0-alpha.1410953367",
4
4
  "description": "Quick Brick Player",
5
5
  "main": "./src/index.ts",
6
6
  "types": "index.d.ts",
@@ -35,13 +35,12 @@
35
35
  },
36
36
  "homepage": "https://github.com/applicaster/quickbrick#readme",
37
37
  "dependencies": {
38
- "@applicaster/quick-brick-mobile-transport-controls": "14.0.0-alpha.1355728993",
39
- "@applicaster/quick-brick-tv-transport-controls": "14.0.0-rc.7",
40
- "@applicaster/zapp-react-native-tvos-app": "14.0.0-alpha.1355728993",
41
- "@applicaster/zapp-react-native-ui-components": "14.0.0-alpha.1355728993",
42
- "@applicaster/zapp-react-native-utils": "14.0.0-alpha.1355728993",
38
+ "@applicaster/quick-brick-mobile-transport-controls": "14.0.0-rc.83",
39
+ "@applicaster/quick-brick-tv-transport-controls": "14.0.0-rc.71",
40
+ "@applicaster/zapp-react-native-tvos-app": "14.0.0-alpha.1410953367",
41
+ "@applicaster/zapp-react-native-ui-components": "14.0.0-alpha.1410953367",
42
+ "@applicaster/zapp-react-native-utils": "14.0.0-alpha.1410953367",
43
43
  "query-string": "7.1.3",
44
- "react-native-web-linear-gradient": "1.1.2",
45
44
  "shaka-player": "4.3.5",
46
45
  "typeface-montserrat": "^0.0.54",
47
46
  "video.js": "7.14.3",
@@ -58,15 +57,11 @@
58
57
  "@applicaster/zapp-react-native-tvos-ui-components": "*",
59
58
  "@babel/runtime": "*",
60
59
  "@react-native-community/netinfo": "*",
61
- "immer": "*",
62
60
  "react": "*",
63
61
  "react-native": "*",
64
62
  "react-native-fs": "*",
65
- "react-native-gesture-handler": "*",
66
63
  "react-native-linear-gradient": "*",
67
- "react-native-safe-area-context": "*",
68
64
  "react-native-svg": "*",
69
- "react-native-web": "*",
70
65
  "react-native-webview": "*",
71
66
  "uglify-js": "*",
72
67
  "validate-color": "*",
@@ -61,6 +61,7 @@ type Props = {
61
61
  inline: boolean;
62
62
  docked: boolean;
63
63
  isModal: boolean;
64
+ pip: boolean;
64
65
  };
65
66
  playNextData: PlayNextData;
66
67
  isTabletPortrait?: boolean;
@@ -99,11 +100,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
99
100
  );
100
101
 
101
102
  useEffect(() => {
102
- if (player) {
103
- setSpeedManager(new SpeedController(player));
104
- } else {
105
- setSpeedManager(null);
106
- }
103
+ setSpeedManager(player ? new SpeedController(player) : null);
107
104
  }, [player]);
108
105
 
109
106
  useEffect(() => {
@@ -217,7 +214,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
217
214
  items: speedOptions,
218
215
  current_selection: playbackSpeed,
219
216
  onPress: onSpeedSelect,
220
- title: configuration["playback_speed_title"],
217
+ title: configuration.playback_speed_title,
221
218
  itemProps: getBottomSheetModalItemProps,
222
219
  iconProps: getBottomSheetModalIconProps,
223
220
  labelProps: getBottomSheetModalLabelProps,
@@ -233,7 +230,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
233
230
  ],
234
231
  },
235
232
  });
236
- }, [playbackSpeed, onSpeedSelect, configuration["playback_speed_title"]]);
233
+ }, [playbackSpeed, onSpeedSelect, configuration.playback_speed_title]);
237
234
 
238
235
  const onPlayerSeek = React.useCallback(
239
236
  (targetTime: number) => {
@@ -250,13 +247,28 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
250
247
  player?.seekTo(0);
251
248
  }, [player]);
252
249
 
250
+ const layoutStateMemo = React.useMemo(
251
+ () => ({
252
+ inline: layoutState.inline,
253
+ docked: layoutState.docked,
254
+ isModal: layoutState.isModal,
255
+ pip: layoutState.pip,
256
+ }),
257
+ [
258
+ layoutState.inline,
259
+ layoutState.docked,
260
+ layoutState.isModal,
261
+ layoutState.pip,
262
+ ]
263
+ );
264
+
253
265
  return (
254
266
  <SafeAreaView style={[style, Styles.playerContainer]} edges={edges}>
255
267
  <View style={Styles.playerContainer} onLayout={onLayout}>
256
268
  <Layout
257
269
  entry={entry}
258
270
  playerState={playerState}
259
- layoutState={layoutState}
271
+ layoutState={layoutStateMemo}
260
272
  value={value}
261
273
  onPlaybackButtonPress={onPlaybackButtonPress}
262
274
  onRewindButtonPress={onRewindButtonPress}
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { StyleSheet } from "react-native";
2
+ import { StyleSheet, View } from "react-native";
3
3
 
4
4
  import { dayjs } from "@applicaster/zapp-react-native-utils/dateUtils";
5
5
  import {
@@ -12,11 +12,6 @@ import {
12
12
  } from "@applicaster/quick-brick-mobile-transport-controls";
13
13
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
14
14
 
15
- import {
16
- AnimationComponent,
17
- ComponentAnimationType,
18
- } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
19
-
20
15
  import { AudioDescription } from "../../AudioDescription";
21
16
  import { isValidDate } from "../../../Utils";
22
17
  import { VerticalGutter } from "./VerticalGutter";
@@ -103,8 +98,6 @@ export const Controls = (props: Props) => {
103
98
  onSkipLive,
104
99
  onSpeedButtonPress,
105
100
  maxWidth = 320,
106
-
107
- docked,
108
101
  } = props;
109
102
 
110
103
  const configuration = useZStore("playerConfiguration");
@@ -229,15 +222,8 @@ export const Controls = (props: Props) => {
229
222
  isLiveShowFullControls,
230
223
  ]);
231
224
 
232
- if (docked) {
233
- return null;
234
- }
235
-
236
225
  return (
237
- <AnimationComponent
238
- animationType={ComponentAnimationType.componentFade}
239
- style={isTablet ? styles.nonFlex : styles.flex}
240
- >
226
+ <View style={isTablet ? styles.nonFlex : styles.flex}>
241
227
  <VerticalGutter />
242
228
 
243
229
  <AudioDescription
@@ -257,7 +243,11 @@ export const Controls = (props: Props) => {
257
243
  content={entry}
258
244
  value={value}
259
245
  visible
260
- layoutState={layoutState}
246
+ layoutState={{
247
+ ...layoutState,
248
+ docked: false, // always use non-docked layout for audio (to show time labels
249
+ inline: true, // always use inline layout for audio (to show time labels)
250
+ }}
261
251
  onPlayerSeek={onPlayerSeek}
262
252
  playerState={playerState}
263
253
  disableFullscreen
@@ -286,6 +276,6 @@ export const Controls = (props: Props) => {
286
276
  }}
287
277
  playerState={playerState}
288
278
  />
289
- </AnimationComponent>
279
+ </View>
290
280
  );
291
281
  };
@@ -1,6 +1,5 @@
1
1
  import * as React from "react";
2
- import { StyleSheet, View, ViewStyle } from "react-native";
3
- import * as R from "ramda";
2
+ import { StyleSheet, View } from "react-native";
4
3
  import {
5
4
  useIsTablet,
6
5
  useZStore,
@@ -16,29 +15,27 @@ import {
16
15
 
17
16
  import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
18
17
 
19
- import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
20
18
  import { useSafeAreaInsets } from "react-native-safe-area-context";
19
+ import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
21
20
  import { getTabBarHeight } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/getTabBarHeight";
22
21
  import { useTitleSummaryOverlay } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerTitleSummaryOverlay";
23
22
  import { usePlayerState } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerState";
24
23
  import { useConfiguration } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/utils";
25
24
  import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
25
+ import { PROGRESS_BAR_HEIGHT } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/utils";
26
+ import { isMenuVisible } from "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler";
27
+ import { usePlugins } from "@applicaster/zapp-react-native-redux";
28
+ import { partial } from "@applicaster/zapp-react-native-utils/utils";
26
29
 
27
30
  const bottomTabBarHeight = getTabBarHeight();
28
31
 
29
32
  type Props = {
30
33
  entry: ZappEntry;
31
34
  layoutState: QuickBrickPlayer.LayoutState;
32
- playerState: QuickBrickPlayer.PlayerState;
33
- value: GetValue;
34
- onCloseVideoModal: () => void;
35
- onPlayerSeek: (targetTime: number) => void;
35
+ onPlayerSeek?: (targetTime: number) => void;
36
36
  playNextData: PlayNextData;
37
- title: string | number;
38
- summary: string | number;
39
37
  ImageComponent?: React.ReactNode;
40
38
  isActiveGesture?: boolean;
41
- minimisedHeight: number;
42
39
  aspectRatio?: number;
43
40
  };
44
41
 
@@ -47,7 +44,6 @@ const styles = StyleSheet.create({
47
44
  flex: 1,
48
45
  flexDirection: "column",
49
46
  alignItems: "stretch",
50
- marginTop: 3, // from plugins/mobile-transport-controls/src/ProgressBar/layouts/DockedLayout.tsx
51
47
  },
52
48
  content: {
53
49
  flex: 1,
@@ -90,14 +86,12 @@ const styles = StyleSheet.create({
90
86
  buttons: {
91
87
  marginVertical: 10,
92
88
  },
89
+ liveMarginTop: { marginTop: 0 },
90
+ marginTop: { marginTop: PROGRESS_BAR_HEIGHT },
93
91
  });
94
92
 
95
- const playerDimensionsStyle = (
96
- minimisedHeight: number,
97
- addPadding: boolean
98
- ): ViewStyle => ({
99
- width: addPadding ? toNumberWithDefault(100, minimisedHeight) : 0,
100
- });
93
+ const getValue = (key: string, stylesObj: Record<string, any>) =>
94
+ stylesObj?.[key] ?? null;
101
95
 
102
96
  const controlButtons = (
103
97
  live: boolean,
@@ -163,7 +157,6 @@ export const DockedControls = (props: Props) => {
163
157
  onPlayerSeek = noop,
164
158
  playNextData,
165
159
  ImageComponent,
166
- isActiveGesture = true,
167
160
  aspectRatio,
168
161
  } = props;
169
162
 
@@ -171,14 +164,16 @@ export const DockedControls = (props: Props) => {
171
164
  playerManager.close();
172
165
  }, []);
173
166
 
167
+ const { currentRoute, screenData } = useNavigation();
168
+
169
+ const plugins = usePlugins();
170
+ const menuVisible = isMenuVisible(currentRoute, screenData, plugins);
171
+
174
172
  const { minimised_height: minimisedHeight } = useConfiguration();
175
173
 
176
174
  const configuration = useZStore("playerConfiguration")();
177
175
  const playerState = usePlayerState("shared-player-wrapper-docked");
178
176
 
179
- const getValue = (key: string, stylesObj: {}) =>
180
- R.propOr(null, key, stylesObj);
181
-
182
177
  const value = React.useCallback(
183
178
  (key: string) => {
184
179
  const retVal = getValue(key, configuration);
@@ -197,7 +192,7 @@ export const DockedControls = (props: Props) => {
197
192
 
198
193
  return retVal;
199
194
  },
200
- [...Object.values(configuration), playerState]
195
+ [...Object.values(configuration), playerState.seekableDuration]
201
196
  );
202
197
 
203
198
  const { title, summary } = useTitleSummaryOverlay(
@@ -214,90 +209,119 @@ export const DockedControls = (props: Props) => {
214
209
 
215
210
  const insets = useSafeAreaInsets();
216
211
 
212
+ const progressBarLayoutState = React.useMemo(
213
+ () => ({
214
+ inline: layoutState.inline,
215
+ docked: true,
216
+ isModal: layoutState.isModal,
217
+ pip: layoutState.pip,
218
+ }),
219
+ [layoutState.inline, layoutState.isModal, layoutState.pip]
220
+ );
221
+
222
+ const _controlButtons = React.useMemo(
223
+ () => partial(controlButtons, playerState.isLive && liveButton),
224
+ [playerState.isLive, liveButton]
225
+ );
226
+
227
+ const containerStyles = React.useMemo(
228
+ () => ({
229
+ height: minimisedHeight,
230
+ maxHeight: minimisedHeight,
231
+ }),
232
+ [minimisedHeight]
233
+ );
234
+
235
+ const imageComponentWrapperStyles = React.useMemo(
236
+ () => ({
237
+ aspectRatio: aspectRatio,
238
+ height: minimisedHeight,
239
+ }),
240
+ [aspectRatio, minimisedHeight]
241
+ );
242
+
243
+ const backgroundColorStyle = React.useMemo(
244
+ () => ({
245
+ backgroundColor: dockedBackgroundColor,
246
+ }),
247
+ [dockedBackgroundColor]
248
+ );
249
+
250
+ const bottomSpacerStyle = React.useMemo(() => {
251
+ const tabBarHeight = menuVisible ? bottomTabBarHeight : 0;
252
+ const safeAreaBottomInset = insets.bottom || 0;
253
+
254
+ return {
255
+ height: safeAreaBottomInset + tabBarHeight,
256
+ };
257
+ }, [menuVisible, insets.bottom]);
258
+
259
+ const contentInfoContent = React.useMemo(
260
+ () => ({ ...entry, title, summary }),
261
+ [title, summary, entry]
262
+ );
263
+
217
264
  return (
218
- <View
219
- style={[
220
- styles.container,
221
- {
222
- height: minimisedHeight + bottomTabBarHeight + insets.bottom,
223
- },
224
- ]}
225
- >
226
- {!playerState.isLive ? (
227
- <ProgressBar
228
- name={"shared-docked-layout"}
229
- content={entry}
230
- value={value}
231
- visible
232
- layoutState={layoutState}
233
- onPlayerSeek={onPlayerSeek}
234
- playerState={playerState}
235
- startComponentsAnimation={noop}
236
- docked
237
- />
238
- ) : null}
239
-
240
- <View style={styles.content}>
241
- <View style={styles.touchableArea}>
242
- {isActiveGesture || layoutState.docked ? (
243
- <View style={{ aspectRatio: aspectRatio, height: minimisedHeight }}>
265
+ <>
266
+ <View
267
+ style={[
268
+ styles.container,
269
+ containerStyles,
270
+ playerState.isLive ? styles.liveMarginTop : styles.marginTop,
271
+ ]}
272
+ >
273
+ {!playerState.isLive ? (
274
+ <ProgressBar
275
+ name={"shared-docked-layout"}
276
+ content={entry}
277
+ value={value}
278
+ visible
279
+ layoutState={progressBarLayoutState}
280
+ onPlayerSeek={onPlayerSeek}
281
+ playerState={playerState}
282
+ docked
283
+ />
284
+ ) : null}
285
+
286
+ <View style={styles.content}>
287
+ <View style={styles.touchableArea}>
288
+ <View style={imageComponentWrapperStyles}>
244
289
  {ImageComponent || null}
245
290
  </View>
246
- ) : (
247
291
  <View
248
- style={playerDimensionsStyle(
249
- minimisedHeight,
250
- isActiveGesture || layoutState.docked
251
- )}
252
- />
253
- )}
292
+ testID="content-info"
293
+ style={[styles.contentInfo, backgroundColorStyle]}
294
+ >
295
+ <ContentInfo content={contentInfoContent} value={value} docked />
296
+ </View>
297
+ </View>
254
298
  <View
255
- testID="content-info"
256
299
  style={[
257
- styles.contentInfo,
258
- { backgroundColor: dockedBackgroundColor },
300
+ isTablet
301
+ ? styles.controlsContainerForTablet
302
+ : styles.controlsContainerForMobile,
303
+ backgroundColorStyle,
259
304
  ]}
260
305
  >
261
- <ContentInfo
262
- content={{ ...entry, title, summary }}
306
+ <Controls
307
+ value={value}
308
+ visible
309
+ buttons={_controlButtons}
310
+ style={styles.playPauseButton}
311
+ playNextData={playNextData}
312
+ playerState={playerState}
313
+ />
314
+ <Button
315
+ icon={"close_mini"}
316
+ size={"medium"}
263
317
  value={value}
264
- docked
318
+ onPress={onCloseVideoModal}
319
+ style={styles.buttons}
265
320
  />
266
321
  </View>
267
322
  </View>
268
- <View
269
- style={[
270
- isTablet
271
- ? styles.controlsContainerForTablet
272
- : styles.controlsContainerForMobile,
273
- { backgroundColor: dockedBackgroundColor },
274
- ]}
275
- >
276
- <Controls
277
- value={value}
278
- visible
279
- buttons={R.partial(controlButtons, [
280
- playerState.isLive && liveButton,
281
- ])}
282
- style={styles.playPauseButton}
283
- playNextData={playNextData}
284
- playerState={playerState}
285
- />
286
- <Button
287
- icon={"close_mini"}
288
- size={"medium"}
289
- value={value}
290
- onPress={onCloseVideoModal}
291
- style={styles.buttons}
292
- />
293
- </View>
294
323
  </View>
295
- <View
296
- style={{
297
- height: insets.bottom + bottomTabBarHeight,
298
- backgroundColor: dockedBackgroundColor,
299
- }}
300
- />
301
- </View>
324
+ <View style={[bottomSpacerStyle, backgroundColorStyle]} />
325
+ </>
302
326
  );
303
327
  };
@@ -4,7 +4,6 @@ import {
4
4
  useSafeAreaFrame,
5
5
  useSafeAreaInsets,
6
6
  } from "react-native-safe-area-context";
7
- import { useModalAnimationContext } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
8
7
 
9
8
  import { MOBILE, NAVBAR_HEIGHT } from "./const";
10
9
  import { TransportInfo } from "./TransportInfo";
@@ -17,7 +16,7 @@ import {
17
16
  BottomDebugSquare,
18
17
  LeftDebugSquare,
19
18
  RightDebugSquare,
20
- } from "./Debug/index";
19
+ } from "./DebugComponent";
21
20
 
22
21
  import { Props } from "./types";
23
22
 
@@ -79,8 +78,6 @@ export function MobileLayout({
79
78
  onSpeedButtonPress,
80
79
  playbackSpeedName,
81
80
  configuration,
82
- dimensions,
83
- playNextData,
84
81
  title,
85
82
  summary,
86
83
  }: Props) {
@@ -88,12 +85,10 @@ export function MobileLayout({
88
85
 
89
86
  const { bottom: bottomInset, top: topInset } = useSafeAreaInsets();
90
87
  const { height: screenHeight } = useSafeAreaFrame();
91
- const { progressBarHeight } = useModalAnimationContext();
92
88
 
93
89
  const { imageSize } = useMobileLayoutImageSize();
94
90
 
95
- const { height: transportInfoHeight, onLayout: onTransportInfoLayout } =
96
- useTransportInfoHeight();
91
+ const { onLayout: onTransportInfoLayout } = useTransportInfoHeight();
97
92
 
98
93
  const controlsContainerHeight = React.useMemo(() => {
99
94
  return (
@@ -107,10 +102,6 @@ export function MobileLayout({
107
102
  );
108
103
  }, [screenHeight, topInset, imageSize, bottomInset]);
109
104
 
110
- const verticalOffsetForImage = React.useMemo(() => {
111
- return transportInfoHeight + MOBILE.MARGIN_TOP - progressBarHeight;
112
- }, [transportInfoHeight, progressBarHeight]);
113
-
114
105
  return (
115
106
  <View
116
107
  style={[
@@ -160,21 +151,7 @@ export function MobileLayout({
160
151
  },
161
152
  ]}
162
153
  >
163
- <PlayerImage
164
- entry={entry}
165
- layoutState={layoutState}
166
- playerState={playerState}
167
- value={value}
168
- configuration={configuration}
169
- onPlayerSeek={onPlayerSeek}
170
- dimensions={dimensions}
171
- playNextData={playNextData}
172
- title={title}
173
- summary={summary}
174
- docked={docked}
175
- imageWidth={imageSize}
176
- verticalOffset={verticalOffsetForImage}
177
- />
154
+ <PlayerImage entry={entry} configuration={configuration} />
178
155
  </View>
179
156
  {/* PlayerImage */}
180
157
 
@@ -1,7 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { Image, ImageStyle } from "react-native";
3
-
4
- import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
3
+ import { useBackgroundImage } from "@applicaster/zapp-react-native-utils/audioPlayerUtils";
5
4
 
6
5
  type Props = {
7
6
  entry: ZappEntry;
@@ -9,12 +8,9 @@ type Props = {
9
8
  };
10
9
 
11
10
  export const FlexImage = ({ entry, style }: Props) => {
12
- const source = React.useMemo(
13
- () => ({ uri: imageSrcFromMediaItem(entry, undefined) }),
14
- [entry]
15
- );
11
+ const backgroundImageSource = useBackgroundImage(entry);
16
12
 
17
- if (!source) return null;
18
-
19
- return <Image resizeMode="cover" style={style} source={source} />;
13
+ return (
14
+ <Image resizeMode="cover" style={style} source={backgroundImageSource} />
15
+ );
20
16
  };
@@ -4,7 +4,6 @@ import { LayoutChangeEvent, View } from "react-native";
4
4
  import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
5
5
  import { toBooleanWithDefaultTrue } from "@applicaster/zapp-react-native-utils/booleanUtils";
6
6
 
7
- import { AnimatedImage } from "./AnimatedImage";
8
7
  import { FlexImage } from "./FlexImage";
9
8
 
10
9
  import { styles } from "./styles";
@@ -13,19 +12,12 @@ import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/nu
13
12
  type Props = {
14
13
  entry: ZappEntry;
15
14
  configuration: QuickBrickPlayer.AudioPlayerProps["configuration"];
16
- docked: boolean;
17
- imageWidth?: Option<number>;
15
+ docked?: boolean;
18
16
  onLayoutImage?: (event: LayoutChangeEvent) => void;
19
17
  };
20
18
 
21
19
  export const PlayerImage = (props: Props) => {
22
- const {
23
- entry,
24
- docked,
25
- imageWidth,
26
- configuration,
27
- onLayoutImage = noop,
28
- } = props;
20
+ const { entry, docked = false, configuration, onLayoutImage = noop } = props;
29
21
 
30
22
  const isShadowEnabled = toBooleanWithDefaultTrue(
31
23
  configuration?.audio_player_artwork_shadow_enabled
@@ -43,18 +35,9 @@ export const PlayerImage = (props: Props) => {
43
35
  onLayout={onLayoutImage}
44
36
  style={[shouldShowShadow ? styles.shadow : undefined, { borderRadius }]}
45
37
  >
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
- )}
38
+ <View style={[styles.defaultImageWrapperView, { borderRadius }]}>
39
+ <FlexImage entry={entry} style={styles.backgroundImageContainer} />
40
+ </View>
58
41
  </View>
59
42
  </View>
60
43
  );