@applicaster/quick-brick-player 12.0.0-alpha.5251355865 → 12.0.0-alpha.5347482137
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 +6 -6
- package/src/CellPlayer/Assets/AssetsComponent.tsx +2 -1
- package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +89 -77
- package/src/Player/AudioLayer/Layout/DefaultLayout.tsx +177 -79
- package/src/Player/AudioLayer/Layout/DockedLayout.tsx +62 -17
- package/src/Player/AudioLayer/Layout/defaultLayoutsConts.ts +2 -0
- package/src/Player/AudioLayer/Layout/index.tsx +1 -7
- package/src/Player/AudioLayer/MagicBG/index.tsx +77 -27
- package/src/Player/Utils/Utils.ts +9 -22
- package/src/Player/index.tsx +119 -71
|
@@ -15,8 +15,13 @@ import {
|
|
|
15
15
|
Button,
|
|
16
16
|
} from "@applicaster/quick-brick-mobile-transport-controls";
|
|
17
17
|
|
|
18
|
-
import { PlayerImageBackground } from "@applicaster/zapp-react-native-ui-components/Components/PlayerImageBackground";
|
|
19
18
|
import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
|
|
19
|
+
import {
|
|
20
|
+
useModalAnimationContext,
|
|
21
|
+
AnimationComponent,
|
|
22
|
+
ComponentAnimationType,
|
|
23
|
+
PlayerAnimationStateEnum,
|
|
24
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
20
25
|
|
|
21
26
|
type Dimensions = {
|
|
22
27
|
width: number;
|
|
@@ -104,14 +109,26 @@ const backgroundColorStyle = (value: GetValue): ViewStyle => ({
|
|
|
104
109
|
backgroundColor: value("docked_player_background_color"),
|
|
105
110
|
});
|
|
106
111
|
|
|
107
|
-
const playerDimensionsStyle = (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
112
|
+
const playerDimensionsStyle = (
|
|
113
|
+
minimisedHeight: number,
|
|
114
|
+
addPadding: boolean
|
|
115
|
+
): ViewStyle => ({
|
|
116
|
+
paddingLeft: addPadding ? minimisedHeight || 100 : 0,
|
|
111
117
|
});
|
|
112
118
|
|
|
113
|
-
const
|
|
114
|
-
|
|
119
|
+
const animatedContainerStyle = (docked: boolean): ViewStyle => ({
|
|
120
|
+
top: docked ? 2 : null,
|
|
121
|
+
position: "absolute",
|
|
122
|
+
width: "100%",
|
|
123
|
+
zIndex: docked ? 1 : -1,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const backgroundImageStyle = (
|
|
127
|
+
dimensions: Dimensions,
|
|
128
|
+
minimisedHeight: number,
|
|
129
|
+
isActiveGesture: boolean
|
|
130
|
+
): ViewStyle => ({
|
|
131
|
+
height: isActiveGesture ? minimisedHeight : dimensions.height,
|
|
115
132
|
aspectRatio: 1,
|
|
116
133
|
position: "absolute",
|
|
117
134
|
});
|
|
@@ -193,7 +210,6 @@ export default function DockedLayout(props: LayoutProps) {
|
|
|
193
210
|
dimensions,
|
|
194
211
|
entry,
|
|
195
212
|
onCloseVideoModal,
|
|
196
|
-
maximiseVideoModal,
|
|
197
213
|
onPlayerSeek,
|
|
198
214
|
playerState,
|
|
199
215
|
configuration,
|
|
@@ -207,9 +223,29 @@ export default function DockedLayout(props: LayoutProps) {
|
|
|
207
223
|
const visible = true;
|
|
208
224
|
const liveButton = Boolean(value("live_badge_enabled"));
|
|
209
225
|
|
|
226
|
+
const {
|
|
227
|
+
isActiveGesture,
|
|
228
|
+
setPlayerAnimationState,
|
|
229
|
+
startComponentsAnimation,
|
|
230
|
+
minimisedHeight,
|
|
231
|
+
} = useModalAnimationContext();
|
|
232
|
+
|
|
233
|
+
const maximazeVideoModal = React.useCallback(
|
|
234
|
+
() => setPlayerAnimationState(PlayerAnimationStateEnum.maximaze),
|
|
235
|
+
[]
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
if (!layoutState.docked && !startComponentsAnimation) return null;
|
|
239
|
+
|
|
210
240
|
return (
|
|
211
|
-
<
|
|
212
|
-
{
|
|
241
|
+
<AnimationComponent
|
|
242
|
+
animationType={ComponentAnimationType.componentAppears}
|
|
243
|
+
style={[
|
|
244
|
+
styles.container,
|
|
245
|
+
animatedContainerStyle(isActiveGesture || layoutState.docked),
|
|
246
|
+
]}
|
|
247
|
+
>
|
|
248
|
+
{!playerState.isLive && layoutState.docked && (
|
|
213
249
|
<ProgressBar
|
|
214
250
|
content={entry}
|
|
215
251
|
value={value}
|
|
@@ -217,18 +253,27 @@ export default function DockedLayout(props: LayoutProps) {
|
|
|
217
253
|
layoutState={layoutState}
|
|
218
254
|
onPlayerSeek={onPlayerSeek}
|
|
219
255
|
playerState={playerState}
|
|
256
|
+
docked
|
|
220
257
|
/>
|
|
221
258
|
)}
|
|
222
259
|
|
|
223
260
|
<View style={styles.content}>
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
261
|
+
<View
|
|
262
|
+
style={backgroundImageStyle(
|
|
263
|
+
dimensions,
|
|
264
|
+
minimisedHeight,
|
|
265
|
+
isActiveGesture
|
|
266
|
+
)}
|
|
228
267
|
/>
|
|
229
|
-
<TouchableWithoutFeedback onPress={
|
|
268
|
+
<TouchableWithoutFeedback onPress={maximazeVideoModal}>
|
|
230
269
|
<View
|
|
231
|
-
style={[
|
|
270
|
+
style={[
|
|
271
|
+
styles.touchableArea,
|
|
272
|
+
playerDimensionsStyle(
|
|
273
|
+
minimisedHeight,
|
|
274
|
+
isActiveGesture || layoutState.docked
|
|
275
|
+
),
|
|
276
|
+
]}
|
|
232
277
|
>
|
|
233
278
|
<View
|
|
234
279
|
style={[
|
|
@@ -272,6 +317,6 @@ export default function DockedLayout(props: LayoutProps) {
|
|
|
272
317
|
/>
|
|
273
318
|
</View>
|
|
274
319
|
</View>
|
|
275
|
-
</
|
|
320
|
+
</AnimationComponent>
|
|
276
321
|
);
|
|
277
322
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import DefaultLayout from "./DefaultLayout";
|
|
3
|
-
import DockedLayout from "./DockedLayout";
|
|
4
3
|
import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
|
|
5
4
|
|
|
6
5
|
type Dimensions = {
|
|
@@ -40,6 +39,7 @@ type LayoutProps = {
|
|
|
40
39
|
onSkipLive: () => void;
|
|
41
40
|
maximiseVideoModal: () => void;
|
|
42
41
|
dimensions: Dimensions;
|
|
42
|
+
defaultDimensions: Dimensions;
|
|
43
43
|
playNextData: PlayNextData;
|
|
44
44
|
title: string | number;
|
|
45
45
|
summary: string | number;
|
|
@@ -48,11 +48,5 @@ type LayoutProps = {
|
|
|
48
48
|
export default function Layout(
|
|
49
49
|
props: LayoutProps
|
|
50
50
|
): React.ReactElement<LayoutProps> {
|
|
51
|
-
const { layoutState } = props;
|
|
52
|
-
|
|
53
|
-
if (layoutState.docked) {
|
|
54
|
-
return <DockedLayout {...props} />;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
51
|
return <DefaultLayout {...props} />;
|
|
58
52
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
// Disabling for now as lint can't recognise typescript definition here
|
|
2
1
|
/* eslint-disable react/prop-types */
|
|
3
2
|
import * as React from "react";
|
|
4
|
-
import { StyleSheet, View } from "react-native";
|
|
3
|
+
import { Animated, StyleSheet, View } from "react-native";
|
|
5
4
|
import LinearGradient from "../LinearGradient";
|
|
6
5
|
import { getDominantColor, getPalettes } from "../../../utils/utils";
|
|
7
6
|
import { useEffect } from "react";
|
|
@@ -11,9 +10,10 @@ type MagicBGProps = {
|
|
|
11
10
|
image: string;
|
|
12
11
|
fallbackUrl?: string;
|
|
13
12
|
defaultColor: string;
|
|
13
|
+
colors: string[];
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const defaultColors = {
|
|
17
17
|
overlay: "rgba(0, 0, 0, 0.35)",
|
|
18
18
|
defaultGradientStart: "rgba(0, 0, 0, 0.25)",
|
|
19
19
|
defaultGradientEnd: "rgba(0, 0, 0, 0)",
|
|
@@ -25,7 +25,7 @@ const styles = StyleSheet.create({
|
|
|
25
25
|
},
|
|
26
26
|
fullScreenOverlay: {
|
|
27
27
|
...StyleSheet.absoluteFillObject,
|
|
28
|
-
backgroundColor:
|
|
28
|
+
backgroundColor: defaultColors.overlay,
|
|
29
29
|
},
|
|
30
30
|
gradientOverlay: {
|
|
31
31
|
position: "absolute",
|
|
@@ -54,52 +54,102 @@ export const MagicBG: React.FC<MagicBGProps> = ({
|
|
|
54
54
|
children,
|
|
55
55
|
image,
|
|
56
56
|
fallbackUrl = "",
|
|
57
|
+
colors = [],
|
|
57
58
|
defaultColor,
|
|
58
59
|
}) => {
|
|
59
60
|
const [dominantColor, setDominantColor] =
|
|
60
61
|
React.useState<string>(defaultColor);
|
|
61
62
|
|
|
62
63
|
const [gradientColors, setGradientColors] = React.useState<string[]>([
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
defaultColors.defaultGradientStart,
|
|
65
|
+
defaultColors.defaultGradientEnd,
|
|
65
66
|
]);
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (!image) return;
|
|
68
|
+
const [backgroundColorAnim] = React.useState(new Animated.Value(0)); // from 0 to 1
|
|
69
|
+
const [gradientOpacityAnim] = React.useState(new Animated.Value(0)); // from 0 to 1
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
const animateColors = () => {
|
|
73
|
+
Animated.timing(backgroundColorAnim, {
|
|
74
|
+
toValue: 1,
|
|
75
|
+
duration: 500,
|
|
76
|
+
useNativeDriver: false,
|
|
77
|
+
}).start();
|
|
78
|
+
|
|
79
|
+
Animated.timing(gradientOpacityAnim, {
|
|
80
|
+
toValue: 1,
|
|
81
|
+
duration: 500,
|
|
82
|
+
useNativeDriver: false,
|
|
83
|
+
}).start();
|
|
84
|
+
};
|
|
74
85
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
86
|
+
const fetchColors = async () => {
|
|
87
|
+
if (colors && colors.length > 0) {
|
|
88
|
+
setGradientColors(colors.slice(0, 2));
|
|
89
|
+
setDominantColor(colors[0]);
|
|
90
|
+
animateColors();
|
|
91
|
+
} else if (image) {
|
|
78
92
|
try {
|
|
79
93
|
const { gradientColors, dominantColor } =
|
|
80
|
-
await fetchPaletteAndDominantColor(
|
|
94
|
+
await fetchPaletteAndDominantColor(image);
|
|
81
95
|
|
|
82
96
|
setGradientColors(gradientColors);
|
|
83
97
|
setDominantColor(dominantColor);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
animateColors();
|
|
99
|
+
} catch (error) {
|
|
100
|
+
try {
|
|
101
|
+
const { gradientColors, dominantColor } =
|
|
102
|
+
await fetchPaletteAndDominantColor(fallbackUrl);
|
|
103
|
+
|
|
104
|
+
setGradientColors(gradientColors);
|
|
105
|
+
setDominantColor(dominantColor);
|
|
106
|
+
animateColors();
|
|
107
|
+
} catch {
|
|
108
|
+
setGradientColors([
|
|
109
|
+
defaultColors.defaultGradientStart,
|
|
110
|
+
defaultColors.defaultGradientEnd,
|
|
111
|
+
]);
|
|
112
|
+
|
|
113
|
+
setDominantColor(defaultColor);
|
|
114
|
+
}
|
|
91
115
|
}
|
|
116
|
+
} else {
|
|
117
|
+
setGradientColors([
|
|
118
|
+
defaultColors.defaultGradientStart,
|
|
119
|
+
defaultColors.defaultGradientEnd,
|
|
120
|
+
]);
|
|
121
|
+
|
|
122
|
+
setDominantColor(defaultColor);
|
|
92
123
|
}
|
|
93
124
|
};
|
|
94
125
|
|
|
95
126
|
fetchColors();
|
|
96
|
-
}, [
|
|
127
|
+
}, []);
|
|
128
|
+
|
|
129
|
+
const interpolatedBackgroundColor = backgroundColorAnim.interpolate({
|
|
130
|
+
inputRange: [0, 1],
|
|
131
|
+
outputRange: ["black", dominantColor],
|
|
132
|
+
});
|
|
97
133
|
|
|
98
134
|
return (
|
|
99
|
-
<View
|
|
135
|
+
<Animated.View
|
|
136
|
+
style={[
|
|
137
|
+
styles.container,
|
|
138
|
+
{ backgroundColor: interpolatedBackgroundColor },
|
|
139
|
+
]}
|
|
140
|
+
>
|
|
100
141
|
<View style={styles.fullScreenOverlay} />
|
|
101
|
-
|
|
142
|
+
|
|
143
|
+
<Animated.View
|
|
144
|
+
style={[styles.gradientOverlay, { opacity: gradientOpacityAnim }]}
|
|
145
|
+
>
|
|
146
|
+
<LinearGradient
|
|
147
|
+
colors={gradientColors}
|
|
148
|
+
style={StyleSheet.absoluteFill}
|
|
149
|
+
/>
|
|
150
|
+
</Animated.View>
|
|
151
|
+
|
|
102
152
|
{children}
|
|
103
|
-
</View>
|
|
153
|
+
</Animated.View>
|
|
104
154
|
);
|
|
105
155
|
};
|
|
@@ -1,26 +1,5 @@
|
|
|
1
1
|
import queryString from "query-string";
|
|
2
|
-
|
|
3
|
-
export const toTypeString = (obj) => {
|
|
4
|
-
switch (typeof obj) {
|
|
5
|
-
case "object":
|
|
6
|
-
return obj instanceof Date ? obj.toISOString() : JSON.stringify(obj); // object, null
|
|
7
|
-
case "undefined":
|
|
8
|
-
return "";
|
|
9
|
-
default:
|
|
10
|
-
// boolean, number, string
|
|
11
|
-
return obj.toString();
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const stringsOnlyObject = (obj) => {
|
|
16
|
-
const strObj = {};
|
|
17
|
-
|
|
18
|
-
Object.keys(obj).forEach((x) => {
|
|
19
|
-
strObj[x] = toTypeString(obj[x]);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return strObj;
|
|
23
|
-
};
|
|
2
|
+
import { dayjs } from "@applicaster/zapp-react-native-utils/dateUtils";
|
|
24
3
|
|
|
25
4
|
export const getLiveUrl = (url: string) => {
|
|
26
5
|
// Use the replace method with a regular expression to replace all instances of subClass with livePage
|
|
@@ -42,3 +21,11 @@ export const addQueryParam = (
|
|
|
42
21
|
|
|
43
22
|
return `${urlWithoutQuery}?${updatedQueryString}`;
|
|
44
23
|
};
|
|
24
|
+
|
|
25
|
+
export const isValidDate = (dateString: string | undefined): boolean => {
|
|
26
|
+
return (
|
|
27
|
+
typeof dateString === "string" &&
|
|
28
|
+
dateString.trim() !== "" &&
|
|
29
|
+
dayjs.utc(dateString).isValid()
|
|
30
|
+
);
|
|
31
|
+
};
|
package/src/Player/index.tsx
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import React from "react";
|
|
5
5
|
import * as R from "ramda";
|
|
6
6
|
|
|
7
|
-
import { findNodeHandle,
|
|
7
|
+
import { findNodeHandle, StyleSheet, View } from "react-native";
|
|
8
8
|
import TransportControlsMobile from "@applicaster/quick-brick-mobile-transport-controls";
|
|
9
9
|
import TransportControlsTV from "@applicaster/quick-brick-tv-transport-controls";
|
|
10
10
|
|
|
@@ -36,15 +36,13 @@ import { AudioPlayerWrapper } from "./AudioLayer/AudioPlayerWrapper";
|
|
|
36
36
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
37
37
|
import { getAllAccessibilityProps } from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
38
38
|
import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
: NativeModules.QBKalturaPlayerModule,
|
|
47
|
-
};
|
|
39
|
+
import { getTargetScreenDataFromEntry } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useTargetScreenData";
|
|
40
|
+
import { isAppleTV } from "@applicaster/zapp-react-native-ui-components/Helpers/Platform";
|
|
41
|
+
import {
|
|
42
|
+
AnimationComponent,
|
|
43
|
+
ComponentAnimationType,
|
|
44
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
45
|
+
import { RNPlayerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/nativePlayerManager";
|
|
48
46
|
|
|
49
47
|
const styles = StyleSheet.create({
|
|
50
48
|
container: { flex: 1 },
|
|
@@ -55,6 +53,7 @@ const styles = StyleSheet.create({
|
|
|
55
53
|
position: "absolute",
|
|
56
54
|
zIndex: 1,
|
|
57
55
|
},
|
|
56
|
+
playerSize: { width: "100%", height: "100%" },
|
|
58
57
|
});
|
|
59
58
|
|
|
60
59
|
const logger = createLogger({
|
|
@@ -113,8 +112,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
componentWillUnmount() {
|
|
116
|
-
this.stopBackgroundPlayback();
|
|
117
|
-
|
|
118
115
|
this.playbackStarted = false;
|
|
119
116
|
this.handleAnalyticEvent(GENERAL_EVENT.session_end);
|
|
120
117
|
this.onPlayerClosed();
|
|
@@ -159,6 +156,11 @@ export default class VideoPlayer extends React.Component<
|
|
|
159
156
|
}
|
|
160
157
|
}
|
|
161
158
|
|
|
159
|
+
// For close button
|
|
160
|
+
public closeNativePlayer = () => {
|
|
161
|
+
this.stopBackgroundPlayback();
|
|
162
|
+
};
|
|
163
|
+
|
|
162
164
|
getPlayNextData = () => this.props.playNextData as PlayNextData;
|
|
163
165
|
|
|
164
166
|
/**
|
|
@@ -333,11 +335,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
333
335
|
}
|
|
334
336
|
};
|
|
335
337
|
|
|
336
|
-
|
|
337
|
-
* Sets either subtitle language, or audio language if we have a selected a new locale.
|
|
338
|
-
* If no locale is set it defaults to system language for audio, and leaves subtitles unaltered.
|
|
339
|
-
*/
|
|
340
|
-
setLanguage = (selected = null) => {
|
|
338
|
+
selectTrack = (selected) => {
|
|
341
339
|
const { trackType, id, language } = selected || {};
|
|
342
340
|
|
|
343
341
|
const isOff = language === "Off";
|
|
@@ -555,6 +553,26 @@ export default class VideoPlayer extends React.Component<
|
|
|
555
553
|
this.props.listener?.onPlayerDetached?.(nativeEvent);
|
|
556
554
|
};
|
|
557
555
|
|
|
556
|
+
onVideoFullscreenPlayerDidDismiss = () => {
|
|
557
|
+
this.props.listener?.onVideoFullscreenPlayerDidDismiss?.();
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
onVideoFullscreenPlayerDidPresent = () => {
|
|
561
|
+
this.props.listener?.onVideoFullscreenPlayerDidPresent?.();
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
onVideoFullscreenPlayerWillDismiss = () => {
|
|
565
|
+
this.props.listener?.onVideoFullscreenPlayerWillDismiss?.();
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
onVideoFullscreenPlayerWillPresent = () => {
|
|
569
|
+
this.props.listener?.onVideoFullscreenPlayerWillPresent?.();
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
onPlayerClose = () => {
|
|
573
|
+
this.props.listener?.onPlayerClose?.();
|
|
574
|
+
};
|
|
575
|
+
|
|
558
576
|
onPiPEnter = () => {
|
|
559
577
|
this.setState({ piped: true });
|
|
560
578
|
this.props.openPiP();
|
|
@@ -758,8 +776,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
758
776
|
|
|
759
777
|
render() {
|
|
760
778
|
const {
|
|
761
|
-
castAction,
|
|
762
|
-
controls,
|
|
763
779
|
docked,
|
|
764
780
|
entry,
|
|
765
781
|
fullscreen,
|
|
@@ -769,8 +785,13 @@ export default class VideoPlayer extends React.Component<
|
|
|
769
785
|
isTabletPortrait,
|
|
770
786
|
muted,
|
|
771
787
|
style,
|
|
788
|
+
castAction,
|
|
789
|
+
controller,
|
|
790
|
+
startComponentsAnimation,
|
|
772
791
|
} = this.props;
|
|
773
792
|
|
|
793
|
+
const supportNativeCast = controller.supportNativeCast();
|
|
794
|
+
|
|
774
795
|
const { audioTrackId, keyEvent, paused, seek, textTrackId, rate } =
|
|
775
796
|
this.state;
|
|
776
797
|
|
|
@@ -817,17 +838,35 @@ export default class VideoPlayer extends React.Component<
|
|
|
817
838
|
const liveCatchUpEnabled =
|
|
818
839
|
this.props.pluginConfiguration?.liveCatchUpEnabled;
|
|
819
840
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
: {};
|
|
841
|
+
// TODO: Get screen data more reliable way useCurrentScreenData
|
|
842
|
+
const screenData = getTargetScreenDataFromEntry(this.props.playableItem);
|
|
823
843
|
|
|
824
|
-
const
|
|
844
|
+
const isInlineTV = screenData?.ui_components?.length > 0 && isTV();
|
|
845
|
+
|
|
846
|
+
let platformSpecificProps: any = isApplePlatform()
|
|
825
847
|
? {
|
|
826
|
-
...hideNativeControls,
|
|
827
848
|
resizeMode: nativeResizeMode,
|
|
828
849
|
}
|
|
829
850
|
: {};
|
|
830
851
|
|
|
852
|
+
const supportsNativeControls =
|
|
853
|
+
!!this.props.controller?.supportsNativeControls?.();
|
|
854
|
+
|
|
855
|
+
const controls = isAppleTV()
|
|
856
|
+
? supportsNativeControls && !isInlineTV && !this.getPlayNextData()
|
|
857
|
+
: supportsNativeControls && !this.getPlayNextData();
|
|
858
|
+
|
|
859
|
+
const shouldUseNativeControls =
|
|
860
|
+
controls &&
|
|
861
|
+
!startComponentsAnimation &&
|
|
862
|
+
!docked &&
|
|
863
|
+
!castAction?.state?.connected;
|
|
864
|
+
|
|
865
|
+
platformSpecificProps = {
|
|
866
|
+
...platformSpecificProps,
|
|
867
|
+
controls: shouldUseNativeControls,
|
|
868
|
+
};
|
|
869
|
+
|
|
831
870
|
const pictureInPictureEnabled =
|
|
832
871
|
this.props.pluginConfiguration?.pictureInPictureEnabled;
|
|
833
872
|
|
|
@@ -835,7 +874,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
835
874
|
entry, // Must be passed first in list
|
|
836
875
|
...platformSpecificProps,
|
|
837
876
|
audioTrackId,
|
|
838
|
-
controls,
|
|
839
877
|
docked,
|
|
840
878
|
enableAutoAudioTrackSelection,
|
|
841
879
|
fullscreen, // TODO: Check fullscreen params not crash
|
|
@@ -890,22 +928,17 @@ export default class VideoPlayer extends React.Component<
|
|
|
890
928
|
onVideoEnd: this.onVideoEnd, // complete
|
|
891
929
|
onVideoError: this.onVideoError, // error
|
|
892
930
|
onVideoProgress: this.onVideoProgress,
|
|
893
|
-
onVideoFullscreenPlayerDidDismiss: this.
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
onVideoFullscreenPlayerWillDismiss: this.unHandledEvent(
|
|
900
|
-
"onVideoFullscreenPlayerWillDismiss"
|
|
901
|
-
),
|
|
902
|
-
onVideoFullscreenPlayerWillPresent: this.unHandledEvent(
|
|
903
|
-
"onVideoFullscreenPlayerWillPresent"
|
|
904
|
-
),
|
|
931
|
+
onVideoFullscreenPlayerDidDismiss: this.onVideoFullscreenPlayerDidDismiss,
|
|
932
|
+
onVideoFullscreenPlayerDidPresent: this.onVideoFullscreenPlayerDidPresent,
|
|
933
|
+
onVideoFullscreenPlayerWillDismiss:
|
|
934
|
+
this.onVideoFullscreenPlayerWillDismiss,
|
|
935
|
+
onVideoFullscreenPlayerWillPresent:
|
|
936
|
+
this.onVideoFullscreenPlayerWillPresent,
|
|
905
937
|
onVideoLoad: this.onVideoLoad,
|
|
906
938
|
onVideoLoadStart: this.unHandledEvent("onVideoLoadStart"),
|
|
907
939
|
onVideoBuffer: this.onVideoBuffer,
|
|
908
940
|
onPlaybackStalled: this.onPlaybackStalled,
|
|
941
|
+
onPlayerClose: this.onPlayerClose,
|
|
909
942
|
onPlayerAttached: this.onPlayerAttached,
|
|
910
943
|
onPlayerDetached: this.onPlayerDetached,
|
|
911
944
|
};
|
|
@@ -956,7 +989,13 @@ export default class VideoPlayer extends React.Component<
|
|
|
956
989
|
...androidLifecyclePiPEvents,
|
|
957
990
|
};
|
|
958
991
|
|
|
959
|
-
const needToShowPlayNextOverlay =
|
|
992
|
+
const needToShowPlayNextOverlay =
|
|
993
|
+
isTV() && this.getPlayNextData() && !docked;
|
|
994
|
+
|
|
995
|
+
const needToShowDefaultControls = !(
|
|
996
|
+
(controls && !castAction?.state?.connected) ||
|
|
997
|
+
this.getPlayNextData()
|
|
998
|
+
);
|
|
960
999
|
|
|
961
1000
|
const playerContainerStyles = isApplePlatform()
|
|
962
1001
|
? styles.playerContainerBlack
|
|
@@ -979,7 +1018,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
979
1018
|
!needToShowPlayNextOverlay &&
|
|
980
1019
|
this.props.mode !== "PIP";
|
|
981
1020
|
|
|
982
|
-
if (
|
|
1021
|
+
if (shouldUseNativeControls) {
|
|
983
1022
|
return null;
|
|
984
1023
|
}
|
|
985
1024
|
|
|
@@ -998,6 +1037,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
998
1037
|
extraInfoText={castAction?.state?.friendlyStatus}
|
|
999
1038
|
controlsAlwaysVisible={castAction?.state?.connected}
|
|
1000
1039
|
playNextData={this.getPlayNextData()}
|
|
1040
|
+
needToShowDefaultControls={needToShowDefaultControls}
|
|
1001
1041
|
/>
|
|
1002
1042
|
) : null;
|
|
1003
1043
|
};
|
|
@@ -1032,29 +1072,14 @@ export default class VideoPlayer extends React.Component<
|
|
|
1032
1072
|
const renderMobilePlayer = () => {
|
|
1033
1073
|
return isFullScreenAudioPlayer && isAudioItem ? (
|
|
1034
1074
|
<View style={containerStyle}>
|
|
1035
|
-
{!castAction?.state?.connected && (
|
|
1075
|
+
{(!castAction?.state?.connected || supportNativeCast) && (
|
|
1036
1076
|
<this.props.PlayerComponent
|
|
1037
1077
|
ref={this._assignRoot}
|
|
1038
1078
|
{...nativeEvents}
|
|
1039
1079
|
{...nativeProps}
|
|
1040
1080
|
/>
|
|
1041
1081
|
)}
|
|
1042
|
-
<AudioPlayerWrapper {...sharedWrapperViewProps}
|
|
1043
|
-
<View>
|
|
1044
|
-
{
|
|
1045
|
-
<PlayNextOverlay
|
|
1046
|
-
item={entry}
|
|
1047
|
-
playerIsDocked={docked}
|
|
1048
|
-
pluginConfiguration={this.getPluginConfiguration()}
|
|
1049
|
-
playerId={this.props.playerId}
|
|
1050
|
-
playNextData={this.getPlayNextData()}
|
|
1051
|
-
setNextVideoPreloadThresholdPercentage={
|
|
1052
|
-
this.props.setNextVideoPreloadThresholdPercentage
|
|
1053
|
-
}
|
|
1054
|
-
/>
|
|
1055
|
-
}
|
|
1056
|
-
</View>
|
|
1057
|
-
</AudioPlayerWrapper>
|
|
1082
|
+
<AudioPlayerWrapper {...sharedWrapperViewProps} />
|
|
1058
1083
|
</View>
|
|
1059
1084
|
) : (
|
|
1060
1085
|
<PlayerWrapper {...sharedWrapperViewProps}>
|
|
@@ -1069,11 +1094,24 @@ export default class VideoPlayer extends React.Component<
|
|
|
1069
1094
|
<View style={styles.container}>
|
|
1070
1095
|
<View style={[playerContainerStyles, playerDimensions]}>
|
|
1071
1096
|
{isAudioItem && (
|
|
1072
|
-
<
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1097
|
+
<AnimationComponent
|
|
1098
|
+
animationType={ComponentAnimationType.player}
|
|
1099
|
+
additionalData={{
|
|
1100
|
+
...playerDimensions,
|
|
1101
|
+
inlineAudioPlayer: true,
|
|
1102
|
+
}}
|
|
1103
|
+
style={getStyle(playerDimensions)}
|
|
1104
|
+
>
|
|
1105
|
+
<AudioPlayer
|
|
1106
|
+
style={
|
|
1107
|
+
isTV()
|
|
1108
|
+
? getStyle(playerDimensions)
|
|
1109
|
+
: styles.playerSize
|
|
1110
|
+
}
|
|
1111
|
+
audio_item={entry}
|
|
1112
|
+
plugin_configuration={this.getPluginConfiguration()}
|
|
1113
|
+
/>
|
|
1114
|
+
</AnimationComponent>
|
|
1077
1115
|
)}
|
|
1078
1116
|
|
|
1079
1117
|
{shouldRenderBackground && (
|
|
@@ -1085,18 +1123,28 @@ export default class VideoPlayer extends React.Component<
|
|
|
1085
1123
|
/>
|
|
1086
1124
|
)}
|
|
1087
1125
|
|
|
1088
|
-
{!castAction?.state?.connected && (
|
|
1089
|
-
<
|
|
1090
|
-
|
|
1091
|
-
{
|
|
1092
|
-
{...nativeProps}
|
|
1093
|
-
listener={this.props.listener}
|
|
1126
|
+
{(!castAction?.state?.connected || supportNativeCast) && (
|
|
1127
|
+
<AnimationComponent
|
|
1128
|
+
animationType={ComponentAnimationType.player}
|
|
1129
|
+
additionalData={playerDimensions}
|
|
1094
1130
|
style={getStyle(playerDimensions)}
|
|
1095
|
-
pluginConfiguration={this.getPluginConfiguration()}
|
|
1096
|
-
controller={this.props.controller}
|
|
1097
1131
|
>
|
|
1098
|
-
|
|
1099
|
-
|
|
1132
|
+
<this.props.PlayerComponent
|
|
1133
|
+
ref={this._assignRoot}
|
|
1134
|
+
{...nativeEvents}
|
|
1135
|
+
{...nativeProps}
|
|
1136
|
+
listener={this.props.listener}
|
|
1137
|
+
style={
|
|
1138
|
+
isTV()
|
|
1139
|
+
? getStyle(playerDimensions)
|
|
1140
|
+
: styles.playerSize
|
|
1141
|
+
}
|
|
1142
|
+
pluginConfiguration={this.getPluginConfiguration()}
|
|
1143
|
+
controller={this.props.controller}
|
|
1144
|
+
>
|
|
1145
|
+
{this.childrenWithPlayNext()}
|
|
1146
|
+
</this.props.PlayerComponent>
|
|
1147
|
+
</AnimationComponent>
|
|
1100
1148
|
)}
|
|
1101
1149
|
</View>
|
|
1102
1150
|
|