@applicaster/quick-brick-player 14.0.0-rc.9 → 15.0.0-alpha.1089439460

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 (43) hide show
  1. package/package.json +6 -11
  2. package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +44 -88
  3. package/src/Player/AudioLayer/Layout/Controls/index.tsx +8 -18
  4. package/src/Player/AudioLayer/Layout/DockedControls/index.tsx +169 -161
  5. package/src/Player/AudioLayer/Layout/MobileLayout.tsx +4 -42
  6. package/src/Player/AudioLayer/Layout/PlayerImage/FlexImage.tsx +5 -9
  7. package/src/Player/AudioLayer/Layout/PlayerImage/index.tsx +35 -83
  8. package/src/Player/AudioLayer/Layout/PlayerImage/styles.ts +6 -1
  9. package/src/Player/AudioLayer/Layout/TabletLandscapeLayout.tsx +6 -66
  10. package/src/Player/AudioLayer/Layout/TabletPortraitLayout.tsx +1 -39
  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/AudioLayer/utils.ts +1 -27
  14. package/src/Player/PlayerModal/GestureAnimatedScrollView.ts +7 -0
  15. package/src/Player/PlayerModal/PlayerModal.tsx +110 -0
  16. package/src/Player/PlayerModal/VideoPlayerModal.tsx +289 -0
  17. package/src/Player/PlayerModal/consts/index.ts +17 -0
  18. package/src/Player/PlayerModal/context/index.ts +6 -0
  19. package/src/Player/PlayerModal/hooks/index.ts +169 -0
  20. package/src/Player/PlayerModal/index.ts +3 -0
  21. package/src/Player/PlayerModal/index.web.ts +5 -0
  22. package/src/Player/PlayerModal/styles.ts +109 -0
  23. package/src/Player/PlayerModal/utils/index.ts +111 -0
  24. package/src/Player/PlayerView/GenericTVPlayerView.tsx +42 -0
  25. package/src/Player/PlayerView/TVPlayerView.tsx +26 -0
  26. package/src/Player/PlayerView/TvOSPlayerView.tsx +51 -0
  27. package/src/Player/PlayerView/types.ts +41 -0
  28. package/src/Player/hooks/progressStates/__tests__/utils.test.ts +23 -0
  29. package/src/Player/hooks/progressStates/useLiveProgressState.tsx +78 -0
  30. package/src/Player/hooks/progressStates/useProgressState.tsx +30 -0
  31. package/src/Player/hooks/progressStates/useVodProgressState.tsx +115 -0
  32. package/src/Player/hooks/progressStates/utils.ts +33 -0
  33. package/src/Player/index.tsx +575 -380
  34. package/src/QuickBrickPlayer.tsx +16 -10
  35. package/src/utils/dimensions.ts +29 -0
  36. package/src/utils/index.ts +12 -0
  37. package/src/utils/logger.ts +6 -0
  38. package/src/utils/playerHelpers.ts +11 -0
  39. package/src/utils/playerStyles.ts +50 -0
  40. package/src/Player/AudioLayer/Layout/PlayerImage/AnimatedImage.tsx +0 -87
  41. package/src/Player/AudioLayer/Layout/PlayerImage/hooks/index.ts +0 -1
  42. package/src/Player/AudioLayer/Layout/PlayerImage/hooks/useChangePlayerState.ts +0 -99
  43. /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-rc.9",
3
+ "version": "15.0.0-alpha.1089439460",
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": "13.0.0-rc.124",
39
- "@applicaster/quick-brick-tv-transport-controls": "14.0.0-rc.7",
40
- "@applicaster/zapp-react-native-tvos-app": "14.0.0-rc.9",
41
- "@applicaster/zapp-react-native-ui-components": "14.0.0-rc.9",
42
- "@applicaster/zapp-react-native-utils": "14.0.0-rc.9",
38
+ "@applicaster/quick-brick-mobile-transport-controls": "15.0.0-alpha.1089439460",
39
+ "@applicaster/quick-brick-tv-transport-controls": "15.0.0-alpha.1089439460",
40
+ "@applicaster/zapp-react-native-tvos-app": "15.0.0-alpha.1089439460",
41
+ "@applicaster/zapp-react-native-ui-components": "15.0.0-alpha.1089439460",
42
+ "@applicaster/zapp-react-native-utils": "15.0.0-alpha.1089439460",
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": "*",
@@ -1,11 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { useEffect, useState } from "react";
3
- import {
4
- Dimensions as ScreenDimensions,
5
- StyleSheet,
6
- View,
7
- ViewStyle,
8
- } from "react-native";
3
+ import { StyleSheet, View, ViewStyle } from "react-native";
9
4
 
10
5
  import { Edge, SafeAreaView } from "react-native-safe-area-context";
11
6
  import { usePlayerState } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerState";
@@ -13,14 +8,9 @@ import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerM
13
8
  import * as R from "ramda";
14
9
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
15
10
  import Layout from "./Layout";
16
- import {
17
- useIsTablet,
18
- useNavigation,
19
- } from "@applicaster/zapp-react-native-utils/reactHooks";
11
+ import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
20
12
  import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
21
13
  import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
22
- import { PlayerDetails } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/PlayerDetails";
23
- import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
24
14
  import { formatSpeed } from "./utils";
25
15
  import {
26
16
  getBottomSheetModalDefaultItemIcon,
@@ -30,12 +20,7 @@ import {
30
20
  getBottomSheetModalSelectedItemIcon,
31
21
  } from "../Utils";
32
22
  import { useTitleSummaryOverlay } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerTitleSummaryOverlay";
33
- import {
34
- AnimatedScrollModal,
35
- AnimationComponent,
36
- ComponentAnimationType,
37
- } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
38
- import { PADDING_HORIZONTAL } from "./Layout/const";
23
+
39
24
  import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
40
25
 
41
26
  import { DEFAULT_SPEED, PlaybackSpeed, SpeedController } from "./SpeedManager";
@@ -76,23 +61,16 @@ type Props = {
76
61
  inline: boolean;
77
62
  docked: boolean;
78
63
  isModal: boolean;
64
+ pip: boolean;
79
65
  };
80
66
  playNextData: PlayNextData;
81
67
  isTabletPortrait?: boolean;
82
68
  };
83
69
 
84
- const { width: SCREEN_WIDTH } = ScreenDimensions.get("screen");
85
-
86
70
  const Styles = StyleSheet.create({
87
71
  playerContainer: {
88
72
  flex: 1,
89
73
  },
90
- paddingHorizontal: { paddingTop: 0, paddingHorizontal: PADDING_HORIZONTAL },
91
- playerDetails: {
92
- marginTop: 60,
93
- alignSelf: "center",
94
- width: SCREEN_WIDTH - PADDING_HORIZONTAL * 2,
95
- },
96
74
  });
97
75
 
98
76
  const edges: Edge[] = ["right", "left", "top"];
@@ -107,16 +85,10 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
107
85
  configuration,
108
86
  style,
109
87
  entry,
110
- children,
111
88
  layoutState,
112
89
  playNextData = null,
113
- isTabletPortrait,
114
90
  } = props;
115
91
 
116
- const isTablet = useIsTablet();
117
-
118
- const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
119
-
120
92
  const { title, summary } = useTitleSummaryOverlay(
121
93
  entry,
122
94
  playerState?.isLive,
@@ -128,11 +100,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
128
100
  );
129
101
 
130
102
  useEffect(() => {
131
- if (player) {
132
- setSpeedManager(new SpeedController(player));
133
- } else {
134
- setSpeedManager(null);
135
- }
103
+ setSpeedManager(player ? new SpeedController(player) : null);
136
104
  }, [player]);
137
105
 
138
106
  useEffect(() => {
@@ -246,7 +214,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
246
214
  items: speedOptions,
247
215
  current_selection: playbackSpeed,
248
216
  onPress: onSpeedSelect,
249
- title: configuration["playback_speed_title"],
217
+ title: configuration.playback_speed_title,
250
218
  itemProps: getBottomSheetModalItemProps,
251
219
  iconProps: getBottomSheetModalIconProps,
252
220
  labelProps: getBottomSheetModalLabelProps,
@@ -262,11 +230,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
262
230
  ],
263
231
  },
264
232
  });
265
- }, [playbackSpeed, onSpeedSelect, configuration["playback_speed_title"]]);
266
-
267
- const onCloseVideoModal = React.useCallback(() => {
268
- playerManager.close();
269
- }, [playerManager]);
233
+ }, [playbackSpeed, onSpeedSelect, configuration.playback_speed_title]);
270
234
 
271
235
  const onPlayerSeek = React.useCallback(
272
236
  (targetTime: number) => {
@@ -283,53 +247,45 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
283
247
  player?.seekTo(0);
284
248
  }, [player]);
285
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
+
286
265
  return (
287
266
  <SafeAreaView style={[style, Styles.playerContainer]} edges={edges}>
288
- <AnimationComponent
289
- animationType={ComponentAnimationType.moveUpComponent}
290
- additionalData={{ saveArea: true }}
291
- style={Styles.playerContainer}
292
- >
293
- <AnimatedScrollModal>
294
- <View style={Styles.playerContainer} onLayout={onLayout}>
295
- <Layout
296
- entry={entry}
297
- playerState={playerState}
298
- layoutState={layoutState}
299
- value={value}
300
- onPlaybackButtonPress={onPlaybackButtonPress}
301
- onRewindButtonPress={onRewindButtonPress}
302
- onForwardButtonPress={onForwardButtonPress}
303
- onPlayerSeek={onPlayerSeek}
304
- onSkipStart={onSkipStart}
305
- onSpeedButtonPress={onSpeedButtonPress}
306
- playbackSpeedName={formatSpeed(playbackSpeed.value)}
307
- onSkipLive={onSkipLive}
308
- onCloseVideoModal={onCloseVideoModal}
309
- maximiseVideoModal={maximiseVideoModal}
310
- configuration={configuration}
311
- dimensions={dimensions}
312
- playNextData={playNextData}
313
- title={title}
314
- summary={summary}
315
- />
316
- <View style={Styles.paddingHorizontal}>
317
- {children}
318
- <AnimationComponent
319
- animationType={ComponentAnimationType.componentFade}
320
- >
321
- <PlayerDetails
322
- isAudioPlayer
323
- configuration={configuration}
324
- style={Styles.playerDetails}
325
- entry={entry}
326
- isTabletLandscape={isTabletLandscape}
327
- />
328
- </AnimationComponent>
329
- </View>
330
- </View>
331
- </AnimatedScrollModal>
332
- </AnimationComponent>
267
+ <View style={Styles.playerContainer} onLayout={onLayout}>
268
+ <Layout
269
+ entry={entry}
270
+ playerState={playerState}
271
+ layoutState={layoutStateMemo}
272
+ value={value}
273
+ onPlaybackButtonPress={onPlaybackButtonPress}
274
+ onRewindButtonPress={onRewindButtonPress}
275
+ onForwardButtonPress={onForwardButtonPress}
276
+ onPlayerSeek={onPlayerSeek}
277
+ onSkipStart={onSkipStart}
278
+ onSpeedButtonPress={onSpeedButtonPress}
279
+ playbackSpeedName={formatSpeed(playbackSpeed.value)}
280
+ onSkipLive={onSkipLive}
281
+ maximiseVideoModal={maximiseVideoModal}
282
+ configuration={configuration}
283
+ dimensions={dimensions}
284
+ playNextData={playNextData}
285
+ title={title}
286
+ summary={summary}
287
+ />
288
+ </View>
333
289
  </SafeAreaView>
334
290
  );
335
291
  };
@@ -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
  };