@remotion/player 3.3.38 → 3.3.39
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/dist/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/MediaVolumeSlider.d.ts +0 -5
- package/dist/MediaVolumeSlider.js +0 -118
- package/dist/Player.d.ts +0 -43
- package/dist/Player.js +0 -141
- package/dist/PlayerControls.d.ts +0 -41
- package/dist/PlayerControls.js +0 -138
- package/dist/PlayerSeekBar.d.ts +0 -8
- package/dist/PlayerSeekBar.js +0 -146
- package/dist/PlayerUI.d.ts +0 -38
- package/dist/PlayerUI.js +0 -308
- package/dist/SharedPlayerContext.d.ts +0 -14
- package/dist/SharedPlayerContext.js +0 -72
- package/dist/Thumbnail.d.ts +0 -20
- package/dist/Thumbnail.js +0 -42
- package/dist/ThumbnailUI.d.ts +0 -11
- package/dist/ThumbnailUI.js +0 -107
- package/dist/calculate-next-frame.d.ts +0 -14
- package/dist/calculate-next-frame.js +0 -28
- package/dist/calculate-scale.d.ts +0 -39
- package/dist/calculate-scale.js +0 -85
- package/dist/emitter-context.d.ts +0 -4
- package/dist/emitter-context.js +0 -9
- package/dist/error-boundary.d.ts +0 -19
- package/dist/error-boundary.js +0 -39
- package/dist/event-emitter.d.ts +0 -66
- package/dist/event-emitter.js +0 -87
- package/dist/format-time.d.ts +0 -1
- package/dist/format-time.js +0 -9
- package/dist/icons.d.ts +0 -10
- package/dist/icons.js +0 -50
- package/dist/index.d.ts +0 -61
- package/dist/index.js +0 -25
- package/dist/player-css-classname.d.ts +0 -1
- package/dist/player-css-classname.js +0 -4
- package/dist/player-methods.d.ts +0 -24
- package/dist/player-methods.js +0 -2
- package/dist/test/index.test.d.ts +0 -1
- package/dist/test/index.test.js +0 -9
- package/dist/test/test-utils.d.ts +0 -6
- package/dist/test/test-utils.js +0 -32
- package/dist/test/validate-in-out-frames.test.d.ts +0 -1
- package/dist/test/validate-in-out-frames.test.js +0 -56
- package/dist/test/validate-prop.test.d.ts +0 -1
- package/dist/test/validate-prop.test.js +0 -131
- package/dist/use-hover-state.d.ts +0 -1
- package/dist/use-hover-state.js +0 -27
- package/dist/use-playback.d.ts +0 -7
- package/dist/use-playback.js +0 -92
- package/dist/use-player.d.ts +0 -19
- package/dist/use-player.js +0 -132
- package/dist/use-thumbnail.d.ts +0 -6
- package/dist/use-thumbnail.js +0 -18
- package/dist/use-video-controls-resize.d.ts +0 -7
- package/dist/use-video-controls-resize.js +0 -36
- package/dist/utils/calculate-player-size.d.ts +0 -9
- package/dist/utils/calculate-player-size.js +0 -29
- package/dist/utils/cancellable-promise.d.ts +0 -5
- package/dist/utils/cancellable-promise.js +0 -26
- package/dist/utils/delay.d.ts +0 -1
- package/dist/utils/delay.js +0 -6
- package/dist/utils/is-node.d.ts +0 -1
- package/dist/utils/is-node.js +0 -4
- package/dist/utils/preview-size.d.ts +0 -8
- package/dist/utils/preview-size.js +0 -2
- package/dist/utils/props-if-has-props.d.ts +0 -5
- package/dist/utils/props-if-has-props.js +0 -2
- package/dist/utils/use-cancellable-promises.d.ts +0 -7
- package/dist/utils/use-cancellable-promises.js +0 -21
- package/dist/utils/use-click-prevention-on-double-click.d.ts +0 -3
- package/dist/utils/use-click-prevention-on-double-click.js +0 -45
- package/dist/utils/use-element-size.d.ts +0 -15
- package/dist/utils/use-element-size.js +0 -98
- package/dist/utils/validate-in-out-frame.d.ts +0 -6
- package/dist/utils/validate-in-out-frame.js +0 -54
- package/dist/utils/validate-initial-frame.d.ts +0 -4
- package/dist/utils/validate-initial-frame.js +0 -27
- package/dist/utils/validate-playbackrate.d.ts +0 -1
- package/dist/utils/validate-playbackrate.js +0 -18
- package/dist/volume-persistance.d.ts +0 -2
- package/dist/volume-persistance.js +0 -19
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CancellablePromise } from './cancellable-promise';
|
|
2
|
-
declare const useCancellablePromises: () => {
|
|
3
|
-
appendPendingPromise: (promise: CancellablePromise) => void;
|
|
4
|
-
removePendingPromise: (promise: CancellablePromise) => void;
|
|
5
|
-
clearPendingPromises: () => void[];
|
|
6
|
-
};
|
|
7
|
-
export { useCancellablePromises };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useCancellablePromises = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const useCancellablePromises = () => {
|
|
6
|
-
const pendingPromises = (0, react_1.useRef)([]);
|
|
7
|
-
const appendPendingPromise = (0, react_1.useCallback)((promise) => {
|
|
8
|
-
pendingPromises.current = [...pendingPromises.current, promise];
|
|
9
|
-
}, []);
|
|
10
|
-
const removePendingPromise = (0, react_1.useCallback)((promise) => {
|
|
11
|
-
pendingPromises.current = pendingPromises.current.filter((p) => p !== promise);
|
|
12
|
-
}, []);
|
|
13
|
-
const clearPendingPromises = (0, react_1.useCallback)(() => pendingPromises.current.map((p) => p.cancel()), []);
|
|
14
|
-
const api = (0, react_1.useMemo)(() => ({
|
|
15
|
-
appendPendingPromise,
|
|
16
|
-
removePendingPromise,
|
|
17
|
-
clearPendingPromises,
|
|
18
|
-
}), [appendPendingPromise, clearPendingPromises, removePendingPromise]);
|
|
19
|
-
return api;
|
|
20
|
-
};
|
|
21
|
-
exports.useCancellablePromises = useCancellablePromises;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { SyntheticEvent } from 'react';
|
|
2
|
-
declare const useClickPreventionOnDoubleClick: (onClick: (e: SyntheticEvent) => void, onDoubleClick: () => void, doubleClickToFullscreen: boolean) => [(e: SyntheticEvent) => void, () => void];
|
|
3
|
-
export { useClickPreventionOnDoubleClick };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useClickPreventionOnDoubleClick = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const cancellable_promise_1 = require("./cancellable-promise");
|
|
6
|
-
const delay_1 = require("./delay");
|
|
7
|
-
const use_cancellable_promises_1 = require("./use-cancellable-promises");
|
|
8
|
-
const useClickPreventionOnDoubleClick = (onClick, onDoubleClick, doubleClickToFullscreen) => {
|
|
9
|
-
const api = (0, use_cancellable_promises_1.useCancellablePromises)();
|
|
10
|
-
const handleClick = (0, react_1.useCallback)(async (e) => {
|
|
11
|
-
api.clearPendingPromises();
|
|
12
|
-
const waitForClick = (0, cancellable_promise_1.cancellablePromise)((0, delay_1.delay)(200));
|
|
13
|
-
api.appendPendingPromise(waitForClick);
|
|
14
|
-
try {
|
|
15
|
-
await waitForClick.promise;
|
|
16
|
-
api.removePendingPromise(waitForClick);
|
|
17
|
-
onClick(e);
|
|
18
|
-
}
|
|
19
|
-
catch (errorInfo) {
|
|
20
|
-
const info = errorInfo;
|
|
21
|
-
api.removePendingPromise(waitForClick);
|
|
22
|
-
if (!info.isCanceled) {
|
|
23
|
-
throw info.error;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}, [api, onClick]);
|
|
27
|
-
const handleDoubleClick = (0, react_1.useCallback)(() => {
|
|
28
|
-
api.clearPendingPromises();
|
|
29
|
-
onDoubleClick();
|
|
30
|
-
}, [api, onDoubleClick]);
|
|
31
|
-
const returnValue = (0, react_1.useMemo)(() => {
|
|
32
|
-
if (!doubleClickToFullscreen) {
|
|
33
|
-
return [onClick, onDoubleClick];
|
|
34
|
-
}
|
|
35
|
-
return [handleClick, handleDoubleClick];
|
|
36
|
-
}, [
|
|
37
|
-
doubleClickToFullscreen,
|
|
38
|
-
handleClick,
|
|
39
|
-
handleDoubleClick,
|
|
40
|
-
onClick,
|
|
41
|
-
onDoubleClick,
|
|
42
|
-
]);
|
|
43
|
-
return returnValue;
|
|
44
|
-
};
|
|
45
|
-
exports.useClickPreventionOnDoubleClick = useClickPreventionOnDoubleClick;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare type Size = {
|
|
2
|
-
width: number;
|
|
3
|
-
height: number;
|
|
4
|
-
left: number;
|
|
5
|
-
top: number;
|
|
6
|
-
windowSize: {
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export declare const updateAllElementsSizes: () => void;
|
|
12
|
-
export declare const useElementSize: (ref: React.RefObject<HTMLElement>, options: {
|
|
13
|
-
triggerOnWindowResize: boolean;
|
|
14
|
-
shouldApplyCssTransforms: boolean;
|
|
15
|
-
}) => Size | null;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useElementSize = exports.updateAllElementsSizes = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
let elementSizeHooks = [];
|
|
6
|
-
const updateAllElementsSizes = () => {
|
|
7
|
-
for (const listener of elementSizeHooks) {
|
|
8
|
-
listener();
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
exports.updateAllElementsSizes = updateAllElementsSizes;
|
|
12
|
-
const useElementSize = (ref, options) => {
|
|
13
|
-
const [size, setSize] = (0, react_1.useState)(null);
|
|
14
|
-
const observer = (0, react_1.useMemo)(() => {
|
|
15
|
-
if (typeof ResizeObserver === 'undefined') {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
return new ResizeObserver((entries) => {
|
|
19
|
-
// The contentRect returns the width without any `scale()`'s being applied. The height is wrong
|
|
20
|
-
const { contentRect } = entries[0];
|
|
21
|
-
// The clientRect returns the size with `scale()` being applied.
|
|
22
|
-
const newSize = entries[0].target.getClientRects();
|
|
23
|
-
if (!newSize || !newSize[0]) {
|
|
24
|
-
setSize(null);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const probableCssParentScale = newSize[0].width / contentRect.width;
|
|
28
|
-
const width = options.shouldApplyCssTransforms
|
|
29
|
-
? newSize[0].width
|
|
30
|
-
: newSize[0].width * (1 / probableCssParentScale);
|
|
31
|
-
const height = options.shouldApplyCssTransforms
|
|
32
|
-
? newSize[0].height
|
|
33
|
-
: newSize[0].height * (1 / probableCssParentScale);
|
|
34
|
-
setSize({
|
|
35
|
-
width,
|
|
36
|
-
height,
|
|
37
|
-
left: newSize[0].x,
|
|
38
|
-
top: newSize[0].y,
|
|
39
|
-
windowSize: {
|
|
40
|
-
height: window.innerHeight,
|
|
41
|
-
width: window.innerWidth,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
}, [options.shouldApplyCssTransforms]);
|
|
46
|
-
const updateSize = (0, react_1.useCallback)(() => {
|
|
47
|
-
if (!ref.current) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const rect = ref.current.getClientRects();
|
|
51
|
-
if (!rect[0]) {
|
|
52
|
-
setSize(null);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
setSize({
|
|
56
|
-
width: rect[0].width,
|
|
57
|
-
height: rect[0].height,
|
|
58
|
-
left: rect[0].x,
|
|
59
|
-
top: rect[0].y,
|
|
60
|
-
windowSize: {
|
|
61
|
-
height: window.innerHeight,
|
|
62
|
-
width: window.innerWidth,
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
}, [ref]);
|
|
66
|
-
(0, react_1.useEffect)(() => {
|
|
67
|
-
if (!observer) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
updateSize();
|
|
71
|
-
const { current } = ref;
|
|
72
|
-
if (ref.current) {
|
|
73
|
-
observer.observe(ref.current);
|
|
74
|
-
}
|
|
75
|
-
return () => {
|
|
76
|
-
if (current) {
|
|
77
|
-
observer.unobserve(current);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}, [observer, ref, updateSize]);
|
|
81
|
-
(0, react_1.useEffect)(() => {
|
|
82
|
-
if (!options.triggerOnWindowResize) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
window.addEventListener('resize', updateSize);
|
|
86
|
-
return () => {
|
|
87
|
-
window.removeEventListener('resize', updateSize);
|
|
88
|
-
};
|
|
89
|
-
}, [options.triggerOnWindowResize, updateSize]);
|
|
90
|
-
(0, react_1.useEffect)(() => {
|
|
91
|
-
elementSizeHooks.push(updateSize);
|
|
92
|
-
return () => {
|
|
93
|
-
elementSizeHooks = elementSizeHooks.filter((e) => e !== updateSize);
|
|
94
|
-
};
|
|
95
|
-
}, [updateSize]);
|
|
96
|
-
return size;
|
|
97
|
-
};
|
|
98
|
-
exports.useElementSize = useElementSize;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const validateSingleFrame: (frame: unknown, variableName: string) => number | null;
|
|
2
|
-
export declare const validateInOutFrames: ({ inFrame, durationInFrames, outFrame, }: {
|
|
3
|
-
inFrame: unknown;
|
|
4
|
-
outFrame: unknown;
|
|
5
|
-
durationInFrames: number;
|
|
6
|
-
}) => void;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateInOutFrames = exports.validateSingleFrame = void 0;
|
|
4
|
-
const validateSingleFrame = (frame, variableName) => {
|
|
5
|
-
if (typeof frame === 'undefined' || frame === null) {
|
|
6
|
-
return frame !== null && frame !== void 0 ? frame : null;
|
|
7
|
-
}
|
|
8
|
-
if (typeof frame !== 'number') {
|
|
9
|
-
throw new TypeError(`"${variableName}" must be a number, but is ${JSON.stringify(frame)}`);
|
|
10
|
-
}
|
|
11
|
-
if (Number.isNaN(frame)) {
|
|
12
|
-
throw new TypeError(`"${variableName}" must not be NaN, but is ${JSON.stringify(frame)}`);
|
|
13
|
-
}
|
|
14
|
-
if (!Number.isFinite(frame)) {
|
|
15
|
-
throw new TypeError(`"${variableName}" must be finite, but is ${JSON.stringify(frame)}`);
|
|
16
|
-
}
|
|
17
|
-
if (frame % 1 !== 0) {
|
|
18
|
-
throw new TypeError(`"${variableName}" must be an integer, but is ${JSON.stringify(frame)}`);
|
|
19
|
-
}
|
|
20
|
-
return frame;
|
|
21
|
-
};
|
|
22
|
-
exports.validateSingleFrame = validateSingleFrame;
|
|
23
|
-
const validateInOutFrames = ({ inFrame, durationInFrames, outFrame, }) => {
|
|
24
|
-
const validatedInFrame = (0, exports.validateSingleFrame)(inFrame, 'inFrame');
|
|
25
|
-
const validatedOutFrame = (0, exports.validateSingleFrame)(outFrame, 'outFrame');
|
|
26
|
-
if (validatedInFrame === null && validatedOutFrame === null) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
// Must not be over the duration
|
|
30
|
-
if (validatedInFrame !== null && validatedInFrame > durationInFrames - 1) {
|
|
31
|
-
throw new Error('inFrame must be less than (durationInFrames - 1), but is ' +
|
|
32
|
-
validatedInFrame);
|
|
33
|
-
}
|
|
34
|
-
if (validatedOutFrame !== null && validatedOutFrame > durationInFrames - 1) {
|
|
35
|
-
throw new Error('outFrame must be less than (durationInFrames - 1), but is ' +
|
|
36
|
-
validatedOutFrame);
|
|
37
|
-
}
|
|
38
|
-
// Must not be under 0
|
|
39
|
-
if (validatedInFrame !== null && validatedInFrame < 0) {
|
|
40
|
-
throw new Error('inFrame must be greater than 0, but is ' + validatedInFrame);
|
|
41
|
-
}
|
|
42
|
-
if (validatedOutFrame !== null && validatedOutFrame <= 0) {
|
|
43
|
-
throw new Error(`outFrame must be greater than 0, but is ${validatedOutFrame}. If you want to render a single frame, use <Thumbnail /> instead.`);
|
|
44
|
-
}
|
|
45
|
-
if (validatedOutFrame !== null &&
|
|
46
|
-
validatedInFrame !== null &&
|
|
47
|
-
validatedOutFrame <= validatedInFrame) {
|
|
48
|
-
throw new Error('outFrame must be greater than inFrame, but is ' +
|
|
49
|
-
validatedOutFrame +
|
|
50
|
-
' <= ' +
|
|
51
|
-
validatedInFrame);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
exports.validateInOutFrames = validateInOutFrames;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateInitialFrame = void 0;
|
|
4
|
-
const validateInitialFrame = ({ initialFrame, durationInFrames, }) => {
|
|
5
|
-
if (typeof durationInFrames !== 'number') {
|
|
6
|
-
throw new Error(`\`durationInFrames\` must be a number, but is ${JSON.stringify(durationInFrames)}`);
|
|
7
|
-
}
|
|
8
|
-
if (typeof initialFrame === 'undefined') {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
if (typeof initialFrame !== 'number') {
|
|
12
|
-
throw new Error(`\`initialFrame\` must be a number, but is ${JSON.stringify(initialFrame)}`);
|
|
13
|
-
}
|
|
14
|
-
if (Number.isNaN(initialFrame)) {
|
|
15
|
-
throw new Error(`\`initialFrame\` must be a number, but is NaN`);
|
|
16
|
-
}
|
|
17
|
-
if (!Number.isFinite(initialFrame)) {
|
|
18
|
-
throw new Error(`\`initialFrame\` must be a number, but is Infinity`);
|
|
19
|
-
}
|
|
20
|
-
if (initialFrame % 1 !== 0) {
|
|
21
|
-
throw new Error(`\`initialFrame\` must be an integer, but is ${JSON.stringify(initialFrame)}`);
|
|
22
|
-
}
|
|
23
|
-
if (initialFrame > durationInFrames - 1) {
|
|
24
|
-
throw new Error(`\`initialFrame\` must be less or equal than \`durationInFrames - 1\`, but is ${JSON.stringify(initialFrame)}`);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
exports.validateInitialFrame = validateInitialFrame;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const validatePlaybackRate: (playbackRate: number | undefined) => void;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validatePlaybackRate = void 0;
|
|
4
|
-
const validatePlaybackRate = (playbackRate) => {
|
|
5
|
-
if (playbackRate === undefined) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
if (playbackRate > 4) {
|
|
9
|
-
throw new Error(`The highest possible playback rate is 4. You passed: ${playbackRate}`);
|
|
10
|
-
}
|
|
11
|
-
if (playbackRate < -4) {
|
|
12
|
-
throw new Error(`The lowest possible playback rate is -4. You passed: ${playbackRate}`);
|
|
13
|
-
}
|
|
14
|
-
if (playbackRate === 0) {
|
|
15
|
-
throw new Error(`A playback rate of 0 is not supported.`);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
exports.validatePlaybackRate = validatePlaybackRate;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPreferredVolume = exports.persistVolume = void 0;
|
|
4
|
-
const VOLUME_PERSISTANCE_KEY = 'remotion.volumePreference';
|
|
5
|
-
const persistVolume = (volume) => {
|
|
6
|
-
if (typeof window === 'undefined') {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
window.localStorage.setItem(VOLUME_PERSISTANCE_KEY, String(volume));
|
|
10
|
-
};
|
|
11
|
-
exports.persistVolume = persistVolume;
|
|
12
|
-
const getPreferredVolume = () => {
|
|
13
|
-
if (typeof window === 'undefined') {
|
|
14
|
-
return 1;
|
|
15
|
-
}
|
|
16
|
-
const val = window.localStorage.getItem(VOLUME_PERSISTANCE_KEY);
|
|
17
|
-
return val ? Number(val) : 1;
|
|
18
|
-
};
|
|
19
|
-
exports.getPreferredVolume = getPreferredVolume;
|