@applicaster/quick-brick-player 17.0.0-alpha.1037440043 → 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 +5 -5
- package/src/Player/AudioLayer/Layout/Controls/__tests__/utils.test.ts +48 -0
- package/src/Player/AudioLayer/Layout/DockedControls/__tests__/controlButtons.test.ts +86 -0
- package/src/Player/AudioLayer/Layout/DockedControls/index.tsx +1 -1
- package/src/Player/AudioLayer/__tests__/playerActions.test.ts +1 -1
- package/src/Player/AudioLayer/playerActions.ts +0 -2
- package/src/Player/__tests__/mobileControls.test.ts +35 -0
- package/src/Player/index.tsx +47 -11
- package/src/Player/mobileControls.ts +7 -0
- package/src/Player/mobileControls.web.ts +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-player",
|
|
3
|
-
"version": "17.0.0-alpha.
|
|
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",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@applicaster/quick-brick-mobile-transport-controls": "16.0.0-rc.127",
|
|
39
|
-
"@applicaster/quick-brick-tv-transport-controls": "
|
|
40
|
-
"@applicaster/zapp-react-native-tvos-app": "17.0.0-alpha.
|
|
41
|
-
"@applicaster/zapp-react-native-ui-components": "17.0.0-alpha.
|
|
42
|
-
"@applicaster/zapp-react-native-utils": "17.0.0-alpha.
|
|
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",
|
|
@@ -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
|
+
});
|
|
@@ -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).
|
|
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([
|
|
@@ -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
|
|
@@ -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";
|
|
@@ -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 {
|
|
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
|
|
|
@@ -1390,8 +1399,31 @@ export default class VideoPlayer extends React.Component<
|
|
|
1390
1399
|
|
|
1391
1400
|
const shouldRenderNativePlayer = !isCasting || this.supportNativeCast;
|
|
1392
1401
|
|
|
1393
|
-
const
|
|
1394
|
-
|
|
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;
|
|
1395
1427
|
|
|
1396
1428
|
const audioPlayerProps = {
|
|
1397
1429
|
ref: this._assignRoot,
|
|
@@ -1432,10 +1464,14 @@ export default class VideoPlayer extends React.Component<
|
|
|
1432
1464
|
fullscreen={fullscreen}
|
|
1433
1465
|
modal
|
|
1434
1466
|
style={{
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
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
|
+
),
|
|
1439
1475
|
width: style.width,
|
|
1440
1476
|
height: style.height,
|
|
1441
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;
|