@applicaster/quick-brick-player 12.0.0-alpha.3977160850 → 12.0.0-alpha.4374801485
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 +5 -5
- package/src/CellPlayer/Assets/AssetsComponent.tsx +2 -1
- package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +89 -79
- package/src/Player/AudioLayer/Layout/DefaultLayout.tsx +185 -72
- 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 +40 -22
- package/src/Player/Utils/Utils.ts +7 -21
- package/src/Player/index.tsx +92 -50
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-player",
|
|
3
|
-
"version": "12.0.0-alpha.
|
|
3
|
+
"version": "12.0.0-alpha.4374801485",
|
|
4
4
|
"description": "Quick Brick Player",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@applicaster/quick-brick-mobile-transport-controls": "12.0.0-
|
|
39
|
+
"@applicaster/quick-brick-mobile-transport-controls": "12.0.0-alpha.4374801485",
|
|
40
40
|
"@applicaster/quick-brick-tv-transport-controls": "11.0.0-rc.133",
|
|
41
|
-
"@applicaster/zapp-react-native-tvos-app": "12.0.0-alpha.
|
|
42
|
-
"@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.
|
|
43
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.
|
|
41
|
+
"@applicaster/zapp-react-native-tvos-app": "12.0.0-alpha.4374801485",
|
|
42
|
+
"@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.4374801485",
|
|
43
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.4374801485",
|
|
44
44
|
"keymirror": "^0.1.1",
|
|
45
45
|
"query-string": "7.1.3",
|
|
46
46
|
"react-native-web-linear-gradient": "1.1.2",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, View } from "react-native";
|
|
3
3
|
import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
|
|
4
4
|
import { MUTED_USAGE } from "../const";
|
|
5
5
|
import { LiveImageManager } from "@applicaster/zapp-react-native-ui-components/Components/VideoLive/LiveImageManager";
|
|
6
|
+
import { QBImage as Image } from "@applicaster/zapp-react-native-ui-components/Components/Image";
|
|
6
7
|
|
|
7
8
|
type Asset = string | undefined;
|
|
8
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { ViewStyle, View
|
|
2
|
+
import { ViewStyle, View } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { SafeAreaView, Edge } from "react-native-safe-area-context";
|
|
5
5
|
import { usePlayerState } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerState";
|
|
@@ -24,8 +24,14 @@ import {
|
|
|
24
24
|
NAMESPACE,
|
|
25
25
|
} from "./utils";
|
|
26
26
|
import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
|
|
27
|
-
import { getLiveUrl } from "../Utils";
|
|
27
|
+
import { addQueryParam, getLiveUrl } from "../Utils";
|
|
28
28
|
import { useTitleSummaryOverlay } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerTitleSummaryOverlay";
|
|
29
|
+
import {
|
|
30
|
+
AnimationComponent,
|
|
31
|
+
ComponentAnimationType,
|
|
32
|
+
AnimatedScrollModal,
|
|
33
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
34
|
+
import { PADDING_HORIZONTAL } from "./Layout/defaultLayoutsConts";
|
|
29
35
|
|
|
30
36
|
const { log_debug } = createLogger({
|
|
31
37
|
subsystem: "UIComponent",
|
|
@@ -68,29 +74,20 @@ export const defaultAspectRatioWidth = (height: number): number =>
|
|
|
68
74
|
(height / 9) * 16;
|
|
69
75
|
|
|
70
76
|
const Styles = {
|
|
71
|
-
mainContainer: (
|
|
77
|
+
mainContainer: (style: ViewStyle) => {
|
|
72
78
|
const combinedStyle: ViewStyle = {
|
|
73
79
|
flex: 1,
|
|
74
80
|
};
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
style
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return { ...combinedStyle, ...style };
|
|
82
|
-
},
|
|
83
|
-
playerContainer: (docked: boolean, style: ViewStyle) => {
|
|
84
|
-
const combinedStyle: ViewStyle = {
|
|
85
|
-
flex: 1,
|
|
82
|
+
return {
|
|
83
|
+
...combinedStyle,
|
|
84
|
+
...style,
|
|
86
85
|
};
|
|
87
|
-
|
|
88
|
-
if (docked) {
|
|
89
|
-
combinedStyle.height = style.height;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return combinedStyle;
|
|
93
86
|
},
|
|
87
|
+
playerContainer: {
|
|
88
|
+
flex: 1,
|
|
89
|
+
},
|
|
90
|
+
paddingHorizontal: { paddingTop: 0, paddingHorizontal: PADDING_HORIZONTAL },
|
|
94
91
|
|
|
95
92
|
controlsMobile: {
|
|
96
93
|
height: 50,
|
|
@@ -144,9 +141,9 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
144
141
|
const isTablet = useIsTablet();
|
|
145
142
|
|
|
146
143
|
const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
|
|
147
|
-
|
|
144
|
+
|
|
148
145
|
// TODO: Have generic place for live url from configuration. Currently its hardcoded for client.
|
|
149
|
-
|
|
146
|
+
|
|
150
147
|
const feedUrl = getLiveUrl(entry?.extensions?.live?.channel_src ?? "");
|
|
151
148
|
|
|
152
149
|
const { title, summary } = useTitleSummaryOverlay(
|
|
@@ -168,6 +165,9 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
168
165
|
|
|
169
166
|
const [sleepTimerDate, setSleepTimerDate] = useState(0);
|
|
170
167
|
|
|
168
|
+
const [defaultDimensions, setDefaultDimensions] =
|
|
169
|
+
React.useState<Dimensions>(undefined);
|
|
170
|
+
|
|
171
171
|
const [dimensions, setDimensions] = React.useState<Dimensions>({
|
|
172
172
|
width: 0,
|
|
173
173
|
height: 0,
|
|
@@ -181,9 +181,11 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
181
181
|
const { width, height } = event.nativeEvent.layout;
|
|
182
182
|
|
|
183
183
|
setDimensions({
|
|
184
|
-
width
|
|
184
|
+
width,
|
|
185
185
|
height,
|
|
186
186
|
});
|
|
187
|
+
|
|
188
|
+
if (!defaultDimensions) setDefaultDimensions({ width, height });
|
|
187
189
|
};
|
|
188
190
|
|
|
189
191
|
const cancelSleepTimer = async () => {
|
|
@@ -195,7 +197,6 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
195
197
|
});
|
|
196
198
|
|
|
197
199
|
setSleepTimerDate(0);
|
|
198
|
-
player?.pause();
|
|
199
200
|
|
|
200
201
|
await localStorage.removeItem("sleep", NAMESPACE);
|
|
201
202
|
};
|
|
@@ -293,7 +294,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
293
294
|
playerState.isPaused ? player?.play() : player.pause();
|
|
294
295
|
}, [playerState, player]);
|
|
295
296
|
|
|
296
|
-
const seekDuration = Number(value("seek_duration"));
|
|
297
|
+
const seekDuration = Number(value("seek_duration")) ?? 10;
|
|
297
298
|
|
|
298
299
|
const onRewindButtonPress = React.useCallback(() => {
|
|
299
300
|
player?.rewind(seekDuration);
|
|
@@ -376,58 +377,64 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
376
377
|
player?.seekTo(0);
|
|
377
378
|
}, [player]);
|
|
378
379
|
|
|
379
|
-
const edges = React.useMemo<Edge[]>(
|
|
380
|
-
() => (docked ? [] : ["right", "left", "top"]),
|
|
381
|
-
[docked]
|
|
382
|
-
);
|
|
380
|
+
const edges = React.useMemo<Edge[]>(() => ["right", "left", "top"], [docked]);
|
|
383
381
|
|
|
384
|
-
const ContainerView =
|
|
382
|
+
const ContainerView = SafeAreaView;
|
|
385
383
|
|
|
386
384
|
const MainContent = React.useMemo(() => {
|
|
387
385
|
return (
|
|
388
|
-
<ContainerView style={Styles.mainContainer(
|
|
389
|
-
<
|
|
390
|
-
|
|
391
|
-
|
|
386
|
+
<ContainerView style={Styles.mainContainer(style)} edges={edges}>
|
|
387
|
+
<AnimationComponent
|
|
388
|
+
animationType={ComponentAnimationType.moveUpComponent}
|
|
389
|
+
additionalData={{ saveArea: true }}
|
|
392
390
|
>
|
|
393
|
-
<
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
391
|
+
<AnimatedScrollModal>
|
|
392
|
+
<View style={Styles.playerContainer} onLayout={onLayout}>
|
|
393
|
+
<Layout
|
|
394
|
+
entry={entry}
|
|
395
|
+
playerState={playerState}
|
|
396
|
+
layoutState={layoutState}
|
|
397
|
+
value={value}
|
|
398
|
+
onPlaybackButtonPress={onPlaybackButtonPress}
|
|
399
|
+
onRewindButtonPress={onRewindButtonPress}
|
|
400
|
+
onForwardButtonPress={onForwardButtonPress}
|
|
401
|
+
onPlayerSeek={onPlayerSeek}
|
|
402
|
+
onSkipStart={onSkipStart}
|
|
403
|
+
onSpeedButtonPress={onSpeedButtonPress}
|
|
404
|
+
onSleepButtonPress={onSleepButtonPress}
|
|
405
|
+
playbackSpeedName={formatSpeed(playbackSpeed.value)}
|
|
406
|
+
playbackSleepName={
|
|
407
|
+
sleepTimer.value === 0 ? "sleep_timer" : "sleep_timer_active"
|
|
408
|
+
}
|
|
409
|
+
sleepTimerDate={sleepTimerDate}
|
|
410
|
+
cancelSleepTimer={cancelSleepTimer}
|
|
411
|
+
onSkipLive={onSkipLive}
|
|
412
|
+
onCloseVideoModal={onCloseVideoModal}
|
|
413
|
+
maximiseVideoModal={maximiseVideoModal}
|
|
414
|
+
configuration={configuration}
|
|
415
|
+
dimensions={dimensions}
|
|
416
|
+
playNextData={playNextData}
|
|
417
|
+
title={title}
|
|
418
|
+
summary={summary}
|
|
419
|
+
defaultDimensions={defaultDimensions}
|
|
420
|
+
/>
|
|
421
|
+
<View style={Styles.paddingHorizontal}>
|
|
422
|
+
{children}
|
|
423
|
+
<AnimationComponent
|
|
424
|
+
animationType={ComponentAnimationType.componentFade}
|
|
425
|
+
>
|
|
426
|
+
<PlayerDetails
|
|
427
|
+
configuration={configuration}
|
|
428
|
+
style={Styles.playerDetails}
|
|
429
|
+
entry={entry}
|
|
430
|
+
isTabletLandscape={isTabletLandscape}
|
|
431
|
+
isAudioPlayer={true}
|
|
432
|
+
/>
|
|
433
|
+
</AnimationComponent>
|
|
434
|
+
</View>
|
|
435
|
+
</View>
|
|
436
|
+
</AnimatedScrollModal>
|
|
437
|
+
</AnimationComponent>
|
|
431
438
|
</ContainerView>
|
|
432
439
|
);
|
|
433
440
|
}, [
|
|
@@ -456,17 +463,20 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
456
463
|
if (configuration.magic_background) {
|
|
457
464
|
const baseUrl = entry?.extensions?.audio_player_background_image ?? "";
|
|
458
465
|
|
|
459
|
-
|
|
466
|
+
const queryParamName =
|
|
467
|
+
configuration.audio_player_background_image_query || "width";
|
|
468
|
+
|
|
469
|
+
const queryParamValue = 15;
|
|
460
470
|
|
|
461
|
-
|
|
462
|
-
// configuration.audio_player_background_image_query || "width";
|
|
463
|
-
//
|
|
464
|
-
// const queryParamValue = 15;
|
|
465
|
-
//
|
|
466
|
-
// const url = addQueryParam(baseUrl, queryParamName, queryParamValue);
|
|
471
|
+
const url = addQueryParam(baseUrl, queryParamName, queryParamValue);
|
|
467
472
|
|
|
468
473
|
return (
|
|
469
|
-
<MagicBG
|
|
474
|
+
<MagicBG
|
|
475
|
+
image={url}
|
|
476
|
+
fallbackUrl={baseUrl}
|
|
477
|
+
colors={entry?.extensions?.backgroundColors}
|
|
478
|
+
defaultColor="#000000"
|
|
479
|
+
>
|
|
470
480
|
{MainContent}
|
|
471
481
|
</MagicBG>
|
|
472
482
|
);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
// DefaultLayout.tsx
|
|
2
|
+
|
|
1
3
|
import * as React from "react";
|
|
2
4
|
import * as R from "ramda";
|
|
3
5
|
import { View } from "react-native";
|
|
6
|
+
import dayjs from "dayjs";
|
|
7
|
+
import utc from "dayjs/plugin/utc";
|
|
4
8
|
|
|
5
9
|
import {
|
|
6
10
|
ProgressBar,
|
|
@@ -18,13 +22,24 @@ import {
|
|
|
18
22
|
rewindButton,
|
|
19
23
|
skipToStartButton,
|
|
20
24
|
skipToLiveButton,
|
|
25
|
+
PADDING_HORIZONTAL,
|
|
21
26
|
speedButton,
|
|
22
27
|
sleepButton,
|
|
23
28
|
} from "./defaultLayoutsConts";
|
|
24
29
|
import { AudioDescription } from "../AudioDescription";
|
|
25
30
|
import { PlayerImageBackground } from "@applicaster/zapp-react-native-ui-components/Components/PlayerImageBackground";
|
|
26
31
|
import { useLanguageData } from "@applicaster/zapp-react-native-utils/reactHooks/player";
|
|
32
|
+
import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
|
|
27
33
|
import { useEffect, useMemo, useState } from "react";
|
|
34
|
+
import {
|
|
35
|
+
useModalAnimationContext,
|
|
36
|
+
AnimationComponent,
|
|
37
|
+
ComponentAnimationType,
|
|
38
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
39
|
+
import DockedLayout from "./DockedLayout";
|
|
40
|
+
import { isValidDate } from "../../Utils";
|
|
41
|
+
|
|
42
|
+
dayjs.extend(utc);
|
|
28
43
|
|
|
29
44
|
type Dimensions = {
|
|
30
45
|
width: number;
|
|
@@ -60,22 +75,29 @@ type LayoutProps = {
|
|
|
60
75
|
onPlayerSeek: (targetTime: number) => void;
|
|
61
76
|
onSkipLive: () => void;
|
|
62
77
|
onSkipStart: () => void;
|
|
78
|
+
onCloseVideoModal: () => void;
|
|
79
|
+
maximiseVideoModal: () => void;
|
|
63
80
|
dimensions: Dimensions;
|
|
81
|
+
playNextData: PlayNextData;
|
|
64
82
|
title: string | number;
|
|
65
83
|
summary: string | number;
|
|
84
|
+
defaultDimensions: Dimensions;
|
|
66
85
|
};
|
|
67
86
|
|
|
68
87
|
const Styles = {
|
|
69
88
|
container: { flex: 1 },
|
|
70
|
-
tabletContainer: (isPortraitMode) => ({
|
|
89
|
+
tabletContainer: (isPortraitMode: boolean) => ({
|
|
71
90
|
flex: 1,
|
|
72
91
|
alignItems: "center",
|
|
73
92
|
justifyContent: isPortraitMode ? "center" : "flex-start",
|
|
74
93
|
}),
|
|
75
|
-
|
|
76
|
-
width:
|
|
94
|
+
playerImageWrapper: {
|
|
95
|
+
width: "100%",
|
|
77
96
|
maxHeight: 750,
|
|
78
97
|
marginTop: 80,
|
|
98
|
+
},
|
|
99
|
+
tabletLayout: {
|
|
100
|
+
width: 463,
|
|
79
101
|
marginBottom: 80,
|
|
80
102
|
},
|
|
81
103
|
controls: (isTablet: boolean, isLiveShowFullControls: boolean) => ({
|
|
@@ -84,24 +106,31 @@ const Styles = {
|
|
|
84
106
|
justifyContent: isLiveShowFullControls ? "space-between" : "space-evenly",
|
|
85
107
|
}),
|
|
86
108
|
backgroundImageContainer: (dimensions: Dimensions, isTablet: boolean) => {
|
|
109
|
+
const mobileValue = dimensions.width
|
|
110
|
+
? dimensions.width - PADDING_HORIZONTAL * 2
|
|
111
|
+
: 330;
|
|
112
|
+
|
|
87
113
|
return {
|
|
88
|
-
width: isTablet ? 463 :
|
|
89
|
-
height: isTablet ? 463 :
|
|
114
|
+
width: isTablet ? 463 : mobileValue,
|
|
115
|
+
height: isTablet ? 463 : mobileValue,
|
|
90
116
|
};
|
|
91
117
|
},
|
|
92
|
-
backgroundImageContainerImageStyle: (
|
|
93
|
-
|
|
118
|
+
backgroundImageContainerImageStyle: (
|
|
119
|
+
isTablet: boolean,
|
|
120
|
+
docked: boolean,
|
|
121
|
+
startComponentsAnimation: boolean,
|
|
122
|
+
isActiveGesture: boolean
|
|
123
|
+
) => ({
|
|
124
|
+
borderRadius:
|
|
125
|
+
(startComponentsAnimation && isActiveGesture) || docked
|
|
126
|
+
? 0
|
|
127
|
+
: isTablet
|
|
128
|
+
? 24
|
|
129
|
+
: 10,
|
|
94
130
|
}),
|
|
95
|
-
playerContainer: (docked: boolean, style) => {
|
|
96
|
-
const combinedStyle = {
|
|
97
|
-
flex: 1,
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
if (docked) {
|
|
101
|
-
combinedStyle["height"] = style.height;
|
|
102
|
-
}
|
|
103
131
|
|
|
104
|
-
|
|
132
|
+
paddingHorizontal: {
|
|
133
|
+
paddingHorizontal: PADDING_HORIZONTAL,
|
|
105
134
|
},
|
|
106
135
|
|
|
107
136
|
controlsMobile: {
|
|
@@ -115,6 +144,12 @@ const Styles = {
|
|
|
115
144
|
separator: {
|
|
116
145
|
height: 20,
|
|
117
146
|
},
|
|
147
|
+
flexDirectionRow: {
|
|
148
|
+
flexDirection: "row",
|
|
149
|
+
},
|
|
150
|
+
alignItemsCenter: {
|
|
151
|
+
alignItems: "center",
|
|
152
|
+
},
|
|
118
153
|
};
|
|
119
154
|
|
|
120
155
|
export default function DefaultLayout(props: LayoutProps) {
|
|
@@ -139,12 +174,14 @@ export default function DefaultLayout(props: LayoutProps) {
|
|
|
139
174
|
sleepTimerDate,
|
|
140
175
|
title,
|
|
141
176
|
summary,
|
|
177
|
+
defaultDimensions,
|
|
142
178
|
} = props;
|
|
143
179
|
|
|
144
180
|
const isTablet = useIsTablet();
|
|
145
181
|
const { width, height } = dimensions;
|
|
146
182
|
const isPortraitMode = width < height;
|
|
147
183
|
const isLiveContent = playerState.isLive;
|
|
184
|
+
const docked = layoutState.docked;
|
|
148
185
|
|
|
149
186
|
const languageData = useLanguageData("audio-player");
|
|
150
187
|
|
|
@@ -160,8 +197,35 @@ export default function DefaultLayout(props: LayoutProps) {
|
|
|
160
197
|
|
|
161
198
|
let showFullControls = !controller?.isAd();
|
|
162
199
|
|
|
200
|
+
// Safely access and validate start_time and end_time
|
|
201
|
+
const startTime = entry.extensions?.start_time;
|
|
202
|
+
const endTime = entry.extensions?.end_time;
|
|
203
|
+
|
|
204
|
+
const hasValidStartTime = isValidDate(startTime);
|
|
205
|
+
const hasValidEndTime = isValidDate(endTime);
|
|
206
|
+
|
|
207
|
+
// Abstracted condition
|
|
208
|
+
const isDateBasedLiveContent =
|
|
209
|
+
isLiveContent && hasValidStartTime && hasValidEndTime;
|
|
210
|
+
|
|
211
|
+
// Determine if progress bar should be shown
|
|
212
|
+
const needsToShowProgressBar =
|
|
213
|
+
(isLiveContent &&
|
|
214
|
+
(Boolean(value("liveSeekingEnabled")) || isDateBasedLiveContent)) ||
|
|
215
|
+
!isLiveContent;
|
|
216
|
+
|
|
217
|
+
// Convert valid date strings to timestamps
|
|
218
|
+
const startTimestamp = hasValidStartTime
|
|
219
|
+
? dayjs.utc(startTime!).valueOf()
|
|
220
|
+
: undefined;
|
|
221
|
+
|
|
222
|
+
const endTimestamp = hasValidEndTime
|
|
223
|
+
? dayjs.utc(endTime!).valueOf()
|
|
224
|
+
: undefined;
|
|
225
|
+
|
|
163
226
|
if (isLiveContent) {
|
|
164
227
|
const seekEnabled = Boolean(value("liveSeekingEnabled"));
|
|
228
|
+
|
|
165
229
|
showFullControls = !!(controller?.hasSeekableDuration?.() && seekEnabled);
|
|
166
230
|
}
|
|
167
231
|
|
|
@@ -191,12 +255,14 @@ export default function DefaultLayout(props: LayoutProps) {
|
|
|
191
255
|
|
|
192
256
|
const rewind = rewindButton({
|
|
193
257
|
isTablet,
|
|
194
|
-
onPress: controller?.
|
|
258
|
+
onPress: controller?.hasSeekableDuration?.() ? onRewindButtonPress : null,
|
|
195
259
|
});
|
|
196
260
|
|
|
197
261
|
const forward = forwardButton({
|
|
198
262
|
isTablet,
|
|
199
|
-
onPress: controller?.
|
|
263
|
+
onPress: controller?.hasSeekableDuration?.()
|
|
264
|
+
? onForwardButtonPress
|
|
265
|
+
: null,
|
|
200
266
|
});
|
|
201
267
|
|
|
202
268
|
const speed = speedButton({
|
|
@@ -278,10 +344,15 @@ export default function DefaultLayout(props: LayoutProps) {
|
|
|
278
344
|
|
|
279
345
|
const Separator = () => <View style={Styles.separator} />;
|
|
280
346
|
|
|
281
|
-
const
|
|
347
|
+
const defaultImageDimensions = React.useMemo(
|
|
348
|
+
() =>
|
|
349
|
+
defaultDimensions &&
|
|
350
|
+
Styles.backgroundImageContainer(defaultDimensions, isTablet),
|
|
351
|
+
[defaultDimensions, isTablet]
|
|
352
|
+
);
|
|
282
353
|
|
|
283
|
-
const
|
|
284
|
-
(
|
|
354
|
+
const { isActiveGesture, startComponentsAnimation } =
|
|
355
|
+
useModalAnimationContext();
|
|
285
356
|
|
|
286
357
|
return (
|
|
287
358
|
<View
|
|
@@ -289,65 +360,107 @@ export default function DefaultLayout(props: LayoutProps) {
|
|
|
289
360
|
isTablet ? Styles.tabletContainer(isPortraitMode) : Styles.container
|
|
290
361
|
}
|
|
291
362
|
>
|
|
292
|
-
<
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
363
|
+
<AnimationComponent animationType={ComponentAnimationType.componentFade}>
|
|
364
|
+
<TransportInfo
|
|
365
|
+
content={entry}
|
|
366
|
+
value={value}
|
|
367
|
+
visible={true}
|
|
368
|
+
languageData={languageData}
|
|
369
|
+
layoutState={layoutState}
|
|
370
|
+
actionButtons={actionButtons}
|
|
371
|
+
/>
|
|
372
|
+
</AnimationComponent>
|
|
373
|
+
<AnimationComponent
|
|
374
|
+
animationType={ComponentAnimationType.moveUpComponent}
|
|
375
|
+
style={isTablet ? Styles.playerImageWrapper : undefined}
|
|
304
376
|
>
|
|
305
|
-
<
|
|
377
|
+
<AnimationComponent
|
|
378
|
+
animationType={ComponentAnimationType.moveComponentHorizontal}
|
|
379
|
+
additionalData={{
|
|
380
|
+
disableAnimatedComponent: !isTablet,
|
|
381
|
+
moveValue: (dimensions.width - 463) / 2,
|
|
382
|
+
extraAnimation: !isTablet
|
|
383
|
+
? {
|
|
384
|
+
[ComponentAnimationType.audioPlayerPaddingHorizontal]: {
|
|
385
|
+
style: Styles.paddingHorizontal,
|
|
386
|
+
},
|
|
387
|
+
}
|
|
388
|
+
: null,
|
|
389
|
+
}}
|
|
390
|
+
style={isTablet ? Styles.alignItemsCenter : undefined}
|
|
391
|
+
>
|
|
306
392
|
<PlayerImageBackground
|
|
307
393
|
entry={entry}
|
|
308
394
|
style={Styles.backgroundImageContainer(dimensions, isTablet)}
|
|
309
|
-
imageStyle={Styles.backgroundImageContainerImageStyle(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
395
|
+
imageStyle={Styles.backgroundImageContainerImageStyle(
|
|
396
|
+
isTablet,
|
|
397
|
+
docked,
|
|
398
|
+
startComponentsAnimation,
|
|
399
|
+
isActiveGesture
|
|
400
|
+
)}
|
|
401
|
+
defaultImageDimensions={defaultImageDimensions}
|
|
316
402
|
/>
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
403
|
+
</AnimationComponent>
|
|
404
|
+
|
|
405
|
+
<DockedLayout {...props} />
|
|
406
|
+
</AnimationComponent>
|
|
407
|
+
<View
|
|
408
|
+
style={[
|
|
409
|
+
Styles.paddingHorizontal,
|
|
410
|
+
isTablet ? Styles.tabletLayout : undefined,
|
|
411
|
+
]}
|
|
412
|
+
>
|
|
413
|
+
{!docked && (
|
|
414
|
+
<AnimationComponent
|
|
415
|
+
animationType={ComponentAnimationType.componentFade}
|
|
416
|
+
>
|
|
417
|
+
<AudioDescription
|
|
418
|
+
title={title}
|
|
419
|
+
summary={summary}
|
|
420
|
+
value={value}
|
|
421
|
+
layoutState={layoutState}
|
|
422
|
+
/>
|
|
423
|
+
<Separator />
|
|
424
|
+
{needsToShowProgressBar && (
|
|
425
|
+
<View>
|
|
426
|
+
<ProgressBar
|
|
427
|
+
content={entry}
|
|
334
428
|
value={value}
|
|
335
|
-
|
|
429
|
+
visible={true}
|
|
430
|
+
layoutState={layoutState}
|
|
431
|
+
onPlayerSeek={onPlayerSeek}
|
|
432
|
+
playerState={playerState}
|
|
433
|
+
disableFullscreen={true}
|
|
434
|
+
sliderStyle={2}
|
|
435
|
+
startTimestamp={startTimestamp}
|
|
436
|
+
endTimestamp={endTimestamp}
|
|
437
|
+
isDateBasedLiveContent={isDateBasedLiveContent}
|
|
336
438
|
/>
|
|
337
|
-
)}
|
|
338
439
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
440
|
+
{showCounter && timeLeft >= 0 && (
|
|
441
|
+
<CountDown
|
|
442
|
+
timeLeft={timeLeft}
|
|
443
|
+
value={value}
|
|
444
|
+
title={sleepTitle}
|
|
445
|
+
/>
|
|
446
|
+
)}
|
|
447
|
+
|
|
448
|
+
<Separator />
|
|
449
|
+
</View>
|
|
450
|
+
)}
|
|
451
|
+
<Controls
|
|
452
|
+
value={value}
|
|
453
|
+
visible={true}
|
|
454
|
+
keepAlive={null}
|
|
455
|
+
buttons={controlButtons}
|
|
456
|
+
style={Styles.controls(
|
|
457
|
+
isTablet,
|
|
458
|
+
isLiveContent && showFullControls
|
|
459
|
+
)}
|
|
460
|
+
playerState={playerState}
|
|
461
|
+
/>
|
|
462
|
+
</AnimationComponent>
|
|
463
|
+
)}
|
|
351
464
|
</View>
|
|
352
465
|
</View>
|
|
353
466
|
);
|
|
@@ -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
|
}
|
|
@@ -11,9 +11,10 @@ type MagicBGProps = {
|
|
|
11
11
|
image: string;
|
|
12
12
|
fallbackUrl?: string;
|
|
13
13
|
defaultColor: string;
|
|
14
|
+
colors: string[]; // Updated to type string[] as it holds hex values
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
const
|
|
17
|
+
const defaultColors = {
|
|
17
18
|
overlay: "rgba(0, 0, 0, 0.35)",
|
|
18
19
|
defaultGradientStart: "rgba(0, 0, 0, 0.25)",
|
|
19
20
|
defaultGradientEnd: "rgba(0, 0, 0, 0)",
|
|
@@ -25,7 +26,7 @@ const styles = StyleSheet.create({
|
|
|
25
26
|
},
|
|
26
27
|
fullScreenOverlay: {
|
|
27
28
|
...StyleSheet.absoluteFillObject,
|
|
28
|
-
backgroundColor:
|
|
29
|
+
backgroundColor: defaultColors.overlay,
|
|
29
30
|
},
|
|
30
31
|
gradientOverlay: {
|
|
31
32
|
position: "absolute",
|
|
@@ -54,46 +55,63 @@ export const MagicBG: React.FC<MagicBGProps> = ({
|
|
|
54
55
|
children,
|
|
55
56
|
image,
|
|
56
57
|
fallbackUrl = "",
|
|
58
|
+
colors = [],
|
|
57
59
|
defaultColor,
|
|
58
60
|
}) => {
|
|
59
61
|
const [dominantColor, setDominantColor] =
|
|
60
62
|
React.useState<string>(defaultColor);
|
|
61
63
|
|
|
62
64
|
const [gradientColors, setGradientColors] = React.useState<string[]>([
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
defaultColors.defaultGradientStart,
|
|
66
|
+
defaultColors.defaultGradientEnd,
|
|
65
67
|
]);
|
|
66
68
|
|
|
67
69
|
useEffect(() => {
|
|
68
70
|
const fetchColors = async () => {
|
|
69
|
-
if
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
setDominantColor(dominantColor);
|
|
77
|
-
} catch (error) {
|
|
71
|
+
// Check if colors are provided and not empty
|
|
72
|
+
if (colors && colors.length > 0) {
|
|
73
|
+
// Use provided colors for gradient and dominant color
|
|
74
|
+
setGradientColors(colors.slice(0, 2)); // First 2 colors for gradient
|
|
75
|
+
setDominantColor(colors[0]); // First color as dominant
|
|
76
|
+
} else if (image) {
|
|
77
|
+
// If no colors, try fetching from image
|
|
78
78
|
try {
|
|
79
79
|
const { gradientColors, dominantColor } =
|
|
80
|
-
await fetchPaletteAndDominantColor(
|
|
80
|
+
await fetchPaletteAndDominantColor(image);
|
|
81
81
|
|
|
82
82
|
setGradientColors(gradientColors);
|
|
83
83
|
setDominantColor(dominantColor);
|
|
84
|
-
} catch {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
} catch (error) {
|
|
85
|
+
// If image fetch fails, try fallback URL
|
|
86
|
+
try {
|
|
87
|
+
const { gradientColors, dominantColor } =
|
|
88
|
+
await fetchPaletteAndDominantColor(fallbackUrl);
|
|
89
|
+
|
|
90
|
+
setGradientColors(gradientColors);
|
|
91
|
+
setDominantColor(dominantColor);
|
|
92
|
+
} catch {
|
|
93
|
+
// If everything fails, use default color
|
|
94
|
+
setGradientColors([
|
|
95
|
+
defaultColors.defaultGradientStart,
|
|
96
|
+
defaultColors.defaultGradientEnd,
|
|
97
|
+
]);
|
|
98
|
+
|
|
99
|
+
setDominantColor(defaultColor);
|
|
100
|
+
}
|
|
91
101
|
}
|
|
102
|
+
} else {
|
|
103
|
+
// If no image or colors, use default color
|
|
104
|
+
setGradientColors([
|
|
105
|
+
defaultColors.defaultGradientStart,
|
|
106
|
+
defaultColors.defaultGradientEnd,
|
|
107
|
+
]);
|
|
108
|
+
|
|
109
|
+
setDominantColor(defaultColor);
|
|
92
110
|
}
|
|
93
111
|
};
|
|
94
112
|
|
|
95
113
|
fetchColors();
|
|
96
|
-
}, [
|
|
114
|
+
}, []);
|
|
97
115
|
|
|
98
116
|
return (
|
|
99
117
|
<View style={[styles.container, { backgroundColor: dominantColor }]}>
|
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
import queryString from "query-string";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import utc from "dayjs/plugin/utc";
|
|
2
4
|
|
|
3
|
-
|
|
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
|
-
};
|
|
5
|
+
dayjs.extend(utc);
|
|
24
6
|
|
|
25
7
|
export const getLiveUrl = (url: string) => {
|
|
26
8
|
// Use the replace method with a regular expression to replace all instances of subClass with livePage
|
|
@@ -42,3 +24,7 @@ export const addQueryParam = (
|
|
|
42
24
|
|
|
43
25
|
return `${urlWithoutQuery}?${updatedQueryString}`;
|
|
44
26
|
};
|
|
27
|
+
|
|
28
|
+
export const isValidDate = (dateString: string) => {
|
|
29
|
+
return dateString && dayjs.utc(dateString).isValid();
|
|
30
|
+
};
|
package/src/Player/index.tsx
CHANGED
|
@@ -36,6 +36,12 @@ 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
|
+
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";
|
|
39
45
|
|
|
40
46
|
const RNPlayerManager = {
|
|
41
47
|
QuickBrickPlayerPlugin: isApplePlatform()
|
|
@@ -55,6 +61,7 @@ const styles = StyleSheet.create({
|
|
|
55
61
|
position: "absolute",
|
|
56
62
|
zIndex: 1,
|
|
57
63
|
},
|
|
64
|
+
playerSize: { width: "100%", height: "100%" },
|
|
58
65
|
});
|
|
59
66
|
|
|
60
67
|
const logger = createLogger({
|
|
@@ -555,6 +562,26 @@ export default class VideoPlayer extends React.Component<
|
|
|
555
562
|
this.props.listener?.onPlayerDetached?.(nativeEvent);
|
|
556
563
|
};
|
|
557
564
|
|
|
565
|
+
onVideoFullscreenPlayerDidDismiss = () => {
|
|
566
|
+
this.props.listener?.onVideoFullscreenPlayerDidDismiss?.();
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
onVideoFullscreenPlayerDidPresent = () => {
|
|
570
|
+
this.props.listener?.onVideoFullscreenPlayerDidPresent?.();
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
onVideoFullscreenPlayerWillDismiss = () => {
|
|
574
|
+
this.props.listener?.onVideoFullscreenPlayerWillDismiss?.();
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
onVideoFullscreenPlayerWillPresent = () => {
|
|
578
|
+
this.props.listener?.onVideoFullscreenPlayerWillPresent?.();
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
onPlayerClose = () => {
|
|
582
|
+
this.props.listener?.onPlayerClose?.();
|
|
583
|
+
};
|
|
584
|
+
|
|
558
585
|
onPiPEnter = () => {
|
|
559
586
|
this.setState({ piped: true });
|
|
560
587
|
this.props.openPiP();
|
|
@@ -759,7 +786,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
759
786
|
render() {
|
|
760
787
|
const {
|
|
761
788
|
castAction,
|
|
762
|
-
controls,
|
|
763
789
|
docked,
|
|
764
790
|
entry,
|
|
765
791
|
fullscreen,
|
|
@@ -817,17 +843,31 @@ export default class VideoPlayer extends React.Component<
|
|
|
817
843
|
const liveCatchUpEnabled =
|
|
818
844
|
this.props.pluginConfiguration?.liveCatchUpEnabled;
|
|
819
845
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
846
|
+
// TODO: Get screen data more reliable way useCurrentScreenData
|
|
847
|
+
const screenData = getTargetScreenDataFromEntry(this.props.playableItem);
|
|
848
|
+
|
|
849
|
+
const isInlineTV = screenData?.ui_components?.length > 0 && isTV();
|
|
823
850
|
|
|
824
|
-
|
|
851
|
+
let platformSpecificProps: any = isApplePlatform()
|
|
825
852
|
? {
|
|
826
|
-
...hideNativeControls,
|
|
827
853
|
resizeMode: nativeResizeMode,
|
|
828
854
|
}
|
|
829
855
|
: {};
|
|
830
856
|
|
|
857
|
+
const supportsNativeControls =
|
|
858
|
+
!!this.props.controller?.supportsNativeControls?.();
|
|
859
|
+
|
|
860
|
+
const controls = isAppleTV()
|
|
861
|
+
? supportsNativeControls && !isInlineTV && !this.getPlayNextData()
|
|
862
|
+
: supportsNativeControls && !this.getPlayNextData();
|
|
863
|
+
|
|
864
|
+
const shouldUseNativeControls = controls && !docked;
|
|
865
|
+
|
|
866
|
+
platformSpecificProps = {
|
|
867
|
+
...platformSpecificProps,
|
|
868
|
+
controls: shouldUseNativeControls,
|
|
869
|
+
};
|
|
870
|
+
|
|
831
871
|
const pictureInPictureEnabled =
|
|
832
872
|
this.props.pluginConfiguration?.pictureInPictureEnabled;
|
|
833
873
|
|
|
@@ -835,7 +875,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
835
875
|
entry, // Must be passed first in list
|
|
836
876
|
...platformSpecificProps,
|
|
837
877
|
audioTrackId,
|
|
838
|
-
controls,
|
|
839
878
|
docked,
|
|
840
879
|
enableAutoAudioTrackSelection,
|
|
841
880
|
fullscreen, // TODO: Check fullscreen params not crash
|
|
@@ -890,22 +929,17 @@ export default class VideoPlayer extends React.Component<
|
|
|
890
929
|
onVideoEnd: this.onVideoEnd, // complete
|
|
891
930
|
onVideoError: this.onVideoError, // error
|
|
892
931
|
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
|
-
),
|
|
932
|
+
onVideoFullscreenPlayerDidDismiss: this.onVideoFullscreenPlayerDidDismiss,
|
|
933
|
+
onVideoFullscreenPlayerDidPresent: this.onVideoFullscreenPlayerDidPresent,
|
|
934
|
+
onVideoFullscreenPlayerWillDismiss:
|
|
935
|
+
this.onVideoFullscreenPlayerWillDismiss,
|
|
936
|
+
onVideoFullscreenPlayerWillPresent:
|
|
937
|
+
this.onVideoFullscreenPlayerWillPresent,
|
|
905
938
|
onVideoLoad: this.onVideoLoad,
|
|
906
939
|
onVideoLoadStart: this.unHandledEvent("onVideoLoadStart"),
|
|
907
940
|
onVideoBuffer: this.onVideoBuffer,
|
|
908
941
|
onPlaybackStalled: this.onPlaybackStalled,
|
|
942
|
+
onPlayerClose: this.onPlayerClose,
|
|
909
943
|
onPlayerAttached: this.onPlayerAttached,
|
|
910
944
|
onPlayerDetached: this.onPlayerDetached,
|
|
911
945
|
};
|
|
@@ -979,7 +1013,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
979
1013
|
!needToShowPlayNextOverlay &&
|
|
980
1014
|
this.props.mode !== "PIP";
|
|
981
1015
|
|
|
982
|
-
if (
|
|
1016
|
+
if (shouldUseNativeControls) {
|
|
983
1017
|
return null;
|
|
984
1018
|
}
|
|
985
1019
|
|
|
@@ -1039,22 +1073,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
1039
1073
|
{...nativeProps}
|
|
1040
1074
|
/>
|
|
1041
1075
|
)}
|
|
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>
|
|
1076
|
+
<AudioPlayerWrapper {...sharedWrapperViewProps} />
|
|
1058
1077
|
</View>
|
|
1059
1078
|
) : (
|
|
1060
1079
|
<PlayerWrapper {...sharedWrapperViewProps}>
|
|
@@ -1069,11 +1088,24 @@ export default class VideoPlayer extends React.Component<
|
|
|
1069
1088
|
<View style={styles.container}>
|
|
1070
1089
|
<View style={[playerContainerStyles, playerDimensions]}>
|
|
1071
1090
|
{isAudioItem && (
|
|
1072
|
-
<
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1091
|
+
<AnimationComponent
|
|
1092
|
+
animationType={ComponentAnimationType.player}
|
|
1093
|
+
additionalData={{
|
|
1094
|
+
...playerDimensions,
|
|
1095
|
+
inlineAudioPlayer: true,
|
|
1096
|
+
}}
|
|
1097
|
+
style={getStyle(playerDimensions)}
|
|
1098
|
+
>
|
|
1099
|
+
<AudioPlayer
|
|
1100
|
+
style={
|
|
1101
|
+
isTV()
|
|
1102
|
+
? getStyle(playerDimensions)
|
|
1103
|
+
: styles.playerSize
|
|
1104
|
+
}
|
|
1105
|
+
audio_item={entry}
|
|
1106
|
+
plugin_configuration={this.getPluginConfiguration()}
|
|
1107
|
+
/>
|
|
1108
|
+
</AnimationComponent>
|
|
1077
1109
|
)}
|
|
1078
1110
|
|
|
1079
1111
|
{shouldRenderBackground && (
|
|
@@ -1086,17 +1118,27 @@ export default class VideoPlayer extends React.Component<
|
|
|
1086
1118
|
)}
|
|
1087
1119
|
|
|
1088
1120
|
{!castAction?.state?.connected && (
|
|
1089
|
-
<
|
|
1090
|
-
|
|
1091
|
-
{
|
|
1092
|
-
{...nativeProps}
|
|
1093
|
-
listener={this.props.listener}
|
|
1121
|
+
<AnimationComponent
|
|
1122
|
+
animationType={ComponentAnimationType.player}
|
|
1123
|
+
additionalData={playerDimensions}
|
|
1094
1124
|
style={getStyle(playerDimensions)}
|
|
1095
|
-
pluginConfiguration={this.getPluginConfiguration()}
|
|
1096
|
-
controller={this.props.controller}
|
|
1097
1125
|
>
|
|
1098
|
-
|
|
1099
|
-
|
|
1126
|
+
<this.props.PlayerComponent
|
|
1127
|
+
ref={this._assignRoot}
|
|
1128
|
+
{...nativeEvents}
|
|
1129
|
+
{...nativeProps}
|
|
1130
|
+
listener={this.props.listener}
|
|
1131
|
+
style={
|
|
1132
|
+
isTV()
|
|
1133
|
+
? getStyle(playerDimensions)
|
|
1134
|
+
: styles.playerSize
|
|
1135
|
+
}
|
|
1136
|
+
pluginConfiguration={this.getPluginConfiguration()}
|
|
1137
|
+
controller={this.props.controller}
|
|
1138
|
+
>
|
|
1139
|
+
{this.childrenWithPlayNext()}
|
|
1140
|
+
</this.props.PlayerComponent>
|
|
1141
|
+
</AnimationComponent>
|
|
1100
1142
|
)}
|
|
1101
1143
|
</View>
|
|
1102
1144
|
|