@applicaster/quick-brick-player 16.0.0-rc.99 → 17.0.0-alpha.1102403272

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-rc.99",
3
+ "version": "17.0.0-alpha.1102403272",
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",
39
- "@applicaster/quick-brick-tv-transport-controls": "16.0.0-rc.69",
40
- "@applicaster/zapp-react-native-tvos-app": "16.0.0-rc.99",
41
- "@applicaster/zapp-react-native-ui-components": "16.0.0-rc.99",
42
- "@applicaster/zapp-react-native-utils": "16.0.0-rc.99",
38
+ "@applicaster/quick-brick-mobile-transport-controls": "16.0.0-rc.127",
39
+ "@applicaster/quick-brick-tv-transport-controls": "17.0.0-alpha.1102403272",
40
+ "@applicaster/zapp-react-native-tvos-app": "17.0.0-alpha.1102403272",
41
+ "@applicaster/zapp-react-native-ui-components": "17.0.0-alpha.1102403272",
42
+ "@applicaster/zapp-react-native-utils": "17.0.0-alpha.1102403272",
43
43
  "query-string": "7.1.3",
44
44
  "shaka-player": "4.3.5",
45
45
  "typeface-montserrat": "^0.0.54",
@@ -25,7 +25,7 @@ import {
25
25
  } from "./playerActions";
26
26
 
27
27
  const { log_debug } = createLogger({
28
- subsystem: "UIComponent",
28
+ subsystem: "player/audio",
29
29
  category: "AudioPlayerWrapper",
30
30
  });
31
31
 
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  controlsRowActionIdentifiers,
3
3
  nextTrackButton,
4
+ playbackButton,
4
5
  previousTrackButton,
5
6
  usesPlaylistControls,
6
7
  } from "../utils";
@@ -85,3 +86,50 @@ describe("track control buttons", () => {
85
86
  ).toMatchObject({ disabled: true });
86
87
  });
87
88
  });
89
+
90
+ describe("playbackButton icon state", () => {
91
+ const basePlayerState = {
92
+ currentTime: 10,
93
+ duration: 120,
94
+ seekableDuration: 120,
95
+ isLive: false,
96
+ isPaused: false,
97
+ isBuffering: false,
98
+ isReadyToPlay: true,
99
+ isAd: false,
100
+ };
101
+
102
+ it("shows pause icon while playing and play icon when paused by interruption", () => {
103
+ const playingButton = playbackButton({
104
+ playerState: { ...basePlayerState, isPaused: false },
105
+ liveButton: false,
106
+ isTablet: false,
107
+ isLiveShowFullControls: false,
108
+ onPress: jest.fn(),
109
+ });
110
+
111
+ expect(playingButton.icon).toBe("pause");
112
+
113
+ const pausedButton = playbackButton({
114
+ playerState: { ...basePlayerState, isPaused: true },
115
+ liveButton: false,
116
+ isTablet: false,
117
+ isLiveShowFullControls: false,
118
+ onPress: jest.fn(),
119
+ });
120
+
121
+ expect(pausedButton.icon).toBe("play");
122
+ });
123
+
124
+ it("shows buffering icon when buffering even if not paused", () => {
125
+ const bufferingButton = playbackButton({
126
+ playerState: { ...basePlayerState, isPaused: false, isBuffering: true },
127
+ liveButton: false,
128
+ isTablet: false,
129
+ isLiveShowFullControls: false,
130
+ onPress: jest.fn(),
131
+ });
132
+
133
+ expect(bufferingButton.icon).toBe("buffering");
134
+ });
135
+ });
@@ -0,0 +1,86 @@
1
+ jest.mock(
2
+ "@applicaster/zapp-react-native-utils/reactHooks/navigation/getTabBarHeight",
3
+ () => ({
4
+ getTabBarHeight: () => 56,
5
+ })
6
+ );
7
+
8
+ jest.mock(
9
+ "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation",
10
+ () => ({
11
+ useNavigation: () => ({}),
12
+ })
13
+ );
14
+
15
+ jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
16
+ useIsTablet: () => false,
17
+ useZStore: () => () => ({}),
18
+ }));
19
+
20
+ jest.mock("@applicaster/zapp-react-native-utils/appUtils", () => ({
21
+ playerManager: {
22
+ isCasting: () => false,
23
+ },
24
+ }));
25
+
26
+ jest.mock(
27
+ "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerState",
28
+ () => ({
29
+ usePlayerState: () => ({}),
30
+ })
31
+ );
32
+
33
+ jest.mock(
34
+ "@applicaster/zapp-react-native-ui-components/Components/VideoModal/utils",
35
+ () => ({
36
+ useConfiguration: () => ({}),
37
+ })
38
+ );
39
+
40
+ jest.mock(
41
+ "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/utils",
42
+ () => ({
43
+ PROGRESS_BAR_HEIGHT: 2,
44
+ })
45
+ );
46
+
47
+ jest.mock(
48
+ "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler",
49
+ () => ({
50
+ isBottomTabVisible: () => false,
51
+ })
52
+ );
53
+
54
+ jest.mock("@applicaster/zapp-react-native-redux", () => ({
55
+ usePlugins: () => [],
56
+ }));
57
+
58
+ jest.mock("@applicaster/quick-brick-mobile-transport-controls", () => ({
59
+ Button: () => null,
60
+ ContentInfo: () => null,
61
+ Controls: () => null,
62
+ ProgressBar: () => null,
63
+ }));
64
+
65
+ import { controlButtons } from "../index";
66
+
67
+ describe("DockedControls controlButtons icon state", () => {
68
+ it("shows pause_mini while playing and play_mini when paused", () => {
69
+ expect(controlButtons(false, false, false, "player-1")[0]).toMatchObject({
70
+ icon: "pause_mini",
71
+ name: "pause",
72
+ });
73
+
74
+ expect(controlButtons(false, true, false, "player-1")[0]).toMatchObject({
75
+ icon: "play_mini",
76
+ name: "play",
77
+ });
78
+ });
79
+
80
+ it("shows buffering when buffering", () => {
81
+ expect(controlButtons(false, false, true, "player-1")[0]).toMatchObject({
82
+ icon: "buffering",
83
+ name: "buffering",
84
+ });
85
+ });
86
+ });
@@ -92,7 +92,7 @@ const styles = StyleSheet.create({
92
92
  const getValue = (key: string, stylesObj: Record<string, any>) =>
93
93
  stylesObj?.[key] ?? null;
94
94
 
95
- const controlButtons = (
95
+ export const controlButtons = (
96
96
  live: boolean,
97
97
  paused: boolean,
98
98
  buffering: boolean,
@@ -5,7 +5,7 @@ import { loadFeedEntry } from "@applicaster/zapp-react-native-utils/appUtils/pla
5
5
  import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
6
6
 
7
7
  const { log_error, log_info } = createLogger({
8
- subsystem: "Player",
8
+ subsystem: "player/audio",
9
9
  category: "PlaylistNavigationController",
10
10
  });
11
11
 
@@ -5,7 +5,7 @@ import { Player } from "@applicaster/zapp-react-native-utils/appUtils/playerMana
5
5
  import { hasDatePassed, NAMESPACE } from "./utils";
6
6
 
7
7
  const { log_debug, log_error } = createLogger({
8
- subsystem: "Player",
8
+ subsystem: "player/audio",
9
9
  category: "SleepTimerManager",
10
10
  });
11
11
 
@@ -5,7 +5,7 @@ import { Player } from "@applicaster/zapp-react-native-utils/appUtils/playerMana
5
5
  import { NAMESPACE } from "./utils";
6
6
 
7
7
  const { log_debug } = createLogger({
8
- subsystem: "Player",
8
+ subsystem: "player/audio",
9
9
  category: "PlaybackSpeedManager",
10
10
  });
11
11
 
@@ -167,7 +167,7 @@ describe("playerActions", () => {
167
167
 
168
168
  expect(sheet.options.replace).toBe(true);
169
169
  expect(sheet.options.header.title).toBe("Playback Speed");
170
- expect(sheet.options.content.role).toBe("collection_selector");
170
+ expect(sheet.options.content.role).toBeUndefined();
171
171
  expect(sheet.options.content.behavior.currentSelection).toEqual(["1"]);
172
172
 
173
173
  expect(sheet.options.content.items.map((item) => item.title)).toEqual([
@@ -2,8 +2,12 @@ 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 { RemoteCommand } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/const";
5
6
 
6
- import { usePlaylistNavigation } from "../usePlaylistNavigation";
7
+ import {
8
+ getTransportControls,
9
+ usePlaylistNavigation,
10
+ } from "../usePlaylistNavigation";
7
11
 
8
12
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
9
13
  useNavigation: jest.fn(),
@@ -24,6 +28,13 @@ jest.mock(
24
28
  })
25
29
  );
26
30
 
31
+ jest.mock(
32
+ "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerNativeCommand",
33
+ () => ({
34
+ PlayerNativeCommandTypes: { setPlayerControls: "setPlayerControls" },
35
+ })
36
+ );
37
+
27
38
  const useNavigationMock = useNavigation as jest.Mock;
28
39
  const loadFeedEntryMock = loadFeedEntry as jest.Mock;
29
40
  const usePlayerMock = usePlayer as jest.Mock;
@@ -384,4 +395,145 @@ describe("usePlaylistNavigation", () => {
384
395
  expect(loadFeedEntryMock).not.toHaveBeenCalled();
385
396
  });
386
397
  });
398
+
399
+ describe("remote commands", () => {
400
+ let listeners: Record<string, QuickBrickPlayer.SharedPlayerCallBacks>;
401
+ const command = jest.fn();
402
+
403
+ const remote = (id: RemoteCommand) =>
404
+ act(async () => {
405
+ Object.values(listeners).forEach((l) => l.onRemoteCommand?.({ id }));
406
+ });
407
+
408
+ beforeEach(() => {
409
+ listeners = {};
410
+ command.mockClear();
411
+
412
+ usePlayerMock.mockReturnValue({
413
+ playerId: "player-1",
414
+ command,
415
+ seekTo,
416
+ addListener: ({ id, listener }) => {
417
+ listeners[id] = listener;
418
+
419
+ return () => delete listeners[id];
420
+ },
421
+ });
422
+ });
423
+
424
+ it("plays next when the lock screen / CarPlay next button is pressed", async () => {
425
+ const target = { id: "next" } as ZappEntry;
426
+ loadFeedEntryMock.mockResolvedValue(target);
427
+
428
+ await renderPlaylistNavigation(
429
+ entryWith({ play_next_feed_url: NEXT_URL }),
430
+ stateAt(0)
431
+ );
432
+
433
+ await remote(RemoteCommand.NextTrack);
434
+
435
+ expect(replaceTop).toHaveBeenCalledWith(target);
436
+ });
437
+
438
+ it("restarts the track on remote previous past the threshold", async () => {
439
+ await renderPlaylistNavigation(entryWith({}), stateAt(10));
440
+
441
+ await remote(RemoteCommand.PreviousTrack);
442
+
443
+ expect(seekTo).toHaveBeenCalledWith(0);
444
+ });
445
+
446
+ it("ignores commands native handles itself", async () => {
447
+ await renderPlaylistNavigation(
448
+ entryWith({ play_next_feed_url: NEXT_URL }),
449
+ stateAt(10)
450
+ );
451
+
452
+ await remote(RemoteCommand.Pause);
453
+
454
+ expect(replaceTop).not.toHaveBeenCalled();
455
+ expect(seekTo).not.toHaveBeenCalled();
456
+ });
457
+
458
+ it("sends native the controls snapshot to show", async () => {
459
+ await renderPlaylistNavigation(
460
+ entryWith({ play_next_feed_url: NEXT_URL }),
461
+ stateAt(0, NOT_SEEKABLE)
462
+ );
463
+
464
+ expect(command).toHaveBeenLastCalledWith("setPlayerControls", {
465
+ transport: [
466
+ RemoteCommand.Play,
467
+ RemoteCommand.Pause,
468
+ RemoteCommand.SkipBackward,
469
+ RemoteCommand.NextTrack,
470
+ ],
471
+ });
472
+ });
473
+
474
+ it("stops listening once unmounted", async () => {
475
+ const { unmount } = await renderPlaylistNavigation(
476
+ entryWith({ play_next_feed_url: NEXT_URL }),
477
+ stateAt(0)
478
+ );
479
+
480
+ unmount();
481
+
482
+ expect(listeners).toEqual({});
483
+ });
484
+ });
485
+ });
486
+
487
+ describe("getTransportControls", () => {
488
+ it("falls back to skip backward and leaves next out when there is no playlist", () => {
489
+ expect(
490
+ getTransportControls({
491
+ hasNext: false,
492
+ hasPrevious: false,
493
+ isLive: false,
494
+ })
495
+ ).toEqual([
496
+ RemoteCommand.Play,
497
+ RemoteCommand.Pause,
498
+ RemoteCommand.SkipBackward,
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,
509
+ ]);
510
+ });
511
+
512
+ it("puts track buttons in place of skip ones", () => {
513
+ expect(
514
+ getTransportControls({ hasNext: true, hasPrevious: true, isLive: false })
515
+ ).toEqual([
516
+ RemoteCommand.Play,
517
+ RemoteCommand.Pause,
518
+ RemoteCommand.PreviousTrack,
519
+ RemoteCommand.NextTrack,
520
+ ]);
521
+ });
522
+
523
+ it("uses stop and never skips on live", () => {
524
+ expect(
525
+ getTransportControls({ hasNext: false, hasPrevious: false, isLive: true })
526
+ ).toEqual([RemoteCommand.Play, RemoteCommand.Stop]);
527
+ });
528
+
529
+ it("keeps track buttons on live, e.g. a list of radio stations", () => {
530
+ expect(
531
+ getTransportControls({ hasNext: true, hasPrevious: true, isLive: true })
532
+ ).toEqual([
533
+ RemoteCommand.Play,
534
+ RemoteCommand.Stop,
535
+ RemoteCommand.PreviousTrack,
536
+ RemoteCommand.NextTrack,
537
+ ]);
538
+ });
387
539
  });
@@ -114,7 +114,6 @@ export async function openPlaybackSpeedAction(
114
114
  title: config.playback_speed_title || "Playback Speed",
115
115
  },
116
116
  content: {
117
- role: "collection_selector",
118
117
  behavior: {
119
118
  selectMode: "single",
120
119
  currentSelection: [String(current.value)],
@@ -154,7 +153,6 @@ export async function openSleepTimerAction(
154
153
  title: config.playback_sleep_title || "Sleep Timer",
155
154
  },
156
155
  content: {
157
- role: "collection_selector",
158
156
  behavior: {
159
157
  selectMode: "single",
160
158
  currentSelection: timerRemaining
@@ -2,8 +2,45 @@ 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 { PlayerNativeCommandTypes } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerNativeCommand";
6
+ import { RemoteCommand } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/const";
5
7
  import { PlaylistNavigationController } from "./PlaylistNavigationController";
6
8
 
9
+ const REMOTE_COMMANDS_LISTENER_ID = "playlist-navigation-remote-commands";
10
+
11
+ /**
12
+ * Buttons native should expose on the lock screen / Control Center / CarPlay.
13
+ * Native enables exactly these and disables the rest. A track button takes its
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.
16
+ */
17
+ export const getTransportControls = ({
18
+ hasNext,
19
+ hasPrevious,
20
+ isLive,
21
+ }: {
22
+ hasNext: boolean;
23
+ hasPrevious: boolean;
24
+ isLive: boolean;
25
+ }): RemoteCommand[] => {
26
+ const commands = [
27
+ RemoteCommand.Play,
28
+ isLive ? RemoteCommand.Stop : RemoteCommand.Pause,
29
+ ];
30
+
31
+ if (hasPrevious) {
32
+ commands.push(RemoteCommand.PreviousTrack);
33
+ } else if (!isLive) {
34
+ commands.push(RemoteCommand.SkipBackward);
35
+ }
36
+
37
+ if (hasNext) {
38
+ commands.push(RemoteCommand.NextTrack);
39
+ }
40
+
41
+ return commands;
42
+ };
43
+
7
44
  export type PlaylistNavigation = {
8
45
  hasNext: boolean;
9
46
  hasPrevious: boolean;
@@ -57,6 +94,41 @@ export const usePlaylistNavigation = (
57
94
  };
58
95
  }, [controller]);
59
96
 
97
+ // Lock screen / Control Center / CarPlay next & previous go through the same
98
+ // controller as the on-screen buttons, so JS stays the single source of truth.
99
+ React.useEffect(
100
+ () =>
101
+ player?.addListener?.({
102
+ id: REMOTE_COMMANDS_LISTENER_ID,
103
+ listener: {
104
+ onRemoteCommand: ({ id }) => {
105
+ if (id === RemoteCommand.NextTrack) {
106
+ controller.goNext();
107
+ } else if (id === RemoteCommand.PreviousTrack) {
108
+ controller.goPrevious();
109
+ }
110
+ },
111
+ },
112
+ }),
113
+ [player, controller]
114
+ );
115
+
116
+ const isLive = Boolean(playerState?.isLive);
117
+
118
+ // Full snapshot: native renders exactly this and drops the rest. Each key is
119
+ // one kind of buttons, so they stay separate lists rather than one flat list.
120
+ React.useEffect(() => {
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);
130
+ }, [player, hasNext, hasPrevious, isLive]);
131
+
60
132
  const goNext = React.useCallback(
61
133
  async () => controller.goNext(),
62
134
  [controller]
@@ -0,0 +1,35 @@
1
+ import { Platform } from "react-native";
2
+ import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
3
+
4
+ import * as mobileControls from "../mobileControls";
5
+ import * as webStandIns from "../mobileControls.web";
6
+
7
+ describe("mobile player controls in web builds", () => {
8
+ const originalOS = Platform.OS;
9
+
10
+ afterEach(() => {
11
+ Platform.OS = originalOS;
12
+ });
13
+
14
+ // The web stand-ins are safe only because Player renders `isTV() ? renderTV() : renderMobile()`.
15
+ it.each(["web", "samsung_tv", "lg_tv"])(
16
+ "%s always takes the TV render path",
17
+ (platform) => {
18
+ Platform.OS = platform as typeof Platform.OS;
19
+
20
+ expect(isTV()).toBe(true);
21
+ }
22
+ );
23
+
24
+ it("provides every control the mobile module exports", () => {
25
+ expect(Object.keys(webStandIns).sort()).toEqual(
26
+ Object.keys(mobileControls).sort()
27
+ );
28
+ });
29
+
30
+ it("renders nothing for each stand-in", () => {
31
+ Object.values(webStandIns).forEach((StandIn) => {
32
+ expect((StandIn as () => null)()).toBeNull();
33
+ });
34
+ });
35
+ });
@@ -5,11 +5,14 @@
5
5
  import React from "react";
6
6
  import * as R from "ramda";
7
7
 
8
- import { findNodeHandle, StyleSheet, View, ViewStyle } from "react-native";
8
+ import {
9
+ Dimensions,
10
+ findNodeHandle,
11
+ StyleSheet,
12
+ View,
13
+ ViewStyle,
14
+ } from "react-native";
9
15
 
10
- import TransportControlsMobile, {
11
- ErrorOverlay,
12
- } from "@applicaster/quick-brick-mobile-transport-controls";
13
16
  import TransportControlsTV, {
14
17
  ErrorOverlay as TVErrorOverlay,
15
18
  } from "@applicaster/quick-brick-tv-transport-controls";
@@ -27,6 +30,7 @@ import {
27
30
  PlayerDetails,
28
31
  PlayerWrapper,
29
32
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal";
33
+ import { getVerticalColumnWidth } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/playerWrapperUtils";
30
34
 
31
35
  import { PlayNextOverlay } from "./PlayNextOverlay";
32
36
  import { PlayerImageBackground } from "@applicaster/zapp-react-native-ui-components/Components/PlayerImageBackground";
@@ -47,10 +51,15 @@ import {
47
51
  isAudioItem as isAudioItemUtil,
48
52
  isInlineTV as isInlineTVUtil,
49
53
  } from "@applicaster/zapp-react-native-utils/playerUtils";
54
+ import { useIsTablet as getIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
50
55
 
51
56
  import { TVPlayerView } from "./PlayerView/TVPlayerView";
52
57
  import PlayerModal, { VideoPlayerModal } from "./PlayerModal";
53
- import { DockedControls } from "./AudioLayer/Layout/DockedControls";
58
+ import {
59
+ DockedControls,
60
+ ErrorOverlay,
61
+ TransportControlsMobile,
62
+ } from "./mobileControls";
54
63
  import { FlexImage } from "./AudioLayer/Layout/PlayerImage/FlexImage";
55
64
  import { PlayerError } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/const";
56
65
 
@@ -398,6 +407,22 @@ export default class VideoPlayer extends React.Component<
398
407
  RNPlayerManager?.[this.playerPluginId]?.stopBackgroundPlayback?.();
399
408
  };
400
409
 
410
+ command = (command: string, userInfo?: Record<string, any>) => {
411
+ if (
412
+ this.isReactNativeMethodsSupported() &&
413
+ RNPlayerManager?.[this.playerPluginId]?.command &&
414
+ this._root
415
+ ) {
416
+ const node = findNodeHandle(this._root);
417
+
418
+ if (!node) {
419
+ return;
420
+ }
421
+
422
+ RNPlayerManager?.[this.playerPluginId]?.command(node, command, userInfo);
423
+ }
424
+ };
425
+
401
426
  forward = (seekTime = SEEK_TIME) => {
402
427
  const currentTime = this.state.currentTime;
403
428
 
@@ -535,6 +560,10 @@ export default class VideoPlayer extends React.Component<
535
560
  return this.props?.listener?.onError(newError);
536
561
  };
537
562
 
563
+ onRemoteCommand = ({ nativeEvent = null }) => {
564
+ this.props?.listener?.onRemoteCommand?.(nativeEvent);
565
+ };
566
+
538
567
  onPlayerPause = ({ nativeEvent = null }) => {
539
568
  this.setState({ paused: true });
540
569
  this.props?.listener?.onPlayerPause(nativeEvent);
@@ -544,7 +573,7 @@ export default class VideoPlayer extends React.Component<
544
573
  const { isAd, resume } = this.state;
545
574
  const isNotAnAd = !isAd;
546
575
  this.setState({ paused: false });
547
- this.props?.listener?.onPlayerResume?.({ nativeEvent });
576
+ this.props?.listener?.onPlayerResume?.(nativeEvent);
548
577
 
549
578
  if (isNotAnAd && !resume) {
550
579
  this.setState({ resume: true });
@@ -1069,6 +1098,7 @@ export default class VideoPlayer extends React.Component<
1069
1098
  onPlayerResume: this.onPlayerResume,
1070
1099
  onPlayerSeekComplete: this.onPlayerSeekComplete,
1071
1100
  onPlayerSeekStart: this.onPlayerSeekStart,
1101
+ onRemoteCommand: this.onRemoteCommand,
1072
1102
  };
1073
1103
 
1074
1104
  const lifecycleEvents = {
@@ -1306,10 +1336,16 @@ export default class VideoPlayer extends React.Component<
1306
1336
  controlsAlwaysVisible={castAction?.state?.connected}
1307
1337
  playNextData={this.getPlayNextData()}
1308
1338
  needToShowDefaultControls={needToShowDefaultControls}
1339
+ vertical={this.isVerticalPlayer()}
1309
1340
  />
1310
1341
  ) : null;
1311
1342
  };
1312
1343
 
1344
+ // Single source for the vertical player flag: used by the player wrapper and the transport controls
1345
+ isVerticalPlayer = (): boolean => {
1346
+ return this.getPluginConfiguration()?.vertical_video_player || false;
1347
+ };
1348
+
1313
1349
  // Helper method for inline TV check
1314
1350
  isInlineTV = () => {
1315
1351
  const screenData = getTargetScreenDataFromEntry(this.props.playableItem);
@@ -1340,6 +1376,8 @@ export default class VideoPlayer extends React.Component<
1340
1376
  const isFullScreenAudioPlayer =
1341
1377
  pluginConfiguration?.full_screen_audio_player || false;
1342
1378
 
1379
+ const vertical = this.isVerticalPlayer();
1380
+
1343
1381
  const sharedWrapperViewProps = {
1344
1382
  style,
1345
1383
  entry,
@@ -1347,6 +1385,7 @@ export default class VideoPlayer extends React.Component<
1347
1385
  docked,
1348
1386
  isModal,
1349
1387
  pip: piped,
1388
+ vertical,
1350
1389
  layoutState: {
1351
1390
  inline,
1352
1391
  docked,
@@ -1360,8 +1399,31 @@ export default class VideoPlayer extends React.Component<
1360
1399
 
1361
1400
  const shouldRenderNativePlayer = !isCasting || this.supportNativeCast;
1362
1401
 
1363
- const aspectRatio =
1364
- !inline && isModal && !piped ? getScreenAspectRatio() : 16 / 9;
1402
+ const isVerticalInlineTabletLandscape =
1403
+ vertical &&
1404
+ inline &&
1405
+ isModal &&
1406
+ !piped &&
1407
+ getIsTablet() &&
1408
+ !isTabletPortrait;
1409
+
1410
+ // Vertical inline on a landscape tablet fills the column height. The
1411
+ // minimise animation and the docked slot both use this ratio, so it has to
1412
+ // describe that box, not 16:9, and both sides have to come from the same
1413
+ // window the layout measures -- getTabletWidth resolves percentages
1414
+ // against the device screen, which is wider than the app in split view.
1415
+ const verticalColumnWidth = isVerticalInlineTabletLandscape
1416
+ ? getVerticalColumnWidth(
1417
+ Dimensions.get("window").width,
1418
+ pluginConfiguration.tablet_landscape_sidebar_width
1419
+ )
1420
+ : undefined;
1421
+
1422
+ const aspectRatio = isVerticalInlineTabletLandscape
1423
+ ? verticalColumnWidth / Dimensions.get("window").height
1424
+ : !inline && isModal && !piped
1425
+ ? getScreenAspectRatio()
1426
+ : 16 / 9;
1365
1427
 
1366
1428
  const audioPlayerProps = {
1367
1429
  ref: this._assignRoot,
@@ -1402,10 +1464,14 @@ export default class VideoPlayer extends React.Component<
1402
1464
  fullscreen={fullscreen}
1403
1465
  modal
1404
1466
  style={{
1405
- tabletLandscapeWidth: getTabletWidth(
1406
- this.getPluginConfiguration().tablet_landscape_sidebar_width,
1407
- style
1408
- ),
1467
+ // The modal freezes this as the player width, so it has to be the
1468
+ // same column the aspect ratio above describes.
1469
+ tabletLandscapeWidth:
1470
+ verticalColumnWidth ??
1471
+ getTabletWidth(
1472
+ this.getPluginConfiguration().tablet_landscape_sidebar_width,
1473
+ style
1474
+ ),
1409
1475
  width: style.width,
1410
1476
  height: style.height,
1411
1477
  }}
@@ -0,0 +1,7 @@
1
+ // Controls only the mobile player renders (Player's renderMobile path). Web builds resolve mobileControls.web.ts.
2
+ export {
3
+ default as TransportControlsMobile,
4
+ ErrorOverlay,
5
+ } from "@applicaster/quick-brick-mobile-transport-controls";
6
+
7
+ export { DockedControls } from "./AudioLayer/Layout/DockedControls";
@@ -0,0 +1,10 @@
1
+ // Web builds always render the TV player: Player renders `isTV() ? renderTV() : renderMobile()`, and isTV() is true on
2
+ // every web platform. The mobile controls are never rendered there, so web bundles get empty stand-ins and leave the
3
+ // mobile transport controls package out.
4
+ const NotRenderedOnWeb = () => null;
5
+
6
+ export const TransportControlsMobile = NotRenderedOnWeb;
7
+
8
+ export const ErrorOverlay = NotRenderedOnWeb;
9
+
10
+ export const DockedControls = NotRenderedOnWeb;
package/src/logger.ts CHANGED
@@ -1,8 +1,6 @@
1
- import { getXray } from "@applicaster/zapp-react-native-utils/logger";
1
+ import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
2
2
 
3
- const { Logger } = getXray();
4
-
5
- export const Subsystem = "plugins/zapp-react-native-default-player";
3
+ export const Subsystem = "player";
6
4
 
7
5
  export const Categories = {
8
6
  PLAYER: "player",
@@ -19,7 +17,7 @@ export function createLogger({ category = "", subsystem }) {
19
17
  return null;
20
18
  }
21
19
 
22
- const logger = new Logger(category, Subsystem);
20
+ const logger = subsystemLogger(Subsystem, category);
23
21
  loggers[subsystem] = logger;
24
22
 
25
23
  return logger;