@applicaster/quick-brick-player 14.0.0-alpha.3011001369 → 14.0.0-alpha.3065652724

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-player",
3
- "version": "14.0.0-alpha.3011001369",
3
+ "version": "14.0.0-alpha.3065652724",
4
4
  "description": "Quick Brick Player",
5
5
  "main": "./src/index.ts",
6
6
  "types": "index.d.ts",
@@ -35,11 +35,11 @@
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.3011001369",
39
- "@applicaster/quick-brick-tv-transport-controls": "14.0.0-rc.48",
40
- "@applicaster/zapp-react-native-tvos-app": "14.0.0-alpha.3011001369",
41
- "@applicaster/zapp-react-native-ui-components": "14.0.0-alpha.3011001369",
42
- "@applicaster/zapp-react-native-utils": "14.0.0-alpha.3011001369",
38
+ "@applicaster/quick-brick-mobile-transport-controls": "14.0.0-rc.67",
39
+ "@applicaster/quick-brick-tv-transport-controls": "14.0.0-rc.65",
40
+ "@applicaster/zapp-react-native-tvos-app": "14.0.0-alpha.3065652724",
41
+ "@applicaster/zapp-react-native-ui-components": "14.0.0-alpha.3065652724",
42
+ "@applicaster/zapp-react-native-utils": "14.0.0-alpha.3065652724",
43
43
  "query-string": "7.1.3",
44
44
  "shaka-player": "4.3.5",
45
45
  "typeface-montserrat": "^0.0.54",
@@ -26,6 +26,7 @@ import { useConfiguration } from "@applicaster/zapp-react-native-ui-components/C
26
26
  import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
27
27
  import { PROGRESS_BAR_HEIGHT } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/utils";
28
28
  import { isMenuVisible } from "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler";
29
+ import { usePlugins } from "@applicaster/zapp-react-native-redux";
29
30
 
30
31
  const bottomTabBarHeight = getTabBarHeight();
31
32
 
@@ -176,15 +177,18 @@ export const DockedControls = (props: Props) => {
176
177
 
177
178
  const { currentRoute, screenData } = useNavigation();
178
179
 
179
- const menuVisible = isMenuVisible(currentRoute, screenData);
180
+ const plugins = usePlugins();
181
+ const menuVisible = isMenuVisible(currentRoute, screenData, plugins);
180
182
 
181
183
  const { minimised_height: minimisedHeight } = useConfiguration();
182
184
 
183
185
  const configuration = useZStore("playerConfiguration")();
184
186
  const playerState = usePlayerState("shared-player-wrapper-docked");
185
187
 
186
- const getValue = (key: string, stylesObj: {}) =>
187
- R.propOr(null, key, stylesObj);
188
+ const getValue = React.useCallback(
189
+ (key: string, stylesObj: {}) => R.propOr(null, key, stylesObj),
190
+ []
191
+ );
188
192
 
189
193
  const value = React.useCallback(
190
194
  (key: string) => {
@@ -204,7 +208,7 @@ export const DockedControls = (props: Props) => {
204
208
 
205
209
  return retVal;
206
210
  },
207
- [...Object.values(configuration), playerState]
211
+ [...Object.values(configuration), playerState.seekableDuration, getValue]
208
212
  );
209
213
 
210
214
  const { title, summary } = useTitleSummaryOverlay(
@@ -222,85 +226,87 @@ export const DockedControls = (props: Props) => {
222
226
  const insets = useSafeAreaInsets();
223
227
 
224
228
  return (
225
- <View
226
- style={[
227
- styles.container,
228
- {
229
- height:
230
- minimisedHeight +
231
- (menuVisible ? bottomTabBarHeight : 0) +
232
- insets.bottom,
233
- },
234
- ]}
235
- >
236
- {!playerState.isLive ? (
237
- <ProgressBar
238
- name={"shared-docked-layout"}
239
- content={entry}
240
- value={value}
241
- visible
242
- layoutState={layoutState}
243
- onPlayerSeek={onPlayerSeek}
244
- playerState={playerState}
245
- startComponentsAnimation={noop}
246
- docked
247
- />
248
- ) : null}
229
+ <>
230
+ <View
231
+ style={[
232
+ styles.container,
233
+ {
234
+ height: minimisedHeight,
235
+ maxHeight: minimisedHeight,
236
+ },
237
+ ]}
238
+ >
239
+ {!playerState.isLive ? (
240
+ <ProgressBar
241
+ name={"shared-docked-layout"}
242
+ content={entry}
243
+ value={value}
244
+ visible
245
+ layoutState={layoutState}
246
+ onPlayerSeek={onPlayerSeek}
247
+ playerState={playerState}
248
+ startComponentsAnimation={noop}
249
+ docked
250
+ />
251
+ ) : null}
249
252
 
250
- <View style={styles.content}>
251
- <View style={styles.touchableArea}>
252
- {isActiveGesture || layoutState.docked ? (
253
- <View style={{ aspectRatio: aspectRatio, height: minimisedHeight }}>
254
- {ImageComponent || null}
255
- </View>
256
- ) : (
253
+ <View style={styles.content}>
254
+ <View style={styles.touchableArea}>
255
+ {isActiveGesture || layoutState.docked ? (
256
+ <View
257
+ style={{ aspectRatio: aspectRatio, height: minimisedHeight }}
258
+ >
259
+ {ImageComponent || null}
260
+ </View>
261
+ ) : (
262
+ <View
263
+ style={playerDimensionsStyle(
264
+ minimisedHeight,
265
+ isActiveGesture || layoutState.docked
266
+ )}
267
+ />
268
+ )}
257
269
  <View
258
- style={playerDimensionsStyle(
259
- minimisedHeight,
260
- isActiveGesture || layoutState.docked
261
- )}
262
- />
263
- )}
270
+ testID="content-info"
271
+ style={[
272
+ styles.contentInfo,
273
+ { backgroundColor: dockedBackgroundColor },
274
+ ]}
275
+ >
276
+ <ContentInfo
277
+ content={{ ...entry, title, summary }}
278
+ value={value}
279
+ docked
280
+ />
281
+ </View>
282
+ </View>
264
283
  <View
265
- testID="content-info"
266
284
  style={[
267
- styles.contentInfo,
285
+ isTablet
286
+ ? styles.controlsContainerForTablet
287
+ : styles.controlsContainerForMobile,
268
288
  { backgroundColor: dockedBackgroundColor },
269
289
  ]}
270
290
  >
271
- <ContentInfo
272
- content={{ ...entry, title, summary }}
291
+ <Controls
273
292
  value={value}
274
- docked
293
+ visible
294
+ buttons={R.partial(controlButtons, [
295
+ playerState.isLive && liveButton,
296
+ ])}
297
+ style={styles.playPauseButton}
298
+ playNextData={playNextData}
299
+ playerState={playerState}
300
+ />
301
+ <Button
302
+ icon={"close_mini"}
303
+ size={"medium"}
304
+ value={value}
305
+ onPress={onCloseVideoModal}
306
+ style={styles.buttons}
275
307
  />
276
308
  </View>
277
309
  </View>
278
- <View
279
- style={[
280
- isTablet
281
- ? styles.controlsContainerForTablet
282
- : styles.controlsContainerForMobile,
283
- { backgroundColor: dockedBackgroundColor },
284
- ]}
285
- >
286
- <Controls
287
- value={value}
288
- visible
289
- buttons={R.partial(controlButtons, [
290
- playerState.isLive && liveButton,
291
- ])}
292
- style={styles.playPauseButton}
293
- playNextData={playNextData}
294
- playerState={playerState}
295
- />
296
- <Button
297
- icon={"close_mini"}
298
- size={"medium"}
299
- value={value}
300
- onPress={onCloseVideoModal}
301
- style={styles.buttons}
302
- />
303
- </View>
304
310
  </View>
305
311
  <View
306
312
  style={{
@@ -308,6 +314,6 @@ export const DockedControls = (props: Props) => {
308
314
  backgroundColor: dockedBackgroundColor,
309
315
  }}
310
316
  />
311
- </View>
317
+ </>
312
318
  );
313
319
  };
@@ -1,6 +1,6 @@
1
- import React, { useRef, ReactElement } from "react";
1
+ import React, { ReactElement, useRef } from "react";
2
2
 
3
- import { StyleSheet, Animated, Pressable, ViewStyle } from "react-native";
3
+ import { Animated, Pressable, StyleSheet, ViewStyle } from "react-native";
4
4
  import { PanGestureHandler } from "react-native-gesture-handler";
5
5
  import { useStyles } from "./styles";
6
6
  import { useConfiguration } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/utils";
@@ -19,6 +19,7 @@ import { useModalAnimationContext } from "@applicaster/zapp-react-native-ui-comp
19
19
  import { PROGRESS_BAR_HEIGHT } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/utils";
20
20
  import { useSafeAreaInsets } from "react-native-safe-area-context";
21
21
  import { GestureAnimatedScrollView } from "./GestureAnimatedScrollView";
22
+ import { PlayerDetailsWrapperHeightContext } from "./context";
22
23
 
23
24
  const orientationStyles = StyleSheet.create({
24
25
  landscape: { flexDirection: "row" },
@@ -30,18 +31,12 @@ const directionStyles = (isLandscape: boolean): ViewStyle => {
30
31
  };
31
32
 
32
33
  type AnimatedModalProps = {
33
- enabled?: boolean;
34
34
  pip?: boolean;
35
35
  fullscreen?: boolean;
36
- content?: (
37
- opacity: Animated.Value | Animated.AnimatedInterpolation<number>
38
- ) => ReactElement;
39
- collapsedContent?: (
40
- opacity: Animated.Value | Animated.AnimatedInterpolation<number>
41
- ) => ReactElement;
42
- extraContent?: (
43
- opacity: Animated.Value | Animated.AnimatedInterpolation<number>
44
- ) => ReactElement;
36
+ modal?: boolean;
37
+ content?: ReactElement;
38
+ collapsedContent?: ReactElement;
39
+ extraContent?: ReactElement;
45
40
  aspectRatio?: number;
46
41
  isTabletPortrait?: boolean;
47
42
  style?: {
@@ -54,7 +49,6 @@ type AnimatedModalProps = {
54
49
  const height = SCREEN_HEIGHT;
55
50
 
56
51
  export function VideoPlayerModal({
57
- enabled = true,
58
52
  aspectRatio = DEFAULT_IMAGE_RATIO_VIDEO,
59
53
  content,
60
54
  extraContent,
@@ -63,7 +57,9 @@ export function VideoPlayerModal({
63
57
  style,
64
58
  pip = false,
65
59
  fullscreen = false,
60
+ modal = true,
66
61
  }: AnimatedModalProps) {
62
+ const enabled = !!modal && !fullscreen;
67
63
  const isTablet = useIsTablet();
68
64
 
69
65
  let width = SCREEN_WIDTH;
@@ -76,6 +72,8 @@ export function VideoPlayerModal({
76
72
  const scrollViewRef = useRef<typeof Animated.ScrollView | null>(null);
77
73
 
78
74
  const translateYRef = useModalAnimationContext().yTranslate;
75
+ // used when modal is false, should not be used in animation
76
+ const dummyRef = useRef(new Animated.Value(0));
79
77
 
80
78
  const {
81
79
  translateY,
@@ -83,7 +81,7 @@ export function VideoPlayerModal({
83
81
  collapsedHeight,
84
82
  gestureHandlerProps,
85
83
  expand,
86
- } = useVideoModalState(translateYRef);
84
+ } = useVideoModalState(modal ? translateYRef : dummyRef);
87
85
 
88
86
  const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
89
87
 
@@ -166,6 +164,20 @@ export function VideoPlayerModal({
166
164
  })
167
165
  : new Animated.Value(0);
168
166
 
167
+ const [playerDetailsWrapperHeight, setPlayerDetailsWrapperHeight] =
168
+ React.useState(0);
169
+
170
+ const onScrollViewLayout = React.useCallback(
171
+ ({
172
+ nativeEvent: {
173
+ layout: { height },
174
+ },
175
+ }) => {
176
+ setPlayerDetailsWrapperHeight(height);
177
+ },
178
+ []
179
+ );
180
+
169
181
  return (
170
182
  <PanGestureHandler
171
183
  enabled={enabled}
@@ -212,7 +224,7 @@ export function VideoPlayerModal({
212
224
  },
213
225
  ]}
214
226
  >
215
- {content(expandedOpacity)}
227
+ {content}
216
228
  </Animated.View>
217
229
  {extraContent ? (
218
230
  <GestureAnimatedScrollView
@@ -220,12 +232,17 @@ export function VideoPlayerModal({
220
232
  contentContainerStyle={{
221
233
  paddingBottom: insets.bottom,
222
234
  }}
235
+ onLayout={onScrollViewLayout}
223
236
  style={[
224
237
  styles.extraContentScrollView,
225
238
  { opacity: expandedOpacity },
226
239
  ]}
227
240
  >
228
- {extraContent ? extraContent(expandedOpacity) : null}
241
+ <PlayerDetailsWrapperHeightContext.Provider
242
+ value={playerDetailsWrapperHeight}
243
+ >
244
+ {extraContent}
245
+ </PlayerDetailsWrapperHeightContext.Provider>
229
246
  </GestureAnimatedScrollView>
230
247
  ) : null}
231
248
  </Animated.View>
@@ -12,7 +12,7 @@ export const VIDEO_TRANSITION_THRESHOLD = 0.5; // Threshold for video transition
12
12
  const windowDimensions = Dimensions.get("window");
13
13
 
14
14
  const isOldAndroidDevice =
15
- isAndroidPlatform() && !isAndroidVersionAtLeast(35) && !isAndroidTablet();
15
+ isAndroidPlatform() && !isAndroidVersionAtLeast(34) && !isAndroidTablet();
16
16
 
17
17
  export const SCREEN_WIDTH = windowDimensions.width;
18
18
 
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+
3
+ export const PlayerDetailsWrapperHeightContext = React.createContext(null);
4
+
5
+ export const usePlayerDetailsWrapperHeight = () =>
6
+ React.useContext(PlayerDetailsWrapperHeightContext);
@@ -15,6 +15,7 @@ import {
15
15
  SCREEN_HEIGHT,
16
16
  } from "../consts";
17
17
  import { PROGRESS_BAR_HEIGHT } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/utils";
18
+ import { usePlugins } from "@applicaster/zapp-react-native-redux";
18
19
 
19
20
  const bottomTabBarHeight = getTabBarHeight();
20
21
 
@@ -31,15 +32,19 @@ export const useVideoModalState = (
31
32
  screenData,
32
33
  } = useNavigation();
33
34
 
34
- const menuVisible = isMenuVisible(currentRoute, screenData);
35
+ const plugins = usePlugins();
36
+
37
+ const menuVisible = isMenuVisible(currentRoute, screenData, plugins);
35
38
 
36
39
  const collapsed = videoModalState.mode === VideoModalMode.MINIMIZED;
37
40
 
38
41
  const { bottom } = useSafeAreaInsets();
39
42
 
43
+ const initialBottomOffset = useRef(bottom).current;
44
+
40
45
  const collapsedHeight =
41
46
  minimisedHeight +
42
- bottom +
47
+ initialBottomOffset +
43
48
  (menuVisible ? bottomTabBarHeight : 0) +
44
49
  PROGRESS_BAR_HEIGHT;
45
50
 
@@ -142,7 +147,7 @@ export const useVideoModalState = (
142
147
  });
143
148
  }
144
149
  },
145
- [collapsedHeight, translateY]
150
+ [collapsedHeight, translateY, collapsed, videoModalState]
146
151
  );
147
152
 
148
153
  const gestureHandlerProps = useMemo(() => {
@@ -0,0 +1,5 @@
1
+ const View = require("react-native").View;
2
+
3
+ export const VideoPlayerModal = View;
4
+
5
+ export default View;
@@ -88,6 +88,7 @@ export const useStyles = ({ height }: { height: number }) => {
88
88
  collapsedBarContainer: {
89
89
  ...StyleSheet.absoluteFillObject,
90
90
  height: COLLAPSED_HEIGHT,
91
+ zIndex: 90,
91
92
  justifyContent: "flex-end",
92
93
  },
93
94
  collapsedBarWrapper: {
@@ -793,7 +793,7 @@ export default class VideoPlayer extends React.Component<
793
793
  };
794
794
 
795
795
  const isFullScreenAudioPlayer =
796
- this.getPluginConfiguration()?.["full_screen_audio_player"] || false;
796
+ this.getPluginConfiguration()?.full_screen_audio_player || false;
797
797
 
798
798
  const isAudioPlayer = isFullScreenAudioPlayer && isAudioItem;
799
799
 
@@ -835,7 +835,7 @@ export default class VideoPlayer extends React.Component<
835
835
  this.isReactNativeMethodsSupported() &&
836
836
  RNPlayerManager?.[this.playerPluginId]?.play
837
837
  ) {
838
- delete nativeProps["paused"];
838
+ delete nativeProps.paused;
839
839
  }
840
840
 
841
841
  const adEvents = {
@@ -1032,11 +1032,11 @@ export default class VideoPlayer extends React.Component<
1032
1032
  />
1033
1033
  ) : (
1034
1034
  <VideoPlayerModal
1035
- enabled={!!isModal && !fullscreen}
1036
1035
  isTabletPortrait={isTabletPortrait}
1037
1036
  aspectRatio={aspectRatio}
1038
1037
  pip={this.state.piped}
1039
1038
  fullscreen={fullscreen}
1039
+ modal={isModal}
1040
1040
  style={{
1041
1041
  tabletLandscapeWidth: getTabletWidth(
1042
1042
  this.getPluginConfiguration().tablet_landscape_sidebar_width,
@@ -1045,9 +1045,10 @@ export default class VideoPlayer extends React.Component<
1045
1045
  width: style.width,
1046
1046
  height: style.height,
1047
1047
  }}
1048
- content={(_opacityAnim) => (
1048
+ content={
1049
1049
  <PlayerWrapper
1050
1050
  {...sharedWrapperViewProps}
1051
+ // eslint-disable-next-line react/no-unstable-nested-components
1051
1052
  playerContent={(playerDimensions) => {
1052
1053
  const shouldRenderBackground =
1053
1054
  !R.isNil(backgroundImageKey) &&
@@ -1060,11 +1061,7 @@ export default class VideoPlayer extends React.Component<
1060
1061
  <View style={[playerContainerStyles, playerDimensions]}>
1061
1062
  {isAudioItem ? (
1062
1063
  <AudioPlayer
1063
- style={
1064
- isTV()
1065
- ? getStyle(playerDimensions)
1066
- : styles.playerSize
1067
- }
1064
+ style={styles.playerSize}
1068
1065
  audio_item={entry}
1069
1066
  plugin_configuration={this.getPluginConfiguration()}
1070
1067
  />
@@ -1086,11 +1083,7 @@ export default class VideoPlayer extends React.Component<
1086
1083
  {...nativeEvents}
1087
1084
  {...nativeProps}
1088
1085
  listener={this.props.listener}
1089
- style={
1090
- isTV()
1091
- ? getStyle(playerDimensions)
1092
- : styles.playerSize
1093
- }
1086
+ style={styles.playerSize}
1094
1087
  pluginConfiguration={this.getPluginConfiguration()}
1095
1088
  controller={this.props.controller}
1096
1089
  >
@@ -1117,8 +1110,8 @@ export default class VideoPlayer extends React.Component<
1117
1110
  );
1118
1111
  }}
1119
1112
  />
1120
- )}
1121
- extraContent={(_opacityAnim) => (
1113
+ }
1114
+ extraContent={
1122
1115
  <PlayerDetails
1123
1116
  configuration={this.getPluginConfiguration()}
1124
1117
  style={{ flex: 1 }}
@@ -1129,18 +1122,16 @@ export default class VideoPlayer extends React.Component<
1129
1122
  isModal={isModal}
1130
1123
  pip={this.state.piped}
1131
1124
  />
1132
- )}
1133
- collapsedContent={(_opacityAnim) =>
1134
- this.state.piped ? null : (
1135
- <View style={styles.container}>
1136
- <DockedControls
1137
- entry={entry}
1138
- aspectRatio={aspectRatio}
1139
- layoutState={sharedWrapperViewProps.layoutState}
1140
- playNextData={sharedWrapperViewProps.playNextData}
1141
- />
1142
- </View>
1143
- )
1125
+ }
1126
+ collapsedContent={
1127
+ <View style={styles.container}>
1128
+ <DockedControls
1129
+ entry={entry}
1130
+ aspectRatio={aspectRatio}
1131
+ layoutState={sharedWrapperViewProps.layoutState}
1132
+ playNextData={sharedWrapperViewProps.playNextData}
1133
+ />
1134
+ </View>
1144
1135
  }
1145
1136
  />
1146
1137
  );
@@ -1,10 +1,12 @@
1
1
  import * as React from "react";
2
+ import { ZStoreProvider } from "@applicaster/zapp-react-native-utils/reactHooks/state";
2
3
 
3
4
  import { useOrientationEffect } from "@applicaster/zapp-react-native-utils/reactHooks/videoModal";
4
5
  import Player from "./Player";
5
6
  import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
6
7
  import { isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
7
8
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
9
+ import { usePlayerTTS } from "@applicaster/zapp-react-native-utils/playerUtils/usePlayerTTS";
8
10
  import { useIsCasting } from "./Player/hooks/useIsCasting";
9
11
 
10
12
  const CHROMECAST_IDENTIFIER = "quick-brick-chromecast-action";
@@ -45,17 +47,21 @@ const QuickBrickPlayerComponent = (
45
47
  isRunningPlayNext: !!props?.playNextData,
46
48
  });
47
49
 
50
+ usePlayerTTS();
51
+
48
52
  return (
49
- <Player
50
- {...props}
51
- ref={ref}
52
- castAction={!props?.disableCastAction && castAction}
53
- isCasting={isCasting}
54
- PlayerComponent={props.PlayerComponent}
55
- openPiP={openPiP}
56
- closePiP={closePiP}
57
- mode={mode}
58
- />
53
+ <ZStoreProvider name="playerConfiguration" value={controller?.config}>
54
+ <Player
55
+ {...props}
56
+ ref={ref}
57
+ castAction={!props?.disableCastAction && castAction}
58
+ isCasting={isCasting}
59
+ PlayerComponent={props.PlayerComponent}
60
+ openPiP={openPiP}
61
+ closePiP={closePiP}
62
+ mode={mode}
63
+ />
64
+ </ZStoreProvider>
59
65
  );
60
66
  };
61
67