@applicaster/quick-brick-player 13.0.0-rc.114 → 13.0.0-rc.116

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": "13.0.0-rc.114",
3
+ "version": "13.0.0-rc.116",
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": "13.0.0-rc.112",
39
39
  "@applicaster/quick-brick-tv-transport-controls": "13.0.0-rc.56",
40
- "@applicaster/zapp-react-native-tvos-app": "13.0.0-rc.114",
41
- "@applicaster/zapp-react-native-ui-components": "13.0.0-rc.114",
42
- "@applicaster/zapp-react-native-utils": "13.0.0-rc.114",
40
+ "@applicaster/zapp-react-native-tvos-app": "13.0.0-rc.116",
41
+ "@applicaster/zapp-react-native-ui-components": "13.0.0-rc.116",
42
+ "@applicaster/zapp-react-native-utils": "13.0.0-rc.116",
43
43
  "query-string": "7.1.3",
44
44
  "react-native-web-linear-gradient": "1.1.2",
45
45
  "shaka-player": "4.3.5",
@@ -113,7 +113,7 @@ export const AudioDescription = (props: AudioDescriptionProps) => {
113
113
  style={[
114
114
  styles.wrapper,
115
115
  {
116
- maxWidth,
116
+ maxWidth: Math.max(maxWidth, 320),
117
117
  height,
118
118
  },
119
119
  ]}
@@ -43,7 +43,11 @@ import {
43
43
  SleepTimerState,
44
44
  } from "./SleepTimerManager";
45
45
  import { DEFAULT_SPEED, PlaybackSpeed, SpeedController } from "./SpeedManager";
46
- import { openBottomSheetModal } from "@applicaster/zapp-react-native-utils/modalState";
46
+ import {
47
+ openBottomSheetModal,
48
+ dismissModal as dismissBottomSheetModal,
49
+ useModalStoreState,
50
+ } from "@applicaster/zapp-react-native-utils/modalState";
47
51
  import { getSleepTimerOptions } from "../Const/sleepTimerOptions";
48
52
  import { speedOptions } from "../Const/speedOptions";
49
53
 
@@ -61,7 +65,6 @@ type Dimensions = {
61
65
 
62
66
  type Configuration = {
63
67
  [key: string]: any;
64
- audio_player_background_image_query?: string;
65
68
  audio_player_background_image_default_color?: string;
66
69
  tablet_landscape_sidebar_width?: string;
67
70
  tablet_landscape_player_container_background_color?: string;
@@ -103,6 +106,8 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
103
106
  const player = usePlayer();
104
107
  const playerState = usePlayerState("audio-player-wrapper");
105
108
 
109
+ const modalBottomSheetState = useModalStoreState();
110
+
106
111
  const {
107
112
  configuration,
108
113
  style,
@@ -140,6 +145,24 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
140
145
  }
141
146
  }, [player]);
142
147
 
148
+ useEffect(() => {
149
+ if (!player) return;
150
+
151
+ const unsubscribe = player.addListener({
152
+ id: "audio-player-wrapper-bottom-sheet-modal",
153
+ listener: {
154
+ onVideoEnd: () => {
155
+ // Dismiss the bottom sheet modal when the video ends to avoid audio breaks and app freeze
156
+ if (modalBottomSheetState.visible) {
157
+ dismissBottomSheetModal();
158
+ }
159
+ },
160
+ },
161
+ });
162
+
163
+ return () => unsubscribe?.();
164
+ }, [player, modalBottomSheetState.visible]);
165
+
143
166
  const [playbackSpeed, setPlaybackSpeed] =
144
167
  useState<PlaybackSpeed>(DEFAULT_SPEED);
145
168
 
@@ -1,5 +1,11 @@
1
1
  import React, { PropsWithChildren } from "react";
2
- import { Image, Animated, StyleSheet, ViewStyle } from "react-native";
2
+ import {
3
+ Image,
4
+ Animated,
5
+ StyleSheet,
6
+ ViewStyle,
7
+ ImageStyle,
8
+ } from "react-native";
3
9
 
4
10
  import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
5
11
  import {
@@ -14,14 +20,12 @@ const styles = StyleSheet.create({
14
20
  // we have to specify flex:0 and dimensions to make animation work
15
21
  flex: 0,
16
22
  aspectRatio: 1,
17
- overflow: "hidden",
18
23
  },
19
24
  });
20
25
 
21
26
  type Props = PropsWithChildren<{
22
27
  entry: ZappEntry;
23
- style?: { [K: string]: any };
24
- imageStyle?: { [K: string]: any };
28
+ style?: ImageStyle | ImageStyle[];
25
29
  wrapperViewStyle?: ViewStyle;
26
30
  imageWidth: number;
27
31
  }>;
@@ -29,7 +33,6 @@ type Props = PropsWithChildren<{
29
33
  export const AnimatedImage = ({
30
34
  entry,
31
35
  style,
32
- imageStyle,
33
36
  wrapperViewStyle,
34
37
  imageWidth,
35
38
  }: Props) => {
@@ -69,15 +72,12 @@ export const AnimatedImage = ({
69
72
  style={[
70
73
  styles.container,
71
74
  wrapperViewStyle,
72
- imageStyle,
73
75
  {
74
76
  width: heightAnim,
75
77
  },
76
78
  ]}
77
79
  >
78
- <Image resizeMode="cover" style={style} source={source}>
79
- {null}
80
- </Image>
80
+ <Image resizeMode="cover" style={style} source={source} />
81
81
  </Animated.View>
82
82
  );
83
83
  };
@@ -1,17 +1,14 @@
1
1
  import * as React from "react";
2
- import { Image } from "react-native";
2
+ import { Image, ImageStyle } from "react-native";
3
3
 
4
4
  import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
5
5
 
6
6
  type Props = {
7
7
  entry: ZappEntry;
8
- style?: { [K: string]: any };
9
- imageStyle?: { [K: string]: any };
8
+ style?: ImageStyle;
10
9
  };
11
10
 
12
- const style = { flex: 1, aspectRatio: 1 };
13
-
14
- export const FlexImage = ({ entry, imageStyle }: Props) => {
11
+ export const FlexImage = ({ entry, style }: Props) => {
15
12
  const source = React.useMemo(
16
13
  () => ({ uri: imageSrcFromMediaItem(entry, undefined) }),
17
14
  [entry]
@@ -19,7 +16,5 @@ export const FlexImage = ({ entry, imageStyle }: Props) => {
19
16
 
20
17
  if (!source) return null;
21
18
 
22
- return (
23
- <Image resizeMode="cover" style={[style, imageStyle]} source={source} />
24
- );
19
+ return <Image resizeMode="cover" style={style} source={source} />;
25
20
  };
@@ -79,17 +79,12 @@ export const PlayerImage = (props: Props) => {
79
79
  }}
80
80
  style={styles.alignItemsCenter}
81
81
  >
82
- <View onLayout={onLayoutImage}>
82
+ <View
83
+ onLayout={onLayoutImage}
84
+ style={shouldShowShadow ? styles.shadow : undefined}
85
+ >
83
86
  {!imageWidth ? (
84
- <View
85
- style={[
86
- styles.defaultImageWrapperView,
87
- shouldShowShadow ? styles.shadow : undefined,
88
- {
89
- borderRadius,
90
- },
91
- ]}
92
- >
87
+ <View style={[styles.defaultImageWrapperView, { borderRadius }]}>
93
88
  <FlexImage
94
89
  entry={entry}
95
90
  style={styles.backgroundImageContainer}
@@ -99,10 +94,8 @@ export const PlayerImage = (props: Props) => {
99
94
  // we have imageSize here and now we could animate resizing of this image
100
95
  <AnimatedImage
101
96
  entry={entry}
102
- style={styles.backgroundImageContainer}
103
- imageStyle={{ borderRadius }}
97
+ style={[styles.backgroundImageContainer, { borderRadius }]}
104
98
  imageWidth={imageWidth}
105
- wrapperViewStyle={shouldShowShadow ? styles.shadow : undefined}
106
99
  />
107
100
  )}
108
101
  </View>
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react-native/no-color-literals */
1
2
  import { StyleSheet } from "react-native";
2
3
 
3
4
  const SHADOW_COLOR = "rgba(0, 0, 0, 1)";
@@ -6,6 +7,7 @@ export const styles = StyleSheet.create({
6
7
  backgroundImageContainer: {
7
8
  flex: 1,
8
9
  aspectRatio: 1,
10
+ overflow: "hidden",
9
11
  },
10
12
 
11
13
  alignItemsCenter: {
@@ -20,6 +22,7 @@ export const styles = StyleSheet.create({
20
22
  overflow: "hidden",
21
23
  },
22
24
  shadow: {
25
+ borderColor: "transparent",
23
26
  shadowColor: SHADOW_COLOR,
24
27
  shadowOffset: { width: 0, height: 24 },
25
28
  shadowOpacity: 0.2,
@@ -42,6 +42,7 @@ const styles = StyleSheet.create({
42
42
  audioPlayerContainer: {
43
43
  flexDirection: "column",
44
44
  alignItems: "center",
45
+ justifyContent: "center",
45
46
  minWidth: MIN_WIDTH,
46
47
 
47
48
  ...withDebug({
@@ -49,6 +50,9 @@ const styles = StyleSheet.create({
49
50
  borderColor: "blue",
50
51
  }),
51
52
  },
53
+ audioPlayerContainerHeightLimit: {
54
+ maxHeight: 750,
55
+ },
52
56
  audioPlayerContainerPaddings: {
53
57
  paddingBottom: MAX_SPACING,
54
58
  paddingTop: MAX_SPACING,
@@ -144,55 +148,57 @@ export function TabletLandscapeLayout({
144
148
  : styles.audioPlayerContainerPaddings,
145
149
  ]}
146
150
  >
147
- {/* PlayerImage non-docked */}
148
- <View style={[styles.flex, withDebug(styles.debugYellow)]}>
149
- {!docked ? (
150
- <PlayerImage
151
- docked={false}
151
+ <View style={[styles.flex, styles.audioPlayerContainerHeightLimit]}>
152
+ {/* PlayerImage non-docked */}
153
+ <View style={[styles.flex, withDebug(styles.debugYellow)]}>
154
+ {!docked ? (
155
+ <PlayerImage
156
+ docked={false}
157
+ entry={entry}
158
+ layoutState={layoutState}
159
+ playerState={playerState}
160
+ value={value}
161
+ configuration={configuration}
162
+ onPlayerSeek={onPlayerSeek}
163
+ onCloseVideoModal={onCloseVideoModal}
164
+ dimensions={dimensions}
165
+ playNextData={playNextData}
166
+ title={title}
167
+ summary={summary}
168
+ verticalOffset={withAdditionalOffset({
169
+ progressBarHeight,
170
+ bottomInset,
171
+ })}
172
+ onLayoutImage={onLayoutImage}
173
+ />
174
+ ) : null}
175
+ </View>
176
+ {/* PlayerImage */}
177
+
178
+ <View style={styles.controlsContainer}>
179
+ <Controls
180
+ maxWidth={imageWidth}
152
181
  entry={entry}
153
182
  layoutState={layoutState}
154
183
  playerState={playerState}
155
184
  value={value}
156
- configuration={configuration}
157
- onPlayerSeek={onPlayerSeek}
158
- onCloseVideoModal={onCloseVideoModal}
159
- dimensions={dimensions}
160
- playNextData={playNextData}
161
185
  title={title}
162
186
  summary={summary}
163
- verticalOffset={withAdditionalOffset({
164
- progressBarHeight,
165
- bottomInset,
166
- })}
167
- onLayoutImage={onLayoutImage}
187
+ sleepTimerDate={sleepTimerDate}
188
+ cancelSleepTimer={cancelSleepTimer}
189
+ playbackSpeedName={playbackSpeedName}
190
+ playbackSleepName={playbackSleepName}
191
+ onPlaybackButtonPress={onPlaybackButtonPress}
192
+ onRewindButtonPress={onRewindButtonPress}
193
+ onForwardButtonPress={onForwardButtonPress}
194
+ onPlayerSeek={onPlayerSeek}
195
+ onSkipStart={onSkipStart}
196
+ onSkipLive={onSkipLive}
197
+ onSpeedButtonPress={onSpeedButtonPress}
198
+ onSleepButtonPress={onSleepButtonPress}
199
+ docked={docked}
168
200
  />
169
- ) : null}
170
- </View>
171
- {/* PlayerImage */}
172
-
173
- <View style={styles.controlsContainer}>
174
- <Controls
175
- maxWidth={imageWidth}
176
- entry={entry}
177
- layoutState={layoutState}
178
- playerState={playerState}
179
- value={value}
180
- title={title}
181
- summary={summary}
182
- sleepTimerDate={sleepTimerDate}
183
- cancelSleepTimer={cancelSleepTimer}
184
- playbackSpeedName={playbackSpeedName}
185
- playbackSleepName={playbackSleepName}
186
- onPlaybackButtonPress={onPlaybackButtonPress}
187
- onRewindButtonPress={onRewindButtonPress}
188
- onForwardButtonPress={onForwardButtonPress}
189
- onPlayerSeek={onPlayerSeek}
190
- onSkipStart={onSkipStart}
191
- onSkipLive={onSkipLive}
192
- onSpeedButtonPress={onSpeedButtonPress}
193
- onSleepButtonPress={onSleepButtonPress}
194
- docked={docked}
195
- />
201
+ </View>
196
202
  </View>
197
203
  </View>
198
204