@applicaster/quick-brick-player 14.0.0-rc.62 → 14.0.0-rc.64

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-rc.62",
3
+ "version": "14.0.0-rc.64",
4
4
  "description": "Quick Brick Player",
5
5
  "main": "./src/index.ts",
6
6
  "types": "index.d.ts",
@@ -37,9 +37,9 @@
37
37
  "dependencies": {
38
38
  "@applicaster/quick-brick-mobile-transport-controls": "14.0.0-rc.56",
39
39
  "@applicaster/quick-brick-tv-transport-controls": "14.0.0-rc.60",
40
- "@applicaster/zapp-react-native-tvos-app": "14.0.0-rc.62",
41
- "@applicaster/zapp-react-native-ui-components": "14.0.0-rc.62",
42
- "@applicaster/zapp-react-native-utils": "14.0.0-rc.62",
40
+ "@applicaster/zapp-react-native-tvos-app": "14.0.0-rc.64",
41
+ "@applicaster/zapp-react-native-ui-components": "14.0.0-rc.64",
42
+ "@applicaster/zapp-react-native-utils": "14.0.0-rc.64",
43
43
  "query-string": "7.1.3",
44
44
  "shaka-player": "4.3.5",
45
45
  "typeface-montserrat": "^0.0.54",
@@ -185,8 +185,10 @@ export const DockedControls = (props: Props) => {
185
185
  const configuration = useZStore("playerConfiguration")();
186
186
  const playerState = usePlayerState("shared-player-wrapper-docked");
187
187
 
188
- const getValue = (key: string, stylesObj: {}) =>
189
- R.propOr(null, key, stylesObj);
188
+ const getValue = React.useCallback(
189
+ (key: string, stylesObj: {}) => R.propOr(null, key, stylesObj),
190
+ []
191
+ );
190
192
 
191
193
  const value = React.useCallback(
192
194
  (key: string) => {
@@ -206,7 +208,7 @@ export const DockedControls = (props: Props) => {
206
208
 
207
209
  return retVal;
208
210
  },
209
- [...Object.values(configuration), playerState]
211
+ [...Object.values(configuration), playerState.seekableDuration, getValue]
210
212
  );
211
213
 
212
214
  const { title, summary } = useTitleSummaryOverlay(
@@ -224,85 +226,87 @@ export const DockedControls = (props: Props) => {
224
226
  const insets = useSafeAreaInsets();
225
227
 
226
228
  return (
227
- <View
228
- style={[
229
- styles.container,
230
- {
231
- height:
232
- minimisedHeight +
233
- (menuVisible ? bottomTabBarHeight : 0) +
234
- insets.bottom,
235
- },
236
- ]}
237
- >
238
- {!playerState.isLive ? (
239
- <ProgressBar
240
- name={"shared-docked-layout"}
241
- content={entry}
242
- value={value}
243
- visible
244
- layoutState={layoutState}
245
- onPlayerSeek={onPlayerSeek}
246
- playerState={playerState}
247
- startComponentsAnimation={noop}
248
- docked
249
- />
250
- ) : 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}
251
252
 
252
- <View style={styles.content}>
253
- <View style={styles.touchableArea}>
254
- {isActiveGesture || layoutState.docked ? (
255
- <View style={{ aspectRatio: aspectRatio, height: minimisedHeight }}>
256
- {ImageComponent || null}
257
- </View>
258
- ) : (
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
+ )}
259
269
  <View
260
- style={playerDimensionsStyle(
261
- minimisedHeight,
262
- isActiveGesture || layoutState.docked
263
- )}
264
- />
265
- )}
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>
266
283
  <View
267
- testID="content-info"
268
284
  style={[
269
- styles.contentInfo,
285
+ isTablet
286
+ ? styles.controlsContainerForTablet
287
+ : styles.controlsContainerForMobile,
270
288
  { backgroundColor: dockedBackgroundColor },
271
289
  ]}
272
290
  >
273
- <ContentInfo
274
- content={{ ...entry, title, summary }}
291
+ <Controls
275
292
  value={value}
276
- 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}
277
307
  />
278
308
  </View>
279
309
  </View>
280
- <View
281
- style={[
282
- isTablet
283
- ? styles.controlsContainerForTablet
284
- : styles.controlsContainerForMobile,
285
- { backgroundColor: dockedBackgroundColor },
286
- ]}
287
- >
288
- <Controls
289
- value={value}
290
- visible
291
- buttons={R.partial(controlButtons, [
292
- playerState.isLive && liveButton,
293
- ])}
294
- style={styles.playPauseButton}
295
- playNextData={playNextData}
296
- playerState={playerState}
297
- />
298
- <Button
299
- icon={"close_mini"}
300
- size={"medium"}
301
- value={value}
302
- onPress={onCloseVideoModal}
303
- style={styles.buttons}
304
- />
305
- </View>
306
310
  </View>
307
311
  <View
308
312
  style={{
@@ -310,6 +314,6 @@ export const DockedControls = (props: Props) => {
310
314
  backgroundColor: dockedBackgroundColor,
311
315
  }}
312
316
  />
313
- </View>
317
+ </>
314
318
  );
315
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);
@@ -33,15 +33,18 @@ export const useVideoModalState = (
33
33
  } = useNavigation();
34
34
 
35
35
  const plugins = usePlugins();
36
+
36
37
  const menuVisible = isMenuVisible(currentRoute, screenData, plugins);
37
38
 
38
39
  const collapsed = videoModalState.mode === VideoModalMode.MINIMIZED;
39
40
 
40
41
  const { bottom } = useSafeAreaInsets();
41
42
 
43
+ const initialBottomOffset = useRef(bottom).current;
44
+
42
45
  const collapsedHeight =
43
46
  minimisedHeight +
44
- bottom +
47
+ initialBottomOffset +
45
48
  (menuVisible ? bottomTabBarHeight : 0) +
46
49
  PROGRESS_BAR_HEIGHT;
47
50
 
@@ -144,7 +147,7 @@ export const useVideoModalState = (
144
147
  });
145
148
  }
146
149
  },
147
- [collapsedHeight, translateY]
150
+ [collapsedHeight, translateY, collapsed, videoModalState]
148
151
  );
149
152
 
150
153
  const gestureHandlerProps = useMemo(() => {
@@ -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,4 +1,5 @@
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";
@@ -49,16 +50,18 @@ const QuickBrickPlayerComponent = (
49
50
  usePlayerTTS();
50
51
 
51
52
  return (
52
- <Player
53
- {...props}
54
- ref={ref}
55
- castAction={!props?.disableCastAction && castAction}
56
- isCasting={isCasting}
57
- PlayerComponent={props.PlayerComponent}
58
- openPiP={openPiP}
59
- closePiP={closePiP}
60
- mode={mode}
61
- />
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>
62
65
  );
63
66
  };
64
67