@remotion/player 4.0.0-lambda.3 → 4.0.0-newpaths.1
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/LICENSE.md +8 -8
- package/README.md +1 -1
- package/dist/cjs/MediaVolumeSlider.d.ts +5 -0
- package/dist/cjs/MediaVolumeSlider.js +118 -0
- package/dist/cjs/Player.d.ts +43 -0
- package/dist/{Player.js → cjs/Player.js} +26 -70
- package/dist/cjs/PlayerControls.d.ts +41 -0
- package/dist/cjs/PlayerControls.js +152 -0
- package/dist/{PlayerSeekBar.d.ts → cjs/PlayerSeekBar.d.ts} +4 -0
- package/dist/{PlayerSeekBar.js → cjs/PlayerSeekBar.js} +35 -11
- package/dist/cjs/PlayerUI.d.ts +38 -0
- package/dist/{PlayerUI.js → cjs/PlayerUI.js} +118 -76
- package/dist/cjs/SharedPlayerContext.d.ts +14 -0
- package/dist/cjs/SharedPlayerContext.js +72 -0
- package/dist/cjs/Thumbnail.d.ts +20 -0
- package/dist/cjs/Thumbnail.js +42 -0
- package/dist/cjs/ThumbnailUI.d.ts +11 -0
- package/dist/cjs/ThumbnailUI.js +107 -0
- package/dist/{calculate-next-frame.d.ts → cjs/calculate-next-frame.d.ts} +0 -0
- package/dist/{calculate-next-frame.js → cjs/calculate-next-frame.js} +0 -0
- package/dist/cjs/calculate-scale.d.ts +39 -0
- package/dist/cjs/calculate-scale.js +85 -0
- package/dist/cjs/emitter-context.d.ts +4 -0
- package/dist/{emitter-context.js → cjs/emitter-context.js} +2 -1
- package/dist/{error-boundary.d.ts → cjs/error-boundary.d.ts} +0 -0
- package/dist/{error-boundary.js → cjs/error-boundary.js} +0 -0
- package/dist/cjs/event-emitter.d.ts +66 -0
- package/dist/{event-emitter.js → cjs/event-emitter.js} +33 -1
- package/dist/{format-time.d.ts → cjs/format-time.d.ts} +0 -0
- package/dist/{format-time.js → cjs/format-time.js} +0 -0
- package/dist/{icons.d.ts → cjs/icons.d.ts} +2 -1
- package/dist/{icons.js → cjs/icons.js} +7 -7
- package/dist/cjs/index.d.ts +61 -0
- package/dist/{index.js → cjs/index.js} +5 -2
- package/dist/{player-css-classname.d.ts → cjs/player-css-classname.d.ts} +0 -1
- package/dist/cjs/player-css-classname.js +4 -0
- package/dist/{player-methods.d.ts → cjs/player-methods.d.ts} +8 -4
- package/dist/{player-methods.js → cjs/player-methods.js} +0 -0
- package/dist/{test → cjs/test}/index.test.d.ts +0 -0
- package/dist/{test → cjs/test}/index.test.js +3 -2
- package/dist/{test → cjs/test}/test-utils.d.ts +2 -2
- package/dist/{test → cjs/test}/test-utils.js +0 -0
- package/dist/{test/validate-prop.test.d.ts → cjs/test/validate-in-out-frames.test.d.ts} +0 -0
- package/dist/cjs/test/validate-in-out-frames.test.js +56 -0
- package/dist/cjs/test/validate-prop.test.d.ts +1 -0
- package/dist/{test → cjs/test}/validate-prop.test.js +24 -23
- package/dist/{use-hover-state.d.ts → cjs/use-hover-state.d.ts} +0 -0
- package/dist/{use-hover-state.js → cjs/use-hover-state.js} +0 -0
- package/dist/cjs/use-playback.d.ts +7 -0
- package/dist/{use-playback.js → cjs/use-playback.js} +7 -3
- package/dist/{use-player.d.ts → cjs/use-player.d.ts} +8 -3
- package/dist/{use-player.js → cjs/use-player.js} +23 -4
- package/dist/cjs/use-thumbnail.d.ts +6 -0
- package/dist/cjs/use-thumbnail.js +18 -0
- package/dist/cjs/use-video-controls-resize.d.ts +7 -0
- package/dist/cjs/use-video-controls-resize.js +36 -0
- package/dist/{utils → cjs/utils}/calculate-player-size.d.ts +2 -2
- package/dist/{utils → cjs/utils}/calculate-player-size.js +0 -0
- package/dist/{utils → cjs/utils}/cancellable-promise.d.ts +0 -0
- package/dist/{utils → cjs/utils}/cancellable-promise.js +0 -0
- package/dist/{utils → cjs/utils}/delay.d.ts +0 -0
- package/dist/{utils → cjs/utils}/delay.js +0 -0
- package/dist/{utils → cjs/utils}/is-node.d.ts +0 -0
- package/dist/{utils → cjs/utils}/is-node.js +0 -0
- package/dist/cjs/utils/preview-size.d.ts +8 -0
- package/dist/{utils → cjs/utils}/preview-size.js +0 -0
- package/dist/cjs/utils/props-if-has-props.d.ts +5 -0
- package/dist/cjs/utils/props-if-has-props.js +2 -0
- package/dist/{utils → cjs/utils}/use-cancellable-promises.d.ts +1 -1
- package/dist/{utils → cjs/utils}/use-cancellable-promises.js +0 -0
- package/dist/{utils → cjs/utils}/use-click-prevention-on-double-click.d.ts +1 -1
- package/dist/{utils → cjs/utils}/use-click-prevention-on-double-click.js +0 -0
- package/dist/{utils → cjs/utils}/use-element-size.d.ts +5 -0
- package/dist/{utils → cjs/utils}/use-element-size.js +9 -1
- package/dist/cjs/utils/validate-in-out-frame.d.ts +6 -0
- package/dist/cjs/utils/validate-in-out-frame.js +54 -0
- package/dist/cjs/utils/validate-initial-frame.d.ts +4 -0
- package/dist/cjs/utils/validate-initial-frame.js +27 -0
- package/dist/{utils → cjs/utils}/validate-playbackrate.d.ts +0 -0
- package/dist/{utils → cjs/utils}/validate-playbackrate.js +0 -0
- package/dist/{volume-persistance.d.ts → cjs/volume-persistance.d.ts} +0 -0
- package/dist/{volume-persistance.js → cjs/volume-persistance.js} +0 -0
- package/dist/esm/MediaVolumeSlider.d.ts +5 -0
- package/dist/esm/MediaVolumeSlider.js +114 -0
- package/dist/esm/Player.d.ts +43 -0
- package/dist/esm/Player.js +136 -0
- package/dist/esm/PlayerControls.d.ts +41 -0
- package/dist/esm/PlayerControls.js +148 -0
- package/dist/esm/PlayerSeekBar.d.ts +8 -0
- package/dist/esm/PlayerSeekBar.js +142 -0
- package/dist/esm/PlayerUI.d.ts +38 -0
- package/dist/esm/PlayerUI.js +283 -0
- package/dist/esm/SharedPlayerContext.d.ts +14 -0
- package/dist/esm/SharedPlayerContext.js +68 -0
- package/dist/esm/Thumbnail.d.ts +20 -0
- package/dist/esm/Thumbnail.js +35 -0
- package/dist/esm/ThumbnailUI.d.ts +11 -0
- package/dist/esm/ThumbnailUI.js +82 -0
- package/dist/esm/calculate-next-frame.d.ts +14 -0
- package/dist/esm/calculate-next-frame.js +24 -0
- package/dist/esm/calculate-scale.d.ts +39 -0
- package/dist/esm/calculate-scale.js +77 -0
- package/dist/esm/emitter-context.d.ts +4 -0
- package/dist/esm/emitter-context.js +3 -0
- package/dist/esm/error-boundary.d.ts +19 -0
- package/dist/esm/error-boundary.js +32 -0
- package/dist/esm/event-emitter.d.ts +66 -0
- package/dist/esm/event-emitter.js +82 -0
- package/dist/esm/format-time.d.ts +1 -0
- package/dist/esm/format-time.js +5 -0
- package/dist/esm/icons.d.ts +10 -0
- package/dist/esm/icons.js +42 -0
- package/dist/esm/index.d.ts +61 -0
- package/dist/esm/index.js +20 -0
- package/dist/esm/player-css-classname.d.ts +1 -0
- package/dist/esm/player-css-classname.js +1 -0
- package/dist/esm/player-methods.d.ts +24 -0
- package/dist/esm/player-methods.js +1 -0
- package/dist/esm/test/index.test.d.ts +1 -0
- package/dist/esm/test/index.test.js +7 -0
- package/dist/esm/test/test-utils.d.ts +6 -0
- package/dist/esm/test/test-utils.js +14 -0
- package/dist/esm/test/validate-in-out-frames.test.d.ts +1 -0
- package/dist/esm/test/validate-in-out-frames.test.js +54 -0
- package/dist/esm/test/validate-prop.test.d.ts +1 -0
- package/dist/esm/test/validate-prop.test.js +129 -0
- package/dist/esm/use-hover-state.d.ts +1 -0
- package/dist/esm/use-hover-state.js +23 -0
- package/dist/esm/use-playback.d.ts +7 -0
- package/dist/esm/use-playback.js +88 -0
- package/dist/esm/use-player.d.ts +19 -0
- package/dist/esm/use-player.js +128 -0
- package/dist/esm/use-thumbnail.d.ts +6 -0
- package/dist/esm/use-thumbnail.js +14 -0
- package/dist/esm/use-video-controls-resize.d.ts +7 -0
- package/dist/esm/use-video-controls-resize.js +32 -0
- package/dist/esm/utils/calculate-player-size.d.ts +9 -0
- package/dist/esm/utils/calculate-player-size.js +25 -0
- package/dist/esm/utils/cancellable-promise.d.ts +5 -0
- package/dist/esm/utils/cancellable-promise.js +22 -0
- package/dist/esm/utils/delay.d.ts +1 -0
- package/dist/esm/utils/delay.js +2 -0
- package/dist/esm/utils/is-node.d.ts +1 -0
- package/dist/esm/utils/is-node.js +1 -0
- package/dist/esm/utils/preview-size.d.ts +8 -0
- package/dist/esm/utils/preview-size.js +1 -0
- package/dist/esm/utils/props-if-has-props.d.ts +5 -0
- package/dist/esm/utils/props-if-has-props.js +1 -0
- package/dist/esm/utils/use-cancellable-promises.d.ts +7 -0
- package/dist/esm/utils/use-cancellable-promises.js +18 -0
- package/dist/esm/utils/use-click-prevention-on-double-click.d.ts +3 -0
- package/dist/esm/utils/use-click-prevention-on-double-click.js +42 -0
- package/dist/esm/utils/use-element-size.d.ts +16 -0
- package/dist/esm/utils/use-element-size.js +93 -0
- package/dist/esm/utils/validate-in-out-frame.d.ts +6 -0
- package/dist/esm/utils/validate-in-out-frame.js +49 -0
- package/dist/esm/utils/validate-initial-frame.d.ts +4 -0
- package/dist/esm/utils/validate-initial-frame.js +23 -0
- package/dist/esm/utils/validate-playbackrate.d.ts +1 -0
- package/dist/esm/utils/validate-playbackrate.js +14 -0
- package/dist/esm/volume-persistance.d.ts +2 -0
- package/dist/esm/volume-persistance.js +14 -0
- package/dist/tsconfig-cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +26 -17
- package/dist/MediaVolumeSlider.d.ts +0 -2
- package/dist/MediaVolumeSlider.d.ts.map +0 -1
- package/dist/MediaVolumeSlider.js +0 -93
- package/dist/MediaVolumeSlider.js.map +0 -1
- package/dist/Player.d.ts +0 -38
- package/dist/Player.d.ts.map +0 -1
- package/dist/Player.js.map +0 -1
- package/dist/PlayerControls.d.ts +0 -14
- package/dist/PlayerControls.d.ts.map +0 -1
- package/dist/PlayerControls.js +0 -87
- package/dist/PlayerControls.js.map +0 -1
- package/dist/PlayerSeekBar.d.ts.map +0 -1
- package/dist/PlayerSeekBar.js.map +0 -1
- package/dist/PlayerUI.d.ts +0 -29
- package/dist/PlayerUI.d.ts.map +0 -1
- package/dist/PlayerUI.js.map +0 -1
- package/dist/calculate-next-frame.d.ts.map +0 -1
- package/dist/calculate-next-frame.js.map +0 -1
- package/dist/calculate-scale.d.ts +0 -14
- package/dist/calculate-scale.d.ts.map +0 -1
- package/dist/calculate-scale.js +0 -24
- package/dist/calculate-scale.js.map +0 -1
- package/dist/emitter-context.d.ts +0 -3
- package/dist/emitter-context.d.ts.map +0 -1
- package/dist/emitter-context.js.map +0 -1
- package/dist/error-boundary.d.ts.map +0 -1
- package/dist/error-boundary.js.map +0 -1
- package/dist/event-emitter.d.ts +0 -42
- package/dist/event-emitter.d.ts.map +0 -1
- package/dist/event-emitter.js.map +0 -1
- package/dist/format-time.d.ts.map +0 -1
- package/dist/format-time.js.map +0 -1
- package/dist/icons.d.ts.map +0 -1
- package/dist/icons.js.map +0 -1
- package/dist/index.d.ts +0 -45
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/player-css-classname.d.ts.map +0 -1
- package/dist/player-css-classname.js +0 -5
- package/dist/player-css-classname.js.map +0 -1
- package/dist/player-methods.d.ts.map +0 -1
- package/dist/player-methods.js.map +0 -1
- package/dist/test/index.test.d.ts.map +0 -1
- package/dist/test/index.test.js.map +0 -1
- package/dist/test/test-utils.d.ts.map +0 -1
- package/dist/test/test-utils.js.map +0 -1
- package/dist/test/validate-prop.test.d.ts.map +0 -1
- package/dist/test/validate-prop.test.js.map +0 -1
- package/dist/use-hover-state.d.ts.map +0 -1
- package/dist/use-hover-state.js.map +0 -1
- package/dist/use-playback.d.ts +0 -4
- package/dist/use-playback.d.ts.map +0 -1
- package/dist/use-playback.js.map +0 -1
- package/dist/use-player.d.ts.map +0 -1
- package/dist/use-player.js.map +0 -1
- package/dist/utils/browser-supports-fullscreen.d.ts +0 -11
- package/dist/utils/browser-supports-fullscreen.d.ts.map +0 -1
- package/dist/utils/browser-supports-fullscreen.js +0 -5
- package/dist/utils/browser-supports-fullscreen.js.map +0 -1
- package/dist/utils/calculate-player-size.d.ts.map +0 -1
- package/dist/utils/calculate-player-size.js.map +0 -1
- package/dist/utils/cancellable-promise.d.ts.map +0 -1
- package/dist/utils/cancellable-promise.js.map +0 -1
- package/dist/utils/delay.d.ts.map +0 -1
- package/dist/utils/delay.js.map +0 -1
- package/dist/utils/is-node.d.ts.map +0 -1
- package/dist/utils/is-node.js.map +0 -1
- package/dist/utils/preview-size.d.ts +0 -1
- package/dist/utils/preview-size.d.ts.map +0 -1
- package/dist/utils/preview-size.js.map +0 -1
- package/dist/utils/use-cancellable-promises.d.ts.map +0 -1
- package/dist/utils/use-cancellable-promises.js.map +0 -1
- package/dist/utils/use-click-prevention-on-double-click.d.ts.map +0 -1
- package/dist/utils/use-click-prevention-on-double-click.js.map +0 -1
- package/dist/utils/use-element-size.d.ts.map +0 -1
- package/dist/utils/use-element-size.js.map +0 -1
- package/dist/utils/validate-playbackrate.d.ts.map +0 -1
- package/dist/utils/validate-playbackrate.js.map +0 -1
- package/dist/volume-persistance.d.ts.map +0 -1
- package/dist/volume-persistance.js.map +0 -1
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
4
|
const remotion_1 = require("remotion");
|
|
5
|
+
const vitest_1 = require("vitest");
|
|
5
6
|
const index_1 = require("../index");
|
|
6
7
|
const test_utils_1 = require("./test-utils");
|
|
7
|
-
test('no compositionWidth should give errors', () => {
|
|
8
|
+
(0, vitest_1.test)('no compositionWidth should give errors', () => {
|
|
8
9
|
try {
|
|
9
10
|
(0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player
|
|
10
11
|
// @ts-expect-error
|
|
@@ -13,27 +14,27 @@ test('no compositionWidth should give errors', () => {
|
|
|
13
14
|
compositionWidth: null, errorFallback: () => 'something went wrong', compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true }));
|
|
14
15
|
}
|
|
15
16
|
catch (e) {
|
|
16
|
-
expect(e.message).toMatch(/'compositionWidth' must be a number but got 'object' instead/);
|
|
17
|
+
(0, vitest_1.expect)(e.message).toMatch(/'compositionWidth' must be a number but got 'object' instead/);
|
|
17
18
|
}
|
|
18
19
|
});
|
|
19
|
-
test('no compositionHeight should give errors', () => {
|
|
20
|
+
(0, vitest_1.test)('no compositionHeight should give errors', () => {
|
|
20
21
|
try {
|
|
21
22
|
(0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 400, errorFallback: () => 'something went wrong',
|
|
22
23
|
// @ts-expect-error
|
|
23
24
|
compositionHeight: undefined, fps: 30, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true }));
|
|
24
25
|
}
|
|
25
26
|
catch (e) {
|
|
26
|
-
expect(e.message).toMatch(/'compositionHeight' must be a number but got 'undefined' instead/);
|
|
27
|
+
(0, vitest_1.expect)(e.message).toMatch(/'compositionHeight' must be a number but got 'undefined' instead/);
|
|
27
28
|
}
|
|
28
29
|
});
|
|
29
|
-
test('No fps should give errors', () => {
|
|
30
|
+
(0, vitest_1.test)('No fps should give errors', () => {
|
|
30
31
|
try {
|
|
31
32
|
(0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, errorFallback: () => 'something went wrong',
|
|
32
33
|
// @ts-expect-error
|
|
33
34
|
fps: null, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true }));
|
|
34
35
|
}
|
|
35
36
|
catch (e) {
|
|
36
|
-
expect(e.message).toMatch(/"fps" must be a number, but you passed a value of type object/);
|
|
37
|
+
(0, vitest_1.expect)(e.message).toMatch(/"fps" must be a number, but you passed a value of type object/);
|
|
37
38
|
}
|
|
38
39
|
try {
|
|
39
40
|
(0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, errorFallback: () => 'something went wrong',
|
|
@@ -41,51 +42,51 @@ test('No fps should give errors', () => {
|
|
|
41
42
|
fps: undefined, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true }));
|
|
42
43
|
}
|
|
43
44
|
catch (e) {
|
|
44
|
-
expect(e.message).toMatch(/"fps" must be a number, but you passed a value of type undefined/);
|
|
45
|
+
(0, vitest_1.expect)(e.message).toMatch(/"fps" must be a number, but you passed a value of type undefined/);
|
|
45
46
|
}
|
|
46
47
|
});
|
|
47
|
-
test('No durationInFrames should give errors', () => {
|
|
48
|
+
(0, vitest_1.test)('No durationInFrames should give errors', () => {
|
|
48
49
|
try {
|
|
49
50
|
(0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, errorFallback: () => 'something went wrong', fps: 30,
|
|
50
51
|
// @ts-expect-error
|
|
51
52
|
durationInFrames: undefined, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true }));
|
|
52
53
|
}
|
|
53
54
|
catch (e) {
|
|
54
|
-
expect(e.message).toMatch(/
|
|
55
|
+
(0, vitest_1.expect)(e.message).toMatch(/durationInFrames` must be a number, but is undefined/);
|
|
55
56
|
}
|
|
56
57
|
});
|
|
57
|
-
test('Invalid playbackRate should give error', () => {
|
|
58
|
+
(0, vitest_1.test)('Invalid playbackRate should give error', () => {
|
|
58
59
|
try {
|
|
59
60
|
(0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true, playbackRate: -5 }));
|
|
60
61
|
}
|
|
61
62
|
catch (e) {
|
|
62
|
-
expect(e.message).toMatch(/The lowest possible playback rate is -4. You passed: -5/);
|
|
63
|
+
(0, vitest_1.expect)(e.message).toMatch(/The lowest possible playback rate is -4. You passed: -5/);
|
|
63
64
|
}
|
|
64
65
|
});
|
|
65
|
-
test('playbackRate of 0 should not be possible', () => {
|
|
66
|
+
(0, vitest_1.test)('playbackRate of 0 should not be possible', () => {
|
|
66
67
|
try {
|
|
67
68
|
(0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true, playbackRate: 0 }));
|
|
68
69
|
}
|
|
69
70
|
catch (e) {
|
|
70
|
-
expect(e.message).toMatch(/A playback rate of 0 is not supported./);
|
|
71
|
+
(0, vitest_1.expect)(e.message).toMatch(/A playback rate of 0 is not supported./);
|
|
71
72
|
}
|
|
72
73
|
});
|
|
73
|
-
test('playbackRate of wrong type should not be possible', () => {
|
|
74
|
+
(0, vitest_1.test)('playbackRate of wrong type should not be possible', () => {
|
|
74
75
|
try {
|
|
75
76
|
(0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true,
|
|
76
77
|
// @ts-expect-error
|
|
77
78
|
playbackRate: 'hi' }));
|
|
78
79
|
}
|
|
79
80
|
catch (e) {
|
|
80
|
-
expect(e.message).toMatch(/A playback rate of 0 is not supported./);
|
|
81
|
+
(0, vitest_1.expect)(e.message).toMatch(/A playback rate of 0 is not supported./);
|
|
81
82
|
}
|
|
82
83
|
});
|
|
83
|
-
test('playbackRate of undefined should be okay', () => {
|
|
84
|
+
(0, vitest_1.test)('playbackRate of undefined should be okay', () => {
|
|
84
85
|
(0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true }));
|
|
85
|
-
expect(true).toBe(true);
|
|
86
|
+
(0, vitest_1.expect)(true).toBe(true);
|
|
86
87
|
});
|
|
87
|
-
test('passing in <Composition /> instance should not be possible', () => {
|
|
88
|
-
expect(() => {
|
|
88
|
+
(0, vitest_1.test)('passing in <Composition /> instance should not be possible', () => {
|
|
89
|
+
(0, vitest_1.expect)(() => {
|
|
89
90
|
(0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: remotion_1.Composition, controls: true, showVolumeControls: true, inputProps: {
|
|
90
91
|
id: 'HelloWorld',
|
|
91
92
|
width: 500,
|
|
@@ -96,8 +97,8 @@ test('passing in <Composition /> instance should not be possible', () => {
|
|
|
96
97
|
} }));
|
|
97
98
|
}).toThrow(/'component' must not be the 'Composition' component\. Pass your own React/);
|
|
98
99
|
});
|
|
99
|
-
test('passing in <Composition /> instance should not be possible', () => {
|
|
100
|
-
expect(() => {
|
|
100
|
+
(0, vitest_1.test)('passing in <Composition /> instance should not be possible', () => {
|
|
101
|
+
(0, vitest_1.expect)(() => {
|
|
101
102
|
(0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500,
|
|
102
103
|
// @ts-expect-error
|
|
103
104
|
component: (0, jsx_runtime_1.jsx)(remotion_1.Composition, { durationInFrames: 30, fps: 30, height: 10, width: 10, id: "hello", component: test_utils_1.HelloWorld }), controls: true, showVolumeControls: true, inputProps: {
|
|
@@ -110,7 +111,7 @@ test('passing in <Composition /> instance should not be possible', () => {
|
|
|
110
111
|
} }));
|
|
111
112
|
}).toThrow(/'component' should not be an instance of <Composition\/>\. Pass the React component dir/);
|
|
112
113
|
});
|
|
113
|
-
test.each([
|
|
114
|
+
vitest_1.test.each([
|
|
114
115
|
['controls'],
|
|
115
116
|
['loop'],
|
|
116
117
|
['autoPlay'],
|
|
@@ -125,6 +126,6 @@ test.each([
|
|
|
125
126
|
(0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, errorFallback: () => 'something went wrong', fps: 30, durationInFrames: 100, component: test_utils_1.HelloWorld, ...props }));
|
|
126
127
|
}
|
|
127
128
|
catch (e) {
|
|
128
|
-
expect(e.message).toMatch(`'${a}' must be a boolean or undefined but got 'string' instead`);
|
|
129
|
+
(0, vitest_1.expect)(e.message).toMatch(`'${a}' must be a boolean or undefined but got 'string' instead`);
|
|
129
130
|
}
|
|
130
131
|
});
|
|
File without changes
|
|
File without changes
|
|
@@ -5,12 +5,11 @@ const react_1 = require("react");
|
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
6
|
const calculate_next_frame_1 = require("./calculate-next-frame");
|
|
7
7
|
const use_player_1 = require("./use-player");
|
|
8
|
-
const usePlayback = ({ loop, playbackRate, }) => {
|
|
8
|
+
const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, outFrame, }) => {
|
|
9
9
|
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
10
10
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
11
11
|
const { playing, pause, emitter } = (0, use_player_1.usePlayer)();
|
|
12
12
|
const setFrame = remotion_1.Internals.Timeline.useTimelineSetFrame();
|
|
13
|
-
const { inFrame, outFrame } = remotion_1.Internals.Timeline.useTimelineInOutFramePosition();
|
|
14
13
|
const frameRef = (0, react_1.useRef)(frame);
|
|
15
14
|
frameRef.current = frame;
|
|
16
15
|
const lastTimeUpdateEvent = (0, react_1.useRef)(null);
|
|
@@ -46,7 +45,8 @@ const usePlayback = ({ loop, playbackRate, }) => {
|
|
|
46
45
|
shouldLoop: loop,
|
|
47
46
|
});
|
|
48
47
|
framesAdvanced += framesToAdvance;
|
|
49
|
-
if (nextFrame !== frameRef.current
|
|
48
|
+
if (nextFrame !== frameRef.current &&
|
|
49
|
+
(!hasEnded || moveToBeginningWhenEnded)) {
|
|
50
50
|
setFrame(nextFrame);
|
|
51
51
|
}
|
|
52
52
|
if (hasEnded) {
|
|
@@ -73,6 +73,7 @@ const usePlayback = ({ loop, playbackRate, }) => {
|
|
|
73
73
|
playbackRate,
|
|
74
74
|
inFrame,
|
|
75
75
|
outFrame,
|
|
76
|
+
moveToBeginningWhenEnded,
|
|
76
77
|
]);
|
|
77
78
|
(0, react_1.useEffect)(() => {
|
|
78
79
|
const interval = setInterval(() => {
|
|
@@ -84,5 +85,8 @@ const usePlayback = ({ loop, playbackRate, }) => {
|
|
|
84
85
|
}, 250);
|
|
85
86
|
return () => clearInterval(interval);
|
|
86
87
|
}, [emitter]);
|
|
88
|
+
(0, react_1.useEffect)(() => {
|
|
89
|
+
emitter.dispatchFrameUpdate({ frame });
|
|
90
|
+
}, [emitter, frame]);
|
|
87
91
|
};
|
|
88
92
|
exports.usePlayback = usePlayback;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { SyntheticEvent } from 'react';
|
|
2
|
-
import { PlayerEmitter } from './event-emitter';
|
|
3
|
-
|
|
1
|
+
import type { SyntheticEvent } from 'react';
|
|
2
|
+
import type { PlayerEmitter } from './event-emitter';
|
|
3
|
+
declare type UsePlayerMethods = {
|
|
4
4
|
frameBack: (frames: number) => void;
|
|
5
5
|
frameForward: (frames: number) => void;
|
|
6
6
|
isLastFrame: boolean;
|
|
7
|
+
isFirstFrame: boolean;
|
|
7
8
|
emitter: PlayerEmitter;
|
|
8
9
|
playing: boolean;
|
|
9
10
|
play: (e?: SyntheticEvent) => void;
|
|
10
11
|
pause: () => void;
|
|
12
|
+
pauseAndReturnToPlayStart: () => void;
|
|
11
13
|
seek: (newFrame: number) => void;
|
|
12
14
|
getCurrentFrame: () => number;
|
|
13
15
|
isPlaying: () => boolean;
|
|
16
|
+
hasPlayed: boolean;
|
|
14
17
|
};
|
|
18
|
+
export declare const usePlayer: () => UsePlayerMethods;
|
|
19
|
+
export {};
|
|
@@ -7,7 +7,9 @@ const emitter_context_1 = require("./emitter-context");
|
|
|
7
7
|
const usePlayer = () => {
|
|
8
8
|
var _a;
|
|
9
9
|
const [playing, setPlaying, imperativePlaying] = remotion_1.Internals.Timeline.usePlayingState();
|
|
10
|
+
const [hasPlayed, setHasPlayed] = (0, react_1.useState)(false);
|
|
10
11
|
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
12
|
+
const playStart = (0, react_1.useRef)(frame);
|
|
11
13
|
const setFrame = remotion_1.Internals.Timeline.useTimelineSetFrame();
|
|
12
14
|
const setTimelinePosition = remotion_1.Internals.Timeline.useTimelineSetFrame();
|
|
13
15
|
const audioContext = (0, react_1.useContext)(remotion_1.Internals.SharedAudioContext);
|
|
@@ -19,6 +21,7 @@ const usePlayer = () => {
|
|
|
19
21
|
const emitter = (0, react_1.useContext)(emitter_context_1.PlayerEventEmitterContext);
|
|
20
22
|
const lastFrame = ((_a = config === null || config === void 0 ? void 0 : config.durationInFrames) !== null && _a !== void 0 ? _a : 1) - 1;
|
|
21
23
|
const isLastFrame = frame === lastFrame;
|
|
24
|
+
const isFirstFrame = frame === 0;
|
|
22
25
|
if (!emitter) {
|
|
23
26
|
throw new TypeError('Expected Player event emitter context');
|
|
24
27
|
}
|
|
@@ -30,6 +33,7 @@ const usePlayer = () => {
|
|
|
30
33
|
if (imperativePlaying.current) {
|
|
31
34
|
return;
|
|
32
35
|
}
|
|
36
|
+
setHasPlayed(true);
|
|
33
37
|
if (isLastFrame) {
|
|
34
38
|
seek(0);
|
|
35
39
|
}
|
|
@@ -46,6 +50,7 @@ const usePlayer = () => {
|
|
|
46
50
|
audioAndVideoTags.current.forEach((a) => a.play());
|
|
47
51
|
imperativePlaying.current = true;
|
|
48
52
|
setPlaying(true);
|
|
53
|
+
playStart.current = frameRef.current;
|
|
49
54
|
emitter.dispatchPlay();
|
|
50
55
|
}, [
|
|
51
56
|
imperativePlaying,
|
|
@@ -63,6 +68,14 @@ const usePlayer = () => {
|
|
|
63
68
|
emitter.dispatchPause();
|
|
64
69
|
}
|
|
65
70
|
}, [emitter, imperativePlaying, setPlaying]);
|
|
71
|
+
const pauseAndReturnToPlayStart = (0, react_1.useCallback)(() => {
|
|
72
|
+
if (imperativePlaying.current) {
|
|
73
|
+
imperativePlaying.current = false;
|
|
74
|
+
setTimelinePosition(playStart.current);
|
|
75
|
+
setPlaying(false);
|
|
76
|
+
emitter.dispatchPause();
|
|
77
|
+
}
|
|
78
|
+
}, [emitter, imperativePlaying, setPlaying, setTimelinePosition]);
|
|
66
79
|
const hasVideo = Boolean(video);
|
|
67
80
|
const frameBack = (0, react_1.useCallback)((frames) => {
|
|
68
81
|
if (!hasVideo) {
|
|
@@ -94,19 +107,25 @@ const usePlayer = () => {
|
|
|
94
107
|
play,
|
|
95
108
|
pause,
|
|
96
109
|
seek,
|
|
110
|
+
isFirstFrame,
|
|
97
111
|
getCurrentFrame: () => frameRef.current,
|
|
98
112
|
isPlaying: () => imperativePlaying.current,
|
|
113
|
+
pauseAndReturnToPlayStart,
|
|
114
|
+
hasPlayed,
|
|
99
115
|
};
|
|
100
116
|
}, [
|
|
101
|
-
emitter,
|
|
102
117
|
frameBack,
|
|
103
118
|
frameForward,
|
|
104
|
-
imperativePlaying,
|
|
105
119
|
isLastFrame,
|
|
106
|
-
|
|
107
|
-
play,
|
|
120
|
+
emitter,
|
|
108
121
|
playing,
|
|
122
|
+
play,
|
|
123
|
+
pause,
|
|
109
124
|
seek,
|
|
125
|
+
isFirstFrame,
|
|
126
|
+
pauseAndReturnToPlayStart,
|
|
127
|
+
imperativePlaying,
|
|
128
|
+
hasPlayed,
|
|
110
129
|
]);
|
|
111
130
|
return returnValue;
|
|
112
131
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useThumbnail = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const emitter_context_1 = require("./emitter-context");
|
|
6
|
+
const useThumbnail = () => {
|
|
7
|
+
const emitter = (0, react_1.useContext)(emitter_context_1.ThumbnailEmitterContext);
|
|
8
|
+
if (!emitter) {
|
|
9
|
+
throw new TypeError('Expected Player event emitter context');
|
|
10
|
+
}
|
|
11
|
+
const returnValue = (0, react_1.useMemo)(() => {
|
|
12
|
+
return {
|
|
13
|
+
emitter,
|
|
14
|
+
};
|
|
15
|
+
}, [emitter]);
|
|
16
|
+
return returnValue;
|
|
17
|
+
};
|
|
18
|
+
exports.useThumbnail = useThumbnail;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useVideoControlsResize = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const icons_1 = require("./icons");
|
|
6
|
+
const MediaVolumeSlider_1 = require("./MediaVolumeSlider");
|
|
7
|
+
const PlayerControls_1 = require("./PlayerControls");
|
|
8
|
+
const useVideoControlsResize = ({ allowFullscreen: allowFullScreen, playerWidth, }) => {
|
|
9
|
+
const resizeInfo = (0, react_1.useMemo)(() => {
|
|
10
|
+
const playPauseIconSize = icons_1.ICON_SIZE;
|
|
11
|
+
const volumeIconSize = icons_1.ICON_SIZE;
|
|
12
|
+
const _fullscreenIconSize = allowFullScreen ? icons_1.fullscreenIconSize : 0;
|
|
13
|
+
const elementsSize = volumeIconSize +
|
|
14
|
+
playPauseIconSize +
|
|
15
|
+
_fullscreenIconSize +
|
|
16
|
+
PlayerControls_1.X_PADDING * 2 +
|
|
17
|
+
PlayerControls_1.X_SPACER * 2;
|
|
18
|
+
const maxTimeLabelWidth = playerWidth - elementsSize;
|
|
19
|
+
const maxTimeLabelWidthWithoutNegativeValue = Math.max(maxTimeLabelWidth, 0);
|
|
20
|
+
const availableTimeLabelWidthIfVolumeOpen = maxTimeLabelWidthWithoutNegativeValue - MediaVolumeSlider_1.VOLUME_SLIDER_WIDTH;
|
|
21
|
+
// If max label width is lower than the volume width
|
|
22
|
+
// then it means we need to take it's width as the max label width
|
|
23
|
+
// otherwise we took the available width when volume open
|
|
24
|
+
const computedLabelWidth = availableTimeLabelWidthIfVolumeOpen < MediaVolumeSlider_1.VOLUME_SLIDER_WIDTH
|
|
25
|
+
? maxTimeLabelWidthWithoutNegativeValue
|
|
26
|
+
: availableTimeLabelWidthIfVolumeOpen;
|
|
27
|
+
const minWidthForHorizontalDisplay = computedLabelWidth + elementsSize + MediaVolumeSlider_1.VOLUME_SLIDER_WIDTH;
|
|
28
|
+
const displayVerticalVolumeSlider = playerWidth < minWidthForHorizontalDisplay;
|
|
29
|
+
return {
|
|
30
|
+
maxTimeLabelWidth: maxTimeLabelWidthWithoutNegativeValue,
|
|
31
|
+
displayVerticalVolumeSlider,
|
|
32
|
+
};
|
|
33
|
+
}, [allowFullScreen, playerWidth]);
|
|
34
|
+
return resizeInfo;
|
|
35
|
+
};
|
|
36
|
+
exports.useVideoControlsResize = useVideoControlsResize;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StandardLonghandProperties } from 'csstype';
|
|
2
|
-
import { Size } from './use-element-size';
|
|
1
|
+
import type { StandardLonghandProperties } from 'csstype';
|
|
2
|
+
import type { Size } from './use-element-size';
|
|
3
3
|
export declare const calculatePlayerSize: ({ currentSize, width, height, compositionWidth, compositionHeight, }: {
|
|
4
4
|
currentSize: Size | null;
|
|
5
5
|
width: StandardLonghandProperties['width'] | undefined;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CancellablePromise } from './cancellable-promise';
|
|
1
|
+
import type { CancellablePromise } from './cancellable-promise';
|
|
2
2
|
declare const useCancellablePromises: () => {
|
|
3
3
|
appendPendingPromise: (promise: CancellablePromise) => void;
|
|
4
4
|
removePendingPromise: (promise: CancellablePromise) => void;
|
|
File without changes
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { SyntheticEvent } from 'react';
|
|
1
|
+
import type { SyntheticEvent } from 'react';
|
|
2
2
|
declare const useClickPreventionOnDoubleClick: (onClick: (e: SyntheticEvent) => void, onDoubleClick: () => void, doubleClickToFullscreen: boolean) => [(e: SyntheticEvent) => void, () => void];
|
|
3
3
|
export { useClickPreventionOnDoubleClick };
|
|
File without changes
|
|
@@ -3,6 +3,11 @@ export declare type Size = {
|
|
|
3
3
|
height: number;
|
|
4
4
|
left: number;
|
|
5
5
|
top: number;
|
|
6
|
+
windowSize: {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
};
|
|
10
|
+
refresh: () => void;
|
|
6
11
|
};
|
|
7
12
|
export declare const updateAllElementsSizes: () => void;
|
|
8
13
|
export declare const useElementSize: (ref: React.RefObject<HTMLElement>, options: {
|
|
@@ -36,6 +36,10 @@ const useElementSize = (ref, options) => {
|
|
|
36
36
|
height,
|
|
37
37
|
left: newSize[0].x,
|
|
38
38
|
top: newSize[0].y,
|
|
39
|
+
windowSize: {
|
|
40
|
+
height: window.innerHeight,
|
|
41
|
+
width: window.innerWidth,
|
|
42
|
+
},
|
|
39
43
|
});
|
|
40
44
|
});
|
|
41
45
|
}, [options.shouldApplyCssTransforms]);
|
|
@@ -53,6 +57,10 @@ const useElementSize = (ref, options) => {
|
|
|
53
57
|
height: rect[0].height,
|
|
54
58
|
left: rect[0].x,
|
|
55
59
|
top: rect[0].y,
|
|
60
|
+
windowSize: {
|
|
61
|
+
height: window.innerHeight,
|
|
62
|
+
width: window.innerWidth,
|
|
63
|
+
},
|
|
56
64
|
});
|
|
57
65
|
}, [ref]);
|
|
58
66
|
(0, react_1.useEffect)(() => {
|
|
@@ -85,6 +93,6 @@ const useElementSize = (ref, options) => {
|
|
|
85
93
|
elementSizeHooks = elementSizeHooks.filter((e) => e !== updateSize);
|
|
86
94
|
};
|
|
87
95
|
}, [updateSize]);
|
|
88
|
-
return size;
|
|
96
|
+
return size ? { ...size, refresh: updateSize } : null;
|
|
89
97
|
};
|
|
90
98
|
exports.useElementSize = useElementSize;
|
|
@@ -0,0 +1,6 @@
|
|
|
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;
|
|
@@ -0,0 +1,54 @@
|
|
|
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;
|
|
@@ -0,0 +1,27 @@
|
|
|
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;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|