@applicaster/quick-brick-player 16.0.0-rc.99 → 17.0.0-alpha.1201533844
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 +6 -6
- package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +1 -1
- package/src/Player/AudioLayer/PlaylistNavigationController.ts +1 -1
- package/src/Player/AudioLayer/SleepTimerManager.ts +1 -1
- package/src/Player/AudioLayer/SpeedManager.ts +1 -1
- package/src/Player/AudioLayer/__tests__/usePlaylistNavigation.test.ts +153 -1
- package/src/Player/AudioLayer/usePlaylistNavigation.ts +72 -0
- package/src/Player/__tests__/mobileControls.test.ts +35 -0
- package/src/Player/index.tsx +63 -8
- package/src/Player/mobileControls.ts +7 -0
- package/src/Player/mobileControls.web.ts +10 -0
- package/src/logger.ts +3 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-player",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0-alpha.1201533844",
|
|
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.
|
|
39
|
-
"@applicaster/quick-brick-tv-transport-controls": "16.0.0-rc.
|
|
40
|
-
"@applicaster/zapp-react-native-tvos-app": "
|
|
41
|
-
"@applicaster/zapp-react-native-ui-components": "
|
|
42
|
-
"@applicaster/zapp-react-native-utils": "
|
|
38
|
+
"@applicaster/quick-brick-mobile-transport-controls": "16.0.0-rc.127",
|
|
39
|
+
"@applicaster/quick-brick-tv-transport-controls": "16.0.0-rc.127",
|
|
40
|
+
"@applicaster/zapp-react-native-tvos-app": "17.0.0-alpha.1201533844",
|
|
41
|
+
"@applicaster/zapp-react-native-ui-components": "17.0.0-alpha.1201533844",
|
|
42
|
+
"@applicaster/zapp-react-native-utils": "17.0.0-alpha.1201533844",
|
|
43
43
|
"query-string": "7.1.3",
|
|
44
44
|
"shaka-player": "4.3.5",
|
|
45
45
|
"typeface-montserrat": "^0.0.54",
|
|
@@ -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: "
|
|
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: "
|
|
8
|
+
subsystem: "player/audio",
|
|
9
9
|
category: "SleepTimerManager",
|
|
10
10
|
});
|
|
11
11
|
|
|
@@ -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 {
|
|
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
|
});
|
|
@@ -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
|
+
});
|
package/src/Player/index.tsx
CHANGED
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
import React from "react";
|
|
6
6
|
import * as R from "ramda";
|
|
7
7
|
|
|
8
|
-
import {
|
|
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";
|
|
@@ -47,10 +50,15 @@ import {
|
|
|
47
50
|
isAudioItem as isAudioItemUtil,
|
|
48
51
|
isInlineTV as isInlineTVUtil,
|
|
49
52
|
} from "@applicaster/zapp-react-native-utils/playerUtils";
|
|
53
|
+
import { useIsTablet as getIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
50
54
|
|
|
51
55
|
import { TVPlayerView } from "./PlayerView/TVPlayerView";
|
|
52
56
|
import PlayerModal, { VideoPlayerModal } from "./PlayerModal";
|
|
53
|
-
import {
|
|
57
|
+
import {
|
|
58
|
+
DockedControls,
|
|
59
|
+
ErrorOverlay,
|
|
60
|
+
TransportControlsMobile,
|
|
61
|
+
} from "./mobileControls";
|
|
54
62
|
import { FlexImage } from "./AudioLayer/Layout/PlayerImage/FlexImage";
|
|
55
63
|
import { PlayerError } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/const";
|
|
56
64
|
|
|
@@ -398,6 +406,22 @@ export default class VideoPlayer extends React.Component<
|
|
|
398
406
|
RNPlayerManager?.[this.playerPluginId]?.stopBackgroundPlayback?.();
|
|
399
407
|
};
|
|
400
408
|
|
|
409
|
+
command = (command: string, userInfo?: Record<string, any>) => {
|
|
410
|
+
if (
|
|
411
|
+
this.isReactNativeMethodsSupported() &&
|
|
412
|
+
RNPlayerManager?.[this.playerPluginId]?.command &&
|
|
413
|
+
this._root
|
|
414
|
+
) {
|
|
415
|
+
const node = findNodeHandle(this._root);
|
|
416
|
+
|
|
417
|
+
if (!node) {
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
RNPlayerManager?.[this.playerPluginId]?.command(node, command, userInfo);
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
|
|
401
425
|
forward = (seekTime = SEEK_TIME) => {
|
|
402
426
|
const currentTime = this.state.currentTime;
|
|
403
427
|
|
|
@@ -535,6 +559,10 @@ export default class VideoPlayer extends React.Component<
|
|
|
535
559
|
return this.props?.listener?.onError(newError);
|
|
536
560
|
};
|
|
537
561
|
|
|
562
|
+
onRemoteCommand = ({ nativeEvent = null }) => {
|
|
563
|
+
this.props?.listener?.onRemoteCommand?.(nativeEvent);
|
|
564
|
+
};
|
|
565
|
+
|
|
538
566
|
onPlayerPause = ({ nativeEvent = null }) => {
|
|
539
567
|
this.setState({ paused: true });
|
|
540
568
|
this.props?.listener?.onPlayerPause(nativeEvent);
|
|
@@ -544,7 +572,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
544
572
|
const { isAd, resume } = this.state;
|
|
545
573
|
const isNotAnAd = !isAd;
|
|
546
574
|
this.setState({ paused: false });
|
|
547
|
-
this.props?.listener?.onPlayerResume?.(
|
|
575
|
+
this.props?.listener?.onPlayerResume?.(nativeEvent);
|
|
548
576
|
|
|
549
577
|
if (isNotAnAd && !resume) {
|
|
550
578
|
this.setState({ resume: true });
|
|
@@ -1069,6 +1097,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
1069
1097
|
onPlayerResume: this.onPlayerResume,
|
|
1070
1098
|
onPlayerSeekComplete: this.onPlayerSeekComplete,
|
|
1071
1099
|
onPlayerSeekStart: this.onPlayerSeekStart,
|
|
1100
|
+
onRemoteCommand: this.onRemoteCommand,
|
|
1072
1101
|
};
|
|
1073
1102
|
|
|
1074
1103
|
const lifecycleEvents = {
|
|
@@ -1306,10 +1335,16 @@ export default class VideoPlayer extends React.Component<
|
|
|
1306
1335
|
controlsAlwaysVisible={castAction?.state?.connected}
|
|
1307
1336
|
playNextData={this.getPlayNextData()}
|
|
1308
1337
|
needToShowDefaultControls={needToShowDefaultControls}
|
|
1338
|
+
vertical={this.isVerticalPlayer()}
|
|
1309
1339
|
/>
|
|
1310
1340
|
) : null;
|
|
1311
1341
|
};
|
|
1312
1342
|
|
|
1343
|
+
// Single source for the vertical player flag: used by the player wrapper and the transport controls
|
|
1344
|
+
isVerticalPlayer = (): boolean => {
|
|
1345
|
+
return this.getPluginConfiguration()?.vertical_video_player || false;
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1313
1348
|
// Helper method for inline TV check
|
|
1314
1349
|
isInlineTV = () => {
|
|
1315
1350
|
const screenData = getTargetScreenDataFromEntry(this.props.playableItem);
|
|
@@ -1340,6 +1375,8 @@ export default class VideoPlayer extends React.Component<
|
|
|
1340
1375
|
const isFullScreenAudioPlayer =
|
|
1341
1376
|
pluginConfiguration?.full_screen_audio_player || false;
|
|
1342
1377
|
|
|
1378
|
+
const vertical = this.isVerticalPlayer();
|
|
1379
|
+
|
|
1343
1380
|
const sharedWrapperViewProps = {
|
|
1344
1381
|
style,
|
|
1345
1382
|
entry,
|
|
@@ -1347,6 +1384,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
1347
1384
|
docked,
|
|
1348
1385
|
isModal,
|
|
1349
1386
|
pip: piped,
|
|
1387
|
+
vertical,
|
|
1350
1388
|
layoutState: {
|
|
1351
1389
|
inline,
|
|
1352
1390
|
docked,
|
|
@@ -1360,8 +1398,25 @@ export default class VideoPlayer extends React.Component<
|
|
|
1360
1398
|
|
|
1361
1399
|
const shouldRenderNativePlayer = !isCasting || this.supportNativeCast;
|
|
1362
1400
|
|
|
1363
|
-
|
|
1364
|
-
|
|
1401
|
+
// Vertical inline on a landscape tablet fills the column height. The
|
|
1402
|
+
// minimise animation and the docked slot both use this ratio, so it has
|
|
1403
|
+
// to describe that box (column width / screen height), not 16:9.
|
|
1404
|
+
const isVerticalInlineTabletLandscape =
|
|
1405
|
+
vertical &&
|
|
1406
|
+
inline &&
|
|
1407
|
+
isModal &&
|
|
1408
|
+
!piped &&
|
|
1409
|
+
getIsTablet() &&
|
|
1410
|
+
!isTabletPortrait;
|
|
1411
|
+
|
|
1412
|
+
const aspectRatio = isVerticalInlineTabletLandscape
|
|
1413
|
+
? getTabletWidth(
|
|
1414
|
+
pluginConfiguration.tablet_landscape_sidebar_width,
|
|
1415
|
+
style
|
|
1416
|
+
) / Dimensions.get("window").height
|
|
1417
|
+
: !inline && isModal && !piped
|
|
1418
|
+
? getScreenAspectRatio()
|
|
1419
|
+
: 16 / 9;
|
|
1365
1420
|
|
|
1366
1421
|
const audioPlayerProps = {
|
|
1367
1422
|
ref: this._assignRoot,
|
|
@@ -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 {
|
|
1
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
2
2
|
|
|
3
|
-
const
|
|
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 =
|
|
20
|
+
const logger = subsystemLogger(Subsystem, category);
|
|
23
21
|
loggers[subsystem] = logger;
|
|
24
22
|
|
|
25
23
|
return logger;
|