@applicaster/quick-brick-player 13.0.0-alpha.5004843012 → 13.0.0-alpha.5112402674
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": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.5112402674",
|
|
4
4
|
"description": "Quick Brick Player",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@applicaster/quick-brick-mobile-transport-controls": "13.0.0-
|
|
40
|
-
"@applicaster/quick-brick-tv-transport-controls": "13.0.0-
|
|
41
|
-
"@applicaster/zapp-react-native-tvos-app": "13.0.0-alpha.
|
|
42
|
-
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.
|
|
43
|
-
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.
|
|
39
|
+
"@applicaster/quick-brick-mobile-transport-controls": "13.0.0-alpha.5112402674",
|
|
40
|
+
"@applicaster/quick-brick-tv-transport-controls": "13.0.0-rc.19",
|
|
41
|
+
"@applicaster/zapp-react-native-tvos-app": "13.0.0-alpha.5112402674",
|
|
42
|
+
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.5112402674",
|
|
43
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.5112402674",
|
|
44
44
|
"keymirror": "^0.1.1",
|
|
45
45
|
"query-string": "7.1.3",
|
|
46
46
|
"react-native-web-linear-gradient": "1.1.2",
|
|
@@ -15,7 +15,7 @@ import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
|
15
15
|
import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
|
|
16
16
|
import { PlayerDetails } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/PlayerDetails";
|
|
17
17
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
18
|
-
import {
|
|
18
|
+
import { useEffect, useState } from "react";
|
|
19
19
|
import { MagicBG } from "./MagicBG";
|
|
20
20
|
import {
|
|
21
21
|
formatSpeed,
|
|
@@ -33,13 +33,6 @@ import {
|
|
|
33
33
|
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
34
34
|
import { PADDING_HORIZONTAL } from "./Layout/defaultLayoutsConts";
|
|
35
35
|
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
36
|
-
import {
|
|
37
|
-
speed_0_8,
|
|
38
|
-
speed_1,
|
|
39
|
-
speed_1_2,
|
|
40
|
-
speed_1_5,
|
|
41
|
-
speed_2,
|
|
42
|
-
} from "@applicaster/quick-brick-mobile-transport-controls";
|
|
43
36
|
|
|
44
37
|
const { log_debug } = createLogger({
|
|
45
38
|
subsystem: "UIComponent",
|
|
@@ -139,11 +132,11 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
139
132
|
} = props;
|
|
140
133
|
|
|
141
134
|
const speeds = [
|
|
142
|
-
{ asset: configuration["speed_0_8"]
|
|
143
|
-
{ asset: configuration["speed_1"]
|
|
144
|
-
{ asset: configuration["speed_1_2"]
|
|
145
|
-
{ asset: configuration["speed_1_5"]
|
|
146
|
-
{ asset: configuration["speed_2"]
|
|
135
|
+
{ asset: configuration["speed_0_8"], value: 0.8 },
|
|
136
|
+
{ asset: configuration["speed_1"], value: 1.0 },
|
|
137
|
+
{ asset: configuration["speed_1_2"], value: 1.2 },
|
|
138
|
+
{ asset: configuration["speed_1_5"], value: 1.5 },
|
|
139
|
+
{ asset: configuration["speed_2"], value: 2.0 },
|
|
147
140
|
];
|
|
148
141
|
|
|
149
142
|
const isTablet = useIsTablet();
|
|
@@ -196,7 +189,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
196
189
|
if (!defaultDimensions) setDefaultDimensions({ width, height });
|
|
197
190
|
};
|
|
198
191
|
|
|
199
|
-
const cancelSleepTimer =
|
|
192
|
+
const cancelSleepTimer = async () => {
|
|
200
193
|
player?.cancelSleepTimer();
|
|
201
194
|
|
|
202
195
|
setSleepTimer({
|
|
@@ -207,47 +200,46 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
207
200
|
setSleepTimerDate(0);
|
|
208
201
|
|
|
209
202
|
await localStorage.removeItem("sleep", NAMESPACE);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const startSleepTimer = useCallback(
|
|
213
|
-
(timerValue: number) => {
|
|
214
|
-
try {
|
|
215
|
-
const futureSleepDate = Date.now() + timerValue * 60000;
|
|
203
|
+
};
|
|
216
204
|
|
|
217
|
-
|
|
205
|
+
const startSleepTimer = (timerValue: number) => {
|
|
206
|
+
try {
|
|
207
|
+
const currentDate = new Date();
|
|
208
|
+
const futureDate = new Date(currentDate.getTime() + timerValue * 60000);
|
|
209
|
+
const futureSleepDate = futureDate.getTime();
|
|
218
210
|
|
|
219
|
-
|
|
211
|
+
player?.cancelSleepTimer();
|
|
220
212
|
|
|
221
|
-
|
|
222
|
-
} catch (e) {
|
|
223
|
-
return 0;
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
[player]
|
|
227
|
-
);
|
|
213
|
+
player?.startSleepTimer(futureSleepDate);
|
|
228
214
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
215
|
+
return futureSleepDate;
|
|
216
|
+
} catch (e) {
|
|
217
|
+
return 0;
|
|
218
|
+
}
|
|
219
|
+
};
|
|
234
220
|
|
|
235
|
-
|
|
236
|
-
|
|
221
|
+
const handleSleep = async (
|
|
222
|
+
timerValue: number,
|
|
223
|
+
currentFutureSleepDate = null
|
|
224
|
+
) => {
|
|
225
|
+
if (currentFutureSleepDate) {
|
|
226
|
+
if (hasDatePassed(currentFutureSleepDate)) {
|
|
227
|
+
await cancelSleepTimer();
|
|
237
228
|
|
|
238
|
-
return
|
|
229
|
+
return 0;
|
|
239
230
|
}
|
|
240
231
|
|
|
241
|
-
|
|
242
|
-
|
|
232
|
+
return currentFutureSleepDate;
|
|
233
|
+
}
|
|
243
234
|
|
|
244
|
-
|
|
245
|
-
|
|
235
|
+
if (timerValue === 0) {
|
|
236
|
+
await cancelSleepTimer();
|
|
246
237
|
|
|
247
|
-
return
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
238
|
+
return timerValue;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return startSleepTimer(timerValue);
|
|
242
|
+
};
|
|
251
243
|
|
|
252
244
|
useEffect(() => {
|
|
253
245
|
const loadSpeed = async () => {
|
|
@@ -270,16 +262,9 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
270
262
|
}
|
|
271
263
|
};
|
|
272
264
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}, [
|
|
276
|
-
playerState.isReadyToPlay,
|
|
277
|
-
handleSleep,
|
|
278
|
-
setSleepTimer,
|
|
279
|
-
setSleepTimerDate,
|
|
280
|
-
setPlaybackSpeed,
|
|
281
|
-
player,
|
|
282
|
-
]);
|
|
265
|
+
loadSpeed().then();
|
|
266
|
+
loadSleep().then();
|
|
267
|
+
}, [playerState.isReadyToPlay]);
|
|
283
268
|
|
|
284
269
|
const getValue = (key: string, stylesObj: {}) =>
|
|
285
270
|
R.propOr(null, key, stylesObj);
|
|
@@ -307,7 +292,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
307
292
|
|
|
308
293
|
const onPlaybackButtonPress = React.useCallback(() => {
|
|
309
294
|
if (playerState.isBuffering) return;
|
|
310
|
-
playerState.isPaused ? player?.play() : player
|
|
295
|
+
playerState.isPaused ? player?.play() : player.pause();
|
|
311
296
|
}, [playerState, player]);
|
|
312
297
|
|
|
313
298
|
const seekDuration = toNumberWithDefault(10, value("seek_duration"));
|
|
@@ -323,7 +308,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
323
308
|
const onSpeedSelect = React.useCallback(
|
|
324
309
|
async (item) => {
|
|
325
310
|
setPlaybackSpeed(item);
|
|
326
|
-
player
|
|
311
|
+
player.setPlaybackRate(item.value);
|
|
327
312
|
await localStorage.setItem("speed", item, NAMESPACE);
|
|
328
313
|
},
|
|
329
314
|
[player, setPlaybackSpeed]
|
|
@@ -341,7 +326,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
341
326
|
NAMESPACE
|
|
342
327
|
);
|
|
343
328
|
},
|
|
344
|
-
[
|
|
329
|
+
[player, setSleepTimer]
|
|
345
330
|
);
|
|
346
331
|
|
|
347
332
|
const onSpeedButtonPress = React.useCallback(() => {
|
|
@@ -356,22 +341,13 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
356
341
|
supportedOrientations: ["portrait"],
|
|
357
342
|
},
|
|
358
343
|
});
|
|
359
|
-
}, [
|
|
360
|
-
playbackSpeed,
|
|
361
|
-
setPlaybackSpeed,
|
|
362
|
-
navigator,
|
|
363
|
-
onSpeedSelect,
|
|
364
|
-
configuration["playback_speed_title"],
|
|
365
|
-
]);
|
|
344
|
+
}, [playbackSpeed, setPlaybackSpeed]);
|
|
366
345
|
|
|
367
346
|
const onSleepButtonPress = React.useCallback(() => {
|
|
368
347
|
navigator.openModalBottomSheet({
|
|
369
348
|
modalBottomSheetContentProps: {
|
|
370
349
|
items: [
|
|
371
|
-
{
|
|
372
|
-
label: configuration["playback_sleep_off_label"],
|
|
373
|
-
value: 0,
|
|
374
|
-
},
|
|
350
|
+
{ label: configuration["playback_sleep_off_label"], value: 0 },
|
|
375
351
|
].concat(sleeps),
|
|
376
352
|
current_selection: sleepTimer,
|
|
377
353
|
onPress: onSleepSelect,
|
|
@@ -381,13 +357,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
381
357
|
supportedOrientations: ["portrait"],
|
|
382
358
|
},
|
|
383
359
|
});
|
|
384
|
-
}, [
|
|
385
|
-
navigator,
|
|
386
|
-
sleepTimer,
|
|
387
|
-
configuration["playback_sleep_title"],
|
|
388
|
-
configuration["playback_sleep_off_label"],
|
|
389
|
-
onSleepSelect,
|
|
390
|
-
]);
|
|
360
|
+
}, [sleepTimer, setSleepTimer, configuration]);
|
|
391
361
|
|
|
392
362
|
const onCloseVideoModal = React.useCallback(() => {
|
|
393
363
|
playerManager.close();
|
package/src/Player/index.tsx
CHANGED
|
@@ -918,8 +918,8 @@ export default class VideoPlayer extends React.Component<
|
|
|
918
918
|
const playerContainerStyles = isApplePlatform()
|
|
919
919
|
? styles.playerContainerBlack
|
|
920
920
|
: isTV() && isAudioItem
|
|
921
|
-
|
|
922
|
-
|
|
921
|
+
? styles.playerContainerTransparent
|
|
922
|
+
: styles.playerContainerBlack;
|
|
923
923
|
|
|
924
924
|
const isInline = () => {
|
|
925
925
|
if (isTV()) {
|