@applicaster/quick-brick-player 12.0.0-alpha.3788876021 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-player",
3
- "version": "12.0.0-alpha.3788876021",
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-alpha.3788876021",
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.3788876021",
42
- "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.3788876021",
43
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.3788876021",
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",
@@ -294,7 +294,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
294
294
  playerState.isPaused ? player?.play() : player.pause();
295
295
  }, [playerState, player]);
296
296
 
297
- const seekDuration = Number(value("seek_duration"));
297
+ const seekDuration = Number(value("seek_duration")) ?? 10;
298
298
 
299
299
  const onRewindButtonPress = React.useCallback(() => {
300
300
  player?.rewind(seekDuration);
@@ -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,
@@ -33,6 +37,9 @@ import {
33
37
  ComponentAnimationType,
34
38
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
35
39
  import DockedLayout from "./DockedLayout";
40
+ import { isValidDate } from "../../Utils";
41
+
42
+ dayjs.extend(utc);
36
43
 
37
44
  type Dimensions = {
38
45
  width: number;
@@ -79,7 +86,7 @@ type LayoutProps = {
79
86
 
80
87
  const Styles = {
81
88
  container: { flex: 1 },
82
- tabletContainer: (isPortraitMode) => ({
89
+ tabletContainer: (isPortraitMode: boolean) => ({
83
90
  flex: 1,
84
91
  alignItems: "center",
85
92
  justifyContent: isPortraitMode ? "center" : "flex-start",
@@ -109,10 +116,10 @@ const Styles = {
109
116
  };
110
117
  },
111
118
  backgroundImageContainerImageStyle: (
112
- isTablet,
113
- docked,
114
- startComponentsAnimation,
115
- isActiveGesture
119
+ isTablet: boolean,
120
+ docked: boolean,
121
+ startComponentsAnimation: boolean,
122
+ isActiveGesture: boolean
116
123
  ) => ({
117
124
  borderRadius:
118
125
  (startComponentsAnimation && isActiveGesture) || docked
@@ -190,8 +197,35 @@ export default function DefaultLayout(props: LayoutProps) {
190
197
 
191
198
  let showFullControls = !controller?.isAd();
192
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
+
193
226
  if (isLiveContent) {
194
227
  const seekEnabled = Boolean(value("liveSeekingEnabled"));
228
+
195
229
  showFullControls = !!(controller?.hasSeekableDuration?.() && seekEnabled);
196
230
  }
197
231
 
@@ -221,12 +255,14 @@ export default function DefaultLayout(props: LayoutProps) {
221
255
 
222
256
  const rewind = rewindButton({
223
257
  isTablet,
224
- onPress: controller?.hasContentDuration?.() ? onRewindButtonPress : null,
258
+ onPress: controller?.hasSeekableDuration?.() ? onRewindButtonPress : null,
225
259
  });
226
260
 
227
261
  const forward = forwardButton({
228
262
  isTablet,
229
- onPress: controller?.hasContentDuration?.() ? onForwardButtonPress : null,
263
+ onPress: controller?.hasSeekableDuration?.()
264
+ ? onForwardButtonPress
265
+ : null,
230
266
  });
231
267
 
232
268
  const speed = speedButton({
@@ -298,7 +334,7 @@ export default function DefaultLayout(props: LayoutProps) {
298
334
  });
299
335
  }, 1000);
300
336
 
301
- // Clearing the interval when the component unmounts or dependencies changea
337
+ // Clearing the interval when the component unmounts or dependencies change
302
338
  return () => clearInterval(intervalId);
303
339
  } else {
304
340
  // Ensure the timeLeft state is set correctly if showCounter is false
@@ -308,20 +344,11 @@ export default function DefaultLayout(props: LayoutProps) {
308
344
 
309
345
  const Separator = () => <View style={Styles.separator} />;
310
346
 
311
- const liveSeekingEnabled = value("liveSeekingEnabled");
312
-
313
- const startTime = entry.extensions.start_time; // October 28, 2024, at 14:27 UTC
314
- const endTime = entry.extensions.end_time; // October 28, 2024, at 16:27 UTC
315
-
316
- const needsToShowProgressBar =
317
- (isLiveContent && (liveSeekingEnabled || (startTime && endTime))) ||
318
- !isLiveContent;
319
-
320
347
  const defaultImageDimensions = React.useMemo(
321
348
  () =>
322
349
  defaultDimensions &&
323
350
  Styles.backgroundImageContainer(defaultDimensions, isTablet),
324
- [defaultDimensions]
351
+ [defaultDimensions, isTablet]
325
352
  );
326
353
 
327
354
  const { isActiveGesture, startComponentsAnimation } =
@@ -345,7 +372,7 @@ export default function DefaultLayout(props: LayoutProps) {
345
372
  </AnimationComponent>
346
373
  <AnimationComponent
347
374
  animationType={ComponentAnimationType.moveUpComponent}
348
- style={isTablet ? Styles.playerImageWrapper : null}
375
+ style={isTablet ? Styles.playerImageWrapper : undefined}
349
376
  >
350
377
  <AnimationComponent
351
378
  animationType={ComponentAnimationType.moveComponentHorizontal}
@@ -360,7 +387,7 @@ export default function DefaultLayout(props: LayoutProps) {
360
387
  }
361
388
  : null,
362
389
  }}
363
- style={isTablet ? Styles.alignItemsCenter : null}
390
+ style={isTablet ? Styles.alignItemsCenter : undefined}
364
391
  >
365
392
  <PlayerImageBackground
366
393
  entry={entry}
@@ -380,7 +407,7 @@ export default function DefaultLayout(props: LayoutProps) {
380
407
  <View
381
408
  style={[
382
409
  Styles.paddingHorizontal,
383
- isTablet ? Styles.tabletLayout : null,
410
+ isTablet ? Styles.tabletLayout : undefined,
384
411
  ]}
385
412
  >
386
413
  {!docked && (
@@ -405,9 +432,9 @@ export default function DefaultLayout(props: LayoutProps) {
405
432
  playerState={playerState}
406
433
  disableFullscreen={true}
407
434
  sliderStyle={2}
408
- startTime={startTime}
409
- endTime={endTime}
410
- isLive={isLiveContent}
435
+ startTimestamp={startTimestamp}
436
+ endTimestamp={endTimestamp}
437
+ isDateBasedLiveContent={isDateBasedLiveContent}
411
438
  />
412
439
 
413
440
  {showCounter && timeLeft >= 0 && (
@@ -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
- 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
- };
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
+ };
@@ -1073,9 +1073,7 @@ export default class VideoPlayer extends React.Component<
1073
1073
  {...nativeProps}
1074
1074
  />
1075
1075
  )}
1076
- <AudioPlayerWrapper {...sharedWrapperViewProps}>
1077
- <></>
1078
- </AudioPlayerWrapper>
1076
+ <AudioPlayerWrapper {...sharedWrapperViewProps} />
1079
1077
  </View>
1080
1078
  ) : (
1081
1079
  <PlayerWrapper {...sharedWrapperViewProps}>