@applicaster/quick-brick-player 17.0.0-alpha.1201533844 → 17.0.0-alpha.3111286799
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/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 +74 -42
- package/src/Player/AudioLayer/playerActions.ts +54 -70
- package/src/Player/Utils/index.tsx +14 -8
- package/src/Player/index.tsx +22 -11
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.3111286799",
|
|
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": "
|
|
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.
|
|
38
|
+
"@applicaster/quick-brick-mobile-transport-controls": "17.0.0-rc.5",
|
|
39
|
+
"@applicaster/quick-brick-tv-transport-controls": "17.0.0-rc.5",
|
|
40
|
+
"@applicaster/zapp-react-native-tvos-app": "17.0.0-alpha.3111286799",
|
|
41
|
+
"@applicaster/zapp-react-native-ui-components": "17.0.0-alpha.3111286799",
|
|
42
|
+
"@applicaster/zapp-react-native-utils": "17.0.0-alpha.3111286799",
|
|
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
|
+
});
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
} from "@applicaster/zapp-react-native-utils/actionsExecutor/ActionExecutor";
|
|
6
6
|
import { uiActionsRegistry } from "@applicaster/zapp-react-native-utils/uiActionsRegistrator";
|
|
7
7
|
import { modalOrchestrator } from "@applicaster/zapp-react-native-utils/modalState/ModalOrchestrator";
|
|
8
|
+
import { openBottomSheetModal } from "@applicaster/zapp-react-native-utils/modalState/store";
|
|
8
9
|
import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
|
|
9
10
|
import { firstValueFrom } from "rxjs";
|
|
10
11
|
|
|
@@ -15,6 +16,13 @@ import {
|
|
|
15
16
|
} from "../playerActions";
|
|
16
17
|
import { SpeedController } from "../SpeedManager";
|
|
17
18
|
import { SleepTimerController } from "../SleepTimerManager";
|
|
19
|
+
import {
|
|
20
|
+
getBottomSheetModalDefaultItemIcon,
|
|
21
|
+
getBottomSheetModalIconProps,
|
|
22
|
+
getBottomSheetModalItemProps,
|
|
23
|
+
getBottomSheetModalLabelProps,
|
|
24
|
+
getBottomSheetModalSelectedItemIcon,
|
|
25
|
+
} from "../../Utils";
|
|
18
26
|
|
|
19
27
|
jest.mock("../../Const/sleepTimerOptions", () => ({
|
|
20
28
|
getSleepTimerOptions: (offLabel: string, sleepTimerValue: number | null) => [
|
|
@@ -40,6 +48,10 @@ jest.mock(
|
|
|
40
48
|
})
|
|
41
49
|
);
|
|
42
50
|
|
|
51
|
+
jest.mock("@applicaster/zapp-react-native-utils/modalState/store", () => ({
|
|
52
|
+
openBottomSheetModal: jest.fn(),
|
|
53
|
+
}));
|
|
54
|
+
|
|
43
55
|
jest.mock(
|
|
44
56
|
"@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage",
|
|
45
57
|
() => ({
|
|
@@ -52,8 +64,6 @@ jest.mock(
|
|
|
52
64
|
);
|
|
53
65
|
|
|
54
66
|
describe("playerActions", () => {
|
|
55
|
-
const openedSheets: ActionType[] = [];
|
|
56
|
-
|
|
57
67
|
let player: {
|
|
58
68
|
getConfig: () => Record<string, string>;
|
|
59
69
|
setPlaybackRate: jest.Mock;
|
|
@@ -66,7 +76,6 @@ describe("playerActions", () => {
|
|
|
66
76
|
let unregisterPlayerActions: () => void;
|
|
67
77
|
|
|
68
78
|
beforeEach(() => {
|
|
69
|
-
openedSheets.length = 0;
|
|
70
79
|
jest.clearAllMocks();
|
|
71
80
|
(localStorage.setItem as jest.Mock).mockResolvedValue(undefined);
|
|
72
81
|
(localStorage.removeItem as jest.Mock).mockResolvedValue(undefined);
|
|
@@ -91,19 +100,12 @@ describe("playerActions", () => {
|
|
|
91
100
|
sleepController = new SleepTimerController(player as any);
|
|
92
101
|
|
|
93
102
|
[
|
|
94
|
-
"openBottomSheet",
|
|
95
103
|
PLAYER_ACTION_TYPES.OPEN_PLAYBACK_SPEED,
|
|
96
104
|
PLAYER_ACTION_TYPES.OPEN_SLEEP_TIMER,
|
|
97
105
|
PLAYER_ACTION_TYPES.SET_PLAYBACK_SPEED,
|
|
98
106
|
PLAYER_ACTION_TYPES.SET_SLEEP_TIMER,
|
|
99
107
|
].forEach((type) => actionExecutor.unregisterAction(type));
|
|
100
108
|
|
|
101
|
-
actionExecutor.registerAction("openBottomSheet", async (action) => {
|
|
102
|
-
openedSheets.push(action);
|
|
103
|
-
|
|
104
|
-
return ActionResult.Success;
|
|
105
|
-
});
|
|
106
|
-
|
|
107
109
|
unregisterPlayerActions = registerPlayerActions({
|
|
108
110
|
speedController,
|
|
109
111
|
sleepController,
|
|
@@ -151,7 +153,7 @@ describe("playerActions", () => {
|
|
|
151
153
|
expect(player.setPlaybackRate).not.toHaveBeenCalled();
|
|
152
154
|
});
|
|
153
155
|
|
|
154
|
-
it("opens playback speed
|
|
156
|
+
it("opens playback speed with audio player theme styles and current speed selected", async () => {
|
|
155
157
|
await speedController.setPlaybackSpeed({
|
|
156
158
|
asset: "speed_1",
|
|
157
159
|
value: 1,
|
|
@@ -162,29 +164,44 @@ describe("playerActions", () => {
|
|
|
162
164
|
});
|
|
163
165
|
|
|
164
166
|
expect(result).toBe(ActionResult.Success);
|
|
167
|
+
expect(openBottomSheetModal).toHaveBeenCalledTimes(1);
|
|
168
|
+
|
|
169
|
+
const { modalBottomSheetContentProps: sheetProps } = (
|
|
170
|
+
openBottomSheetModal as jest.Mock
|
|
171
|
+
).mock.calls[0][0];
|
|
172
|
+
|
|
173
|
+
expect(sheetProps).toMatchObject({
|
|
174
|
+
key: PLAYER_ACTION_IDENTIFIERS.PLAYBACK_SPEED,
|
|
175
|
+
title: "Playback Speed",
|
|
176
|
+
current_selection: expect.objectContaining({ value: 1 }),
|
|
177
|
+
itemProps: getBottomSheetModalItemProps,
|
|
178
|
+
iconProps: getBottomSheetModalIconProps,
|
|
179
|
+
labelProps: getBottomSheetModalLabelProps,
|
|
180
|
+
getSelectedItemIcon: getBottomSheetModalSelectedItemIcon,
|
|
181
|
+
getDefaultItemIcon: getBottomSheetModalDefaultItemIcon,
|
|
182
|
+
iconPlacement: "right",
|
|
183
|
+
});
|
|
165
184
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
"
|
|
175
|
-
"
|
|
176
|
-
"1.
|
|
177
|
-
"
|
|
178
|
-
"2x",
|
|
185
|
+
expect(
|
|
186
|
+
sheetProps.items.map((item) => ({
|
|
187
|
+
id: item.id,
|
|
188
|
+
label: item.label,
|
|
189
|
+
value: item.value,
|
|
190
|
+
}))
|
|
191
|
+
).toEqual([
|
|
192
|
+
{ id: "0.8", label: "0.8x", value: 0.8 },
|
|
193
|
+
{ id: "1", label: "1x", value: 1 },
|
|
194
|
+
{ id: "1.2", label: "1.2x", value: 1.2 },
|
|
195
|
+
{ id: "1.5", label: "1.5x", value: 1.5 },
|
|
196
|
+
{ id: "2", label: "2x", value: 2 },
|
|
179
197
|
]);
|
|
180
198
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
).toBe(true);
|
|
199
|
+
await sheetProps.onPress(sheetProps.items[3]);
|
|
200
|
+
|
|
201
|
+
expect(player.setPlaybackRate).toHaveBeenCalledWith(1.5);
|
|
185
202
|
});
|
|
186
203
|
|
|
187
|
-
it("opens sleep timer with
|
|
204
|
+
it("opens sleep timer with audio player theme styles and active timer selected", async () => {
|
|
188
205
|
const timerDate = Date.now() + 15 * 60 * 1000;
|
|
189
206
|
|
|
190
207
|
await sleepController.setSleepTimer(
|
|
@@ -197,17 +214,27 @@ describe("playerActions", () => {
|
|
|
197
214
|
});
|
|
198
215
|
|
|
199
216
|
expect(result).toBe(ActionResult.Success);
|
|
217
|
+
expect(openBottomSheetModal).toHaveBeenCalledTimes(1);
|
|
218
|
+
|
|
219
|
+
const { modalBottomSheetContentProps: sheetProps } = (
|
|
220
|
+
openBottomSheetModal as jest.Mock
|
|
221
|
+
).mock.calls[0][0];
|
|
222
|
+
|
|
223
|
+
expect(sheetProps).toMatchObject({
|
|
224
|
+
key: PLAYER_ACTION_IDENTIFIERS.SLEEP_TIMER,
|
|
225
|
+
title: "Sleep Timer",
|
|
226
|
+
current_selection: expect.objectContaining({ value: 15 }),
|
|
227
|
+
itemProps: getBottomSheetModalItemProps,
|
|
228
|
+
iconProps: getBottomSheetModalIconProps,
|
|
229
|
+
labelProps: getBottomSheetModalLabelProps,
|
|
230
|
+
getSelectedItemIcon: getBottomSheetModalSelectedItemIcon,
|
|
231
|
+
getDefaultItemIcon: getBottomSheetModalDefaultItemIcon,
|
|
232
|
+
iconPlacement: "right",
|
|
233
|
+
});
|
|
200
234
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
expect(sheet.options.replace).toBe(true);
|
|
204
|
-
expect(sheet.options.header.title).toBe("Sleep Timer");
|
|
205
|
-
expect(sheet.options.header.subtitle).toBeUndefined();
|
|
206
|
-
expect(sheet.options.content.behavior.currentSelection).toEqual(["15"]);
|
|
235
|
+
await sheetProps.onPress(sheetProps.items[0]);
|
|
207
236
|
|
|
208
|
-
expect(
|
|
209
|
-
sheet.options.content.items[0].extensions.tap_actions.actions[0].type
|
|
210
|
-
).toBe(PLAYER_ACTION_TYPES.SET_SLEEP_TIMER);
|
|
237
|
+
expect(player.cancelSleepTimer).toHaveBeenCalled();
|
|
211
238
|
});
|
|
212
239
|
|
|
213
240
|
it("setPlaybackSpeed applies the rate and closes the sheet when opened from the picker", async () => {
|
|
@@ -361,9 +388,14 @@ describe("playerActions", () => {
|
|
|
361
388
|
.getAction(PLAYER_ACTION_IDENTIFIERS.SLEEP_TIMER)
|
|
362
389
|
.invokeAction({} as ZappEntry);
|
|
363
390
|
|
|
364
|
-
expect(
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
391
|
+
expect(
|
|
392
|
+
(openBottomSheetModal as jest.Mock).mock.calls.map(
|
|
393
|
+
([arg]) => arg.modalBottomSheetContentProps.title
|
|
394
|
+
)
|
|
395
|
+
).toEqual(["Playback Speed", "Sleep Timer"]);
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
it("falls back to sheet width when audio modal theme spacing keys are absent", () => {
|
|
399
|
+
expect(getBottomSheetModalLabelProps({}, 375).maxWidth).toBe(375);
|
|
368
400
|
});
|
|
369
401
|
});
|
|
@@ -7,10 +7,18 @@ import { ActionHandler } from "@applicaster/zapp-react-native-utils/actionsExecu
|
|
|
7
7
|
import { uiActionsRegistry } from "@applicaster/zapp-react-native-utils/uiActionsRegistrator";
|
|
8
8
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
9
9
|
import { modalOrchestrator } from "@applicaster/zapp-react-native-utils/modalState/ModalOrchestrator";
|
|
10
|
+
import { openBottomSheetModal } from "@applicaster/zapp-react-native-utils/modalState/store";
|
|
10
11
|
import { toNumber } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
11
12
|
|
|
12
13
|
import { speedOptions } from "../Const/speedOptions";
|
|
13
14
|
import { getSleepTimerOptions } from "../Const/sleepTimerOptions";
|
|
15
|
+
import {
|
|
16
|
+
getBottomSheetModalDefaultItemIcon,
|
|
17
|
+
getBottomSheetModalIconProps,
|
|
18
|
+
getBottomSheetModalItemProps,
|
|
19
|
+
getBottomSheetModalLabelProps,
|
|
20
|
+
getBottomSheetModalSelectedItemIcon,
|
|
21
|
+
} from "../Utils";
|
|
14
22
|
import { formatSpeed } from "./utils";
|
|
15
23
|
import { SpeedController } from "./SpeedManager";
|
|
16
24
|
import { SleepTimerController, SleepTimerState } from "./SleepTimerManager";
|
|
@@ -41,24 +49,14 @@ function dismissOpenedSheet(action: ActionType) {
|
|
|
41
49
|
}
|
|
42
50
|
}
|
|
43
51
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
title,
|
|
53
|
-
extensions: {
|
|
54
|
-
tap_actions: {
|
|
55
|
-
actions: [
|
|
56
|
-
{ type: actionType, options: { ...options, dismissSheet: true } },
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
} as ZappEntry;
|
|
61
|
-
}
|
|
52
|
+
const AUDIO_PICKER_SHEET_STYLE_PROPS = {
|
|
53
|
+
itemProps: getBottomSheetModalItemProps,
|
|
54
|
+
iconProps: getBottomSheetModalIconProps,
|
|
55
|
+
labelProps: getBottomSheetModalLabelProps,
|
|
56
|
+
getSelectedItemIcon: getBottomSheetModalSelectedItemIcon,
|
|
57
|
+
getDefaultItemIcon: getBottomSheetModalDefaultItemIcon,
|
|
58
|
+
iconPlacement: "right" as const,
|
|
59
|
+
};
|
|
62
60
|
|
|
63
61
|
function sleepTimerEntryState(
|
|
64
62
|
sleepState: SleepTimerState
|
|
@@ -97,32 +95,25 @@ export async function openPlaybackSpeedAction(
|
|
|
97
95
|
const config = getPlayerConfig();
|
|
98
96
|
const current = speedController.currentSpeed;
|
|
99
97
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
content: {
|
|
117
|
-
role: "collection_selector",
|
|
118
|
-
behavior: {
|
|
119
|
-
selectMode: "single",
|
|
120
|
-
currentSelection: [String(current.value)],
|
|
121
|
-
},
|
|
122
|
-
items,
|
|
123
|
-
},
|
|
98
|
+
openBottomSheetModal({
|
|
99
|
+
modalBottomSheetContentProps: {
|
|
100
|
+
key: PLAYER_ACTION_IDENTIFIERS.PLAYBACK_SPEED,
|
|
101
|
+
title: config.playback_speed_title || "Playback Speed",
|
|
102
|
+
items: speedOptions.map((option) => ({
|
|
103
|
+
...option,
|
|
104
|
+
id: String(option.value),
|
|
105
|
+
})),
|
|
106
|
+
current_selection: current,
|
|
107
|
+
onPress: (item) =>
|
|
108
|
+
actionExecutor.handleAction({
|
|
109
|
+
type: PLAYER_ACTION_TYPES.SET_PLAYBACK_SPEED,
|
|
110
|
+
options: { value: item.value },
|
|
111
|
+
}),
|
|
112
|
+
...AUDIO_PICKER_SHEET_STYLE_PROPS,
|
|
124
113
|
},
|
|
125
|
-
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
return ActionResult.Success;
|
|
126
117
|
}
|
|
127
118
|
|
|
128
119
|
export async function openSleepTimerAction(
|
|
@@ -137,34 +128,27 @@ export async function openSleepTimerAction(
|
|
|
137
128
|
timerRemaining
|
|
138
129
|
)
|
|
139
130
|
.filter(Boolean)
|
|
140
|
-
.map((option) =>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
role: "collection_selector",
|
|
158
|
-
behavior: {
|
|
159
|
-
selectMode: "single",
|
|
160
|
-
currentSelection: timerRemaining
|
|
161
|
-
? [String(sleepState.timer.value)]
|
|
162
|
-
: [],
|
|
163
|
-
},
|
|
164
|
-
items,
|
|
165
|
-
},
|
|
131
|
+
.map((option) => ({
|
|
132
|
+
...option,
|
|
133
|
+
id: String(option.value),
|
|
134
|
+
}));
|
|
135
|
+
|
|
136
|
+
openBottomSheetModal({
|
|
137
|
+
modalBottomSheetContentProps: {
|
|
138
|
+
key: PLAYER_ACTION_IDENTIFIERS.SLEEP_TIMER,
|
|
139
|
+
title: config.playback_sleep_title || "Sleep Timer",
|
|
140
|
+
items,
|
|
141
|
+
current_selection: timerRemaining ? sleepState.timer : null,
|
|
142
|
+
onPress: (item) =>
|
|
143
|
+
actionExecutor.handleAction({
|
|
144
|
+
type: PLAYER_ACTION_TYPES.SET_SLEEP_TIMER,
|
|
145
|
+
options: { value: item.value, label: item.label },
|
|
146
|
+
}),
|
|
147
|
+
...AUDIO_PICKER_SHEET_STYLE_PROPS,
|
|
166
148
|
},
|
|
167
|
-
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
return ActionResult.Success;
|
|
168
152
|
}
|
|
169
153
|
|
|
170
154
|
export async function setPlaybackSpeedAction(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
2
|
+
import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
2
3
|
|
|
3
4
|
export * from "./Utils";
|
|
4
5
|
|
|
@@ -38,15 +39,20 @@ export const getBottomSheetModalLabelProps = (theme, width: number) => {
|
|
|
38
39
|
audio_modal_bottom_sheet_item_padding_right,
|
|
39
40
|
} = theme;
|
|
40
41
|
|
|
41
|
-
const
|
|
42
|
+
const calculatedMaxWidth =
|
|
42
43
|
width -
|
|
43
|
-
(audio_modal_bottom_sheet_item_icon_width +
|
|
44
|
-
audio_modal_bottom_sheet_item_icon_margin_left +
|
|
45
|
-
audio_modal_bottom_sheet_item_icon_margin_right +
|
|
46
|
-
audio_modal_bottom_sheet_item_margin_left +
|
|
47
|
-
audio_modal_bottom_sheet_item_margin_right +
|
|
48
|
-
audio_modal_bottom_sheet_item_padding_left +
|
|
49
|
-
audio_modal_bottom_sheet_item_padding_right);
|
|
44
|
+
(toNumberWithDefaultZero(audio_modal_bottom_sheet_item_icon_width) +
|
|
45
|
+
toNumberWithDefaultZero(audio_modal_bottom_sheet_item_icon_margin_left) +
|
|
46
|
+
toNumberWithDefaultZero(audio_modal_bottom_sheet_item_icon_margin_right) +
|
|
47
|
+
toNumberWithDefaultZero(audio_modal_bottom_sheet_item_margin_left) +
|
|
48
|
+
toNumberWithDefaultZero(audio_modal_bottom_sheet_item_margin_right) +
|
|
49
|
+
toNumberWithDefaultZero(audio_modal_bottom_sheet_item_padding_left) +
|
|
50
|
+
toNumberWithDefaultZero(audio_modal_bottom_sheet_item_padding_right));
|
|
51
|
+
|
|
52
|
+
const maxWidth =
|
|
53
|
+
Number.isNaN(calculatedMaxWidth) || calculatedMaxWidth <= 0
|
|
54
|
+
? width
|
|
55
|
+
: calculatedMaxWidth;
|
|
50
56
|
|
|
51
57
|
return {
|
|
52
58
|
fontFamily: platformSelect({
|
package/src/Player/index.tsx
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
PlayerDetails,
|
|
31
31
|
PlayerWrapper,
|
|
32
32
|
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal";
|
|
33
|
+
import { getVerticalColumnWidth } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/playerWrapperUtils";
|
|
33
34
|
|
|
34
35
|
import { PlayNextOverlay } from "./PlayNextOverlay";
|
|
35
36
|
import { PlayerImageBackground } from "@applicaster/zapp-react-native-ui-components/Components/PlayerImageBackground";
|
|
@@ -1398,9 +1399,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
1398
1399
|
|
|
1399
1400
|
const shouldRenderNativePlayer = !isCasting || this.supportNativeCast;
|
|
1400
1401
|
|
|
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
1402
|
const isVerticalInlineTabletLandscape =
|
|
1405
1403
|
vertical &&
|
|
1406
1404
|
inline &&
|
|
@@ -1409,11 +1407,20 @@ export default class VideoPlayer extends React.Component<
|
|
|
1409
1407
|
getIsTablet() &&
|
|
1410
1408
|
!isTabletPortrait;
|
|
1411
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
|
+
|
|
1412
1422
|
const aspectRatio = isVerticalInlineTabletLandscape
|
|
1413
|
-
?
|
|
1414
|
-
pluginConfiguration.tablet_landscape_sidebar_width,
|
|
1415
|
-
style
|
|
1416
|
-
) / Dimensions.get("window").height
|
|
1423
|
+
? verticalColumnWidth / Dimensions.get("window").height
|
|
1417
1424
|
: !inline && isModal && !piped
|
|
1418
1425
|
? getScreenAspectRatio()
|
|
1419
1426
|
: 16 / 9;
|
|
@@ -1457,10 +1464,14 @@ export default class VideoPlayer extends React.Component<
|
|
|
1457
1464
|
fullscreen={fullscreen}
|
|
1458
1465
|
modal
|
|
1459
1466
|
style={{
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
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
|
+
),
|
|
1464
1475
|
width: style.width,
|
|
1465
1476
|
height: style.height,
|
|
1466
1477
|
}}
|