@remotion/player 4.0.0-alpha.217 → 4.0.0-alpha4
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/cjs/Player.d.ts +4 -6
- package/dist/cjs/Player.js +1 -1
- package/dist/cjs/PlayerUI.js +11 -2
- package/dist/cjs/SharedPlayerContext.js +0 -1
- package/dist/cjs/Thumbnail.d.ts +4 -4
- package/dist/cjs/event-emitter.d.ts +12 -2
- package/dist/cjs/event-emitter.js +14 -2
- package/dist/cjs/is-backgrounded.d.ts +2 -0
- package/dist/cjs/is-backgrounded.js +24 -0
- package/dist/cjs/player-methods.d.ts +1 -1
- package/dist/cjs/test/validate-prop.test.js +1 -1
- package/dist/cjs/use-playback.js +42 -5
- package/dist/cjs/utils/props-if-has-props.d.ts +2 -7
- package/dist/esm/Player.d.ts +4 -6
- package/dist/esm/Thumbnail.d.ts +4 -4
- package/dist/esm/event-emitter.d.ts +12 -2
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.mjs +87 -11
- package/dist/esm/is-backgrounded.d.ts +2 -0
- package/dist/esm/player-methods.d.ts +1 -1
- package/dist/esm/utils/props-if-has-props.d.ts +2 -7
- package/dist/tsconfig-esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +77 -79
package/dist/cjs/Player.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { CompProps } from 'remotion';
|
|
4
|
-
import type { z } from 'zod';
|
|
5
4
|
import type { PlayerRef } from './player-methods.js';
|
|
6
5
|
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls.js';
|
|
7
6
|
import type { RenderLoading, RenderPoster } from './PlayerUI.js';
|
|
@@ -9,7 +8,7 @@ import type { PropsIfHasProps } from './utils/props-if-has-props.js';
|
|
|
9
8
|
export declare type ErrorFallback = (info: {
|
|
10
9
|
error: Error;
|
|
11
10
|
}) => React.ReactNode;
|
|
12
|
-
export declare type PlayerProps<
|
|
11
|
+
export declare type PlayerProps<T> = {
|
|
13
12
|
durationInFrames: number;
|
|
14
13
|
compositionWidth: number;
|
|
15
14
|
compositionHeight: number;
|
|
@@ -40,12 +39,11 @@ export declare type PlayerProps<Schema extends z.ZodTypeAny, Props> = {
|
|
|
40
39
|
renderPlayPauseButton?: RenderPlayPauseButton;
|
|
41
40
|
renderFullscreenButton?: RenderFullscreenButton;
|
|
42
41
|
alwaysShowControls?: boolean;
|
|
43
|
-
schema?: Schema;
|
|
44
42
|
initiallyMuted?: boolean;
|
|
45
|
-
} &
|
|
46
|
-
export declare const componentOrNullIfLazy: <
|
|
43
|
+
} & PropsIfHasProps<T> & CompProps<T>;
|
|
44
|
+
export declare const componentOrNullIfLazy: <T>(props: CompProps<T>) => ComponentType<T> | null;
|
|
47
45
|
/**
|
|
48
46
|
* @description A component which can be rendered in a regular React App (for example: Create React App, Next.js) to display a Remotion video.
|
|
49
47
|
* @see [Documentation](https://www.remotion.dev/docs/player/player)
|
|
50
48
|
*/
|
|
51
|
-
export declare const Player: <
|
|
49
|
+
export declare const Player: <T>(props: PlayerProps<T> & React.RefAttributes<PlayerRef>) => React.ReactElement | null;
|
package/dist/cjs/Player.js
CHANGED
|
@@ -106,7 +106,7 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
106
106
|
}
|
|
107
107
|
(0, validate_playbackrate_js_1.validatePlaybackRate)(playbackRate);
|
|
108
108
|
(0, react_1.useEffect)(() => {
|
|
109
|
-
emitter.
|
|
109
|
+
emitter.dispatchRateChange(playbackRate);
|
|
110
110
|
}, [emitter, playbackRate]);
|
|
111
111
|
(0, react_1.useImperativeHandle)(ref, () => rootRef.current, []);
|
|
112
112
|
const timelineContextValue = (0, react_1.useMemo)(() => {
|
package/dist/cjs/PlayerUI.js
CHANGED
|
@@ -128,12 +128,12 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
128
128
|
var _a;
|
|
129
129
|
const element = (_a = document.webkitFullscreenElement) !== null && _a !== void 0 ? _a : document.fullscreenElement;
|
|
130
130
|
if (element && element === container.current) {
|
|
131
|
-
player.emitter.
|
|
131
|
+
player.emitter.dispatchFullscreenChange({
|
|
132
132
|
isFullscreen: true,
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
else {
|
|
136
|
-
player.emitter.
|
|
136
|
+
player.emitter.dispatchFullscreenChange({
|
|
137
137
|
isFullscreen: false,
|
|
138
138
|
});
|
|
139
139
|
}
|
|
@@ -158,6 +158,14 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
158
158
|
});
|
|
159
159
|
}, [canvasSize, config]);
|
|
160
160
|
const scale = (_b = layout === null || layout === void 0 ? void 0 : layout.scale) !== null && _b !== void 0 ? _b : 1;
|
|
161
|
+
const initialScaleIgnored = (0, react_1.useRef)(false);
|
|
162
|
+
(0, react_1.useEffect)(() => {
|
|
163
|
+
if (!initialScaleIgnored.current) {
|
|
164
|
+
initialScaleIgnored.current = true;
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
player.emitter.dispatchScaleChange(scale);
|
|
168
|
+
}, [player.emitter, scale]);
|
|
161
169
|
const { setMediaVolume, setMediaMuted } = (0, react_1.useContext)(remotion_1.Internals.SetMediaVolumeContext);
|
|
162
170
|
const { mediaMuted, mediaVolume } = (0, react_1.useContext)(remotion_1.Internals.MediaVolumeContext);
|
|
163
171
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
@@ -201,6 +209,7 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
201
209
|
throw new TypeError(`setVolume() got a number that is out of range. Must be between 0 and 1, got ${typeof vol}`);
|
|
202
210
|
}
|
|
203
211
|
setMediaVolume(vol);
|
|
212
|
+
player.emitter.dispatchVolumeChange(vol);
|
|
204
213
|
},
|
|
205
214
|
isMuted: () => mediaMuted || mediaVolume === 0,
|
|
206
215
|
mute: () => {
|
package/dist/cjs/Thumbnail.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import type { CSSProperties, MutableRefObject } from 'react';
|
|
2
2
|
import type { CompProps } from 'remotion';
|
|
3
|
-
import type { z } from 'zod';
|
|
4
3
|
import type { ThumbnailMethods } from './player-methods.js';
|
|
5
4
|
import type { ErrorFallback, RenderLoading } from './PlayerUI.js';
|
|
6
5
|
import type { PropsIfHasProps } from './utils/props-if-has-props.js';
|
|
7
|
-
declare type ThumbnailProps<
|
|
6
|
+
declare type ThumbnailProps<T> = PropsIfHasProps<T> & CompProps<T> & {
|
|
8
7
|
frameToDisplay: number;
|
|
9
8
|
style?: CSSProperties;
|
|
10
9
|
durationInFrames: number;
|
|
11
10
|
compositionWidth: number;
|
|
12
11
|
compositionHeight: number;
|
|
12
|
+
inputProps?: unknown;
|
|
13
13
|
fps: number;
|
|
14
14
|
errorFallback?: ErrorFallback;
|
|
15
15
|
renderLoading?: RenderLoading;
|
|
16
16
|
className?: string;
|
|
17
17
|
};
|
|
18
|
-
export declare const ThumbnailFn: <
|
|
18
|
+
export declare const ThumbnailFn: <T>({ frameToDisplay, style, inputProps, compositionHeight, compositionWidth, durationInFrames, fps, className, errorFallback, renderLoading, ...componentProps }: ThumbnailProps<T>, ref: MutableRefObject<ThumbnailMethods>) => JSX.Element;
|
|
19
19
|
/**
|
|
20
20
|
* @description A component which can be rendered in a regular React App (for example: Create React App, Next.js) to display a single frame of a video.
|
|
21
21
|
* @see [Documentation](https://www.remotion.dev/docs/player/thumbnail)
|
|
22
22
|
*/
|
|
23
|
-
export declare const Thumbnail: <
|
|
23
|
+
export declare const Thumbnail: <T>(props: ThumbnailProps<T> & import("react").RefAttributes<ThumbnailMethods>) => React.ReactElement | null;
|
|
24
24
|
export {};
|
|
@@ -13,6 +13,12 @@ declare type FrameUpdateEventPayload = {
|
|
|
13
13
|
declare type RateChangeEventPayload = {
|
|
14
14
|
playbackRate: number;
|
|
15
15
|
};
|
|
16
|
+
declare type ScaleChangeEventPayload = {
|
|
17
|
+
scale: number;
|
|
18
|
+
};
|
|
19
|
+
declare type VolumeChangeEventPayload = {
|
|
20
|
+
volume: number;
|
|
21
|
+
};
|
|
16
22
|
declare type FullscreenChangeEventPayload = {
|
|
17
23
|
isFullscreen: boolean;
|
|
18
24
|
};
|
|
@@ -21,6 +27,8 @@ declare type PlayerStateEventMap = {
|
|
|
21
27
|
pause: undefined;
|
|
22
28
|
play: undefined;
|
|
23
29
|
ratechange: RateChangeEventPayload;
|
|
30
|
+
scalechange: ScaleChangeEventPayload;
|
|
31
|
+
volumechange: VolumeChangeEventPayload;
|
|
24
32
|
ended: undefined;
|
|
25
33
|
error: ErrorPayload;
|
|
26
34
|
timeupdate: TimeUpdateEventPayload;
|
|
@@ -47,14 +55,16 @@ export declare class PlayerEmitter {
|
|
|
47
55
|
removeEventListener<Q extends PlayerEventTypes>(name: Q, callback: CallbackListener<Q>): void;
|
|
48
56
|
private dispatchEvent;
|
|
49
57
|
dispatchSeek(frame: number): void;
|
|
58
|
+
dispatchVolumeChange(volume: number): void;
|
|
50
59
|
dispatchPause(): void;
|
|
51
60
|
dispatchPlay(): void;
|
|
52
61
|
dispatchEnded(): void;
|
|
53
|
-
|
|
62
|
+
dispatchRateChange(playbackRate: number): void;
|
|
63
|
+
dispatchScaleChange(scale: number): void;
|
|
54
64
|
dispatchError(error: Error): void;
|
|
55
65
|
dispatchTimeUpdate(event: TimeUpdateEventPayload): void;
|
|
56
66
|
dispatchFrameUpdate(event: FrameUpdateEventPayload): void;
|
|
57
|
-
|
|
67
|
+
dispatchFullscreenChange(event: FullscreenChangeEventPayload): void;
|
|
58
68
|
}
|
|
59
69
|
export declare class ThumbnailEmitter {
|
|
60
70
|
listeners: ThumbnailListeners;
|
|
@@ -9,10 +9,12 @@ class PlayerEmitter {
|
|
|
9
9
|
pause: [],
|
|
10
10
|
play: [],
|
|
11
11
|
ratechange: [],
|
|
12
|
+
scalechange: [],
|
|
12
13
|
seeked: [],
|
|
13
14
|
timeupdate: [],
|
|
14
15
|
frameupdate: [],
|
|
15
16
|
fullscreenchange: [],
|
|
17
|
+
volumechange: [],
|
|
16
18
|
};
|
|
17
19
|
}
|
|
18
20
|
addEventListener(name, callback) {
|
|
@@ -31,6 +33,11 @@ class PlayerEmitter {
|
|
|
31
33
|
frame,
|
|
32
34
|
});
|
|
33
35
|
}
|
|
36
|
+
dispatchVolumeChange(volume) {
|
|
37
|
+
this.dispatchEvent('volumechange', {
|
|
38
|
+
volume,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
34
41
|
dispatchPause() {
|
|
35
42
|
this.dispatchEvent('pause', undefined);
|
|
36
43
|
}
|
|
@@ -40,11 +47,16 @@ class PlayerEmitter {
|
|
|
40
47
|
dispatchEnded() {
|
|
41
48
|
this.dispatchEvent('ended', undefined);
|
|
42
49
|
}
|
|
43
|
-
|
|
50
|
+
dispatchRateChange(playbackRate) {
|
|
44
51
|
this.dispatchEvent('ratechange', {
|
|
45
52
|
playbackRate,
|
|
46
53
|
});
|
|
47
54
|
}
|
|
55
|
+
dispatchScaleChange(scale) {
|
|
56
|
+
this.dispatchEvent('scalechange', {
|
|
57
|
+
scale,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
48
60
|
dispatchError(error) {
|
|
49
61
|
this.dispatchEvent('error', {
|
|
50
62
|
error,
|
|
@@ -56,7 +68,7 @@ class PlayerEmitter {
|
|
|
56
68
|
dispatchFrameUpdate(event) {
|
|
57
69
|
this.dispatchEvent('frameupdate', event);
|
|
58
70
|
}
|
|
59
|
-
|
|
71
|
+
dispatchFullscreenChange(event) {
|
|
60
72
|
this.dispatchEvent('fullscreenchange', event);
|
|
61
73
|
}
|
|
62
74
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useIsBackgrounded = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const getIsBackgrounded = () => {
|
|
6
|
+
if (typeof document === 'undefined') {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return document.visibilityState === 'hidden';
|
|
10
|
+
};
|
|
11
|
+
const useIsBackgrounded = () => {
|
|
12
|
+
const isBackgrounded = (0, react_1.useRef)(getIsBackgrounded());
|
|
13
|
+
(0, react_1.useEffect)(() => {
|
|
14
|
+
const onVisibilityChange = () => {
|
|
15
|
+
isBackgrounded.current = getIsBackgrounded();
|
|
16
|
+
};
|
|
17
|
+
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
18
|
+
return () => {
|
|
19
|
+
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
20
|
+
};
|
|
21
|
+
}, []);
|
|
22
|
+
return isBackgrounded;
|
|
23
|
+
};
|
|
24
|
+
exports.useIsBackgrounded = useIsBackgrounded;
|
|
@@ -12,7 +12,7 @@ export declare type PlayerMethods = ThumbnailMethods & {
|
|
|
12
12
|
getCurrentFrame: () => number;
|
|
13
13
|
requestFullscreen: () => void;
|
|
14
14
|
exitFullscreen: () => void;
|
|
15
|
-
isFullscreen: () =>
|
|
15
|
+
isFullscreen: () => boolean;
|
|
16
16
|
setVolume: (num: number) => void;
|
|
17
17
|
getVolume: () => number;
|
|
18
18
|
isMuted: () => boolean;
|
|
@@ -57,7 +57,7 @@ const test_utils_js_1 = require("./test-utils.js");
|
|
|
57
57
|
});
|
|
58
58
|
(0, vitest_1.test)('Invalid playbackRate should give error', () => {
|
|
59
59
|
try {
|
|
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
|
|
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 }));
|
|
61
61
|
}
|
|
62
62
|
catch (e) {
|
|
63
63
|
(0, vitest_1.expect)(e.message).toMatch(/The lowest possible playback rate is -4. You passed: -5/);
|
package/dist/cjs/use-playback.js
CHANGED
|
@@ -4,12 +4,17 @@ exports.usePlayback = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
6
|
const calculate_next_frame_js_1 = require("./calculate-next-frame.js");
|
|
7
|
+
const is_backgrounded_js_1 = require("./is-backgrounded.js");
|
|
7
8
|
const use_player_js_1 = require("./use-player.js");
|
|
8
9
|
const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, outFrame, }) => {
|
|
9
10
|
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
10
11
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
11
12
|
const { playing, pause, emitter } = (0, use_player_js_1.usePlayer)();
|
|
12
13
|
const setFrame = remotion_1.Internals.Timeline.useTimelineSetFrame();
|
|
14
|
+
// requestAnimationFrame() does not work if the tab is not active.
|
|
15
|
+
// This means that audio will keep playing even if it has ended.
|
|
16
|
+
// In that case, we use setTimeout() instead.
|
|
17
|
+
const isBackgroundedRef = (0, is_backgrounded_js_1.useIsBackgrounded)();
|
|
13
18
|
const frameRef = (0, react_1.useRef)(frame);
|
|
14
19
|
frameRef.current = frame;
|
|
15
20
|
const lastTimeUpdateEvent = (0, react_1.useRef)(null);
|
|
@@ -24,12 +29,20 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
24
29
|
let reqAnimFrameCall = null;
|
|
25
30
|
const startedTime = performance.now();
|
|
26
31
|
let framesAdvanced = 0;
|
|
27
|
-
const
|
|
28
|
-
hasBeenStopped = true;
|
|
32
|
+
const cancelQueuedFrame = () => {
|
|
29
33
|
if (reqAnimFrameCall !== null) {
|
|
30
|
-
|
|
34
|
+
if (reqAnimFrameCall.type === 'raf') {
|
|
35
|
+
cancelAnimationFrame(reqAnimFrameCall.id);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
clearTimeout(reqAnimFrameCall.id);
|
|
39
|
+
}
|
|
31
40
|
}
|
|
32
41
|
};
|
|
42
|
+
const stop = () => {
|
|
43
|
+
hasBeenStopped = true;
|
|
44
|
+
cancelQueuedFrame();
|
|
45
|
+
};
|
|
33
46
|
const callback = () => {
|
|
34
47
|
const time = performance.now() - startedTime;
|
|
35
48
|
const actualLastFrame = outFrame !== null && outFrame !== void 0 ? outFrame : config.durationInFrames - 1;
|
|
@@ -56,11 +69,34 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
56
69
|
return;
|
|
57
70
|
}
|
|
58
71
|
if (!hasBeenStopped) {
|
|
59
|
-
|
|
72
|
+
queueNextFrame();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const queueNextFrame = () => {
|
|
76
|
+
if (isBackgroundedRef.current) {
|
|
77
|
+
reqAnimFrameCall = {
|
|
78
|
+
type: 'timeout',
|
|
79
|
+
// Note: Most likely, this will not be 1000 / fps, but the browser will throttle it to ~1/sec.
|
|
80
|
+
id: setTimeout(callback, 1000 / config.fps),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
reqAnimFrameCall = { type: 'raf', id: requestAnimationFrame(callback) };
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
queueNextFrame();
|
|
88
|
+
const onVisibilityChange = () => {
|
|
89
|
+
if (document.visibilityState === 'visible') {
|
|
90
|
+
return;
|
|
60
91
|
}
|
|
92
|
+
// If tab goes into the background, cancel requestAnimationFrame() and update immediately.
|
|
93
|
+
// , so the transition to setTimeout() can be fulfilled.
|
|
94
|
+
cancelQueuedFrame();
|
|
95
|
+
callback();
|
|
61
96
|
};
|
|
62
|
-
|
|
97
|
+
window.addEventListener('visibilitychange', onVisibilityChange);
|
|
63
98
|
return () => {
|
|
99
|
+
window.removeEventListener('visibilitychange', onVisibilityChange);
|
|
64
100
|
stop();
|
|
65
101
|
};
|
|
66
102
|
}, [
|
|
@@ -74,6 +110,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
74
110
|
inFrame,
|
|
75
111
|
outFrame,
|
|
76
112
|
moveToBeginningWhenEnded,
|
|
113
|
+
isBackgroundedRef,
|
|
77
114
|
]);
|
|
78
115
|
(0, react_1.useEffect)(() => {
|
|
79
116
|
const interval = setInterval(() => {
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
inputProps?: z.infer<Schema> & Props;
|
|
1
|
+
export declare type PropsIfHasProps<Props> = {} extends Props ? {
|
|
2
|
+
inputProps?: Props;
|
|
4
3
|
} : {
|
|
5
4
|
inputProps: Props;
|
|
6
|
-
} : {} extends Props ? {
|
|
7
|
-
inputProps: z.infer<Schema>;
|
|
8
|
-
} : {
|
|
9
|
-
inputProps: z.infer<Schema> & Props;
|
|
10
5
|
};
|
package/dist/esm/Player.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { CompProps } from 'remotion';
|
|
4
|
-
import type { z } from 'zod';
|
|
5
4
|
import type { PlayerRef } from './player-methods.js';
|
|
6
5
|
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls.js';
|
|
7
6
|
import type { RenderLoading, RenderPoster } from './PlayerUI.js';
|
|
@@ -9,7 +8,7 @@ import type { PropsIfHasProps } from './utils/props-if-has-props.js';
|
|
|
9
8
|
export declare type ErrorFallback = (info: {
|
|
10
9
|
error: Error;
|
|
11
10
|
}) => React.ReactNode;
|
|
12
|
-
export declare type PlayerProps<
|
|
11
|
+
export declare type PlayerProps<T> = {
|
|
13
12
|
durationInFrames: number;
|
|
14
13
|
compositionWidth: number;
|
|
15
14
|
compositionHeight: number;
|
|
@@ -40,12 +39,11 @@ export declare type PlayerProps<Schema extends z.ZodTypeAny, Props> = {
|
|
|
40
39
|
renderPlayPauseButton?: RenderPlayPauseButton;
|
|
41
40
|
renderFullscreenButton?: RenderFullscreenButton;
|
|
42
41
|
alwaysShowControls?: boolean;
|
|
43
|
-
schema?: Schema;
|
|
44
42
|
initiallyMuted?: boolean;
|
|
45
|
-
} &
|
|
46
|
-
export declare const componentOrNullIfLazy: <
|
|
43
|
+
} & PropsIfHasProps<T> & CompProps<T>;
|
|
44
|
+
export declare const componentOrNullIfLazy: <T>(props: CompProps<T>) => ComponentType<T> | null;
|
|
47
45
|
/**
|
|
48
46
|
* @description A component which can be rendered in a regular React App (for example: Create React App, Next.js) to display a Remotion video.
|
|
49
47
|
* @see [Documentation](https://www.remotion.dev/docs/player/player)
|
|
50
48
|
*/
|
|
51
|
-
export declare const Player: <
|
|
49
|
+
export declare const Player: <T>(props: PlayerProps<T> & React.RefAttributes<PlayerRef>) => React.ReactElement | null;
|
package/dist/esm/Thumbnail.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import type { CSSProperties, MutableRefObject } from 'react';
|
|
2
2
|
import type { CompProps } from 'remotion';
|
|
3
|
-
import type { z } from 'zod';
|
|
4
3
|
import type { ThumbnailMethods } from './player-methods.js';
|
|
5
4
|
import type { ErrorFallback, RenderLoading } from './PlayerUI.js';
|
|
6
5
|
import type { PropsIfHasProps } from './utils/props-if-has-props.js';
|
|
7
|
-
declare type ThumbnailProps<
|
|
6
|
+
declare type ThumbnailProps<T> = PropsIfHasProps<T> & CompProps<T> & {
|
|
8
7
|
frameToDisplay: number;
|
|
9
8
|
style?: CSSProperties;
|
|
10
9
|
durationInFrames: number;
|
|
11
10
|
compositionWidth: number;
|
|
12
11
|
compositionHeight: number;
|
|
12
|
+
inputProps?: unknown;
|
|
13
13
|
fps: number;
|
|
14
14
|
errorFallback?: ErrorFallback;
|
|
15
15
|
renderLoading?: RenderLoading;
|
|
16
16
|
className?: string;
|
|
17
17
|
};
|
|
18
|
-
export declare const ThumbnailFn: <
|
|
18
|
+
export declare const ThumbnailFn: <T>({ frameToDisplay, style, inputProps, compositionHeight, compositionWidth, durationInFrames, fps, className, errorFallback, renderLoading, ...componentProps }: ThumbnailProps<T>, ref: MutableRefObject<ThumbnailMethods>) => JSX.Element;
|
|
19
19
|
/**
|
|
20
20
|
* @description A component which can be rendered in a regular React App (for example: Create React App, Next.js) to display a single frame of a video.
|
|
21
21
|
* @see [Documentation](https://www.remotion.dev/docs/player/thumbnail)
|
|
22
22
|
*/
|
|
23
|
-
export declare const Thumbnail: <
|
|
23
|
+
export declare const Thumbnail: <T>(props: ThumbnailProps<T> & import("react").RefAttributes<ThumbnailMethods>) => React.ReactElement | null;
|
|
24
24
|
export {};
|
|
@@ -13,6 +13,12 @@ declare type FrameUpdateEventPayload = {
|
|
|
13
13
|
declare type RateChangeEventPayload = {
|
|
14
14
|
playbackRate: number;
|
|
15
15
|
};
|
|
16
|
+
declare type ScaleChangeEventPayload = {
|
|
17
|
+
scale: number;
|
|
18
|
+
};
|
|
19
|
+
declare type VolumeChangeEventPayload = {
|
|
20
|
+
volume: number;
|
|
21
|
+
};
|
|
16
22
|
declare type FullscreenChangeEventPayload = {
|
|
17
23
|
isFullscreen: boolean;
|
|
18
24
|
};
|
|
@@ -21,6 +27,8 @@ declare type PlayerStateEventMap = {
|
|
|
21
27
|
pause: undefined;
|
|
22
28
|
play: undefined;
|
|
23
29
|
ratechange: RateChangeEventPayload;
|
|
30
|
+
scalechange: ScaleChangeEventPayload;
|
|
31
|
+
volumechange: VolumeChangeEventPayload;
|
|
24
32
|
ended: undefined;
|
|
25
33
|
error: ErrorPayload;
|
|
26
34
|
timeupdate: TimeUpdateEventPayload;
|
|
@@ -47,14 +55,16 @@ export declare class PlayerEmitter {
|
|
|
47
55
|
removeEventListener<Q extends PlayerEventTypes>(name: Q, callback: CallbackListener<Q>): void;
|
|
48
56
|
private dispatchEvent;
|
|
49
57
|
dispatchSeek(frame: number): void;
|
|
58
|
+
dispatchVolumeChange(volume: number): void;
|
|
50
59
|
dispatchPause(): void;
|
|
51
60
|
dispatchPlay(): void;
|
|
52
61
|
dispatchEnded(): void;
|
|
53
|
-
|
|
62
|
+
dispatchRateChange(playbackRate: number): void;
|
|
63
|
+
dispatchScaleChange(scale: number): void;
|
|
54
64
|
dispatchError(error: Error): void;
|
|
55
65
|
dispatchTimeUpdate(event: TimeUpdateEventPayload): void;
|
|
56
66
|
dispatchFrameUpdate(event: FrameUpdateEventPayload): void;
|
|
57
|
-
|
|
67
|
+
dispatchFullscreenChange(event: FullscreenChangeEventPayload): void;
|
|
58
68
|
}
|
|
59
69
|
export declare class ThumbnailEmitter {
|
|
60
70
|
listeners: ThumbnailListeners;
|
package/dist/esm/index.d.ts
CHANGED