@applicaster/quick-brick-player 12.0.0-alpha.8417280639 → 12.0.0-alpha.8961274073

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.8417280639",
3
+ "version": "12.0.0-alpha.8961274073",
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.8417280639",
39
+ "@applicaster/quick-brick-mobile-transport-controls": "12.0.0-rc.58",
40
40
  "@applicaster/quick-brick-tv-transport-controls": "11.0.0-rc.133",
41
- "@applicaster/zapp-react-native-tvos-app": "12.0.0-alpha.8417280639",
42
- "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.8417280639",
43
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.8417280639",
41
+ "@applicaster/zapp-react-native-tvos-app": "12.0.0-alpha.8961274073",
42
+ "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.8961274073",
43
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.8961274073",
44
44
  "keymirror": "^0.1.1",
45
45
  "query-string": "7.1.3",
46
46
  "react-native-web-linear-gradient": "1.1.2",
@@ -32,6 +32,7 @@ import {
32
32
  AnimatedScrollModal,
33
33
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
34
34
  import { PADDING_HORIZONTAL } from "./Layout/defaultLayoutsConts";
35
+ import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
35
36
 
36
37
  const { log_debug } = createLogger({
37
38
  subsystem: "UIComponent",
@@ -54,7 +55,7 @@ type Configuration = {
54
55
  };
55
56
 
56
57
  type Props = {
57
- children?: React.ReactNode;
58
+ children: React.ReactNode;
58
59
  inline?: boolean;
59
60
  docked?: boolean;
60
61
  configuration: Configuration;
@@ -294,7 +295,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
294
295
  playerState.isPaused ? player?.play() : player.pause();
295
296
  }, [playerState, player]);
296
297
 
297
- const seekDuration = Number(value("seek_duration"));
298
+ const seekDuration = toNumberWithDefault(10, value("seek_duration"));
298
299
 
299
300
  const onRewindButtonPress = React.useCallback(() => {
300
301
  player?.rewind(seekDuration);
@@ -1,10 +1,7 @@
1
- // DefaultLayout.tsx
2
-
3
1
  import * as React from "react";
4
2
  import * as R from "ramda";
5
3
  import { View } from "react-native";
6
- import dayjs from "dayjs";
7
- import utc from "dayjs/plugin/utc";
4
+ import { dayjs } from "@applicaster/zapp-react-native-utils/dateUtils";
8
5
 
9
6
  import {
10
7
  ProgressBar,
@@ -39,8 +36,6 @@ import {
39
36
  import DockedLayout from "./DockedLayout";
40
37
  import { isValidDate } from "../../Utils";
41
38
 
42
- dayjs.extend(utc);
43
-
44
39
  type Dimensions = {
45
40
  width: number;
46
41
  height: number;
@@ -197,24 +192,20 @@ export default function DefaultLayout(props: LayoutProps) {
197
192
 
198
193
  let showFullControls = !controller?.isAd();
199
194
 
200
- // Safely access and validate start_time and end_time
201
- const startTime = entry.extensions?.start_time;
202
- const endTime = entry.extensions?.end_time;
195
+ const startTime = entry.extensions?.live?.start_time;
196
+ const endTime = entry.extensions?.live?.end_time;
203
197
 
204
198
  const hasValidStartTime = isValidDate(startTime);
205
199
  const hasValidEndTime = isValidDate(endTime);
206
200
 
207
- // Abstracted condition
208
201
  const isDateBasedLiveContent =
209
202
  isLiveContent && hasValidStartTime && hasValidEndTime;
210
203
 
211
- // Determine if progress bar should be shown
212
204
  const needsToShowProgressBar =
213
205
  (isLiveContent &&
214
206
  (Boolean(value("liveSeekingEnabled")) || isDateBasedLiveContent)) ||
215
207
  !isLiveContent;
216
208
 
217
- // Convert valid date strings to timestamps
218
209
  const startTimestamp = hasValidStartTime
219
210
  ? dayjs.utc(startTime!).valueOf()
220
211
  : undefined;
@@ -255,12 +246,14 @@ export default function DefaultLayout(props: LayoutProps) {
255
246
 
256
247
  const rewind = rewindButton({
257
248
  isTablet,
258
- onPress: controller?.hasContentDuration?.() ? onRewindButtonPress : null,
249
+ onPress: controller?.hasSeekableDuration?.() ? onRewindButtonPress : null,
259
250
  });
260
251
 
261
252
  const forward = forwardButton({
262
253
  isTablet,
263
- onPress: controller?.hasContentDuration?.() ? onForwardButtonPress : null,
254
+ onPress: controller?.hasSeekableDuration?.()
255
+ ? onForwardButtonPress
256
+ : null,
264
257
  });
265
258
 
266
259
  const speed = speedButton({
@@ -289,7 +282,6 @@ export default function DefaultLayout(props: LayoutProps) {
289
282
  return [skipToStart, rewind, play, forward, skipToLive];
290
283
  }
291
284
 
292
- // Temporary empty button until we add sleep button. It will ensure the buttons will not break in their position
293
285
  return [speed, rewind, play, forward, sleep];
294
286
  }, [
295
287
  playerState,
@@ -310,15 +302,12 @@ export default function DefaultLayout(props: LayoutProps) {
310
302
 
311
303
  useEffect(() => {
312
304
  if (showCounter && sleepTimerDate !== 0) {
313
- // Setting the initial timeLeft based on sleepTimerDate
314
305
  setTimeLeft(sleepTimerDate - Date.now());
315
306
 
316
- // Setting up an interval to update the remaining time every second
317
307
  const intervalId = setInterval(() => {
318
308
  setTimeLeft(() => {
319
309
  const newTimeLeft = sleepTimerDate - Date.now();
320
310
 
321
- // If the new remaining time is less than or equal to 0, clear the interval and trigger the cancelSleepTimer function
322
311
  if (newTimeLeft <= 0) {
323
312
  clearInterval(intervalId);
324
313
 
@@ -326,16 +315,13 @@ export default function DefaultLayout(props: LayoutProps) {
326
315
 
327
316
  return 0;
328
317
  } else {
329
- // Otherwise, update the state with the new remaining time
330
318
  return newTimeLeft;
331
319
  }
332
320
  });
333
321
  }, 1000);
334
322
 
335
- // Clearing the interval when the component unmounts or dependencies change
336
323
  return () => clearInterval(intervalId);
337
324
  } else {
338
- // Ensure the timeLeft state is set correctly if showCounter is false
339
325
  setTimeLeft(0);
340
326
  }
341
327
  }, [sleepTimerDate, showCounter, cancelSleepTimer]);
@@ -432,7 +418,7 @@ export default function DefaultLayout(props: LayoutProps) {
432
418
  sliderStyle={2}
433
419
  startTimestamp={startTimestamp}
434
420
  endTimestamp={endTimestamp}
435
- isLive={isDateBasedLiveContent}
421
+ isDateBasedLiveContent={isDateBasedLiveContent}
436
422
  />
437
423
 
438
424
  {showCounter && timeLeft >= 0 && (
@@ -1,8 +1,5 @@
1
1
  import queryString from "query-string";
2
- import dayjs from "dayjs";
3
- import utc from "dayjs/plugin/utc";
4
-
5
- dayjs.extend(utc);
2
+ import { dayjs } from "@applicaster/zapp-react-native-utils/dateUtils";
6
3
 
7
4
  export const getLiveUrl = (url: string) => {
8
5
  // Use the replace method with a regular expression to replace all instances of subClass with livePage
@@ -25,6 +22,6 @@ export const addQueryParam = (
25
22
  return `${urlWithoutQuery}?${updatedQueryString}`;
26
23
  };
27
24
 
28
- export const isValidDate = (dateString: string) => {
29
- return dateString && dayjs.utc(dateString).isValid();
25
+ export const isValidDate = (dateString: string): boolean => {
26
+ return dateString.trim() !== "" && dayjs.utc(dateString).isValid();
30
27
  };
@@ -785,7 +785,6 @@ export default class VideoPlayer extends React.Component<
785
785
 
786
786
  render() {
787
787
  const {
788
- castAction,
789
788
  docked,
790
789
  entry,
791
790
  fullscreen,
@@ -795,8 +794,13 @@ export default class VideoPlayer extends React.Component<
795
794
  isTabletPortrait,
796
795
  muted,
797
796
  style,
797
+ castAction,
798
+ controller,
799
+ startComponentsAnimation,
798
800
  } = this.props;
799
801
 
802
+ const supportNativeCast = controller.supportNativeCast();
803
+
800
804
  const { audioTrackId, keyEvent, paused, seek, textTrackId, rate } =
801
805
  this.state;
802
806
 
@@ -861,7 +865,11 @@ export default class VideoPlayer extends React.Component<
861
865
  ? supportsNativeControls && !isInlineTV && !this.getPlayNextData()
862
866
  : supportsNativeControls && !this.getPlayNextData();
863
867
 
864
- const shouldUseNativeControls = controls && !docked;
868
+ const shouldUseNativeControls =
869
+ controls &&
870
+ !startComponentsAnimation &&
871
+ !docked &&
872
+ !castAction?.state?.connected;
865
873
 
866
874
  platformSpecificProps = {
867
875
  ...platformSpecificProps,
@@ -1032,6 +1040,7 @@ export default class VideoPlayer extends React.Component<
1032
1040
  extraInfoText={castAction?.state?.friendlyStatus}
1033
1041
  controlsAlwaysVisible={castAction?.state?.connected}
1034
1042
  playNextData={this.getPlayNextData()}
1043
+ nativeControls={!!controls}
1035
1044
  />
1036
1045
  ) : null;
1037
1046
  };
@@ -1066,7 +1075,7 @@ export default class VideoPlayer extends React.Component<
1066
1075
  const renderMobilePlayer = () => {
1067
1076
  return isFullScreenAudioPlayer && isAudioItem ? (
1068
1077
  <View style={containerStyle}>
1069
- {!castAction?.state?.connected && (
1078
+ {(!castAction?.state?.connected || supportNativeCast) && (
1070
1079
  <this.props.PlayerComponent
1071
1080
  ref={this._assignRoot}
1072
1081
  {...nativeEvents}
@@ -1117,7 +1126,7 @@ export default class VideoPlayer extends React.Component<
1117
1126
  />
1118
1127
  )}
1119
1128
 
1120
- {!castAction?.state?.connected && (
1129
+ {(!castAction?.state?.connected || supportNativeCast) && (
1121
1130
  <AnimationComponent
1122
1131
  animationType={ComponentAnimationType.player}
1123
1132
  additionalData={playerDimensions}