@remotion/player 4.0.177 → 4.0.179
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/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/Player.d.ts +40 -43
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/Player.js +4 -7
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/PlayerControls.d.ts +24 -24
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/PlayerControls.js +3 -3
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/PlayerUI.d.ts +31 -31
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/PlayerUI.js +2 -3
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/SharedPlayerContext.d.ts +9 -9
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/index.d.ts +3 -4
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/test/test-utils.d.ts +1 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/test/test-utils.js +1 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/tsconfig-esm.tsbuildinfo +1 -1
- package/README.md +16 -84
- package/dist/cjs/Player.d.ts +1 -1
- package/dist/cjs/Player.js +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/test/index.test.js +3 -3
- package/dist/cjs/test/validate-in-out-frames.test.js +12 -12
- package/dist/cjs/test/validate-prop.test.js +24 -24
- package/dist/esm/BufferingIndicator.d.ts +5 -0
- package/dist/esm/DefaultPlayPauseButton.d.ts +5 -0
- package/dist/esm/EmitterProvider.d.ts +5 -0
- package/dist/esm/MediaVolumeSlider.d.ts +5 -0
- package/dist/esm/PlaybackrateControl.d.ts +8 -0
- package/dist/esm/Player.d.ts +56 -0
- package/dist/esm/PlayerControls.d.ts +47 -0
- package/dist/esm/PlayerSeekBar.d.ts +8 -0
- package/dist/esm/PlayerUI.d.ts +46 -0
- package/dist/esm/SharedPlayerContext.d.ts +15 -0
- package/dist/esm/Thumbnail.d.ts +23 -0
- package/dist/esm/ThumbnailUI.d.ts +11 -0
- package/dist/esm/calculate-next-frame.d.ts +14 -0
- package/dist/esm/calculate-scale.d.ts +50 -0
- package/dist/esm/emitter-context.d.ts +4 -0
- package/dist/esm/error-boundary.d.ts +19 -0
- package/dist/esm/event-emitter.d.ts +91 -0
- package/dist/esm/format-time.d.ts +1 -0
- package/dist/esm/icons.d.ts +10 -0
- package/dist/esm/index.d.ts +64 -0
- package/dist/esm/is-backgrounded.d.ts +2 -0
- package/dist/esm/player-css-classname.d.ts +1 -0
- package/dist/esm/player-methods.d.ts +25 -0
- package/dist/esm/test/index.test.d.ts +1 -0
- package/dist/esm/test/test-utils.d.ts +6 -0
- package/dist/esm/test/validate-in-out-frames.test.d.ts +1 -0
- package/dist/esm/test/validate-prop.test.d.ts +1 -0
- package/dist/esm/use-buffer-state-emitter.d.ts +2 -0
- package/dist/esm/use-hover-state.d.ts +1 -0
- package/dist/esm/use-playback.d.ts +8 -0
- package/dist/esm/use-player.d.ts +24 -0
- package/dist/esm/use-thumbnail.d.ts +6 -0
- package/dist/esm/use-video-controls-resize.d.ts +11 -0
- package/dist/esm/utils/calculate-player-size.d.ts +9 -0
- package/dist/esm/utils/cancellable-promise.d.ts +5 -0
- package/dist/esm/utils/delay.d.ts +1 -0
- package/dist/esm/utils/is-node.d.ts +1 -0
- package/dist/esm/utils/props-if-has-props.d.ts +10 -0
- package/dist/esm/utils/use-cancellable-promises.d.ts +7 -0
- package/dist/esm/utils/use-click-prevention-on-double-click.d.ts +3 -0
- package/dist/esm/utils/use-component-visible.d.ts +6 -0
- package/dist/esm/utils/use-element-size.d.ts +16 -0
- package/dist/esm/utils/validate-in-out-frame.d.ts +6 -0
- package/dist/esm/utils/validate-initial-frame.d.ts +4 -0
- package/dist/esm/utils/validate-playbackrate.d.ts +1 -0
- package/dist/esm/validate.d.ts +5 -0
- package/dist/esm/volume-persistance.d.ts +2 -0
- package/dist/tsconfig-esm.tsbuildinfo +1 -0
- package/package.json +8 -17
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
4
|
const validate_in_out_frame_js_1 = require("../utils/validate-in-out-frame.js");
|
|
5
|
-
(0,
|
|
6
|
-
(0,
|
|
5
|
+
(0, bun_test_1.test)('Validate in out frames', () => {
|
|
6
|
+
(0, bun_test_1.expect)(() => (0, validate_in_out_frame_js_1.validateInOutFrames)({
|
|
7
7
|
durationInFrames: 200,
|
|
8
8
|
inFrame: 201,
|
|
9
9
|
outFrame: undefined,
|
|
10
10
|
})).toThrow(/inFrame must be less than \(durationInFrames - 1\)/);
|
|
11
|
-
(0,
|
|
11
|
+
(0, bun_test_1.expect)(() => (0, validate_in_out_frame_js_1.validateInOutFrames)({
|
|
12
12
|
durationInFrames: 200,
|
|
13
13
|
inFrame: 199,
|
|
14
14
|
outFrame: 201,
|
|
15
15
|
})).toThrow(/outFrame must be less than \(durationInFrames - 1\)/);
|
|
16
|
-
(0,
|
|
16
|
+
(0, bun_test_1.expect)(() => (0, validate_in_out_frame_js_1.validateInOutFrames)({
|
|
17
17
|
durationInFrames: 200,
|
|
18
18
|
inFrame: -10,
|
|
19
19
|
outFrame: null,
|
|
20
20
|
})).toThrow(/inFrame must be greater than 0, but is -10/);
|
|
21
|
-
(0,
|
|
21
|
+
(0, bun_test_1.expect)(() => (0, validate_in_out_frame_js_1.validateInOutFrames)({
|
|
22
22
|
durationInFrames: 200,
|
|
23
23
|
inFrame: null,
|
|
24
24
|
outFrame: -10,
|
|
25
25
|
})).toThrow(/outFrame must be greater than 0, but is -10/);
|
|
26
|
-
(0,
|
|
26
|
+
(0, bun_test_1.expect)(() => (0, validate_in_out_frame_js_1.validateInOutFrames)({
|
|
27
27
|
durationInFrames: 200,
|
|
28
28
|
inFrame: 1.5,
|
|
29
29
|
outFrame: null,
|
|
30
30
|
})).toThrow(/"inFrame" must be an integer, but is 1.5/);
|
|
31
|
-
(0,
|
|
31
|
+
(0, bun_test_1.expect)(() => (0, validate_in_out_frame_js_1.validateInOutFrames)({
|
|
32
32
|
durationInFrames: 200,
|
|
33
33
|
inFrame: 20,
|
|
34
34
|
outFrame: 20,
|
|
35
35
|
})).toThrow(/outFrame must be greater than inFrame, but is 20/);
|
|
36
|
-
(0,
|
|
36
|
+
(0, bun_test_1.expect)(() => (0, validate_in_out_frame_js_1.validateInOutFrames)({
|
|
37
37
|
durationInFrames: 200,
|
|
38
38
|
inFrame: 21,
|
|
39
39
|
outFrame: 20,
|
|
40
40
|
})).toThrow(/outFrame must be greater than inFrame, but is 20 <= 21/);
|
|
41
|
-
(0,
|
|
41
|
+
(0, bun_test_1.expect)(() => (0, validate_in_out_frame_js_1.validateInOutFrames)({
|
|
42
42
|
durationInFrames: 200,
|
|
43
43
|
inFrame: null,
|
|
44
44
|
outFrame: 20,
|
|
45
45
|
})).not.toThrow();
|
|
46
|
-
(0,
|
|
46
|
+
(0, bun_test_1.expect)(() => (0, validate_in_out_frame_js_1.validateInOutFrames)({
|
|
47
47
|
durationInFrames: 200,
|
|
48
48
|
inFrame: null,
|
|
49
49
|
outFrame: null,
|
|
50
50
|
})).not.toThrow();
|
|
51
|
-
(0,
|
|
51
|
+
(0, bun_test_1.expect)(() => (0, validate_in_out_frame_js_1.validateInOutFrames)({
|
|
52
52
|
durationInFrames: 200,
|
|
53
53
|
inFrame: 10,
|
|
54
54
|
outFrame: 20,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const bun_test_1 = require("bun:test");
|
|
4
5
|
const remotion_1 = require("remotion");
|
|
5
|
-
const vitest_1 = require("vitest");
|
|
6
6
|
const index_js_1 = require("../index.js");
|
|
7
7
|
const test_utils_js_1 = require("./test-utils.js");
|
|
8
|
-
(0,
|
|
8
|
+
(0, bun_test_1.test)('no compositionWidth should give errors', () => {
|
|
9
9
|
try {
|
|
10
10
|
(0, test_utils_js_1.render)((0, jsx_runtime_1.jsx)(index_js_1.Player
|
|
11
11
|
// @ts-expect-error
|
|
@@ -14,27 +14,27 @@ const test_utils_js_1 = require("./test-utils.js");
|
|
|
14
14
|
compositionWidth: null, errorFallback: () => 'something went wrong', compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_js_1.HelloWorld, controls: true, showVolumeControls: true }));
|
|
15
15
|
}
|
|
16
16
|
catch (e) {
|
|
17
|
-
(0,
|
|
17
|
+
(0, bun_test_1.expect)(e.message).toMatch(/'compositionWidth' must be a number but got 'object' instead/);
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
(0,
|
|
20
|
+
(0, bun_test_1.test)('no compositionHeight should give errors', () => {
|
|
21
21
|
try {
|
|
22
22
|
(0, test_utils_js_1.render)((0, jsx_runtime_1.jsx)(index_js_1.Player, { compositionWidth: 400, errorFallback: () => 'something went wrong',
|
|
23
23
|
// @ts-expect-error
|
|
24
24
|
compositionHeight: undefined, fps: 30, durationInFrames: 500, component: test_utils_js_1.HelloWorld, controls: true, showVolumeControls: true }));
|
|
25
25
|
}
|
|
26
26
|
catch (e) {
|
|
27
|
-
(0,
|
|
27
|
+
(0, bun_test_1.expect)(e.message).toMatch(/'compositionHeight' must be a number but got 'undefined' instead/);
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
(0,
|
|
30
|
+
(0, bun_test_1.test)('No fps should give errors', () => {
|
|
31
31
|
try {
|
|
32
32
|
(0, test_utils_js_1.render)((0, jsx_runtime_1.jsx)(index_js_1.Player, { compositionWidth: 500, compositionHeight: 400, errorFallback: () => 'something went wrong',
|
|
33
33
|
// @ts-expect-error
|
|
34
34
|
fps: null, durationInFrames: 500, component: test_utils_js_1.HelloWorld, controls: true, showVolumeControls: true }));
|
|
35
35
|
}
|
|
36
36
|
catch (e) {
|
|
37
|
-
(0,
|
|
37
|
+
(0, bun_test_1.expect)(e.message).toMatch(/"fps" must be a number, but you passed a value of type object/);
|
|
38
38
|
}
|
|
39
39
|
try {
|
|
40
40
|
(0, test_utils_js_1.render)((0, jsx_runtime_1.jsx)(index_js_1.Player, { compositionWidth: 500, compositionHeight: 400, errorFallback: () => 'something went wrong',
|
|
@@ -42,51 +42,51 @@ const test_utils_js_1 = require("./test-utils.js");
|
|
|
42
42
|
fps: undefined, durationInFrames: 500, component: test_utils_js_1.HelloWorld, controls: true, showVolumeControls: true }));
|
|
43
43
|
}
|
|
44
44
|
catch (e) {
|
|
45
|
-
(0,
|
|
45
|
+
(0, bun_test_1.expect)(e.message).toMatch(/"fps" must be a number, but you passed a value of type undefined/);
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
(0,
|
|
48
|
+
(0, bun_test_1.test)('No durationInFrames should give errors', () => {
|
|
49
49
|
try {
|
|
50
50
|
(0, test_utils_js_1.render)((0, jsx_runtime_1.jsx)(index_js_1.Player, { compositionWidth: 500, compositionHeight: 400, errorFallback: () => 'something went wrong', fps: 30,
|
|
51
51
|
// @ts-expect-error
|
|
52
52
|
durationInFrames: undefined, component: test_utils_js_1.HelloWorld, controls: true, showVolumeControls: true }));
|
|
53
53
|
}
|
|
54
54
|
catch (e) {
|
|
55
|
-
(0,
|
|
55
|
+
(0, bun_test_1.expect)(e.message).toMatch(/durationInFrames` must be a number, but is undefined/);
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
(0,
|
|
58
|
+
(0, bun_test_1.test)('Invalid playbackRate should give error', () => {
|
|
59
59
|
try {
|
|
60
60
|
(0, test_utils_js_1.render)((0, jsx_runtime_1.jsx)(index_js_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_js_1.HelloWorld, controls: true, showVolumeControls: true, playbackRate: -5, inputProps: {} }));
|
|
61
61
|
}
|
|
62
62
|
catch (e) {
|
|
63
|
-
(0,
|
|
63
|
+
(0, bun_test_1.expect)(e.message).toMatch(/The lowest possible playback rate is -4. You passed: -5/);
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
-
(0,
|
|
66
|
+
(0, bun_test_1.test)('playbackRate of 0 should not be possible', () => {
|
|
67
67
|
try {
|
|
68
68
|
(0, test_utils_js_1.render)((0, jsx_runtime_1.jsx)(index_js_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_js_1.HelloWorld, controls: true, showVolumeControls: true, playbackRate: 0 }));
|
|
69
69
|
}
|
|
70
70
|
catch (e) {
|
|
71
|
-
(0,
|
|
71
|
+
(0, bun_test_1.expect)(e.message).toMatch(/A playback rate of 0 is not supported./);
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
|
-
(0,
|
|
74
|
+
(0, bun_test_1.test)('playbackRate of wrong type should not be possible', () => {
|
|
75
75
|
try {
|
|
76
76
|
(0, test_utils_js_1.render)((0, jsx_runtime_1.jsx)(index_js_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_js_1.HelloWorld, controls: true, showVolumeControls: true,
|
|
77
77
|
// @ts-expect-error
|
|
78
78
|
playbackRate: 'hi' }));
|
|
79
79
|
}
|
|
80
80
|
catch (e) {
|
|
81
|
-
(0,
|
|
81
|
+
(0, bun_test_1.expect)(e.message).toMatch(/A playback rate of 0 is not supported./);
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
(0,
|
|
84
|
+
(0, bun_test_1.test)('playbackRate of undefined should be okay', () => {
|
|
85
85
|
(0, test_utils_js_1.render)((0, jsx_runtime_1.jsx)(index_js_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_js_1.HelloWorld, controls: true, showVolumeControls: true }));
|
|
86
|
-
(0,
|
|
86
|
+
(0, bun_test_1.expect)(true).toBe(true);
|
|
87
87
|
});
|
|
88
|
-
(0,
|
|
89
|
-
(0,
|
|
88
|
+
(0, bun_test_1.test)('passing in <Composition /> instance should not be possible', () => {
|
|
89
|
+
(0, bun_test_1.expect)(() => {
|
|
90
90
|
(0, test_utils_js_1.render)((0, jsx_runtime_1.jsx)(index_js_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: remotion_1.Composition, controls: true, showVolumeControls: true, inputProps: {
|
|
91
91
|
id: 'HelloWorld',
|
|
92
92
|
width: 500,
|
|
@@ -97,8 +97,8 @@ const test_utils_js_1 = require("./test-utils.js");
|
|
|
97
97
|
} }));
|
|
98
98
|
}).toThrow(/'component' must not be the 'Composition' component\. Pass your own React/);
|
|
99
99
|
});
|
|
100
|
-
(0,
|
|
101
|
-
(0,
|
|
100
|
+
(0, bun_test_1.test)('passing in <Composition /> instance should not be possible', () => {
|
|
101
|
+
(0, bun_test_1.expect)(() => {
|
|
102
102
|
(0, test_utils_js_1.render)((0, jsx_runtime_1.jsx)(index_js_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500,
|
|
103
103
|
// @ts-expect-error
|
|
104
104
|
component: (0, jsx_runtime_1.jsx)(remotion_1.Composition, { durationInFrames: 30, fps: 30, height: 10, width: 10, id: "hello", component: test_utils_js_1.HelloWorld }), controls: true, showVolumeControls: true, inputProps: {
|
|
@@ -111,7 +111,7 @@ const test_utils_js_1 = require("./test-utils.js");
|
|
|
111
111
|
} }));
|
|
112
112
|
}).toThrow(/'component' should not be an instance of <Composition\/>\. Pass the React component dir/);
|
|
113
113
|
});
|
|
114
|
-
|
|
114
|
+
bun_test_1.test.each([
|
|
115
115
|
['controls'],
|
|
116
116
|
['loop'],
|
|
117
117
|
['autoPlay'],
|
|
@@ -126,6 +126,6 @@ vitest_1.test.each([
|
|
|
126
126
|
(0, test_utils_js_1.render)((0, jsx_runtime_1.jsx)(index_js_1.Player, { compositionWidth: 500, compositionHeight: 400, errorFallback: () => 'something went wrong', fps: 30, durationInFrames: 100, component: test_utils_js_1.HelloWorld, ...props }));
|
|
127
127
|
}
|
|
128
128
|
catch (e) {
|
|
129
|
-
(0,
|
|
129
|
+
(0, bun_test_1.expect)(e.message).toMatch(`'${a}' must be a boolean or undefined but got 'string' instead`);
|
|
130
130
|
}
|
|
131
131
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Size } from './utils/use-element-size.js';
|
|
3
|
+
export declare const Checkmark: () => import("react/jsx-runtime.js").JSX.Element;
|
|
4
|
+
export declare const playerButtonStyle: React.CSSProperties;
|
|
5
|
+
export declare const PlaybackrateControl: React.FC<{
|
|
6
|
+
playbackRates: number[];
|
|
7
|
+
canvasSize: Size;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { CompProps } from 'remotion';
|
|
4
|
+
import type { AnyZodObject } from 'zod';
|
|
5
|
+
import type { PlayerRef } from './player-methods.js';
|
|
6
|
+
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls.js';
|
|
7
|
+
import type { PosterFillMode, RenderLoading, RenderPoster } from './PlayerUI.js';
|
|
8
|
+
import type { PropsIfHasProps } from './utils/props-if-has-props.js';
|
|
9
|
+
export type ErrorFallback = (info: {
|
|
10
|
+
error: Error;
|
|
11
|
+
}) => React.ReactNode;
|
|
12
|
+
export type PlayerProps<Schema extends AnyZodObject, Props> = {
|
|
13
|
+
durationInFrames: number;
|
|
14
|
+
compositionWidth: number;
|
|
15
|
+
compositionHeight: number;
|
|
16
|
+
fps: number;
|
|
17
|
+
showVolumeControls?: boolean;
|
|
18
|
+
controls?: boolean;
|
|
19
|
+
errorFallback?: ErrorFallback;
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
loop?: boolean;
|
|
22
|
+
autoPlay?: boolean;
|
|
23
|
+
allowFullscreen?: boolean;
|
|
24
|
+
clickToPlay?: boolean;
|
|
25
|
+
doubleClickToFullscreen?: boolean;
|
|
26
|
+
spaceKeyToPlayOrPause?: boolean;
|
|
27
|
+
numberOfSharedAudioTags?: number;
|
|
28
|
+
playbackRate?: number;
|
|
29
|
+
renderLoading?: RenderLoading;
|
|
30
|
+
moveToBeginningWhenEnded?: boolean;
|
|
31
|
+
className?: string;
|
|
32
|
+
initialFrame?: number;
|
|
33
|
+
renderPoster?: RenderPoster;
|
|
34
|
+
showPosterWhenPaused?: boolean;
|
|
35
|
+
showPosterWhenEnded?: boolean;
|
|
36
|
+
showPosterWhenUnplayed?: boolean;
|
|
37
|
+
showPosterWhenBuffering?: boolean;
|
|
38
|
+
inFrame?: number | null;
|
|
39
|
+
outFrame?: number | null;
|
|
40
|
+
initiallyShowControls?: number | boolean;
|
|
41
|
+
renderPlayPauseButton?: RenderPlayPauseButton;
|
|
42
|
+
renderFullscreenButton?: RenderFullscreenButton;
|
|
43
|
+
alwaysShowControls?: boolean;
|
|
44
|
+
schema?: Schema;
|
|
45
|
+
initiallyMuted?: boolean;
|
|
46
|
+
showPlaybackRateControl?: boolean | number[];
|
|
47
|
+
posterFillMode?: PosterFillMode;
|
|
48
|
+
bufferStateDelayInMilliseconds?: number;
|
|
49
|
+
hideControlsWhenPointerDoesntMove?: boolean | number;
|
|
50
|
+
} & CompProps<Props> & PropsIfHasProps<Schema, Props>;
|
|
51
|
+
export declare const componentOrNullIfLazy: <Props>(props: CompProps<Props>) => ComponentType<Props> | null;
|
|
52
|
+
/**
|
|
53
|
+
* @description A component which can be rendered in a regular React App (for example: Vite, Next.js) to display a Remotion video.
|
|
54
|
+
* @see [Documentation](https://www.remotion.dev/docs/player/player)
|
|
55
|
+
*/
|
|
56
|
+
export declare const Player: <Schema extends AnyZodObject, Props>(props: PlayerProps<Schema, Props> & React.RefAttributes<PlayerRef>) => React.ReactElement | null;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { usePlayer } from './use-player.js';
|
|
4
|
+
import type { Size } from './utils/use-element-size.js';
|
|
5
|
+
export type RenderPlayPauseButton = (props: {
|
|
6
|
+
playing: boolean;
|
|
7
|
+
isBuffering: boolean;
|
|
8
|
+
}) => ReactNode | null;
|
|
9
|
+
export type RenderFullscreenButton = (props: {
|
|
10
|
+
isFullscreen: boolean;
|
|
11
|
+
}) => ReactNode;
|
|
12
|
+
declare global {
|
|
13
|
+
interface Document {
|
|
14
|
+
webkitFullscreenEnabled?: boolean;
|
|
15
|
+
webkitFullscreenElement?: Element;
|
|
16
|
+
webkitExitFullscreen?: Document['exitFullscreen'];
|
|
17
|
+
}
|
|
18
|
+
interface HTMLDivElement {
|
|
19
|
+
webkitRequestFullScreen: HTMLDivElement['requestFullscreen'];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export declare const Controls: React.FC<{
|
|
23
|
+
fps: number;
|
|
24
|
+
durationInFrames: number;
|
|
25
|
+
showVolumeControls: boolean;
|
|
26
|
+
player: ReturnType<typeof usePlayer>;
|
|
27
|
+
onFullscreenButtonClick: MouseEventHandler<HTMLButtonElement>;
|
|
28
|
+
isFullscreen: boolean;
|
|
29
|
+
allowFullscreen: boolean;
|
|
30
|
+
onExitFullscreenButtonClick: MouseEventHandler<HTMLButtonElement>;
|
|
31
|
+
spaceKeyToPlayOrPause: boolean;
|
|
32
|
+
onSeekEnd: () => void;
|
|
33
|
+
onSeekStart: () => void;
|
|
34
|
+
inFrame: number | null;
|
|
35
|
+
outFrame: number | null;
|
|
36
|
+
initiallyShowControls: number | boolean;
|
|
37
|
+
canvasSize: Size | null;
|
|
38
|
+
renderPlayPauseButton: RenderPlayPauseButton | null;
|
|
39
|
+
renderFullscreenButton: RenderFullscreenButton | null;
|
|
40
|
+
alwaysShowControls: boolean;
|
|
41
|
+
showPlaybackRateControl: boolean | number[];
|
|
42
|
+
containerRef: React.RefObject<HTMLDivElement>;
|
|
43
|
+
buffering: boolean;
|
|
44
|
+
hideControlsWhenPointerDoesntMove: boolean | number;
|
|
45
|
+
onPointerUp: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
46
|
+
onDoubleClick: MouseEventHandler<HTMLDivElement> | undefined;
|
|
47
|
+
}>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PlayerRef } from './player-methods.js';
|
|
3
|
+
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls.js';
|
|
4
|
+
export type ErrorFallback = (info: {
|
|
5
|
+
error: Error;
|
|
6
|
+
}) => React.ReactNode;
|
|
7
|
+
export type RenderLoading = (canvas: {
|
|
8
|
+
height: number;
|
|
9
|
+
width: number;
|
|
10
|
+
isBuffering: boolean;
|
|
11
|
+
}) => React.ReactNode;
|
|
12
|
+
export type RenderPoster = RenderLoading;
|
|
13
|
+
export type PosterFillMode = 'player-size' | 'composition-size';
|
|
14
|
+
declare const _default: React.ForwardRefExoticComponent<{
|
|
15
|
+
controls: boolean;
|
|
16
|
+
loop: boolean;
|
|
17
|
+
autoPlay: boolean;
|
|
18
|
+
allowFullscreen: boolean;
|
|
19
|
+
inputProps: Record<string, unknown>;
|
|
20
|
+
showVolumeControls: boolean;
|
|
21
|
+
style?: React.CSSProperties | undefined;
|
|
22
|
+
clickToPlay: boolean;
|
|
23
|
+
doubleClickToFullscreen: boolean;
|
|
24
|
+
spaceKeyToPlayOrPause: boolean;
|
|
25
|
+
errorFallback: ErrorFallback;
|
|
26
|
+
playbackRate: number;
|
|
27
|
+
renderLoading: RenderLoading | undefined;
|
|
28
|
+
renderPoster: RenderLoading | undefined;
|
|
29
|
+
className: string | undefined;
|
|
30
|
+
moveToBeginningWhenEnded: boolean;
|
|
31
|
+
showPosterWhenPaused: boolean;
|
|
32
|
+
showPosterWhenEnded: boolean;
|
|
33
|
+
showPosterWhenUnplayed: boolean;
|
|
34
|
+
showPosterWhenBuffering: boolean;
|
|
35
|
+
inFrame: number | null;
|
|
36
|
+
outFrame: number | null;
|
|
37
|
+
initiallyShowControls: number | boolean;
|
|
38
|
+
renderPlayPauseButton: RenderPlayPauseButton | null;
|
|
39
|
+
renderFullscreen: RenderFullscreenButton | null;
|
|
40
|
+
alwaysShowControls: boolean;
|
|
41
|
+
showPlaybackRateControl: boolean | number[];
|
|
42
|
+
posterFillMode: PosterFillMode;
|
|
43
|
+
bufferStateDelayInMilliseconds: number;
|
|
44
|
+
hideControlsWhenPointerDoesntMove: number | boolean;
|
|
45
|
+
} & React.RefAttributes<PlayerRef>>;
|
|
46
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentType, LazyExoticComponent } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { TimelineContextValue } from 'remotion';
|
|
4
|
+
export declare const PLAYER_COMP_ID = "player-comp";
|
|
5
|
+
export declare const SharedPlayerContexts: React.FC<{
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
timelineContext: TimelineContextValue;
|
|
8
|
+
fps: number;
|
|
9
|
+
compositionWidth: number;
|
|
10
|
+
compositionHeight: number;
|
|
11
|
+
durationInFrames: number;
|
|
12
|
+
component: LazyExoticComponent<ComponentType<unknown>>;
|
|
13
|
+
numberOfSharedAudioTags: number;
|
|
14
|
+
initiallyMuted: boolean;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { CompProps } from 'remotion';
|
|
3
|
+
import type { AnyZodObject } from 'zod';
|
|
4
|
+
import type { ThumbnailMethods } from './player-methods.js';
|
|
5
|
+
import type { ErrorFallback, RenderLoading } from './PlayerUI.js';
|
|
6
|
+
import type { PropsIfHasProps } from './utils/props-if-has-props.js';
|
|
7
|
+
type ThumbnailProps<Schema extends AnyZodObject, Props extends Record<string, unknown>> = PropsIfHasProps<Schema, Props> & CompProps<Props> & {
|
|
8
|
+
frameToDisplay: number;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
durationInFrames: number;
|
|
11
|
+
compositionWidth: number;
|
|
12
|
+
compositionHeight: number;
|
|
13
|
+
fps: number;
|
|
14
|
+
errorFallback?: ErrorFallback;
|
|
15
|
+
renderLoading?: RenderLoading;
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @description A component which can be rendered in a regular React App (for example: Next.js, Vite) to display a single frame of a video.
|
|
20
|
+
* @see [Documentation](https://www.remotion.dev/docs/player/thumbnail)
|
|
21
|
+
*/
|
|
22
|
+
export declare const Thumbnail: <Schema extends AnyZodObject, Props extends Record<string, unknown>>(props: ThumbnailProps<Schema, Props> & import("react").RefAttributes<ThumbnailMethods>) => React.ReactElement | null;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ThumbnailMethods } from './player-methods.js';
|
|
3
|
+
import type { ErrorFallback, RenderLoading } from './PlayerUI.js';
|
|
4
|
+
declare const _default: React.ForwardRefExoticComponent<{
|
|
5
|
+
inputProps: Record<string, unknown>;
|
|
6
|
+
style?: React.CSSProperties | undefined;
|
|
7
|
+
errorFallback: ErrorFallback;
|
|
8
|
+
renderLoading: RenderLoading | undefined;
|
|
9
|
+
className: string | undefined;
|
|
10
|
+
} & React.RefAttributes<ThumbnailMethods>>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const calculateNextFrame: ({ time, currentFrame: startFrame, playbackSpeed, fps, actualLastFrame, actualFirstFrame, framesAdvanced, shouldLoop, }: {
|
|
2
|
+
time: number;
|
|
3
|
+
currentFrame: number;
|
|
4
|
+
playbackSpeed: number;
|
|
5
|
+
fps: number;
|
|
6
|
+
actualFirstFrame: number;
|
|
7
|
+
actualLastFrame: number;
|
|
8
|
+
framesAdvanced: number;
|
|
9
|
+
shouldLoop: boolean;
|
|
10
|
+
}) => {
|
|
11
|
+
nextFrame: number;
|
|
12
|
+
framesToAdvance: number;
|
|
13
|
+
hasEnded: boolean;
|
|
14
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { PreviewSize, VideoConfig } from 'remotion';
|
|
2
|
+
import type { Size } from './utils/use-element-size.js';
|
|
3
|
+
type Layout = {
|
|
4
|
+
centerX: number;
|
|
5
|
+
centerY: number;
|
|
6
|
+
xCorrection: number;
|
|
7
|
+
yCorrection: number;
|
|
8
|
+
scale: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const calculateCanvasTransformation: ({ previewSize, compositionWidth, compositionHeight, canvasSize, }: {
|
|
11
|
+
previewSize: PreviewSize['size'];
|
|
12
|
+
compositionWidth: number;
|
|
13
|
+
compositionHeight: number;
|
|
14
|
+
canvasSize: Size;
|
|
15
|
+
}) => Layout;
|
|
16
|
+
export declare const calculateOuterStyle: ({ config, style, canvasSize, }: {
|
|
17
|
+
config: VideoConfig | null;
|
|
18
|
+
style: React.CSSProperties | undefined;
|
|
19
|
+
canvasSize: Size | null;
|
|
20
|
+
}) => React.CSSProperties;
|
|
21
|
+
export declare const calculateContainerStyle: ({ config, canvasSize, layout, scale, }: {
|
|
22
|
+
config: VideoConfig | null;
|
|
23
|
+
canvasSize: Size | null;
|
|
24
|
+
layout: Layout | null;
|
|
25
|
+
scale: number;
|
|
26
|
+
}) => React.CSSProperties;
|
|
27
|
+
export declare const calculateOuter: ({ layout, scale, config, }: {
|
|
28
|
+
layout: Layout | null;
|
|
29
|
+
scale: number;
|
|
30
|
+
config: VideoConfig | null;
|
|
31
|
+
}) => {
|
|
32
|
+
readonly width?: undefined;
|
|
33
|
+
readonly height?: undefined;
|
|
34
|
+
readonly display?: undefined;
|
|
35
|
+
readonly flexDirection?: undefined;
|
|
36
|
+
readonly position?: undefined;
|
|
37
|
+
readonly left?: undefined;
|
|
38
|
+
readonly top?: undefined;
|
|
39
|
+
readonly overflow?: undefined;
|
|
40
|
+
} | {
|
|
41
|
+
readonly width: number;
|
|
42
|
+
readonly height: number;
|
|
43
|
+
readonly display: "flex";
|
|
44
|
+
readonly flexDirection: "column";
|
|
45
|
+
readonly position: "absolute";
|
|
46
|
+
readonly left: number;
|
|
47
|
+
readonly top: number;
|
|
48
|
+
readonly overflow: "hidden";
|
|
49
|
+
};
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PlayerEmitter, ThumbnailEmitter } from './event-emitter.js';
|
|
3
|
+
export declare const PlayerEventEmitterContext: React.Context<PlayerEmitter | undefined>;
|
|
4
|
+
export declare const ThumbnailEmitterContext: React.Context<ThumbnailEmitter | undefined>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare class ErrorBoundary extends React.Component<{
|
|
3
|
+
onError: (error: Error) => void;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
errorFallback: (info: {
|
|
6
|
+
error: Error;
|
|
7
|
+
}) => React.ReactNode;
|
|
8
|
+
}, {
|
|
9
|
+
hasError: Error | null;
|
|
10
|
+
}> {
|
|
11
|
+
state: {
|
|
12
|
+
hasError: null;
|
|
13
|
+
};
|
|
14
|
+
static getDerivedStateFromError(error: Error): {
|
|
15
|
+
hasError: Error;
|
|
16
|
+
};
|
|
17
|
+
componentDidCatch(error: Error): void;
|
|
18
|
+
render(): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
19
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
type SeekPayload = {
|
|
2
|
+
frame: number;
|
|
3
|
+
};
|
|
4
|
+
type ErrorPayload = {
|
|
5
|
+
error: Error;
|
|
6
|
+
};
|
|
7
|
+
type TimeUpdateEventPayload = {
|
|
8
|
+
frame: number;
|
|
9
|
+
};
|
|
10
|
+
type FrameUpdateEventPayload = {
|
|
11
|
+
frame: number;
|
|
12
|
+
};
|
|
13
|
+
type RateChangeEventPayload = {
|
|
14
|
+
playbackRate: number;
|
|
15
|
+
};
|
|
16
|
+
type ScaleChangeEventPayload = {
|
|
17
|
+
scale: number;
|
|
18
|
+
};
|
|
19
|
+
type VolumeChangeEventPayload = {
|
|
20
|
+
volume: number;
|
|
21
|
+
};
|
|
22
|
+
type FullscreenChangeEventPayload = {
|
|
23
|
+
isFullscreen: boolean;
|
|
24
|
+
};
|
|
25
|
+
type MuteChangeEventPayload = {
|
|
26
|
+
isMuted: boolean;
|
|
27
|
+
};
|
|
28
|
+
type WaitingEventPayload = {};
|
|
29
|
+
type ResumeEventPayload = {};
|
|
30
|
+
type PlayerStateEventMap = {
|
|
31
|
+
seeked: SeekPayload;
|
|
32
|
+
pause: undefined;
|
|
33
|
+
play: undefined;
|
|
34
|
+
ratechange: RateChangeEventPayload;
|
|
35
|
+
scalechange: ScaleChangeEventPayload;
|
|
36
|
+
volumechange: VolumeChangeEventPayload;
|
|
37
|
+
ended: undefined;
|
|
38
|
+
error: ErrorPayload;
|
|
39
|
+
timeupdate: TimeUpdateEventPayload;
|
|
40
|
+
frameupdate: FrameUpdateEventPayload;
|
|
41
|
+
fullscreenchange: FullscreenChangeEventPayload;
|
|
42
|
+
mutechange: MuteChangeEventPayload;
|
|
43
|
+
waiting: WaitingEventPayload;
|
|
44
|
+
resume: ResumeEventPayload;
|
|
45
|
+
};
|
|
46
|
+
type ThumbnailStateEventMap = {
|
|
47
|
+
error: ErrorPayload;
|
|
48
|
+
waiting: WaitingEventPayload;
|
|
49
|
+
resume: ResumeEventPayload;
|
|
50
|
+
};
|
|
51
|
+
export type PlayerEventTypes = keyof PlayerStateEventMap;
|
|
52
|
+
export type ThumbnailEventTypes = keyof ThumbnailStateEventMap;
|
|
53
|
+
export type CallbackListener<T extends PlayerEventTypes> = (data: {
|
|
54
|
+
detail: PlayerStateEventMap[T];
|
|
55
|
+
}) => void;
|
|
56
|
+
type PlayerListeners = {
|
|
57
|
+
[EventType in PlayerEventTypes]: CallbackListener<EventType>[];
|
|
58
|
+
};
|
|
59
|
+
type ThumbnailListeners = {
|
|
60
|
+
[EventType in ThumbnailEventTypes]: CallbackListener<EventType>[];
|
|
61
|
+
};
|
|
62
|
+
export declare class PlayerEmitter {
|
|
63
|
+
listeners: PlayerListeners;
|
|
64
|
+
addEventListener<Q extends PlayerEventTypes>(name: Q, callback: CallbackListener<Q>): void;
|
|
65
|
+
removeEventListener<Q extends PlayerEventTypes>(name: Q, callback: CallbackListener<Q>): void;
|
|
66
|
+
private dispatchEvent;
|
|
67
|
+
dispatchSeek(frame: number): void;
|
|
68
|
+
dispatchVolumeChange(volume: number): void;
|
|
69
|
+
dispatchPause(): void;
|
|
70
|
+
dispatchPlay(): void;
|
|
71
|
+
dispatchEnded(): void;
|
|
72
|
+
dispatchRateChange(playbackRate: number): void;
|
|
73
|
+
dispatchScaleChange(scale: number): void;
|
|
74
|
+
dispatchError(error: Error): void;
|
|
75
|
+
dispatchTimeUpdate(event: TimeUpdateEventPayload): void;
|
|
76
|
+
dispatchFrameUpdate(event: FrameUpdateEventPayload): void;
|
|
77
|
+
dispatchFullscreenChange(event: FullscreenChangeEventPayload): void;
|
|
78
|
+
dispatchMuteChange(event: MuteChangeEventPayload): void;
|
|
79
|
+
dispatchWaiting(event: WaitingEventPayload): void;
|
|
80
|
+
dispatchResume(event: ResumeEventPayload): void;
|
|
81
|
+
}
|
|
82
|
+
export declare class ThumbnailEmitter {
|
|
83
|
+
listeners: ThumbnailListeners;
|
|
84
|
+
addEventListener<Q extends ThumbnailEventTypes>(name: Q, callback: CallbackListener<Q>): void;
|
|
85
|
+
removeEventListener<Q extends ThumbnailEventTypes>(name: Q, callback: CallbackListener<Q>): void;
|
|
86
|
+
private dispatchEvent;
|
|
87
|
+
dispatchError(error: Error): void;
|
|
88
|
+
dispatchWaiting(event: WaitingEventPayload): void;
|
|
89
|
+
dispatchResume(event: ResumeEventPayload): void;
|
|
90
|
+
}
|
|
91
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatTime: (timeInSeconds: number) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const ICON_SIZE = 25;
|
|
3
|
+
export declare const fullscreenIconSize = 16;
|
|
4
|
+
export declare const PlayIcon: React.FC;
|
|
5
|
+
export declare const PauseIcon: React.FC;
|
|
6
|
+
export declare const FullscreenIcon: React.FC<{
|
|
7
|
+
isFullscreen: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const VolumeOffIcon: React.FC;
|
|
10
|
+
export declare const VolumeOnIcon: React.FC;
|