@applicaster/quick-brick-player 13.0.0-alpha.2761483533 → 13.0.0-alpha.3013227535
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.3013227535",
|
|
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-rc.
|
|
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-rc.25",
|
|
40
|
+
"@applicaster/quick-brick-tv-transport-controls": "13.0.0-rc.26",
|
|
41
|
+
"@applicaster/zapp-react-native-tvos-app": "13.0.0-alpha.3013227535",
|
|
42
|
+
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.3013227535",
|
|
43
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.3013227535",
|
|
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 { useEffect, useState } from "react";
|
|
18
|
+
import { useCallback, useEffect, useState } from "react";
|
|
19
19
|
import { MagicBG } from "./MagicBG";
|
|
20
20
|
import {
|
|
21
21
|
formatSpeed,
|
|
@@ -189,7 +189,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
189
189
|
if (!defaultDimensions) setDefaultDimensions({ width, height });
|
|
190
190
|
};
|
|
191
191
|
|
|
192
|
-
const cancelSleepTimer = async () => {
|
|
192
|
+
const cancelSleepTimer = useCallback(async () => {
|
|
193
193
|
player?.cancelSleepTimer();
|
|
194
194
|
|
|
195
195
|
setSleepTimer({
|
|
@@ -200,46 +200,47 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
200
200
|
setSleepTimerDate(0);
|
|
201
201
|
|
|
202
202
|
await localStorage.removeItem("sleep", NAMESPACE);
|
|
203
|
-
};
|
|
204
|
-
|
|
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();
|
|
210
|
-
|
|
211
|
-
player?.cancelSleepTimer();
|
|
203
|
+
}, [player, setSleepTimer, setSleepTimerDate]);
|
|
212
204
|
|
|
213
|
-
|
|
205
|
+
const startSleepTimer = useCallback(
|
|
206
|
+
(timerValue: number) => {
|
|
207
|
+
try {
|
|
208
|
+
const futureSleepDate = Date.now() + timerValue * 60000;
|
|
214
209
|
|
|
215
|
-
|
|
216
|
-
} catch (e) {
|
|
217
|
-
return 0;
|
|
218
|
-
}
|
|
219
|
-
};
|
|
210
|
+
player?.cancelSleepTimer?.();
|
|
220
211
|
|
|
221
|
-
|
|
222
|
-
timerValue: number,
|
|
223
|
-
currentFutureSleepDate = null
|
|
224
|
-
) => {
|
|
225
|
-
if (currentFutureSleepDate) {
|
|
226
|
-
if (hasDatePassed(currentFutureSleepDate)) {
|
|
227
|
-
await cancelSleepTimer();
|
|
212
|
+
player?.startSleepTimer?.(futureSleepDate);
|
|
228
213
|
|
|
214
|
+
return futureSleepDate;
|
|
215
|
+
} catch (e) {
|
|
229
216
|
return 0;
|
|
230
217
|
}
|
|
218
|
+
},
|
|
219
|
+
[player]
|
|
220
|
+
);
|
|
231
221
|
|
|
232
|
-
|
|
233
|
-
|
|
222
|
+
const handleSleep = useCallback(
|
|
223
|
+
async (timerValue: number, currentFutureSleepDate = null) => {
|
|
224
|
+
if (currentFutureSleepDate) {
|
|
225
|
+
if (hasDatePassed(currentFutureSleepDate)) {
|
|
226
|
+
await cancelSleepTimer();
|
|
234
227
|
|
|
235
|
-
|
|
236
|
-
|
|
228
|
+
return 0;
|
|
229
|
+
}
|
|
237
230
|
|
|
238
|
-
|
|
239
|
-
|
|
231
|
+
return currentFutureSleepDate;
|
|
232
|
+
}
|
|
240
233
|
|
|
241
|
-
|
|
242
|
-
|
|
234
|
+
if (timerValue === 0) {
|
|
235
|
+
await cancelSleepTimer();
|
|
236
|
+
|
|
237
|
+
return timerValue;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return startSleepTimer(timerValue);
|
|
241
|
+
},
|
|
242
|
+
[startSleepTimer, cancelSleepTimer]
|
|
243
|
+
);
|
|
243
244
|
|
|
244
245
|
useEffect(() => {
|
|
245
246
|
const loadSpeed = async () => {
|
|
@@ -262,9 +263,16 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
262
263
|
}
|
|
263
264
|
};
|
|
264
265
|
|
|
265
|
-
loadSpeed()
|
|
266
|
-
loadSleep()
|
|
267
|
-
}, [
|
|
266
|
+
void loadSpeed();
|
|
267
|
+
void loadSleep();
|
|
268
|
+
}, [
|
|
269
|
+
playerState.isReadyToPlay,
|
|
270
|
+
handleSleep,
|
|
271
|
+
setSleepTimer,
|
|
272
|
+
setSleepTimerDate,
|
|
273
|
+
setPlaybackSpeed,
|
|
274
|
+
player,
|
|
275
|
+
]);
|
|
268
276
|
|
|
269
277
|
const getValue = (key: string, stylesObj: {}) =>
|
|
270
278
|
R.propOr(null, key, stylesObj);
|
|
@@ -292,7 +300,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
292
300
|
|
|
293
301
|
const onPlaybackButtonPress = React.useCallback(() => {
|
|
294
302
|
if (playerState.isBuffering) return;
|
|
295
|
-
playerState.isPaused ? player?.play() : player
|
|
303
|
+
playerState.isPaused ? player?.play() : player?.pause();
|
|
296
304
|
}, [playerState, player]);
|
|
297
305
|
|
|
298
306
|
const seekDuration = toNumberWithDefault(10, value("seek_duration"));
|
|
@@ -308,7 +316,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
308
316
|
const onSpeedSelect = React.useCallback(
|
|
309
317
|
async (item) => {
|
|
310
318
|
setPlaybackSpeed(item);
|
|
311
|
-
player
|
|
319
|
+
player?.setPlaybackRate(item.value);
|
|
312
320
|
await localStorage.setItem("speed", item, NAMESPACE);
|
|
313
321
|
},
|
|
314
322
|
[player, setPlaybackSpeed]
|
|
@@ -326,7 +334,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
326
334
|
NAMESPACE
|
|
327
335
|
);
|
|
328
336
|
},
|
|
329
|
-
[
|
|
337
|
+
[setSleepTimer, setSleepTimerDate, handleSleep]
|
|
330
338
|
);
|
|
331
339
|
|
|
332
340
|
const onSpeedButtonPress = React.useCallback(() => {
|
|
@@ -341,7 +349,13 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
341
349
|
supportedOrientations: ["portrait"],
|
|
342
350
|
},
|
|
343
351
|
});
|
|
344
|
-
}, [
|
|
352
|
+
}, [
|
|
353
|
+
playbackSpeed,
|
|
354
|
+
setPlaybackSpeed,
|
|
355
|
+
navigator,
|
|
356
|
+
onSpeedSelect,
|
|
357
|
+
configuration["playback_speed_title"],
|
|
358
|
+
]);
|
|
345
359
|
|
|
346
360
|
const onSleepButtonPress = React.useCallback(() => {
|
|
347
361
|
navigator.openModalBottomSheet({
|
|
@@ -357,7 +371,13 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
|
|
|
357
371
|
supportedOrientations: ["portrait"],
|
|
358
372
|
},
|
|
359
373
|
});
|
|
360
|
-
}, [
|
|
374
|
+
}, [
|
|
375
|
+
navigator,
|
|
376
|
+
sleepTimer,
|
|
377
|
+
configuration["playback_sleep_title"],
|
|
378
|
+
configuration["playback_sleep_off_label"],
|
|
379
|
+
onSleepSelect,
|
|
380
|
+
]);
|
|
361
381
|
|
|
362
382
|
const onCloseVideoModal = React.useCallback(() => {
|
|
363
383
|
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()) {
|