@applicaster/quick-brick-player 12.0.0-alpha.3977160850 → 12.0.0-alpha.4043183114

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": "12.0.0-alpha.3977160850",
3
+ "version": "12.0.0-alpha.4043183114",
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.28",
40
- "@applicaster/quick-brick-tv-transport-controls": "11.0.0-rc.133",
41
- "@applicaster/zapp-react-native-tvos-app": "12.0.0-alpha.3977160850",
42
- "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.3977160850",
43
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.3977160850",
39
+ "@applicaster/quick-brick-mobile-transport-controls": "12.0.0-rc.96",
40
+ "@applicaster/quick-brick-tv-transport-controls": "12.0.0-alpha.4043183114",
41
+ "@applicaster/zapp-react-native-tvos-app": "12.0.0-alpha.4043183114",
42
+ "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.4043183114",
43
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.4043183114",
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 { Image, StyleSheet, View } from "react-native";
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, ScrollView } from "react-native";
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: (docked: boolean, style: ViewStyle) => {
78
+ mainContainer: (style: ViewStyle) => {
72
79
  const combinedStyle: ViewStyle = {
73
80
  flex: 1,
74
81
  };
75
82
 
76
- if (!docked) {
77
- style.paddingTop = 0;
78
- style.paddingHorizontal = 15;
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: docked ? defaultAspectRatioWidth(height) : 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 = Number(value("seek_duration"));
298
+ const seekDuration = toNumberWithDefault(10, value("seek_duration"));
297
299
 
298
300
  const onRewindButtonPress = React.useCallback(() => {
299
301
  player?.rewind(seekDuration);
@@ -376,58 +378,65 @@ 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 = docked ? View : SafeAreaView;
383
+ const ContainerView = SafeAreaView;
385
384
 
386
385
  const MainContent = React.useMemo(() => {
387
386
  return (
388
- <ContainerView style={Styles.mainContainer(docked, style)} edges={edges}>
389
- <ScrollView
390
- style={Styles.playerContainer(docked, style)}
391
- onLayout={onLayout}
387
+ <ContainerView style={Styles.mainContainer(style)} edges={edges}>
388
+ <AnimationComponent
389
+ animationType={ComponentAnimationType.moveUpComponent}
390
+ additionalData={{ saveArea: true }}
391
+ style={Styles.playerContainer}
392
392
  >
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
- />
420
- {children}
421
- {!docked && (
422
- <PlayerDetails
423
- configuration={configuration}
424
- style={Styles.playerDetails}
425
- entry={entry}
426
- isTabletLandscape={isTabletLandscape}
427
- isAudioPlayer={true}
428
- />
429
- )}
430
- </ScrollView>
393
+ <AnimatedScrollModal>
394
+ <View style={Styles.playerContainer} onLayout={onLayout}>
395
+ <Layout
396
+ entry={entry}
397
+ playerState={playerState}
398
+ layoutState={layoutState}
399
+ value={value}
400
+ onPlaybackButtonPress={onPlaybackButtonPress}
401
+ onRewindButtonPress={onRewindButtonPress}
402
+ onForwardButtonPress={onForwardButtonPress}
403
+ onPlayerSeek={onPlayerSeek}
404
+ onSkipStart={onSkipStart}
405
+ onSpeedButtonPress={onSpeedButtonPress}
406
+ onSleepButtonPress={onSleepButtonPress}
407
+ playbackSpeedName={formatSpeed(playbackSpeed.value)}
408
+ playbackSleepName={
409
+ sleepTimer.value === 0 ? "sleep_timer" : "sleep_timer_active"
410
+ }
411
+ sleepTimerDate={sleepTimerDate}
412
+ cancelSleepTimer={cancelSleepTimer}
413
+ onSkipLive={onSkipLive}
414
+ onCloseVideoModal={onCloseVideoModal}
415
+ maximiseVideoModal={maximiseVideoModal}
416
+ configuration={configuration}
417
+ dimensions={dimensions}
418
+ playNextData={playNextData}
419
+ title={title}
420
+ summary={summary}
421
+ defaultDimensions={defaultDimensions}
422
+ />
423
+ <View style={Styles.paddingHorizontal}>
424
+ {children}
425
+ <AnimationComponent
426
+ animationType={ComponentAnimationType.componentFade}
427
+ >
428
+ <PlayerDetails
429
+ configuration={configuration}
430
+ style={Styles.playerDetails}
431
+ entry={entry}
432
+ isTabletLandscape={isTabletLandscape}
433
+ isAudioPlayer={true}
434
+ />
435
+ </AnimationComponent>
436
+ </View>
437
+ </View>
438
+ </AnimatedScrollModal>
439
+ </AnimationComponent>
431
440
  </ContainerView>
432
441
  );
433
442
  }, [
@@ -456,17 +465,20 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
456
465
  if (configuration.magic_background) {
457
466
  const baseUrl = entry?.extensions?.audio_player_background_image ?? "";
458
467
 
459
- // TODO: To be added when background is ready
468
+ const queryParamName =
469
+ configuration.audio_player_background_image_query || "width";
470
+
471
+ const queryParamValue = 15;
460
472
 
461
- // const queryParamName =
462
- // configuration.audio_player_background_image_query || "width";
463
- //
464
- // const queryParamValue = 15;
465
- //
466
- // const url = addQueryParam(baseUrl, queryParamName, queryParamValue);
473
+ const url = addQueryParam(baseUrl, queryParamName, queryParamValue);
467
474
 
468
475
  return (
469
- <MagicBG image={baseUrl} fallbackUrl={baseUrl} defaultColor="#000000">
476
+ <MagicBG
477
+ image={url}
478
+ fallbackUrl={baseUrl}
479
+ colors={entry?.extensions?.backgroundColors}
480
+ defaultColor="#000000"
481
+ >
470
482
  {MainContent}
471
483
  </MagicBG>
472
484
  );