@applicaster/quick-brick-player 12.0.0-alpha.3977160850 → 12.0.0-alpha.4054240460
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 +90 -79
- 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 +112 -66
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.4054240460",
|
|
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-rc.
|
|
40
|
-
"@applicaster/quick-brick-tv-transport-controls": "
|
|
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.
|
|
39
|
+
"@applicaster/quick-brick-mobile-transport-controls": "12.0.0-rc.79",
|
|
40
|
+
"@applicaster/quick-brick-tv-transport-controls": "12.0.0-alpha.4054240460",
|
|
41
|
+
"@applicaster/zapp-react-native-tvos-app": "12.0.0-alpha.4054240460",
|
|
42
|
+
"@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.4054240460",
|
|
43
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.4054240460",
|
|
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,15 @@ 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";
|
|
35
|
+
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
29
36
|
|
|
30
37
|
const { log_debug } = createLogger({
|
|
31
38
|
subsystem: "UIComponent",
|
|
@@ -68,29 +75,20 @@ export const defaultAspectRatioWidth = (height: number): number =>
|
|
|
68
75
|
(height / 9) * 16;
|
|
69
76
|
|
|
70
77
|
const Styles = {
|
|
71
|
-
mainContainer: (
|
|
78
|
+
mainContainer: (style: ViewStyle) => {
|
|
72
79
|
const combinedStyle: ViewStyle = {
|
|
73
80
|
flex: 1,
|
|
74
81
|
};
|
|
75
82
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
style
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return { ...combinedStyle, ...style };
|
|
82
|
-
},
|
|
83
|
-
playerContainer: (docked: boolean, style: ViewStyle) => {
|
|
84
|
-
const combinedStyle: ViewStyle = {
|
|
85
|
-
flex: 1,
|
|
83
|
+
return {
|
|
84
|
+
...combinedStyle,
|
|
85
|
+
...style,
|
|
86
86
|
};
|
|
87
|
-
|
|
88
|
-
if (docked) {
|
|
89
|
-
combinedStyle.height = style.height;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return combinedStyle;
|
|
93
87
|
},
|
|
88
|
+
playerContainer: {
|
|
89
|
+
flex: 1,
|
|
90
|
+
},
|
|
91
|
+
paddingHorizontal: { paddingTop: 0, paddingHorizontal: PADDING_HORIZONTAL },
|
|
94
92
|
|
|
95
93
|
controlsMobile: {
|
|
96
94
|
height: 50,
|
|
@@ -144,9 +142,9 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
144
142
|
const isTablet = useIsTablet();
|
|
145
143
|
|
|
146
144
|
const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
|
|
147
|
-
|
|
145
|
+
|
|
148
146
|
// TODO: Have generic place for live url from configuration. Currently its hardcoded for client.
|
|
149
|
-
|
|
147
|
+
|
|
150
148
|
const feedUrl = getLiveUrl(entry?.extensions?.live?.channel_src ?? "");
|
|
151
149
|
|
|
152
150
|
const { title, summary } = useTitleSummaryOverlay(
|
|
@@ -168,6 +166,9 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
168
166
|
|
|
169
167
|
const [sleepTimerDate, setSleepTimerDate] = useState(0);
|
|
170
168
|
|
|
169
|
+
const [defaultDimensions, setDefaultDimensions] =
|
|
170
|
+
React.useState<Dimensions>(undefined);
|
|
171
|
+
|
|
171
172
|
const [dimensions, setDimensions] = React.useState<Dimensions>({
|
|
172
173
|
width: 0,
|
|
173
174
|
height: 0,
|
|
@@ -181,9 +182,11 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
181
182
|
const { width, height } = event.nativeEvent.layout;
|
|
182
183
|
|
|
183
184
|
setDimensions({
|
|
184
|
-
width
|
|
185
|
+
width,
|
|
185
186
|
height,
|
|
186
187
|
});
|
|
188
|
+
|
|
189
|
+
if (!defaultDimensions) setDefaultDimensions({ width, height });
|
|
187
190
|
};
|
|
188
191
|
|
|
189
192
|
const cancelSleepTimer = async () => {
|
|
@@ -195,7 +198,6 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
195
198
|
});
|
|
196
199
|
|
|
197
200
|
setSleepTimerDate(0);
|
|
198
|
-
player?.pause();
|
|
199
201
|
|
|
200
202
|
await localStorage.removeItem("sleep", NAMESPACE);
|
|
201
203
|
};
|
|
@@ -293,7 +295,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
293
295
|
playerState.isPaused ? player?.play() : player.pause();
|
|
294
296
|
}, [playerState, player]);
|
|
295
297
|
|
|
296
|
-
const seekDuration =
|
|
298
|
+
const seekDuration = toNumberWithDefault(10, value("seek_duration"));
|
|
297
299
|
|
|
298
300
|
const onRewindButtonPress = React.useCallback(() => {
|
|
299
301
|
player?.rewind(seekDuration);
|
|
@@ -376,58 +378,64 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
376
378
|
player?.seekTo(0);
|
|
377
379
|
}, [player]);
|
|
378
380
|
|
|
379
|
-
const edges = React.useMemo<Edge[]>(
|
|
380
|
-
() => (docked ? [] : ["right", "left", "top"]),
|
|
381
|
-
[docked]
|
|
382
|
-
);
|
|
381
|
+
const edges = React.useMemo<Edge[]>(() => ["right", "left", "top"], [docked]);
|
|
383
382
|
|
|
384
|
-
const ContainerView =
|
|
383
|
+
const ContainerView = SafeAreaView;
|
|
385
384
|
|
|
386
385
|
const MainContent = React.useMemo(() => {
|
|
387
386
|
return (
|
|
388
|
-
<ContainerView style={Styles.mainContainer(
|
|
389
|
-
<
|
|
390
|
-
|
|
391
|
-
|
|
387
|
+
<ContainerView style={Styles.mainContainer(style)} edges={edges}>
|
|
388
|
+
<AnimationComponent
|
|
389
|
+
animationType={ComponentAnimationType.moveUpComponent}
|
|
390
|
+
additionalData={{ saveArea: true }}
|
|
392
391
|
>
|
|
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
|
-
|
|
392
|
+
<AnimatedScrollModal>
|
|
393
|
+
<View style={Styles.playerContainer} onLayout={onLayout}>
|
|
394
|
+
<Layout
|
|
395
|
+
entry={entry}
|
|
396
|
+
playerState={playerState}
|
|
397
|
+
layoutState={layoutState}
|
|
398
|
+
value={value}
|
|
399
|
+
onPlaybackButtonPress={onPlaybackButtonPress}
|
|
400
|
+
onRewindButtonPress={onRewindButtonPress}
|
|
401
|
+
onForwardButtonPress={onForwardButtonPress}
|
|
402
|
+
onPlayerSeek={onPlayerSeek}
|
|
403
|
+
onSkipStart={onSkipStart}
|
|
404
|
+
onSpeedButtonPress={onSpeedButtonPress}
|
|
405
|
+
onSleepButtonPress={onSleepButtonPress}
|
|
406
|
+
playbackSpeedName={formatSpeed(playbackSpeed.value)}
|
|
407
|
+
playbackSleepName={
|
|
408
|
+
sleepTimer.value === 0 ? "sleep_timer" : "sleep_timer_active"
|
|
409
|
+
}
|
|
410
|
+
sleepTimerDate={sleepTimerDate}
|
|
411
|
+
cancelSleepTimer={cancelSleepTimer}
|
|
412
|
+
onSkipLive={onSkipLive}
|
|
413
|
+
onCloseVideoModal={onCloseVideoModal}
|
|
414
|
+
maximiseVideoModal={maximiseVideoModal}
|
|
415
|
+
configuration={configuration}
|
|
416
|
+
dimensions={dimensions}
|
|
417
|
+
playNextData={playNextData}
|
|
418
|
+
title={title}
|
|
419
|
+
summary={summary}
|
|
420
|
+
defaultDimensions={defaultDimensions}
|
|
421
|
+
/>
|
|
422
|
+
<View style={Styles.paddingHorizontal}>
|
|
423
|
+
{children}
|
|
424
|
+
<AnimationComponent
|
|
425
|
+
animationType={ComponentAnimationType.componentFade}
|
|
426
|
+
>
|
|
427
|
+
<PlayerDetails
|
|
428
|
+
configuration={configuration}
|
|
429
|
+
style={Styles.playerDetails}
|
|
430
|
+
entry={entry}
|
|
431
|
+
isTabletLandscape={isTabletLandscape}
|
|
432
|
+
isAudioPlayer={true}
|
|
433
|
+
/>
|
|
434
|
+
</AnimationComponent>
|
|
435
|
+
</View>
|
|
436
|
+
</View>
|
|
437
|
+
</AnimatedScrollModal>
|
|
438
|
+
</AnimationComponent>
|
|
431
439
|
</ContainerView>
|
|
432
440
|
);
|
|
433
441
|
}, [
|
|
@@ -456,17 +464,20 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
456
464
|
if (configuration.magic_background) {
|
|
457
465
|
const baseUrl = entry?.extensions?.audio_player_background_image ?? "";
|
|
458
466
|
|
|
459
|
-
|
|
467
|
+
const queryParamName =
|
|
468
|
+
configuration.audio_player_background_image_query || "width";
|
|
469
|
+
|
|
470
|
+
const queryParamValue = 15;
|
|
460
471
|
|
|
461
|
-
|
|
462
|
-
// configuration.audio_player_background_image_query || "width";
|
|
463
|
-
//
|
|
464
|
-
// const queryParamValue = 15;
|
|
465
|
-
//
|
|
466
|
-
// const url = addQueryParam(baseUrl, queryParamName, queryParamValue);
|
|
472
|
+
const url = addQueryParam(baseUrl, queryParamName, queryParamValue);
|
|
467
473
|
|
|
468
474
|
return (
|
|
469
|
-
<MagicBG
|
|
475
|
+
<MagicBG
|
|
476
|
+
image={url}
|
|
477
|
+
fallbackUrl={baseUrl}
|
|
478
|
+
colors={entry?.extensions?.backgroundColors}
|
|
479
|
+
defaultColor="#000000"
|
|
480
|
+
>
|
|
470
481
|
{MainContent}
|
|
471
482
|
</MagicBG>
|
|
472
483
|
);
|