remotion 4.0.469 → 4.0.471
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/AbsoluteFill.js +1 -1
- package/dist/cjs/CanUseRemotionHooks.js +1 -1
- package/dist/cjs/Composition.d.ts +1 -1
- package/dist/cjs/Composition.js +3 -3
- package/dist/cjs/CompositionErrorBoundary.js +2 -5
- package/dist/cjs/CompositionManagerProvider.d.ts +2 -2
- package/dist/cjs/CompositionManagerProvider.js +1 -1
- package/dist/cjs/EditorProps.d.ts +2 -2
- package/dist/cjs/EditorProps.js +1 -1
- package/dist/cjs/Folder.js +1 -1
- package/dist/cjs/HtmlInCanvas.d.ts +11 -3
- package/dist/cjs/HtmlInCanvas.js +14 -3
- package/dist/cjs/IFrame.d.ts +2 -2
- package/dist/cjs/IFrame.js +1 -1
- package/dist/cjs/Img.d.ts +11 -11
- package/dist/cjs/Img.js +30 -20
- package/dist/cjs/RemotionRoot.d.ts +1 -0
- package/dist/cjs/RemotionRoot.js +2 -2
- package/dist/cjs/RenderAssetManager.js +1 -1
- package/dist/cjs/Sequence.js +4 -4
- package/dist/cjs/SequenceManager.js +1 -1
- package/dist/cjs/Still.js +1 -1
- package/dist/cjs/TimelineContext.js +1 -1
- package/dist/cjs/animated-image/AnimatedImage.d.ts +4 -4
- package/dist/cjs/animated-image/AnimatedImage.js +15 -4
- package/dist/cjs/animated-image/canvas.js +1 -1
- package/dist/cjs/animated-image/decode-image.d.ts +2 -1
- package/dist/cjs/animated-image/decode-image.js +2 -2
- package/dist/cjs/animated-image/index.js +1 -1
- package/dist/cjs/animated-image/props.d.ts +1 -0
- package/dist/cjs/animated-image/request-init.d.ts +1 -0
- package/dist/cjs/animated-image/request-init.js +16 -0
- package/dist/cjs/audio/AudioForPreview.js +1 -1
- package/dist/cjs/audio/AudioForRendering.d.ts +20 -5
- package/dist/cjs/audio/AudioForRendering.js +1 -1
- package/dist/cjs/audio/html5-audio.d.ts +36 -36
- package/dist/cjs/audio/html5-audio.js +6 -6
- package/dist/cjs/audio/index.js +1 -1
- package/dist/cjs/audio/props.d.ts +1 -1
- package/dist/cjs/audio/shared-audio-tags.d.ts +2 -2
- package/dist/cjs/audio/shared-audio-tags.js +16 -5
- package/dist/cjs/audio/shared-element-source-node.d.ts +1 -1
- package/dist/cjs/audio/use-audio-context.d.ts +3 -3
- package/dist/cjs/audio/use-audio-context.js +7 -3
- package/dist/cjs/audio/wait-until-actually-resumed.d.ts +1 -2
- package/dist/cjs/audio/wait-until-actually-resumed.js +2 -1
- package/dist/cjs/buffer-until-first-frame.d.ts +3 -4
- package/dist/cjs/buffering.js +1 -1
- package/dist/cjs/canvas-image/CanvasImage.d.ts +18 -16
- package/dist/cjs/canvas-image/CanvasImage.js +12 -5
- package/dist/cjs/canvas-image/index.js +1 -1
- package/dist/cjs/canvas-image/props.d.ts +4 -0
- package/dist/cjs/default-css.d.ts +1 -1
- package/dist/cjs/delay-render.d.ts +2 -3
- package/dist/cjs/delay-render.js +2 -1
- package/dist/cjs/effects/Solid.d.ts +1 -1
- package/dist/cjs/effects/Solid.js +2 -2
- package/dist/cjs/effects/canvas-pool.js +4 -2
- package/dist/cjs/effects/effect-types.d.ts +2 -2
- package/dist/cjs/effects/run-effect-chain.d.ts +1 -1
- package/dist/cjs/effects/run-effect-chain.js +15 -5
- package/dist/cjs/freeze.js +1 -1
- package/dist/cjs/index.d.ts +10 -9
- package/dist/cjs/index.js +34 -37
- package/dist/cjs/internals.d.ts +129 -116
- package/dist/cjs/internals.js +4 -0
- package/dist/cjs/interpolate-colors.d.ts +4 -1
- package/dist/cjs/interpolate-colors.js +4 -3
- package/dist/cjs/interpolate-keyframed-status.d.ts +5 -0
- package/dist/cjs/interpolate-keyframed-status.js +58 -0
- package/dist/cjs/interpolate.d.ts +2 -0
- package/dist/cjs/interpolate.js +17 -2
- package/dist/cjs/is-player.js +1 -1
- package/dist/cjs/loading-indicator.js +4 -2
- package/dist/cjs/log-level-context.d.ts +1 -1
- package/dist/cjs/log.d.ts +1 -1
- package/dist/cjs/loop/index.js +1 -1
- package/dist/cjs/media-tag-current-time-timestamp.d.ts +1 -1
- package/dist/cjs/media-tag-current-time-timestamp.js +4 -3
- package/dist/cjs/no-react.d.ts +17 -17
- package/dist/cjs/no-react.js +4 -3
- package/dist/cjs/play-and-handle-not-allowed-error.d.ts +3 -4
- package/dist/cjs/playback-logging.d.ts +1 -2
- package/dist/cjs/prefetch-state.js +1 -1
- package/dist/cjs/prefetch.d.ts +6 -7
- package/dist/cjs/props-if-has-props.d.ts +1 -2
- package/dist/cjs/register-root.d.ts +2 -2
- package/dist/cjs/resolve-video-config.d.ts +2 -2
- package/dist/cjs/seek.d.ts +2 -3
- package/dist/cjs/sequence-field-schema.d.ts +32 -32
- package/dist/cjs/series/flatten-children.d.ts +1 -3
- package/dist/cjs/series/index.js +3 -3
- package/dist/cjs/series/is-inside-series.js +2 -2
- package/dist/cjs/spring/index.d.ts +1 -1
- package/dist/cjs/spring/index.js +1 -1
- package/dist/cjs/spring/measure-spring.d.ts +1 -1
- package/dist/cjs/spring/spring-utils.d.ts +1 -1
- package/dist/cjs/timeline-position-state.d.ts +1 -1
- package/dist/cjs/use-amplification.d.ts +6 -4
- package/dist/cjs/use-current-scale.d.ts +2 -2
- package/dist/cjs/use-delay-render.d.ts +1 -2
- package/dist/cjs/use-lazy-component.d.ts +1 -1
- package/dist/cjs/use-media-buffering.d.ts +2 -3
- package/dist/cjs/use-media-enabled.d.ts +1 -1
- package/dist/cjs/use-media-enabled.js +1 -1
- package/dist/cjs/use-media-in-timeline.d.ts +2 -2
- package/dist/cjs/use-media-in-timeline.js +2 -1
- package/dist/cjs/use-media-playback.d.ts +2 -2
- package/dist/cjs/use-media-playback.js +4 -3
- package/dist/cjs/use-media-tag.d.ts +1 -1
- package/dist/cjs/use-request-video-callback-time.d.ts +3 -3
- package/dist/cjs/use-schema.d.ts +5 -1
- package/dist/cjs/use-schema.js +25 -7
- package/dist/cjs/validate-media-props.d.ts +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/MediaPlaybackError.js +1 -0
- package/dist/cjs/video/OffthreadVideo.js +4 -4
- package/dist/cjs/video/OffthreadVideoForRendering.js +1 -1
- package/dist/cjs/video/VideoForPreview.js +1 -1
- package/dist/cjs/video/VideoForRendering.d.ts +21 -6
- package/dist/cjs/video/VideoForRendering.js +1 -1
- package/dist/cjs/video/duration-state.js +1 -1
- package/dist/cjs/video/emit-video-frame.d.ts +1 -1
- package/dist/cjs/video/html5-video.d.ts +34 -34
- package/dist/cjs/video/html5-video.js +7 -7
- package/dist/cjs/video/index.js +2 -2
- package/dist/cjs/video/seek-until-right.d.ts +2 -3
- package/dist/cjs/warn-about-non-seekable-media.d.ts +1 -1
- package/dist/cjs/wrap-in-schema.js +5 -0
- package/dist/cjs/wrap-remotion-context.d.ts +1 -1
- package/dist/cjs/wrap-remotion-context.js +1 -1
- package/dist/esm/index.mjs +7370 -7202
- package/dist/esm/no-react.mjs +13 -2
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
package/dist/cjs/AbsoluteFill.js
CHANGED
|
@@ -106,7 +106,7 @@ const AbsoluteFillRefForwarding = (props, ref) => {
|
|
|
106
106
|
...style,
|
|
107
107
|
};
|
|
108
108
|
}, [other.className, style]);
|
|
109
|
-
return
|
|
109
|
+
return jsx_runtime_1.jsx("div", { ref: ref, style: actualStyle, ...other });
|
|
110
110
|
};
|
|
111
111
|
/*
|
|
112
112
|
* @description A helper component which renders an absolutely positioned <div> element with full width, height, and flex display suited for content layering.
|
|
@@ -5,6 +5,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
exports.CanUseRemotionHooks = (0, react_1.createContext)(false);
|
|
7
7
|
const CanUseRemotionHooksProvider = ({ children }) => {
|
|
8
|
-
return (
|
|
8
|
+
return (jsx_runtime_1.jsx(exports.CanUseRemotionHooks.Provider, { value: true, children: children }));
|
|
9
9
|
};
|
|
10
10
|
exports.CanUseRemotionHooksProvider = CanUseRemotionHooksProvider;
|
|
@@ -59,5 +59,5 @@ export type CompositionProps<Schema extends AnyZodObject, Props extends Record<s
|
|
|
59
59
|
readonly id: string;
|
|
60
60
|
readonly schema?: Schema;
|
|
61
61
|
} & CompositionCalculateMetadataOrExplicit<Schema, Props> & CompProps<Props> & PropsIfHasProps<Schema, Props>;
|
|
62
|
-
export declare const Composition: <Schema extends AnyZodObject, Props extends Record<string, unknown>>(props: CompositionProps<Schema, Props>) => import("react/jsx-runtime
|
|
62
|
+
export declare const Composition: <Schema extends AnyZodObject, Props extends Record<string, unknown>>(props: CompositionProps<Schema, Props>) => import("react/jsx-runtime").JSX.Element | null;
|
|
63
63
|
export {};
|
package/dist/cjs/Composition.js
CHANGED
|
@@ -116,7 +116,7 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
|
|
|
116
116
|
resolved.type !== 'success-and-refreshing')) {
|
|
117
117
|
return null;
|
|
118
118
|
}
|
|
119
|
-
return (0, react_dom_1.createPortal)(
|
|
119
|
+
return (0, react_dom_1.createPortal)(jsx_runtime_1.jsx(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: jsx_runtime_1.jsx(CompositionErrorBoundary_js_1.CompositionErrorBoundary, { onError: onError, onClear: onClear, children: jsx_runtime_1.jsx(react_1.Suspense, { fallback: jsx_runtime_1.jsx(loading_indicator_js_1.Loading, {}), children: jsx_runtime_1.jsx(Comp, { ...((_c = resolved.result.props) !== null && _c !== void 0 ? _c : {}) }) }) }) }), (0, portal_node_js_1.portalNode)());
|
|
120
120
|
}
|
|
121
121
|
if (environment.isRendering &&
|
|
122
122
|
video &&
|
|
@@ -128,7 +128,7 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
|
|
|
128
128
|
resolved.type !== 'success-and-refreshing')) {
|
|
129
129
|
return null;
|
|
130
130
|
}
|
|
131
|
-
return (0, react_dom_1.createPortal)(
|
|
131
|
+
return (0, react_dom_1.createPortal)(jsx_runtime_1.jsx(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: jsx_runtime_1.jsx(react_1.Suspense, { fallback: jsx_runtime_1.jsx(Fallback, {}), children: jsx_runtime_1.jsx(Comp, { ...((_d = resolved.result.props) !== null && _d !== void 0 ? _d : {}) }) }) }), (0, portal_node_js_1.portalNode)());
|
|
132
132
|
}
|
|
133
133
|
return null;
|
|
134
134
|
};
|
|
@@ -142,6 +142,6 @@ const Composition = (props) => {
|
|
|
142
142
|
return null;
|
|
143
143
|
}
|
|
144
144
|
// @ts-expect-error
|
|
145
|
-
return
|
|
145
|
+
return jsx_runtime_1.jsx(InnerComposition, { ...props });
|
|
146
146
|
};
|
|
147
147
|
exports.Composition = Composition;
|
|
@@ -18,11 +18,8 @@ const getHot = () => {
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
class CompositionErrorBoundary extends react_1.default.Component {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.state = { hasError: false };
|
|
24
|
-
this.hmrStatusHandler = null;
|
|
25
|
-
}
|
|
21
|
+
state = { hasError: false };
|
|
22
|
+
hmrStatusHandler = null;
|
|
26
23
|
static getDerivedStateFromError() {
|
|
27
24
|
return { hasError: true };
|
|
28
25
|
}
|
|
@@ -2,9 +2,9 @@ import { type AnyComposition } from './CompositionManager';
|
|
|
2
2
|
import type { CanvasContent } from './CompositionManagerContext';
|
|
3
3
|
import type { BaseMetadata } from './CompositionManagerContext.js';
|
|
4
4
|
export declare const CompositionManagerProvider: ({ children, onlyRenderComposition, currentCompositionMetadata, initialCompositions, initialCanvasContent, }: {
|
|
5
|
-
readonly children:
|
|
5
|
+
readonly children: import("react").ReactNode;
|
|
6
6
|
readonly onlyRenderComposition: string | null;
|
|
7
7
|
readonly currentCompositionMetadata: BaseMetadata | null;
|
|
8
8
|
readonly initialCompositions: AnyComposition[];
|
|
9
9
|
readonly initialCanvasContent: CanvasContent | null;
|
|
10
|
-
}) => import("react/jsx-runtime
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -77,6 +77,6 @@ const CompositionManagerProvider = ({ children, onlyRenderComposition, currentCo
|
|
|
77
77
|
canvasContent,
|
|
78
78
|
};
|
|
79
79
|
}, [compositions, folders, currentCompositionMetadata, canvasContent]);
|
|
80
|
-
return (
|
|
80
|
+
return (jsx_runtime_1.jsx(CompositionManagerContext_1.CompositionManager.Provider, { value: compositionManagerContextValue, children: jsx_runtime_1.jsx(CompositionManagerContext_1.CompositionSetters.Provider, { value: compositionManagerSetters, children: children }) }));
|
|
81
81
|
};
|
|
82
82
|
exports.CompositionManagerProvider = CompositionManagerProvider;
|
|
@@ -13,9 +13,9 @@ export declare const EditorPropsContext: React.Context<EditorPropsContextType>;
|
|
|
13
13
|
export declare const timeValueRef: React.RefObject<{
|
|
14
14
|
goToFrame: () => void;
|
|
15
15
|
seek: (newFrame: number) => void;
|
|
16
|
-
play: (e?: SyntheticEvent |
|
|
16
|
+
play: (e?: PointerEvent | SyntheticEvent<Element, Event> | undefined) => void;
|
|
17
17
|
pause: () => void;
|
|
18
|
-
toggle: (e?: SyntheticEvent |
|
|
18
|
+
toggle: (e?: PointerEvent | SyntheticEvent<Element, Event> | undefined) => void;
|
|
19
19
|
} | null>;
|
|
20
20
|
export declare const EditorPropsProvider: React.FC<{
|
|
21
21
|
readonly children: React.ReactNode;
|
package/dist/cjs/EditorProps.js
CHANGED
|
@@ -59,6 +59,6 @@ const EditorPropsProvider = ({ children }) => {
|
|
|
59
59
|
const ctx = (0, react_1.useMemo)(() => {
|
|
60
60
|
return { props, updateProps };
|
|
61
61
|
}, [props, updateProps]);
|
|
62
|
-
return (
|
|
62
|
+
return (jsx_runtime_1.jsx(exports.EditorPropsContext.Provider, { value: ctx, children: children }));
|
|
63
63
|
};
|
|
64
64
|
exports.EditorPropsProvider = EditorPropsProvider;
|
package/dist/cjs/Folder.js
CHANGED
|
@@ -41,6 +41,6 @@ const Folder = ({ name, children }) => {
|
|
|
41
41
|
unregisterFolder,
|
|
42
42
|
nonce,
|
|
43
43
|
]);
|
|
44
|
-
return (
|
|
44
|
+
return (jsx_runtime_1.jsx(exports.FolderContext.Provider, { value: value, children: children }));
|
|
45
45
|
};
|
|
46
46
|
exports.Folder = Folder;
|
|
@@ -51,7 +51,7 @@ export declare const HTML_IN_CANVAS_UNSUPPORTED_MESSAGE = "HTML in Canvas is not
|
|
|
51
51
|
export type HtmlInCanvasOnPaint = (params: HtmlInCanvasOnPaintParams) => void | Promise<void>;
|
|
52
52
|
export type HtmlInCanvasOnInitCleanup = () => void;
|
|
53
53
|
export type HtmlInCanvasOnInit = (params: HtmlInCanvasOnPaintParams) => HtmlInCanvasOnInitCleanup | Promise<HtmlInCanvasOnInitCleanup>;
|
|
54
|
-
export type HtmlInCanvasProps = Omit<SequenceProps, 'children' | 'durationInFrames' | keyof LayoutAndStyle | '_remotionInternalEffects'> & Omit<AbsoluteFillLayout, 'layout' | 'styleWhilePostmounted' | 'postmountFor' | 'premountFor' | 'styleWhilePremounted'> & {
|
|
54
|
+
export type HtmlInCanvasProps = Omit<SequenceProps, 'children' | 'durationInFrames' | keyof LayoutAndStyle | '_remotionInternalEffects' | '_remotionInternalRefForOutline'> & Omit<AbsoluteFillLayout, 'layout' | 'styleWhilePostmounted' | 'postmountFor' | 'premountFor' | 'styleWhilePremounted'> & {
|
|
55
55
|
readonly durationInFrames?: number;
|
|
56
56
|
readonly width: number;
|
|
57
57
|
readonly height: number;
|
|
@@ -60,6 +60,14 @@ export type HtmlInCanvasProps = Omit<SequenceProps, 'children' | 'durationInFram
|
|
|
60
60
|
readonly onPaint?: HtmlInCanvasOnPaint;
|
|
61
61
|
readonly onInit?: HtmlInCanvasOnInit;
|
|
62
62
|
};
|
|
63
|
-
export declare const HtmlInCanvas: React.ForwardRefExoticComponent<
|
|
64
|
-
readonly
|
|
63
|
+
export declare const HtmlInCanvas: React.ForwardRefExoticComponent<Omit<SequenceProps, "_remotionInternalEffects" | "_remotionInternalRefForOutline" | "children" | "durationInFrames" | "layout"> & Omit<AbsoluteFillLayout, "layout" | "postmountFor" | "premountFor" | "styleWhilePostmounted" | "styleWhilePremounted"> & {
|
|
64
|
+
readonly durationInFrames?: number | undefined;
|
|
65
|
+
readonly width: number;
|
|
66
|
+
readonly height: number;
|
|
67
|
+
readonly effects?: EffectsProp | undefined;
|
|
68
|
+
readonly children: React.ReactNode;
|
|
69
|
+
readonly onPaint?: HtmlInCanvasOnPaint | undefined;
|
|
70
|
+
readonly onInit?: HtmlInCanvasOnInit | undefined;
|
|
71
|
+
} & React.RefAttributes<HTMLCanvasElement>> & {
|
|
72
|
+
readonly isSupported: () => boolean;
|
|
65
73
|
};
|
package/dist/cjs/HtmlInCanvas.js
CHANGED
|
@@ -228,16 +228,27 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
228
228
|
if (isInsideAncestorHtmlInCanvas) {
|
|
229
229
|
throw new Error('<HtmlInCanvas> effects cannot be nested together. Chrome will only display the outer effect. Consider merging the effects into one if you can.');
|
|
230
230
|
}
|
|
231
|
-
return (
|
|
231
|
+
return (jsx_runtime_1.jsx(HtmlInCanvasAncestorContext.Provider, { value: true, children: jsx_runtime_1.jsx("canvas", { ref: setLayoutCanvasRef, width: width, height: height, style: style, children: jsx_runtime_1.jsx("div", { ref: divRef, style: innerStyle, children: children }) }, canvasSizeKey) }));
|
|
232
232
|
});
|
|
233
233
|
HtmlInCanvasContent.displayName = 'HtmlInCanvasContent';
|
|
234
234
|
const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = [], children, onPaint, onInit, _experimentalControls: controls, style, durationInFrames, name, ...sequenceProps }, ref) => {
|
|
235
235
|
const { durationInFrames: videoDuration } = (0, use_video_config_js_1.useVideoConfig)();
|
|
236
236
|
const resolvedDuration = durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : videoDuration;
|
|
237
237
|
const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
|
|
238
|
-
|
|
238
|
+
const actualRef = (0, react_1.useRef)(null);
|
|
239
|
+
const setCanvasRef = (0, react_1.useCallback)((node) => {
|
|
240
|
+
actualRef.current = node;
|
|
241
|
+
if (typeof ref === 'function') {
|
|
242
|
+
ref(node);
|
|
243
|
+
}
|
|
244
|
+
else if (ref) {
|
|
245
|
+
ref.current =
|
|
246
|
+
node;
|
|
247
|
+
}
|
|
248
|
+
}, [ref]);
|
|
249
|
+
return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { durationInFrames: resolvedDuration, name: name !== null && name !== void 0 ? name : '<HtmlInCanvas>', _remotionInternalDocumentationLink: name === undefined
|
|
239
250
|
? 'https://www.remotion.dev/docs/remotion/html-in-canvas'
|
|
240
|
-
: undefined, _experimentalControls: controls, _remotionInternalEffects: memoizedEffectDefinitions, layout: "none", ...sequenceProps, children:
|
|
251
|
+
: undefined, _experimentalControls: controls, _remotionInternalEffects: memoizedEffectDefinitions, _remotionInternalRefForOutline: actualRef, layout: "none", ...sequenceProps, children: jsx_runtime_1.jsx(HtmlInCanvasContent, { ref: setCanvasRef, width: width, height: height, effects: effects, onPaint: onPaint, onInit: onInit, controls: controls, style: style, children: children }) }));
|
|
241
252
|
});
|
|
242
253
|
HtmlInCanvasInner.displayName = 'HtmlInCanvas';
|
|
243
254
|
const htmlInCanvasSchema = {
|
package/dist/cjs/IFrame.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const IFrame: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLIFrameElement> & React.IframeHTMLAttributes<HTMLIFrameElement> & {
|
|
3
|
-
readonly delayRenderRetries?: number;
|
|
4
|
-
readonly delayRenderTimeoutInMilliseconds?: number;
|
|
3
|
+
readonly delayRenderRetries?: number | undefined;
|
|
4
|
+
readonly delayRenderTimeoutInMilliseconds?: number | undefined;
|
|
5
5
|
}, "ref"> & React.RefAttributes<HTMLIFrameElement>>;
|
package/dist/cjs/IFrame.js
CHANGED
|
@@ -24,7 +24,7 @@ const IFrameRefForwarding = ({ onLoad, onError, delayRenderRetries, delayRenderT
|
|
|
24
24
|
console.error('Error loading iframe:', e, 'Handle the event using the onError() prop to make this message disappear.');
|
|
25
25
|
}
|
|
26
26
|
}, [handle, onError, continueRender]);
|
|
27
|
-
return (
|
|
27
|
+
return (jsx_runtime_1.jsx("iframe", { referrerPolicy: "strict-origin-when-cross-origin", ...props, ref: ref, onError: didGetError, onLoad: didLoad }));
|
|
28
28
|
};
|
|
29
29
|
/*
|
|
30
30
|
* @description The <IFrame /> can be used like a regular <iframe> HTML tag.
|
package/dist/cjs/Img.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ export type ImgProps = NativeImgProps & {
|
|
|
18
18
|
readonly stack?: string;
|
|
19
19
|
} & Pick<SequenceProps, 'durationInFrames' | 'from' | 'hidden'>;
|
|
20
20
|
export declare const imgSchema: {
|
|
21
|
-
readonly hidden: import("./sequence-field-schema.js").SequenceFieldSchema;
|
|
22
21
|
readonly 'style.translate': {
|
|
23
22
|
readonly type: "translate";
|
|
24
23
|
readonly step: 1;
|
|
@@ -47,20 +46,21 @@ export declare const imgSchema: {
|
|
|
47
46
|
readonly default: 1;
|
|
48
47
|
readonly description: "Opacity";
|
|
49
48
|
};
|
|
49
|
+
readonly hidden: import("./sequence-field-schema.js").SequenceFieldSchema;
|
|
50
50
|
};
|
|
51
51
|
export declare const Img: React.ComponentType<NativeImgProps & {
|
|
52
|
-
readonly maxRetries?: number;
|
|
53
|
-
readonly pauseWhenLoading?: boolean;
|
|
54
|
-
readonly delayRenderRetries?: number;
|
|
55
|
-
readonly delayRenderTimeoutInMilliseconds?: number;
|
|
56
|
-
readonly onImageFrame?: (imageElement: HTMLImageElement) => void;
|
|
52
|
+
readonly maxRetries?: number | undefined;
|
|
53
|
+
readonly pauseWhenLoading?: boolean | undefined;
|
|
54
|
+
readonly delayRenderRetries?: number | undefined;
|
|
55
|
+
readonly delayRenderTimeoutInMilliseconds?: number | undefined;
|
|
56
|
+
readonly onImageFrame?: ((imageElement: HTMLImageElement) => void) | undefined;
|
|
57
57
|
readonly src: string;
|
|
58
|
-
readonly effects?: EffectsProp;
|
|
59
|
-
readonly showInTimeline?: boolean;
|
|
60
|
-
readonly name?: string;
|
|
58
|
+
readonly effects?: EffectsProp | undefined;
|
|
59
|
+
readonly showInTimeline?: boolean | undefined;
|
|
60
|
+
readonly name?: string | undefined;
|
|
61
61
|
/**
|
|
62
62
|
* @deprecated For internal use only
|
|
63
63
|
*/
|
|
64
|
-
readonly stack?: string;
|
|
65
|
-
} & Pick<SequenceProps, "
|
|
64
|
+
readonly stack?: string | undefined;
|
|
65
|
+
} & Pick<SequenceProps, "durationInFrames" | "from" | "hidden">>;
|
|
66
66
|
export {};
|
package/dist/cjs/Img.js
CHANGED
|
@@ -18,7 +18,7 @@ const wrap_in_schema_js_1 = require("./wrap-in-schema.js");
|
|
|
18
18
|
function exponentialBackoff(errorCount) {
|
|
19
19
|
return 1000 * 2 ** (errorCount - 1);
|
|
20
20
|
}
|
|
21
|
-
const ImgContent = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRenderRetries, delayRenderTimeoutInMilliseconds, onImageFrame, crossOrigin, decoding, ref, ...props }) => {
|
|
21
|
+
const ImgContent = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRenderRetries, delayRenderTimeoutInMilliseconds, onImageFrame, crossOrigin, decoding, ref, refForOutline, ...props }) => {
|
|
22
22
|
const imageRef = (0, react_1.useRef)(null);
|
|
23
23
|
const errors = (0, react_1.useRef)({});
|
|
24
24
|
const { delayPlayback } = (0, use_buffer_state_js_1.useBufferState)();
|
|
@@ -27,9 +27,16 @@ const ImgContent = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRende
|
|
|
27
27
|
if (!_propsValid) {
|
|
28
28
|
throw new Error('typecheck error');
|
|
29
29
|
}
|
|
30
|
-
(0, react_1.
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const imageCallbackRef = (0, react_1.useCallback)((img) => {
|
|
31
|
+
imageRef.current = img;
|
|
32
|
+
refForOutline.current = img;
|
|
33
|
+
if (typeof ref === 'function') {
|
|
34
|
+
ref(img);
|
|
35
|
+
}
|
|
36
|
+
else if (ref) {
|
|
37
|
+
ref.current = img;
|
|
38
|
+
}
|
|
39
|
+
}, [ref, refForOutline]);
|
|
33
40
|
const actualSrc = (0, prefetch_js_1.usePreload)(src);
|
|
34
41
|
const retryIn = (0, react_1.useCallback)((timeout) => {
|
|
35
42
|
if (!imageRef.current) {
|
|
@@ -53,27 +60,28 @@ const ImgContent = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRende
|
|
|
53
60
|
}, []);
|
|
54
61
|
const { delayRender, continueRender, cancelRender } = (0, use_delay_render_js_1.useDelayRender)();
|
|
55
62
|
const didGetError = (0, react_1.useCallback)((e) => {
|
|
56
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
63
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
64
|
+
var _h, _j, _k, _l;
|
|
57
65
|
if (!errors.current) {
|
|
58
66
|
return;
|
|
59
67
|
}
|
|
60
68
|
errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src] =
|
|
61
|
-
((
|
|
69
|
+
((_h = errors.current[(_b = imageRef.current) === null || _b === void 0 ? void 0 : _b.src]) !== null && _h !== void 0 ? _h : 0) + 1;
|
|
62
70
|
if (onError &&
|
|
63
|
-
((
|
|
71
|
+
((_j = errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src]) !== null && _j !== void 0 ? _j : 0) > maxRetries) {
|
|
64
72
|
onError(e);
|
|
65
73
|
return;
|
|
66
74
|
}
|
|
67
|
-
if (((
|
|
68
|
-
const backoff = exponentialBackoff((
|
|
75
|
+
if (((_k = errors.current[(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src]) !== null && _k !== void 0 ? _k : 0) <= maxRetries) {
|
|
76
|
+
const backoff = exponentialBackoff((_l = errors.current[(_e = imageRef.current) === null || _e === void 0 ? void 0 : _e.src]) !== null && _l !== void 0 ? _l : 0);
|
|
69
77
|
// eslint-disable-next-line no-console
|
|
70
|
-
console.warn(`Could not load image with source ${(0, truncate_src_for_label_js_1.truncateSrcForLabel)((
|
|
78
|
+
console.warn(`Could not load image with source ${(0, truncate_src_for_label_js_1.truncateSrcForLabel)((_f = imageRef.current) === null || _f === void 0 ? void 0 : _f.src)}, retrying again in ${backoff}ms`);
|
|
71
79
|
retryIn(backoff);
|
|
72
80
|
return;
|
|
73
81
|
}
|
|
74
82
|
try {
|
|
75
83
|
cancelRender('Error loading image with src: ' +
|
|
76
|
-
(0, truncate_src_for_label_js_1.truncateSrcForLabel)((
|
|
84
|
+
(0, truncate_src_for_label_js_1.truncateSrcForLabel)((_g = imageRef.current) === null || _g === void 0 ? void 0 : _g.src));
|
|
77
85
|
}
|
|
78
86
|
catch (_m) {
|
|
79
87
|
// cancelRender() intentionally throws after storing the error in scope.
|
|
@@ -105,16 +113,17 @@ const ImgContent = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRende
|
|
|
105
113
|
: () => undefined;
|
|
106
114
|
let unmounted = false;
|
|
107
115
|
const onComplete = () => {
|
|
108
|
-
var _a, _b, _c
|
|
116
|
+
var _a, _b, _c;
|
|
117
|
+
var _d;
|
|
109
118
|
// the decode() promise isn't cancelable -- it may still resolve after unmounting
|
|
110
119
|
if (unmounted) {
|
|
111
120
|
continueRender(newHandle);
|
|
112
121
|
return;
|
|
113
122
|
}
|
|
114
|
-
if (((
|
|
115
|
-
delete errors.current[(
|
|
123
|
+
if (((_d = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _d !== void 0 ? _d : 0) > 0) {
|
|
124
|
+
delete errors.current[(_b = imageRef.current) === null || _b === void 0 ? void 0 : _b.src];
|
|
116
125
|
// eslint-disable-next-line no-console
|
|
117
|
-
console.info(`Retry successful - ${(0, truncate_src_for_label_js_1.truncateSrcForLabel)((
|
|
126
|
+
console.info(`Retry successful - ${(0, truncate_src_for_label_js_1.truncateSrcForLabel)((_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src)} is now loaded`);
|
|
118
127
|
}
|
|
119
128
|
if (current) {
|
|
120
129
|
onImageFrame === null || onImageFrame === void 0 ? void 0 : onImageFrame(current);
|
|
@@ -172,13 +181,13 @@ const ImgContent = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRende
|
|
|
172
181
|
isClientSideRendering,
|
|
173
182
|
});
|
|
174
183
|
// src gets set once we've loaded and decoded the image.
|
|
175
|
-
return (
|
|
184
|
+
return (jsx_runtime_1.jsx("img", { ...props, ref: imageCallbackRef, crossOrigin: crossOriginValue, onError: didGetError, decoding: isRendering ? 'sync' : decoding }));
|
|
176
185
|
};
|
|
177
|
-
const NativeImgInner = ({ hidden, name, stack, showInTimeline, src, from, durationInFrames, _experimentalControls: controls, ...props }) => {
|
|
186
|
+
const NativeImgInner = ({ hidden, name, stack, showInTimeline, src, from, durationInFrames, _experimentalControls: controls, _remotionInternalRefForOutline: refForOutline, ...props }) => {
|
|
178
187
|
if (!src) {
|
|
179
188
|
throw new Error('No "src" prop was passed to <Img>.');
|
|
180
189
|
}
|
|
181
|
-
return (
|
|
190
|
+
return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity, _remotionInternalStack: stack, _remotionInternalDocumentationLink: name === undefined ? 'https://www.remotion.dev/docs/img' : undefined, _remotionInternalIsMedia: { type: 'image', src }, name: name !== null && name !== void 0 ? name : '<Img>', _experimentalControls: controls, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, hidden: hidden, _remotionInternalRefForOutline: refForOutline, children: jsx_runtime_1.jsx(ImgContent, { src: src, refForOutline: refForOutline, ...props }) }));
|
|
182
191
|
};
|
|
183
192
|
const CanvasImageWithPrivateProps = index_js_1.CanvasImage;
|
|
184
193
|
exports.imgSchema = {
|
|
@@ -226,8 +235,9 @@ const getFitFromObjectFit = (style) => {
|
|
|
226
235
|
};
|
|
227
236
|
const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src, from, durationInFrames, _experimentalControls: controls, width, height, className, style, id, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...props }) => {
|
|
228
237
|
var _a;
|
|
238
|
+
const refForOutline = (0, react_1.useRef)(null);
|
|
229
239
|
if (effects.length === 0) {
|
|
230
|
-
return (
|
|
240
|
+
return (jsx_runtime_1.jsx(NativeImgInner, { ...props, ref: ref, hidden: hidden, name: name, stack: stack, showInTimeline: showInTimeline, src: src, from: from, durationInFrames: durationInFrames, _experimentalControls: controls, width: width, height: height, className: className, style: style, id: id, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, _remotionInternalRefForOutline: refForOutline }));
|
|
231
241
|
}
|
|
232
242
|
if (!src) {
|
|
233
243
|
throw new Error('No "src" prop was passed to <Img>.');
|
|
@@ -242,7 +252,7 @@ const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src,
|
|
|
242
252
|
const canvasHeight = typeof height === 'number' ? height : undefined;
|
|
243
253
|
const canvasProps = props;
|
|
244
254
|
const canvasFit = (_a = getFitFromObjectFit(style)) !== null && _a !== void 0 ? _a : 'fill';
|
|
245
|
-
return (
|
|
255
|
+
return (jsx_runtime_1.jsx(CanvasImageWithPrivateProps, { src: src, width: canvasWidth, height: canvasHeight, fit: canvasFit, effects: effects, className: className, style: style, id: id, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, from: from, durationInFrames: durationInFrames, hidden: hidden, name: name !== null && name !== void 0 ? name : '<Img>', showInTimeline: showInTimeline, stack: stack, _remotionInternalDocumentationLink: name === undefined ? 'https://www.remotion.dev/docs/img' : undefined, _experimentalControls: controls, _remotionInternalRefForOutline: refForOutline, ...canvasProps }));
|
|
246
256
|
};
|
|
247
257
|
/*
|
|
248
258
|
* @description Works just like a regular HTML img tag. When you use the <Img> tag, Remotion will ensure that the image is loaded before rendering the frame.
|
|
@@ -5,6 +5,7 @@ export declare const RemotionRootContexts: React.FC<{
|
|
|
5
5
|
readonly numberOfAudioTags: number;
|
|
6
6
|
readonly logLevel: LogLevel;
|
|
7
7
|
readonly audioLatencyHint: AudioContextLatencyCategory;
|
|
8
|
+
readonly previewSampleRate: number | null;
|
|
8
9
|
readonly videoEnabled: boolean;
|
|
9
10
|
readonly audioEnabled: boolean;
|
|
10
11
|
readonly frameState: Record<string, number> | null;
|
package/dist/cjs/RemotionRoot.js
CHANGED
|
@@ -13,7 +13,7 @@ const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
|
13
13
|
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
14
14
|
const use_media_enabled_js_1 = require("./use-media-enabled.js");
|
|
15
15
|
const duration_state_js_1 = require("./video/duration-state.js");
|
|
16
|
-
const RemotionRootContexts = ({ children, numberOfAudioTags, logLevel, audioLatencyHint, videoEnabled, audioEnabled, frameState, }) => {
|
|
16
|
+
const RemotionRootContexts = ({ children, numberOfAudioTags, logLevel, audioLatencyHint, previewSampleRate, videoEnabled, audioEnabled, frameState, }) => {
|
|
17
17
|
const nonceContext = (0, react_1.useMemo)(() => {
|
|
18
18
|
let counter = 0;
|
|
19
19
|
return {
|
|
@@ -23,6 +23,6 @@ const RemotionRootContexts = ({ children, numberOfAudioTags, logLevel, audioLate
|
|
|
23
23
|
const logging = (0, react_1.useMemo)(() => {
|
|
24
24
|
return { logLevel, mountTime: Date.now() };
|
|
25
25
|
}, [logLevel]);
|
|
26
|
-
return (
|
|
26
|
+
return (jsx_runtime_1.jsx(log_level_context_js_1.LogLevelContext.Provider, { value: logging, children: jsx_runtime_1.jsx(nonce_js_1.NonceContext.Provider, { value: nonceContext, children: jsx_runtime_1.jsx(TimelineContext_js_1.TimelineContextProvider, { frameState: frameState, children: jsx_runtime_1.jsx(use_media_enabled_js_1.MediaEnabledProvider, { videoEnabled: videoEnabled, audioEnabled: audioEnabled, children: jsx_runtime_1.jsx(EditorProps_js_1.EditorPropsProvider, { children: jsx_runtime_1.jsx(prefetch_state_js_1.PrefetchProvider, { children: jsx_runtime_1.jsx(SequenceManager_js_1.SequenceManagerProvider, { children: jsx_runtime_1.jsx(duration_state_js_1.DurationsContextProvider, { children: jsx_runtime_1.jsx(buffering_js_1.BufferingProvider, { children: jsx_runtime_1.jsx(shared_audio_tags_js_1.SharedAudioContextProvider, { audioLatencyHint: audioLatencyHint, audioEnabled: audioEnabled, previewSampleRate: previewSampleRate, children: jsx_runtime_1.jsx(shared_audio_tags_js_1.SharedAudioTagsContextProvider, { numberOfAudioTags: numberOfAudioTags, children: children }) }) }) }) }) }) }) }) }) }) }));
|
|
27
27
|
};
|
|
28
28
|
exports.RemotionRootContexts = RemotionRootContexts;
|
|
@@ -52,6 +52,6 @@ const RenderAssetManagerProvider = ({ children, collectAssets }) => {
|
|
|
52
52
|
renderAssets,
|
|
53
53
|
};
|
|
54
54
|
}, [renderAssets, registerRenderAsset, unregisterRenderAsset]);
|
|
55
|
-
return (
|
|
55
|
+
return (jsx_runtime_1.jsx(exports.RenderAssetManager.Provider, { value: contextValue, children: children }));
|
|
56
56
|
};
|
|
57
57
|
exports.RenderAssetManagerProvider = RenderAssetManagerProvider;
|
package/dist/cjs/Sequence.js
CHANGED
|
@@ -253,7 +253,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
|
|
|
253
253
|
if (hidden) {
|
|
254
254
|
return null;
|
|
255
255
|
}
|
|
256
|
-
return (
|
|
256
|
+
return (jsx_runtime_1.jsx(SequenceContext_js_1.SequenceContext.Provider, { value: contextValue, children: content === null ? null : other.layout === 'none' ? (content) : (jsx_runtime_1.jsx(AbsoluteFill_js_1.AbsoluteFill, { ref: ref, style: defaultStyle, className: other.className, children: content })) }));
|
|
257
257
|
};
|
|
258
258
|
const RegularSequence = (0, react_1.forwardRef)(RegularSequenceRefForwardingFunction);
|
|
259
259
|
const PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
|
|
@@ -291,7 +291,7 @@ const PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
|
|
|
291
291
|
styleWhilePremounted,
|
|
292
292
|
styleWhilePostmounted,
|
|
293
293
|
]);
|
|
294
|
-
return (
|
|
294
|
+
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isFreezingActive, children: jsx_runtime_1.jsx(SequenceInner, { ref: ref, from: from, durationInFrames: durationInFrames, style: style, _remotionInternalPremountDisplay: premountFor, _remotionInternalPostmountDisplay: postmountFor, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, ...otherProps }) }));
|
|
295
295
|
};
|
|
296
296
|
const PremountedPostmountedSequence = (0, react_1.forwardRef)(PremountedPostmountedSequenceRefForwardingFunction);
|
|
297
297
|
const SequenceRefForwardingFunction = (props, ref) => {
|
|
@@ -303,10 +303,10 @@ const SequenceRefForwardingFunction = (props, ref) => {
|
|
|
303
303
|
? ((_a = props.premountFor) !== null && _a !== void 0 ? _a : fps)
|
|
304
304
|
: props.premountFor;
|
|
305
305
|
if (effectivePremountFor || props.postmountFor) {
|
|
306
|
-
return (
|
|
306
|
+
return (jsx_runtime_1.jsx(PremountedPostmountedSequence, { ref: ref, ...props, premountFor: effectivePremountFor }));
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
-
return
|
|
309
|
+
return jsx_runtime_1.jsx(RegularSequence, { ...props, ref: ref });
|
|
310
310
|
};
|
|
311
311
|
const SequenceInner = (0, react_1.forwardRef)(SequenceRefForwardingFunction);
|
|
312
312
|
/*
|
|
@@ -188,6 +188,6 @@ const SequenceManagerProvider = ({ children }) => {
|
|
|
188
188
|
clearEffectDragOverrides,
|
|
189
189
|
setCodeValues,
|
|
190
190
|
]);
|
|
191
|
-
return (
|
|
191
|
+
return (jsx_runtime_1.jsx(exports.SequenceManager.Provider, { value: sequenceContext, children: jsx_runtime_1.jsx(exports.VisualModeCodeValuesContext.Provider, { value: codeValuesContext, children: jsx_runtime_1.jsx(exports.VisualModeDragOverridesContext.Provider, { value: dragOverridesContext, children: jsx_runtime_1.jsx(exports.VisualModeSettersContext.Provider, { value: settersContext, children: children }) }) }) }));
|
|
192
192
|
};
|
|
193
193
|
exports.SequenceManagerProvider = SequenceManagerProvider;
|
package/dist/cjs/Still.js
CHANGED
|
@@ -17,6 +17,6 @@ const Still = (props) => {
|
|
|
17
17
|
fps: 1,
|
|
18
18
|
};
|
|
19
19
|
// @ts-expect-error TypeScript does not understand it, but should still fail on type mismatch
|
|
20
|
-
return react_1.default.createElement(
|
|
20
|
+
return react_1.default.createElement(Composition_js_1.Composition, newProps);
|
|
21
21
|
};
|
|
22
22
|
exports.Still = Still;
|
|
@@ -78,6 +78,6 @@ const TimelineContextProvider = ({ children, frameState }) => {
|
|
|
78
78
|
setPlaying,
|
|
79
79
|
};
|
|
80
80
|
}, []);
|
|
81
|
-
return (
|
|
81
|
+
return (jsx_runtime_1.jsx(exports.AbsoluteTimeContext.Provider, { value: timelineContextValue, children: jsx_runtime_1.jsx(exports.PlaybackRateContext.Provider, { value: playbackRateContextValue, children: jsx_runtime_1.jsx(exports.TimelineContext.Provider, { value: timelineContextValue, children: jsx_runtime_1.jsx(exports.SetTimelineContext.Provider, { value: setTimelineContextValue, children: children }) }) }) }));
|
|
82
82
|
};
|
|
83
83
|
exports.TimelineContextProvider = TimelineContextProvider;
|
|
@@ -2,10 +2,10 @@ import type React from 'react';
|
|
|
2
2
|
import type { SequenceControls } from '../CompositionManager.js';
|
|
3
3
|
import type { EffectsProp } from '../effects/effect-types.js';
|
|
4
4
|
import type { RemotionAnimatedImageProps } from './props';
|
|
5
|
-
export declare const AnimatedImage: React.ComponentType<Omit<import("../Sequence.js").SequenceProps, "
|
|
6
|
-
readonly durationInFrames?: number;
|
|
7
|
-
readonly effects?: EffectsProp;
|
|
5
|
+
export declare const AnimatedImage: React.ComponentType<Omit<import("../Sequence.js").SequenceProps, "_remotionInternalEffects" | "children" | "durationInFrames" | "layout"> & RemotionAnimatedImageProps & {
|
|
6
|
+
readonly durationInFrames?: number | undefined;
|
|
7
|
+
readonly effects?: EffectsProp | undefined;
|
|
8
8
|
} & {
|
|
9
9
|
readonly _experimentalControls?: SequenceControls | undefined;
|
|
10
|
-
readonly ref?: React.Ref<HTMLCanvasElement
|
|
10
|
+
readonly ref?: React.Ref<HTMLCanvasElement> | undefined;
|
|
11
11
|
}>;
|
|
@@ -14,6 +14,7 @@ const use_video_config_js_1 = require("../use-video-config.js");
|
|
|
14
14
|
const wrap_in_schema_js_1 = require("../wrap-in-schema.js");
|
|
15
15
|
const canvas_1 = require("./canvas");
|
|
16
16
|
const decode_image_js_1 = require("./decode-image.js");
|
|
17
|
+
const request_init_1 = require("./request-init");
|
|
17
18
|
const resolve_image_source_1 = require("./resolve-image-source");
|
|
18
19
|
const animatedImageSchema = {
|
|
19
20
|
playbackRate: {
|
|
@@ -27,7 +28,7 @@ const animatedImageSchema = {
|
|
|
27
28
|
...sequence_field_schema_js_1.sequenceVisualStyleSchema,
|
|
28
29
|
hidden: sequence_field_schema_js_1.hiddenField,
|
|
29
30
|
};
|
|
30
|
-
const AnimatedImageContent = (0, react_1.forwardRef)(({ src, width, height, onError, loopBehavior = 'loop', playbackRate = 1, fit = 'fill', effects, controls, ...props }, canvasRef) => {
|
|
31
|
+
const AnimatedImageContent = (0, react_1.forwardRef)(({ src, width, height, onError, loopBehavior = 'loop', playbackRate = 1, fit = 'fill', requestInit, effects, controls, ...props }, canvasRef) => {
|
|
31
32
|
var _a;
|
|
32
33
|
const resolvedSrc = (0, resolve_image_source_1.resolveAnimatedImageSource)(src);
|
|
33
34
|
const [imageDecoder, setImageDecoder] = (0, react_1.useState)(null);
|
|
@@ -38,6 +39,9 @@ const AnimatedImageContent = (0, react_1.forwardRef)(({ src, width, height, onEr
|
|
|
38
39
|
const currentTime = frame / playbackRate / fps;
|
|
39
40
|
const currentTimeRef = (0, react_1.useRef)(currentTime);
|
|
40
41
|
currentTimeRef.current = currentTime;
|
|
42
|
+
const requestInitKey = (0, request_init_1.serializeRequestInit)(requestInit);
|
|
43
|
+
const requestInitRef = (0, react_1.useRef)(requestInit);
|
|
44
|
+
requestInitRef.current = requestInit;
|
|
41
45
|
const ref = (0, react_1.useRef)(null);
|
|
42
46
|
const memoizedEffects = (0, use_memoized_effects_js_1.useMemoizedEffects)({
|
|
43
47
|
effects,
|
|
@@ -57,6 +61,7 @@ const AnimatedImageContent = (0, react_1.forwardRef)(({ src, width, height, onEr
|
|
|
57
61
|
(0, decode_image_js_1.decodeImage)({
|
|
58
62
|
resolvedSrc,
|
|
59
63
|
signal: controller.signal,
|
|
64
|
+
requestInit: requestInitRef.current,
|
|
60
65
|
currentTime: currentTimeRef.current,
|
|
61
66
|
initialLoopBehavior,
|
|
62
67
|
})
|
|
@@ -84,6 +89,7 @@ const AnimatedImageContent = (0, react_1.forwardRef)(({ src, width, height, onEr
|
|
|
84
89
|
resolvedSrc,
|
|
85
90
|
decodeHandle,
|
|
86
91
|
onError,
|
|
92
|
+
requestInitKey,
|
|
87
93
|
initialLoopBehavior,
|
|
88
94
|
continueRender,
|
|
89
95
|
]);
|
|
@@ -139,13 +145,17 @@ const AnimatedImageContent = (0, react_1.forwardRef)(({ src, width, height, onEr
|
|
|
139
145
|
width,
|
|
140
146
|
height,
|
|
141
147
|
]);
|
|
142
|
-
return (
|
|
148
|
+
return (jsx_runtime_1.jsx(canvas_1.Canvas, { ref: ref, width: width, height: height, fit: fit, effects: memoizedEffects, ...props }));
|
|
143
149
|
});
|
|
144
150
|
AnimatedImageContent.displayName = 'AnimatedImageContent';
|
|
145
|
-
const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, loopBehavior, id, className, style, durationInFrames, effects = [], _experimentalControls: controls, ref, ...sequenceProps }) => {
|
|
151
|
+
const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, loopBehavior, id, className, style, durationInFrames, requestInit, effects = [], _experimentalControls: controls, ref, ...sequenceProps }) => {
|
|
146
152
|
const { durationInFrames: videoDuration } = (0, use_video_config_js_1.useVideoConfig)();
|
|
147
153
|
const resolvedDuration = durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : videoDuration;
|
|
154
|
+
const actualRef = (0, react_1.useRef)(null);
|
|
148
155
|
const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
|
|
156
|
+
(0, react_1.useImperativeHandle)(ref, () => {
|
|
157
|
+
return actualRef.current;
|
|
158
|
+
}, []);
|
|
149
159
|
const animatedImageProps = {
|
|
150
160
|
src,
|
|
151
161
|
width,
|
|
@@ -157,8 +167,9 @@ const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, lo
|
|
|
157
167
|
id,
|
|
158
168
|
className,
|
|
159
169
|
style,
|
|
170
|
+
requestInit,
|
|
160
171
|
};
|
|
161
|
-
return (
|
|
172
|
+
return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", durationInFrames: resolvedDuration, name: "<AnimatedImage>", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage", _experimentalControls: controls, _remotionInternalEffects: memoizedEffectDefinitions, ...sequenceProps, _remotionInternalRefForOutline: actualRef, children: jsx_runtime_1.jsx(AnimatedImageContent, { ...animatedImageProps, ref: actualRef, effects: effects, controls: controls }) }));
|
|
162
173
|
};
|
|
163
174
|
exports.AnimatedImage = (0, wrap_in_schema_js_1.wrapInSchema)(AnimatedImageInner, animatedImageSchema);
|
|
164
175
|
exports.AnimatedImage.displayName = 'AnimatedImage';
|
|
@@ -101,6 +101,6 @@ const CanvasRefForwardingFunction = ({ width, height, fit, className, style, eff
|
|
|
101
101
|
},
|
|
102
102
|
};
|
|
103
103
|
}, [draw]);
|
|
104
|
-
return
|
|
104
|
+
return jsx_runtime_1.jsx("canvas", { ref: canvasRef, className: className, style: style });
|
|
105
105
|
};
|
|
106
106
|
exports.Canvas = react_1.default.forwardRef(CanvasRefForwardingFunction);
|
|
@@ -8,9 +8,10 @@ export type RemotionImageDecoder = {
|
|
|
8
8
|
getFrame: (i: number, loopBehavior: RemotionAnimatedImageLoopBehavior) => Promise<AnimatedImageCacheItem | null>;
|
|
9
9
|
frameCount: number;
|
|
10
10
|
};
|
|
11
|
-
export declare const decodeImage: ({ resolvedSrc, signal, currentTime, initialLoopBehavior, }: {
|
|
11
|
+
export declare const decodeImage: ({ resolvedSrc, signal, requestInit, currentTime, initialLoopBehavior, }: {
|
|
12
12
|
resolvedSrc: string;
|
|
13
13
|
signal: AbortSignal;
|
|
14
|
+
requestInit?: RequestInit | undefined;
|
|
14
15
|
currentTime: number;
|
|
15
16
|
initialLoopBehavior: RemotionAnimatedImageLoopBehavior;
|
|
16
17
|
}) => Promise<RemotionImageDecoder>;
|
|
@@ -9,11 +9,11 @@ const getActualTime = ({ loopBehavior, durationFound, timeInSec, }) => {
|
|
|
9
9
|
: timeInSec
|
|
10
10
|
: Math.min(timeInSec, durationFound || Infinity);
|
|
11
11
|
};
|
|
12
|
-
const decodeImage = async ({ resolvedSrc, signal, currentTime, initialLoopBehavior, }) => {
|
|
12
|
+
const decodeImage = async ({ resolvedSrc, signal, requestInit, currentTime, initialLoopBehavior, }) => {
|
|
13
13
|
if (typeof ImageDecoder === 'undefined') {
|
|
14
14
|
throw new Error('Your browser does not support the WebCodecs ImageDecoder API.');
|
|
15
15
|
}
|
|
16
|
-
const res = await fetch(resolvedSrc, { signal });
|
|
16
|
+
const res = await fetch(resolvedSrc, { ...requestInit, signal });
|
|
17
17
|
const { body } = res;
|
|
18
18
|
if (!body) {
|
|
19
19
|
throw new Error('Got no body');
|