@applicaster/quick-brick-player 16.0.0-alpha.1929433645 → 16.0.0-alpha.2105365027

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": "16.0.0-alpha.1929433645",
3
+ "version": "16.0.0-alpha.2105365027",
4
4
  "description": "Quick Brick Player",
5
5
  "main": "./src/index.ts",
6
6
  "types": "index.d.ts",
@@ -35,11 +35,11 @@
35
35
  },
36
36
  "homepage": "https://github.com/applicaster/quickbrick#readme",
37
37
  "dependencies": {
38
- "@applicaster/quick-brick-mobile-transport-controls": "16.0.0-rc.93",
38
+ "@applicaster/quick-brick-mobile-transport-controls": "16.0.0-rc.118",
39
39
  "@applicaster/quick-brick-tv-transport-controls": "16.0.0-rc.69",
40
- "@applicaster/zapp-react-native-tvos-app": "16.0.0-alpha.1929433645",
41
- "@applicaster/zapp-react-native-ui-components": "16.0.0-alpha.1929433645",
42
- "@applicaster/zapp-react-native-utils": "16.0.0-alpha.1929433645",
40
+ "@applicaster/zapp-react-native-tvos-app": "16.0.0-alpha.2105365027",
41
+ "@applicaster/zapp-react-native-ui-components": "16.0.0-alpha.2105365027",
42
+ "@applicaster/zapp-react-native-utils": "16.0.0-alpha.2105365027",
43
43
  "query-string": "7.1.3",
44
44
  "shaka-player": "4.3.5",
45
45
  "typeface-montserrat": "^0.0.54",
@@ -2,7 +2,6 @@ import { renderHook, act } from "@testing-library/react-native";
2
2
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
3
3
  import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
4
4
  import { loadFeedEntry } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/OverlayObserver/utils";
5
- import { PlayerNativeSendCommand } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerNativeCommand";
6
5
  import { RemoteCommand } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/const";
7
6
 
8
7
  import {
@@ -33,12 +32,10 @@ jest.mock(
33
32
  "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerNativeCommand",
34
33
  () => ({
35
34
  PlayerNativeCommandTypes: { setPlayerControls: "setPlayerControls" },
36
- PlayerNativeSendCommand: jest.fn(),
37
35
  })
38
36
  );
39
37
 
40
38
  const useNavigationMock = useNavigation as jest.Mock;
41
- const PlayerNativeSendCommandMock = PlayerNativeSendCommand as jest.Mock;
42
39
  const loadFeedEntryMock = loadFeedEntry as jest.Mock;
43
40
  const usePlayerMock = usePlayer as jest.Mock;
44
41
 
@@ -401,6 +398,7 @@ describe("usePlaylistNavigation", () => {
401
398
 
402
399
  describe("remote commands", () => {
403
400
  let listeners: Record<string, QuickBrickPlayer.SharedPlayerCallBacks>;
401
+ const command = jest.fn();
404
402
 
405
403
  const remote = (id: RemoteCommand) =>
406
404
  act(async () => {
@@ -409,10 +407,11 @@ describe("usePlaylistNavigation", () => {
409
407
 
410
408
  beforeEach(() => {
411
409
  listeners = {};
412
- PlayerNativeSendCommandMock.mockClear();
410
+ command.mockClear();
413
411
 
414
412
  usePlayerMock.mockReturnValue({
415
413
  playerId: "player-1",
414
+ command,
416
415
  seekTo,
417
416
  addListener: ({ id, listener }) => {
418
417
  listeners[id] = listener;
@@ -462,18 +461,14 @@ describe("usePlaylistNavigation", () => {
462
461
  stateAt(0, NOT_SEEKABLE)
463
462
  );
464
463
 
465
- expect(PlayerNativeSendCommandMock).toHaveBeenLastCalledWith(
466
- "setPlayerControls",
467
- "player-1",
468
- {
469
- transport: [
470
- RemoteCommand.Play,
471
- RemoteCommand.Pause,
472
- RemoteCommand.SkipBackward,
473
- RemoteCommand.NextTrack,
474
- ],
475
- }
476
- );
464
+ expect(command).toHaveBeenLastCalledWith("setPlayerControls", {
465
+ transport: [
466
+ RemoteCommand.Play,
467
+ RemoteCommand.Pause,
468
+ RemoteCommand.SkipBackward,
469
+ RemoteCommand.NextTrack,
470
+ ],
471
+ });
477
472
  });
478
473
 
479
474
  it("stops listening once unmounted", async () => {
@@ -490,7 +485,7 @@ describe("usePlaylistNavigation", () => {
490
485
  });
491
486
 
492
487
  describe("getTransportControls", () => {
493
- it("falls back to skip buttons when there is no playlist", () => {
488
+ it("falls back to skip backward and leaves next out when there is no playlist", () => {
494
489
  expect(
495
490
  getTransportControls({
496
491
  hasNext: false,
@@ -501,7 +496,16 @@ describe("getTransportControls", () => {
501
496
  RemoteCommand.Play,
502
497
  RemoteCommand.Pause,
503
498
  RemoteCommand.SkipBackward,
504
- RemoteCommand.SkipForward,
499
+ ]);
500
+ });
501
+
502
+ it("leaves next out without a next item, so it shows disabled", () => {
503
+ expect(
504
+ getTransportControls({ hasNext: false, hasPrevious: true, isLive: false })
505
+ ).toEqual([
506
+ RemoteCommand.Play,
507
+ RemoteCommand.Pause,
508
+ RemoteCommand.PreviousTrack,
505
509
  ]);
506
510
  });
507
511
 
@@ -2,10 +2,7 @@ import * as React from "react";
2
2
 
3
3
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
4
4
  import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
5
- import {
6
- PlayerNativeCommandTypes,
7
- PlayerNativeSendCommand,
8
- } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerNativeCommand";
5
+ import { PlayerNativeCommandTypes } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerNativeCommand";
9
6
  import { RemoteCommand } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/const";
10
7
  import { PlaylistNavigationController } from "./PlaylistNavigationController";
11
8
 
@@ -15,6 +12,7 @@ const REMOTE_COMMANDS_LISTENER_ID = "playlist-navigation-remote-commands";
15
12
  * Buttons native should expose on the lock screen / Control Center / CarPlay.
16
13
  * Native enables exactly these and disables the rest. A track button takes its
17
14
  * slot over the skip one, since the system shows only one of them per side.
15
+ * Without a next item next is left out, so the system shows it disabled.
18
16
  */
19
17
  export const getTransportControls = ({
20
18
  hasNext,
@@ -38,8 +36,6 @@ export const getTransportControls = ({
38
36
 
39
37
  if (hasNext) {
40
38
  commands.push(RemoteCommand.NextTrack);
41
- } else if (!isLive) {
42
- commands.push(RemoteCommand.SkipForward);
43
39
  }
44
40
 
45
41
  return commands;
@@ -122,17 +118,15 @@ export const usePlaylistNavigation = (
122
118
  // Full snapshot: native renders exactly this and drops the rest. Each key is
123
119
  // one kind of buttons, so they stay separate lists rather than one flat list.
124
120
  React.useEffect(() => {
125
- PlayerNativeSendCommand(
126
- PlayerNativeCommandTypes.setPlayerControls,
127
- player?.playerId,
128
- {
129
- transport: getTransportControls({ hasNext, hasPrevious, isLive }),
130
- // TODO: other button kinds go in as their own keys next to `transport`,
131
- // e.g. custom / native-drawn buttons ("play next", CarPlay / Android Auto
132
- // row buttons). Add a composer on Player once more than this hook fills it.
133
- // actions: [],
134
- }
135
- );
121
+ const controls = {
122
+ transport: getTransportControls({ hasNext, hasPrevious, isLive }),
123
+ // TODO: other button kinds go in as their own keys next to `transport`,
124
+ // e.g. custom / native-drawn buttons ("play next", CarPlay / Android Auto
125
+ // row buttons). Add a composer on Player once more than this hook fills it.
126
+ // actions: [],
127
+ };
128
+
129
+ player?.command?.(PlayerNativeCommandTypes.setPlayerControls, controls);
136
130
  }, [player, hasNext, hasPrevious, isLive]);
137
131
 
138
132
  const goNext = React.useCallback(
@@ -398,6 +398,22 @@ export default class VideoPlayer extends React.Component<
398
398
  RNPlayerManager?.[this.playerPluginId]?.stopBackgroundPlayback?.();
399
399
  };
400
400
 
401
+ command = (command: string, userInfo?: Record<string, any>) => {
402
+ if (
403
+ this.isReactNativeMethodsSupported() &&
404
+ RNPlayerManager?.[this.playerPluginId]?.command &&
405
+ this._root
406
+ ) {
407
+ const node = findNodeHandle(this._root);
408
+
409
+ if (!node) {
410
+ return;
411
+ }
412
+
413
+ RNPlayerManager?.[this.playerPluginId]?.command(node, command, userInfo);
414
+ }
415
+ };
416
+
401
417
  forward = (seekTime = SEEK_TIME) => {
402
418
  const currentTime = this.state.currentTime;
403
419
 
@@ -1311,10 +1327,16 @@ export default class VideoPlayer extends React.Component<
1311
1327
  controlsAlwaysVisible={castAction?.state?.connected}
1312
1328
  playNextData={this.getPlayNextData()}
1313
1329
  needToShowDefaultControls={needToShowDefaultControls}
1330
+ vertical={this.isVerticalPlayer()}
1314
1331
  />
1315
1332
  ) : null;
1316
1333
  };
1317
1334
 
1335
+ // Single source for the vertical player flag: used by the player wrapper and the transport controls
1336
+ isVerticalPlayer = (): boolean => {
1337
+ return this.getPluginConfiguration()?.vertical_video_player || false;
1338
+ };
1339
+
1318
1340
  // Helper method for inline TV check
1319
1341
  isInlineTV = () => {
1320
1342
  const screenData = getTargetScreenDataFromEntry(this.props.playableItem);
@@ -1345,6 +1367,8 @@ export default class VideoPlayer extends React.Component<
1345
1367
  const isFullScreenAudioPlayer =
1346
1368
  pluginConfiguration?.full_screen_audio_player || false;
1347
1369
 
1370
+ const vertical = this.isVerticalPlayer();
1371
+
1348
1372
  const sharedWrapperViewProps = {
1349
1373
  style,
1350
1374
  entry,
@@ -1352,6 +1376,7 @@ export default class VideoPlayer extends React.Component<
1352
1376
  docked,
1353
1377
  isModal,
1354
1378
  pip: piped,
1379
+ vertical,
1355
1380
  layoutState: {
1356
1381
  inline,
1357
1382
  docked,