@applicaster/quick-brick-player 12.0.0-alpha.3551594096 → 12.0.0-alpha.3612044069

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.3551594096",
3
+ "version": "12.0.0-alpha.3612044069",
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.3551594096",
40
- "@applicaster/quick-brick-tv-transport-controls": "12.0.0-rc.89",
41
- "@applicaster/zapp-react-native-tvos-app": "12.0.0-alpha.3551594096",
42
- "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.3551594096",
43
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.3551594096",
39
+ "@applicaster/quick-brick-mobile-transport-controls": "12.0.0-alpha.3612044069",
40
+ "@applicaster/quick-brick-tv-transport-controls": "12.0.0-rc.100",
41
+ "@applicaster/zapp-react-native-tvos-app": "12.0.0-alpha.3612044069",
42
+ "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.3612044069",
43
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.3612044069",
44
44
  "keymirror": "^0.1.1",
45
45
  "query-string": "7.1.3",
46
46
  "react-native-web-linear-gradient": "1.1.2",
@@ -10,66 +10,76 @@ type Asset = string | undefined;
10
10
  const isCurrentPlayer = (playerId) =>
11
11
  LiveImageManager.instance.getCurrentlyPlaying()?.playerId === playerId;
12
12
 
13
+ const liveImageButtonsListenerKey = "live-image-buttons";
14
+
13
15
  const usePlayPauseListeners = (playerId, player, asset, setImageUri) =>
14
16
  useEffect(() => {
15
17
  if (playerId && player) {
16
- if (player.playerState.isReadyToPlay) {
17
- if (player.playerState.isPaused) {
18
- setImageUri(asset.active);
19
- } else {
20
- setImageUri(asset.inactive);
21
- }
18
+ setImageUri(null);
19
+
20
+ return;
21
+ }
22
+
23
+ if (player.playerState.isReadyToPlay) {
24
+ if (player.playerState.isPaused) {
25
+ setImageUri(asset.active);
26
+ } else {
27
+ setImageUri(asset.inactive);
22
28
  }
29
+ }
23
30
 
24
- return player.addListener({
25
- id: "live-image-buttons",
26
- listener: {
27
- onPlayerResume: () => {
28
- setImageUri(asset.inactive);
29
- },
30
- onPlayerPause: () => {
31
- setImageUri(asset.active);
32
- },
33
- onPlayerClose: () => {
34
- setImageUri(null);
35
- },
36
- onLoad() {
37
- setImageUri(asset.inactive);
38
- },
31
+ return player.addListener({
32
+ id: liveImageButtonsListenerKey,
33
+ listener: {
34
+ onPlayerResume: () => {
35
+ setImageUri(asset.inactive);
39
36
  },
40
- });
41
- }
37
+ onPlayerPause: () => {
38
+ setImageUri(asset.active);
39
+ },
40
+ onPlayerClose: () => {
41
+ setImageUri(null);
42
+ },
43
+ onLoad() {
44
+ setImageUri(asset.inactive);
45
+ },
46
+ },
47
+ });
42
48
  }, [player, playerId, asset]);
43
49
 
44
50
  const useMuteUnmuteListeners = (playerId, player, asset, setImageUri) =>
45
51
  useEffect(() => {
46
- if (playerId && player) {
47
- // active action = muted, inactive = unmuted
48
- return player.addListener({
49
- id: "live-image-buttons",
50
- listener: {
51
- onPlayerMute: () => {
52
- if (isCurrentPlayer(playerId)) {
53
- setImageUri(asset.active);
54
- }
55
- },
56
- onPlayerUnmute: () => {
57
- if (isCurrentPlayer(playerId)) {
58
- setImageUri(asset.inactive);
59
- }
60
- },
61
- onLoad() {
62
- setImageUri(player?.getIsMuted() ? asset.active : asset.inactive);
63
- },
64
- onPlayerClose: () => {
65
- setImageUri(null);
66
- },
67
- onVideoEnd: () => {
68
- setImageUri(null);
69
- },
70
- },
71
- });
52
+ if (!player || !playerId) {
53
+ setImageUri(null);
54
+
55
+ return;
72
56
  }
57
+
58
+ // active action = muted, inactive = unmuted
59
+ return player.addListener({
60
+ id: liveImageButtonsListenerKey,
61
+ listener: {
62
+ onPlayerMute: () => {
63
+ if (isCurrentPlayer(playerId)) {
64
+ setImageUri(asset.active);
65
+ }
66
+ },
67
+ onPlayerUnmute: () => {
68
+ if (isCurrentPlayer(playerId)) {
69
+ setImageUri(asset.inactive);
70
+ }
71
+ },
72
+ onLoad() {
73
+ setImageUri(player?.getIsMuted() ? asset.active : asset.inactive);
74
+ },
75
+ onPlayerClose: () => {
76
+ setImageUri(null);
77
+ },
78
+ onVideoEnd: () => {
79
+ setImageUri(null);
80
+ },
81
+ },
82
+ });
73
83
  }, [player, playerId, asset]);
74
84
 
75
85
  const useListeners = MUTED_USAGE
@@ -21,7 +21,7 @@ const playActionCallback = (player) => {
21
21
  }
22
22
  };
23
23
 
24
- const invokeAction = () => {
24
+ const invokeAction = (_item: ZappEntry, _object) => {
25
25
  const actionCallback = MUTED_USAGE ? muteActionCallback : playActionCallback;
26
26
  // We only allow one player to be present at a time
27
27
  const player = LiveImageManager.instance.getCurrentlyPlaying()?.player;
@@ -29,6 +29,54 @@ const invokeAction = () => {
29
29
  actionCallback(player);
30
30
  };
31
31
 
32
+ // Not exported because currently the is no way
33
+ // to subscribe to the action availability change.
34
+ // We currently return a null state to disable the action.
35
+ // eslint-disable-next-line unused-imports/no-unused-vars
36
+ const isActionAvailable = (item: ZappEntry) => {
37
+ return (
38
+ LiveImageManager.instance.getCurrentlyPlaying()?.getPlayer().entry.id ===
39
+ item.id
40
+ );
41
+ };
42
+
43
+ const addListener = (
44
+ entryId: string,
45
+ listener: CellActionStateListenerFunction
46
+ ) => {
47
+ const callback = (event: Record<string, any>) => {
48
+ if (event.entry?.id !== entryId) {
49
+ return;
50
+ }
51
+
52
+ const player = LiveImageManager.instance.getCurrentlyPlaying()?.getPlayer();
53
+
54
+ if (!player || player.entry?.id !== entryId) {
55
+ listener(null);
56
+
57
+ return;
58
+ }
59
+
60
+ const actionState = MUTED_USAGE ? player.getIsMuted() : player.isPaused();
61
+
62
+ listener({
63
+ state: actionState ? 1 : 0,
64
+ label: "",
65
+ asset: AssetComponent,
66
+ });
67
+ };
68
+
69
+ return LiveImageManager.instance.addListener({
70
+ id: `cell-player-${entryId}`,
71
+ listener: {
72
+ onEnd: callback,
73
+ onStart: callback,
74
+ onError: callback,
75
+ onDestroy: callback,
76
+ },
77
+ });
78
+ };
79
+
32
80
  const emptyState = [];
33
81
 
34
82
  const initialEntryState = () => ({
@@ -46,6 +94,7 @@ export function ContextProvider(Component: ReactComponent<any>) {
46
94
  state: emptyState,
47
95
  invokeAction,
48
96
  initialEntryState,
97
+ addListener,
49
98
  }),
50
99
  [invokeAction, initialEntryState]
51
100
  );
@@ -117,7 +117,6 @@ const playerDimensionsStyle = (
117
117
  });
118
118
 
119
119
  const animatedContainerStyle = (docked: boolean): ViewStyle => ({
120
- top: docked ? 2 : null,
121
120
  position: "absolute",
122
121
  width: "100%",
123
122
  zIndex: docked ? 1 : -1,
@@ -853,7 +853,7 @@ export default class VideoPlayer extends React.Component<
853
853
  !!this.props.controller?.supportsNativeControls?.();
854
854
 
855
855
  const controls = isAppleTV()
856
- ? supportsNativeControls && !isInlineTV && !this.getPlayNextData()
856
+ ? (supportsNativeControls && !isInlineTV) || !!this.getPlayNextData()
857
857
  : supportsNativeControls && !this.getPlayNextData();
858
858
 
859
859
  const shouldUseNativeControls =