@applicaster/quick-brick-player 12.0.0-alpha.3021004521 → 12.0.0-alpha.3436326335

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.3021004521",
3
+ "version": "12.0.0-alpha.3436326335",
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.3",
39
+ "@applicaster/quick-brick-mobile-transport-controls": "12.0.0-rc.11",
40
40
  "@applicaster/quick-brick-tv-transport-controls": "11.0.0-rc.133",
41
- "@applicaster/zapp-react-native-tvos-app": "12.0.0-alpha.3021004521",
42
- "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.3021004521",
43
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.3021004521",
41
+ "@applicaster/zapp-react-native-tvos-app": "12.0.0-alpha.3436326335",
42
+ "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.3436326335",
43
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.3436326335",
44
44
  "keymirror": "^0.1.1",
45
45
  "react-native-web-linear-gradient": "1.1.2",
46
46
  "shaka-player": "4.3.5",
@@ -10,7 +10,7 @@ import {
10
10
 
11
11
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
12
12
 
13
- import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device/useIsTablet";
13
+ import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
14
14
  import {
15
15
  forwardButton,
16
16
  playbackButton,
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import * as React from "react";
2
2
  import {
3
3
  StyleSheet,
4
4
  TouchableWithoutFeedback,
@@ -6,7 +6,7 @@ import {
6
6
  ViewStyle,
7
7
  } from "react-native";
8
8
  import * as R from "ramda";
9
- import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks";
9
+ import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
10
10
 
11
11
  import {
12
12
  ContentInfo,
@@ -198,9 +198,7 @@ export default function DockedLayout(props: LayoutProps) {
198
198
  playNextData,
199
199
  } = props;
200
200
 
201
- const {
202
- deviceInfo: { isTablet },
203
- } = useDimensions("screen", { deviceInfo: true });
201
+ const isTablet = useIsTablet();
204
202
 
205
203
  const visible = true;
206
204
  const liveButton = Boolean(value("live_badge_enabled"));
@@ -36,6 +36,10 @@ 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 {
40
+ getTargetScreenDataFromEntry
41
+ } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useTargetScreenData";
42
+ import { isAppleTV } from "@applicaster/zapp-react-native-ui-components/Helpers/Platform";
39
43
 
40
44
  const RNPlayerManager = {
41
45
  QuickBrickPlayerPlugin: isApplePlatform()
@@ -551,6 +555,28 @@ export default class VideoPlayer extends React.Component<
551
555
  this.props.listener?.onPlayerDetached?.(nativeEvent);
552
556
  };
553
557
 
558
+ onVideoFullscreenPlayerDidDismiss = () => {
559
+ console.log("Anton onVideoFullscreenPlayerDidDismiss");
560
+ this.props.listener?.onVideoFullscreenPlayerDidDismiss?.();
561
+ }
562
+
563
+ onVideoFullscreenPlayerDidPresent = () => {
564
+ console.log("Anton onVideoFullscreenPlayerDidPresent");
565
+ this.props.listener?.onVideoFullscreenPlayerDidPresent?.();
566
+ }
567
+
568
+ onVideoFullscreenPlayerWillDismiss = () => {
569
+ this.props.listener?.onVideoFullscreenPlayerWillDismiss?.();
570
+ }
571
+
572
+ onVideoFullscreenPlayerWillPresent = () => {
573
+ this.props.listener?.onVideoFullscreenPlayerWillPresent?.();
574
+ }
575
+
576
+ onPlayerClose = () => {
577
+ this.props.listener?.onPlayerClose?.();
578
+ }
579
+
554
580
  onPiPEnter = () => {
555
581
  this.setState({ piped: true });
556
582
  this.props.openPiP();
@@ -755,7 +781,6 @@ export default class VideoPlayer extends React.Component<
755
781
  render() {
756
782
  const {
757
783
  castAction,
758
- controls,
759
784
  docked,
760
785
  entry,
761
786
  fullscreen,
@@ -812,16 +837,32 @@ export default class VideoPlayer extends React.Component<
812
837
  const liveCatchUpEnabled =
813
838
  this.props.pluginConfiguration?.liveCatchUpEnabled;
814
839
 
815
- const hideNativeControls = isTV()
816
- ? { controls: !this.getPlayNextData() }
817
- : {};
840
+ // TODO: Get screen data more reliable way useCurrentScreenData
841
+ const screenData = getTargetScreenDataFromEntry(this.props.playableItem);
842
+
843
+ const isInlineTV = screenData?.ui_components?.length > 0 && isTV();
818
844
 
819
- const platformSpecificProps = isApplePlatform()
845
+ let platformSpecificProps: any = isApplePlatform()
820
846
  ? {
821
- ...hideNativeControls,
822
- resizeMode: nativeResizeMode,
823
- }
824
- : {};
847
+ resizeMode: nativeResizeMode,
848
+ } : {};
849
+
850
+ const supportsNativeControls = !!this.props.controller?.supportsNativeControls?.();
851
+
852
+ const controls = isAppleTV()
853
+ ? supportsNativeControls && isInlineTV && !this.getPlayNextData()
854
+ : supportsNativeControls && !this.getPlayNextData();
855
+
856
+ platformSpecificProps = {
857
+ ...platformSpecificProps,
858
+ controls
859
+ };
860
+
861
+ console.log("Anton Player render2 ", {
862
+ platformSpecificProps,
863
+ isNotInlineTv: !isInlineTV,
864
+ hasNoPlayNextData: !this.getPlayNextData()
865
+ });
825
866
 
826
867
  const pictureInPictureEnabled =
827
868
  this.props.pluginConfiguration?.pictureInPictureEnabled;
@@ -830,7 +871,6 @@ export default class VideoPlayer extends React.Component<
830
871
  entry, // Must be passed first in list
831
872
  ...platformSpecificProps,
832
873
  audioTrackId,
833
- controls,
834
874
  docked,
835
875
  enableAutoAudioTrackSelection,
836
876
  fullscreen, // TODO: Check fullscreen params not crash
@@ -884,22 +924,15 @@ export default class VideoPlayer extends React.Component<
884
924
  onVideoEnd: this.onVideoEnd, // complete
885
925
  onVideoError: this.onVideoError, // error
886
926
  onVideoProgress: this.onVideoProgress,
887
- onVideoFullscreenPlayerDidDismiss: this.unHandledEvent(
888
- "onVideoFullscreenPlayerDidPresent"
889
- ),
890
- onVideoFullscreenPlayerDidPresent: this.unHandledEvent(
891
- "onVideoFullscreenPlayerDidPresent"
892
- ),
893
- onVideoFullscreenPlayerWillDismiss: this.unHandledEvent(
894
- "onVideoFullscreenPlayerWillDismiss"
895
- ),
896
- onVideoFullscreenPlayerWillPresent: this.unHandledEvent(
897
- "onVideoFullscreenPlayerWillPresent"
898
- ),
927
+ onVideoFullscreenPlayerDidDismiss: this.onVideoFullscreenPlayerDidDismiss,
928
+ onVideoFullscreenPlayerDidPresent: this.onVideoFullscreenPlayerDidPresent,
929
+ onVideoFullscreenPlayerWillDismiss: this.onVideoFullscreenPlayerWillDismiss,
930
+ onVideoFullscreenPlayerWillPresent: this.onVideoFullscreenPlayerWillPresent,
899
931
  onVideoLoad: this.onVideoLoad,
900
932
  onVideoLoadStart: this.unHandledEvent("onVideoLoadStart"),
901
933
  onVideoBuffer: this.onVideoBuffer,
902
934
  onPlaybackStalled: this.onPlaybackStalled,
935
+ onPlayerClose: this.onPlayerClose,
903
936
  onPlayerAttached: this.onPlayerAttached,
904
937
  onPlayerDetached: this.onPlayerDetached,
905
938
  };
@@ -958,6 +991,8 @@ export default class VideoPlayer extends React.Component<
958
991
  ? styles.playerContainerTransparent
959
992
  : styles.playerContainerBlack;
960
993
 
994
+ console.log("Anton Player render", {screenData, props: this.props, nativeProps});
995
+
961
996
  const isInline = () => {
962
997
  if (isTV()) {
963
998
  return inline;
@@ -1005,10 +1040,12 @@ export default class VideoPlayer extends React.Component<
1005
1040
  inline,
1006
1041
  docked,
1007
1042
  isModal,
1043
+ pip: this.state.piped,
1008
1044
  layoutState: {
1009
1045
  inline,
1010
1046
  docked,
1011
1047
  isModal,
1048
+ pip: this.state.piped,
1012
1049
  },
1013
1050
  configuration: this.getPluginConfiguration(),
1014
1051
  fullscreen: fullscreen,
@@ -1085,6 +1122,7 @@ export default class VideoPlayer extends React.Component<
1085
1122
  listener={this.props.listener}
1086
1123
  style={getStyle(playerDimensions)}
1087
1124
  pluginConfiguration={this.getPluginConfiguration()}
1125
+ controller={this.props.controller}
1088
1126
  >
1089
1127
  {this.childrenWithPlayNext()}
1090
1128
  </this.props.PlayerComponent>
@@ -1121,6 +1159,7 @@ export default class VideoPlayer extends React.Component<
1121
1159
  listener={this.props.listener}
1122
1160
  style={this.takeParentStyle}
1123
1161
  pluginConfiguration={this.getPluginConfiguration()}
1162
+ controller={this.props.controller}
1124
1163
  >
1125
1164
  {this.childrenWithPlayNext()}
1126
1165
  </this.props.PlayerComponent>
@@ -1,55 +1,13 @@
1
1
  import * as React from "react";
2
- import { isNotNil } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
2
+
3
3
  import { useOrientationEffect } from "@applicaster/zapp-react-native-utils/reactHooks/videoModal";
4
4
  import Player from "./Player";
5
5
  import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
6
6
  import { isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
7
7
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
8
- import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
9
- import { isEqual } from "@applicaster/zapp-react-native-utils/equalUtils";
10
- import { toNoopIfNil } from "@applicaster/zapp-react-native-utils/functionUtils";
11
8
 
12
9
  const CHROMECAST_IDENTIFIER = "quick-brick-chromecast-action";
13
10
 
14
- const MemoizedPlayer = React.memo(
15
- Player,
16
- isEqual({
17
- byValue: [
18
- "PlayerComponent",
19
- "autoplay",
20
- "controls",
21
- "disableCastAction",
22
- "docked",
23
- "focused",
24
- "fullscreen",
25
- "inline",
26
- "isModal",
27
- "isTabletPortrait",
28
- "muted",
29
- "playerId",
30
- "playerPluginIdentifier",
31
- "mode",
32
- "style",
33
- ],
34
- byReference: [
35
- "controller",
36
- "listener",
37
- "playNextData",
38
- "entry",
39
- "playableItem",
40
- "source",
41
- "playerEvent",
42
- "playerPluginManifest",
43
- "pluginConfiguration",
44
- "setNextVideoPreloadThresholdPercentage",
45
- "toggleFullscreen",
46
- "openPiP",
47
- "closePiP",
48
- "castAction",
49
- ],
50
- })
51
- );
52
-
53
11
  const QuickBrickPlayerComponent = (
54
12
  props: QuickBrickPlayer.PlayerProps,
55
13
  ref
@@ -67,7 +25,7 @@ const QuickBrickPlayerComponent = (
67
25
 
68
26
  const castAction = useActions(CHROMECAST_IDENTIFIER);
69
27
 
70
- const isModal = toBooleanWithDefaultFalse(props?.isModal);
28
+ const isModal = Boolean(props?.isModal);
71
29
  const isScreenDisabled = !controller?.isFullScreenSupported() || !isModal;
72
30
 
73
31
  const {
@@ -77,24 +35,16 @@ const QuickBrickPlayerComponent = (
77
35
  } = useNavigation();
78
36
 
79
37
  useOrientationEffect({
80
- isTabletPortrait: toBooleanWithDefaultFalse(props?.isTabletPortrait),
38
+ isTabletPortrait: props?.isTabletPortrait,
81
39
  docked: mode === "MINIMIZED",
82
- toggleFullscreen: toNoopIfNil(props?.toggleFullscreen),
40
+ toggleFullscreen: props?.toggleFullscreen,
83
41
  disable: isScreenDisabled,
84
42
  skipInitialOrientationEffects: mode === "FULLSCREEN",
85
- isRunningPlayNext: isNotNil(props?.playNextData),
43
+ isRunningPlayNext: !!props?.playNextData,
86
44
  });
87
45
 
88
- // console.log("debug_2", "QuickBrickPlayerComponent - render", {
89
- // mode,
90
- // props,
91
- // disableCastAction: props?.disableCastAction,
92
- // castAction,
93
- // PlayerComponent: props.PlayerComponent,
94
- // });
95
-
96
46
  return (
97
- <MemoizedPlayer
47
+ <Player
98
48
  {...props}
99
49
  ref={ref}
100
50
  castAction={!props?.disableCastAction && castAction}