remotion 4.0.479 → 4.0.482

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.
@@ -59,9 +59,11 @@ export type SequenceControls = {
59
59
  overrideId: string;
60
60
  supportsEffects: boolean;
61
61
  componentIdentity: JsxComponentIdentity | null;
62
+ componentName: string;
62
63
  };
63
64
  export type TSequence = {
64
65
  from: number;
66
+ trimBefore: number | null;
65
67
  duration: number;
66
68
  id: string;
67
69
  displayName: string;
@@ -64,6 +64,80 @@ export type HtmlInCanvasProps = Omit<InteractiveBaseProps, 'children'> & Omit<Ab
64
64
  readonly onInit?: HtmlInCanvasOnInit;
65
65
  readonly pixelDensity?: HtmlInCanvasPixelDensity;
66
66
  };
67
+ export declare const htmlInCanvasSchema: {
68
+ readonly 'style.transformOrigin': {
69
+ readonly type: "transform-origin";
70
+ readonly step: 1;
71
+ readonly default: "50% 50%";
72
+ readonly description: "Transform origin";
73
+ };
74
+ readonly 'style.translate': {
75
+ readonly type: "translate";
76
+ readonly step: 1;
77
+ readonly default: "0px 0px";
78
+ readonly description: "Offset";
79
+ };
80
+ readonly 'style.scale': {
81
+ readonly type: "scale";
82
+ readonly max: 100;
83
+ readonly step: 0.01;
84
+ readonly default: 1;
85
+ readonly description: "Scale";
86
+ };
87
+ readonly 'style.rotate': {
88
+ readonly type: "rotation-css";
89
+ readonly step: 1;
90
+ readonly default: "0deg";
91
+ readonly description: "Rotation";
92
+ };
93
+ readonly 'style.opacity': {
94
+ readonly type: "number";
95
+ readonly min: 0;
96
+ readonly max: 1;
97
+ readonly step: 0.01;
98
+ readonly default: 1;
99
+ readonly description: "Opacity";
100
+ readonly hiddenFromList: false;
101
+ };
102
+ readonly durationInFrames: {
103
+ readonly type: "number";
104
+ readonly default: undefined;
105
+ readonly min: 1;
106
+ readonly step: 1;
107
+ readonly hiddenFromList: true;
108
+ };
109
+ readonly from: {
110
+ readonly type: "number";
111
+ readonly default: 0;
112
+ readonly step: 1;
113
+ readonly hiddenFromList: true;
114
+ };
115
+ readonly trimBefore: {
116
+ readonly type: "number";
117
+ readonly default: 0;
118
+ readonly min: 0;
119
+ readonly step: 1;
120
+ readonly hiddenFromList: true;
121
+ };
122
+ readonly freeze: {
123
+ readonly type: "number";
124
+ readonly default: null;
125
+ readonly step: 1;
126
+ readonly hiddenFromList: true;
127
+ };
128
+ readonly hidden: import("./interactivity-schema.js").BooleanFieldSchema;
129
+ readonly name: import("./interactivity-schema.js").HiddenFieldSchema;
130
+ readonly showInTimeline: import("./interactivity-schema.js").HiddenFieldSchema;
131
+ readonly pixelDensity: {
132
+ readonly type: "number";
133
+ readonly min: 1;
134
+ readonly max: 3;
135
+ readonly step: 0.1;
136
+ readonly default: 1;
137
+ readonly description: "Pixel density";
138
+ readonly hiddenFromList: false;
139
+ };
140
+ };
67
141
  export declare const HtmlInCanvas: React.ForwardRefExoticComponent<Omit<InteractiveBaseProps, "children"> & Omit<AbsoluteFillLayout, "layout" | "postmountFor" | "premountFor" | "styleWhilePostmounted" | "styleWhilePremounted"> & {
68
142
  readonly durationInFrames?: number | undefined;
69
143
  readonly width: number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HtmlInCanvas = exports.HTML_IN_CANVAS_UNSUPPORTED_MESSAGE = exports.isHtmlInCanvasSupported = void 0;
3
+ exports.HtmlInCanvas = exports.htmlInCanvasSchema = exports.HTML_IN_CANVAS_UNSUPPORTED_MESSAGE = exports.isHtmlInCanvasSupported = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const delay_render_js_1 = require("./delay-render.js");
@@ -137,13 +137,6 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
137
137
  if (!placeholderCanvas) {
138
138
  throw new Error('Canvas not found');
139
139
  }
140
- // `GPUQueue.copyElementImageToTexture` / related paths validate the
141
- // linked offscreen surface has a rendering context. Acquire `2d` here
142
- // before any capture or handler (must not call getContext on placeholder).
143
- const offscreen2d = offscreen.getContext('2d');
144
- if (!offscreen2d) {
145
- throw new Error('Failed to acquire 2D context for <HtmlInCanvas> offscreen canvas');
146
- }
147
140
  const handle = (0, delay_render_js_1.delayRender)('onPaint');
148
141
  if (!initializedRef.current) {
149
142
  initializedRef.current = true;
@@ -293,14 +286,24 @@ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = []
293
286
  return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { durationInFrames: resolvedDuration, name: name !== null && name !== void 0 ? name : '<HtmlInCanvas>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/remotion/html-in-canvas", controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, outlineRef: actualRef, layout: "none", ...sequenceProps, children: jsx_runtime_1.jsx(HtmlInCanvasContent, { ref: setCanvasRef, width: width, height: height, effects: effects, onPaint: onPaint, onInit: onInit, pixelDensity: pixelDensity, controls: controls, style: style, children: children }) }));
294
287
  });
295
288
  HtmlInCanvasInner.displayName = 'HtmlInCanvas';
296
- const htmlInCanvasSchema = {
289
+ exports.htmlInCanvasSchema = {
297
290
  ...interactivity_schema_js_1.baseSchema,
291
+ pixelDensity: {
292
+ type: 'number',
293
+ min: 1,
294
+ max: 3,
295
+ step: 0.1,
296
+ default: 1,
297
+ description: 'Pixel density',
298
+ hiddenFromList: false,
299
+ },
298
300
  ...interactivity_schema_js_1.transformSchema,
299
301
  };
300
302
  const HtmlInCanvasWrapped = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
301
303
  Component: HtmlInCanvasInner,
304
+ componentName: '<HtmlInCanvas>',
302
305
  componentIdentity: 'dev.remotion.remotion.HtmlInCanvas',
303
- schema: htmlInCanvasSchema,
306
+ schema: exports.htmlInCanvasSchema,
304
307
  supportsEffects: true,
305
308
  });
306
309
  exports.HtmlInCanvas = Object.assign(HtmlInCanvasWrapped, {
package/dist/cjs/Img.d.ts CHANGED
@@ -65,6 +65,13 @@ export declare const imgSchema: {
65
65
  readonly step: 1;
66
66
  readonly hiddenFromList: true;
67
67
  };
68
+ readonly trimBefore: {
69
+ readonly type: "number";
70
+ readonly default: 0;
71
+ readonly min: 0;
72
+ readonly step: 1;
73
+ readonly hiddenFromList: true;
74
+ };
68
75
  readonly freeze: {
69
76
  readonly type: "number";
70
77
  readonly default: null;
package/dist/cjs/Img.js CHANGED
@@ -183,11 +183,11 @@ const ImgContent = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRende
183
183
  // src gets set once we've loaded and decoded the image.
184
184
  return (jsx_runtime_1.jsx("img", { ...props, ref: imageCallbackRef, crossOrigin: crossOriginValue, onError: didGetError, decoding: isRendering ? 'sync' : decoding }));
185
185
  };
186
- const NativeImgInner = ({ hidden, name, stack, showInTimeline, src, from, durationInFrames, freeze, controls, outlineRef: refForOutline, ...props }) => {
186
+ const NativeImgInner = ({ hidden, name, stack, showInTimeline, src, from, trimBefore, durationInFrames, freeze, controls, outlineRef: refForOutline, ...props }) => {
187
187
  if (!src) {
188
188
  throw new Error('No "src" prop was passed to <Img>.');
189
189
  }
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, freeze: freeze, _remotionInternalStack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", _remotionInternalIsMedia: { type: 'image', src }, name: name !== null && name !== void 0 ? name : '<Img>', controls: controls, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, hidden: hidden, outlineRef: refForOutline, children: jsx_runtime_1.jsx(ImgContent, { src: src, refForOutline: refForOutline, ...props }) }));
190
+ return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, trimBefore: trimBefore, durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity, freeze: freeze, _remotionInternalStack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", _remotionInternalIsMedia: { type: 'image', src }, name: name !== null && name !== void 0 ? name : '<Img>', controls: controls, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, hidden: hidden, outlineRef: refForOutline, children: jsx_runtime_1.jsx(ImgContent, { src: src, refForOutline: refForOutline, ...props }) }));
191
191
  };
192
192
  const CanvasImageWithPrivateProps = index_js_1.CanvasImage;
193
193
  exports.imgSchema = {
@@ -233,11 +233,11 @@ const getFitFromObjectFit = (style) => {
233
233
  }
234
234
  return undefined;
235
235
  };
236
- const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src, from, durationInFrames, freeze, controls, width, height, className, style, id, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...props }) => {
236
+ const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src, from, trimBefore, durationInFrames, freeze, controls, width, height, className, style, id, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...props }) => {
237
237
  var _a;
238
238
  const refForOutline = (0, react_1.useRef)(null);
239
239
  if (effects.length === 0) {
240
- return (jsx_runtime_1.jsx(NativeImgInner, { ...props, ref: ref, hidden: hidden, name: name, stack: stack, showInTimeline: showInTimeline, src: src, from: from, durationInFrames: durationInFrames, freeze: freeze, controls: controls, width: width, height: height, className: className, style: style, id: id, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, outlineRef: refForOutline }));
240
+ return (jsx_runtime_1.jsx(NativeImgInner, { ...props, ref: ref, hidden: hidden, name: name, stack: stack, showInTimeline: showInTimeline, src: src, from: from, trimBefore: trimBefore, durationInFrames: durationInFrames, freeze: freeze, controls: controls, width: width, height: height, className: className, style: style, id: id, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, outlineRef: refForOutline }));
241
241
  }
242
242
  if (!src) {
243
243
  throw new Error('No "src" prop was passed to <Img>.');
@@ -252,7 +252,7 @@ const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src,
252
252
  const canvasHeight = typeof height === 'number' ? height : undefined;
253
253
  const canvasProps = props;
254
254
  const canvasFit = (_a = getFitFromObjectFit(style)) !== null && _a !== void 0 ? _a : 'fill';
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, freeze: freeze, hidden: hidden, name: name !== null && name !== void 0 ? name : '<Img>', showInTimeline: showInTimeline, stack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", controls: controls, outlineRef: refForOutline, ...canvasProps }));
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, trimBefore: trimBefore, durationInFrames: durationInFrames, freeze: freeze, hidden: hidden, name: name !== null && name !== void 0 ? name : '<Img>', showInTimeline: showInTimeline, stack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", controls: controls, outlineRef: refForOutline, ...canvasProps }));
256
256
  };
257
257
  /*
258
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.
@@ -260,6 +260,7 @@ const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src,
260
260
  */
261
261
  exports.Img = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
262
262
  Component: ImgInner,
263
+ componentName: '<Img>',
263
264
  componentIdentity: 'dev.remotion.remotion.Img',
264
265
  schema: exports.imgSchema,
265
266
  supportsEffects: true,
@@ -6,7 +6,7 @@ type InteractiveHtmlTag = 'a' | 'article' | 'aside' | 'button' | 'code' | 'div'
6
6
  type InteractiveSvgTag = 'circle' | 'ellipse' | 'g' | 'line' | 'path' | 'rect' | 'svg' | 'text';
7
7
  type InteractiveTag = InteractiveHtmlTag | InteractiveSvgTag;
8
8
  type ElementForTag<Tag extends InteractiveTag> = Tag extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[Tag] : Tag extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[Tag] : Element;
9
- export type InteractiveBaseProps = Pick<SequenceProps, 'durationInFrames' | 'from' | 'freeze' | 'hidden' | 'name' | 'showInTimeline'>;
9
+ export type InteractiveBaseProps = Pick<SequenceProps, 'durationInFrames' | 'from' | 'trimBefore' | 'freeze' | 'hidden' | 'name' | 'showInTimeline'>;
10
10
  export type InteractiveTransformProps = Pick<AbsoluteFillLayout, 'style'>;
11
11
  export type InteractivePremountProps = Pick<AbsoluteFillLayout, 'premountFor' | 'postmountFor' | 'styleWhilePremounted' | 'styleWhilePostmounted'>;
12
12
  type InteractiveSequenceProps = InteractiveBaseProps & {
@@ -35,6 +35,13 @@ export declare const Interactive: {
35
35
  readonly step: 1;
36
36
  readonly hiddenFromList: true;
37
37
  };
38
+ readonly trimBefore: {
39
+ readonly type: "number";
40
+ readonly default: 0;
41
+ readonly min: 0;
42
+ readonly step: 1;
43
+ readonly hiddenFromList: true;
44
+ };
38
45
  readonly freeze: {
39
46
  readonly type: "number";
40
47
  readonly default: null;
@@ -81,6 +88,77 @@ export declare const Interactive: {
81
88
  readonly hiddenFromList: false;
82
89
  };
83
90
  };
91
+ textSchema: {
92
+ readonly 'style.color': {
93
+ readonly type: "color";
94
+ readonly default: undefined;
95
+ readonly description: "Color";
96
+ };
97
+ readonly 'style.fontSize': {
98
+ readonly type: "number";
99
+ readonly default: undefined;
100
+ readonly min: 0;
101
+ readonly step: 1;
102
+ readonly description: "Font size";
103
+ readonly hiddenFromList: false;
104
+ };
105
+ readonly 'style.lineHeight': {
106
+ readonly type: "number";
107
+ readonly default: undefined;
108
+ readonly min: 0;
109
+ readonly step: 0.05;
110
+ readonly description: "Line height";
111
+ readonly hiddenFromList: false;
112
+ };
113
+ readonly 'style.fontWeight': {
114
+ readonly type: "enum";
115
+ readonly default: "400";
116
+ readonly description: "Font weight";
117
+ readonly variants: {
118
+ readonly '100': {};
119
+ readonly '200': {};
120
+ readonly '300': {};
121
+ readonly '400': {};
122
+ readonly '500': {};
123
+ readonly '600': {};
124
+ readonly '700': {};
125
+ readonly '800': {};
126
+ readonly '900': {};
127
+ readonly normal: {};
128
+ readonly bold: {};
129
+ };
130
+ };
131
+ readonly 'style.fontStyle': {
132
+ readonly type: "enum";
133
+ readonly default: "normal";
134
+ readonly description: "Font style";
135
+ readonly variants: {
136
+ readonly normal: {};
137
+ readonly italic: {};
138
+ readonly oblique: {};
139
+ };
140
+ };
141
+ readonly 'style.textAlign': {
142
+ readonly type: "enum";
143
+ readonly default: "left";
144
+ readonly description: "Text align";
145
+ readonly variants: {
146
+ readonly left: {};
147
+ readonly center: {};
148
+ readonly right: {};
149
+ readonly justify: {};
150
+ readonly start: {};
151
+ readonly end: {};
152
+ };
153
+ };
154
+ readonly 'style.letterSpacing': {
155
+ readonly type: "number";
156
+ readonly default: undefined;
157
+ readonly step: 0.1;
158
+ readonly description: "Letter spacing";
159
+ readonly hiddenFromList: false;
160
+ };
161
+ };
84
162
  premountSchema: {
85
163
  readonly premountFor: {
86
164
  readonly type: "number";
@@ -118,6 +196,13 @@ export declare const Interactive: {
118
196
  readonly step: 1;
119
197
  readonly hiddenFromList: true;
120
198
  };
199
+ readonly trimBefore: {
200
+ readonly type: "number";
201
+ readonly default: 0;
202
+ readonly min: 0;
203
+ readonly step: 1;
204
+ readonly hiddenFromList: true;
205
+ };
121
206
  readonly freeze: {
122
207
  readonly type: "number";
123
208
  readonly default: null;
@@ -193,10 +278,11 @@ export declare const Interactive: {
193
278
  };
194
279
  };
195
280
  };
196
- withSchema: <S extends InteractivitySchema, Props extends object>({ Component, componentIdentity, schema, supportsEffects, }: {
281
+ withSchema: <S extends InteractivitySchema, Props extends object>({ Component, componentName, componentIdentity, schema, supportsEffects, }: {
197
282
  Component: React.ComponentType<Props & {
198
283
  readonly controls: SequenceControls | undefined;
199
284
  }>;
285
+ componentName: string;
200
286
  componentIdentity: string | null;
201
287
  schema: S;
202
288
  supportsEffects: boolean;
@@ -43,6 +43,7 @@ const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js")
43
43
  const interactiveElementSchema = {
44
44
  ...interactivity_schema_js_1.baseSchema,
45
45
  ...interactivity_schema_js_1.transformSchema,
46
+ ...interactivity_schema_js_1.textSchema,
46
47
  };
47
48
  const setRef = (ref, value) => {
48
49
  if (typeof ref === 'function') {
@@ -54,13 +55,13 @@ const setRef = (ref, value) => {
54
55
  };
55
56
  const makeInteractiveElement = (tag, displayName) => {
56
57
  const Inner = (0, react_1.forwardRef)((propsWithControls, ref) => {
57
- const { durationInFrames, from, freeze, hidden, name, showInTimeline, stack, controls, ...props } = propsWithControls;
58
+ const { durationInFrames, from, trimBefore, freeze, hidden, name, showInTimeline, stack, controls, ...props } = propsWithControls;
58
59
  const refForOutline = (0, react_1.useRef)(null);
59
60
  const callbackRef = (0, react_1.useCallback)((element) => {
60
61
  refForOutline.current = element;
61
62
  setRef(ref, element);
62
63
  }, [ref]);
63
- 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, freeze: freeze, hidden: hidden, name: name !== null && name !== void 0 ? name : displayName, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, controls: controls, _remotionInternalStack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/interactive", outlineRef: refForOutline, children: react_1.default.createElement(tag, {
64
+ return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, trimBefore: trimBefore, durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity, freeze: freeze, hidden: hidden, name: name !== null && name !== void 0 ? name : displayName, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, controls: controls, _remotionInternalStack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/interactive", outlineRef: refForOutline, children: react_1.default.createElement(tag, {
64
65
  ...props,
65
66
  ref: callbackRef,
66
67
  }) }));
@@ -68,6 +69,7 @@ const makeInteractiveElement = (tag, displayName) => {
68
69
  Inner.displayName = displayName;
69
70
  const Wrapped = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
70
71
  Component: Inner,
72
+ componentName: displayName,
71
73
  componentIdentity: `dev.remotion.remotion.${displayName.slice(1, -1)}`,
72
74
  schema: interactiveElementSchema,
73
75
  supportsEffects: false,
@@ -82,6 +84,7 @@ const makeInteractiveElement = (tag, displayName) => {
82
84
  exports.Interactive = {
83
85
  baseSchema: interactivity_schema_js_1.baseSchema,
84
86
  transformSchema: interactivity_schema_js_1.transformSchema,
87
+ textSchema: interactivity_schema_js_1.textSchema,
85
88
  premountSchema: interactivity_schema_js_1.premountSchema,
86
89
  sequenceSchema: interactivity_schema_js_1.sequenceSchema,
87
90
  withSchema: with_interactivity_schema_js_1.withInteractivitySchema,
@@ -19,6 +19,7 @@ export type SequencePropsWithoutDuration = {
19
19
  readonly width?: number;
20
20
  readonly height?: number;
21
21
  readonly from?: number;
22
+ readonly trimBefore?: number;
22
23
  readonly freeze?: number | null;
23
24
  readonly name?: string;
24
25
  readonly showInTimeline?: boolean;
@@ -19,7 +19,7 @@ const use_video_config_js_1 = require("./use-video-config.js");
19
19
  const v5_flag_js_1 = require("./v5-flag.js");
20
20
  const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js");
21
21
  const EMPTY_EFFECTS = [];
22
- const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFrames = Infinity, children, name, height, width, showInTimeline = true, hidden = false, controls, _remotionInternalEffects, _remotionInternalLoopDisplay: loopDisplay, _remotionInternalStack: stack, _remotionInternalDocumentationLink: documentationLink, _remotionInternalPremountDisplay: premountDisplay, _remotionInternalPostmountDisplay: postmountDisplay, _remotionInternalIsMedia: isMedia, outlineRef: passedRefForOutline, ...other }, ref) => {
22
+ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze, durationInFrames = Infinity, children, name, height, width, showInTimeline = true, hidden = false, controls, _remotionInternalEffects, _remotionInternalLoopDisplay: loopDisplay, _remotionInternalStack: stack, _remotionInternalDocumentationLink: documentationLink, _remotionInternalPremountDisplay: premountDisplay, _remotionInternalPostmountDisplay: postmountDisplay, _remotionInternalIsMedia: isMedia, outlineRef: passedRefForOutline, ...other }, ref) => {
23
23
  var _a, _b, _c;
24
24
  const { layout = 'absolute-fill' } = other;
25
25
  const [id] = (0, react_1.useState)(() => String(Math.random()));
@@ -28,7 +28,6 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
28
28
  const cumulatedFrom = parentSequence
29
29
  ? parentSequence.cumulatedFrom + parentSequence.relativeFrom
30
30
  : 0;
31
- const absoluteFrom = ((_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.absoluteFrom) !== null && _a !== void 0 ? _a : 0) + from;
32
31
  const nonce = (0, nonce_js_1.useNonce)();
33
32
  if (layout !== 'absolute-fill' && layout !== 'none') {
34
33
  throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
@@ -51,6 +50,18 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
51
50
  if (!Number.isFinite(from)) {
52
51
  throw new TypeError(`The "from" prop of a sequence must be finite, but got ${from}.`);
53
52
  }
53
+ if (typeof trimBefore !== 'number') {
54
+ throw new TypeError(`You passed to the "trimBefore" prop of your <Sequence> an argument of type ${typeof trimBefore}, but it must be a number.`);
55
+ }
56
+ if (trimBefore < 0) {
57
+ throw new TypeError(`The "trimBefore" prop of <Sequence /> must be greater than or equal to 0, but got ${trimBefore}.`);
58
+ }
59
+ if (Number.isNaN(trimBefore)) {
60
+ throw new TypeError('The "trimBefore" prop of <Sequence /> must be a real number, but it is NaN.');
61
+ }
62
+ if (!Number.isFinite(trimBefore)) {
63
+ throw new TypeError(`The "trimBefore" prop of <Sequence /> must be finite, but it is ${trimBefore}.`);
64
+ }
54
65
  if (typeof freeze !== 'undefined' && freeze !== null) {
55
66
  if (typeof freeze !== 'number') {
56
67
  throw new TypeError(`The "freeze" prop of <Sequence /> must be a number, but is of type ${typeof freeze}.`);
@@ -64,8 +75,10 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
64
75
  }
65
76
  const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
66
77
  const videoConfig = (0, use_video_config_js_1.useVideoConfig)();
78
+ const effectiveRelativeFrom = from - trimBefore;
79
+ const absoluteFrom = ((_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.absoluteFrom) !== null && _a !== void 0 ? _a : 0) + effectiveRelativeFrom;
67
80
  const parentSequenceDuration = parentSequence
68
- ? Math.min(parentSequence.durationInFrames - from, durationInFrames)
81
+ ? Math.min(parentSequence.durationInFrames - effectiveRelativeFrom, durationInFrames)
69
82
  : durationInFrames;
70
83
  const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
71
84
  const { registerSequence, unregisterSequence } = (0, react_1.useContext)(SequenceManager_js_1.SequenceManager);
@@ -96,7 +109,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
96
109
  // 10-frame pre-roll, because the positive child offset cancels part of the
97
110
  // negative parent offset. But <Sequence from={10}><Sequence from={-5}>
98
111
  // should still trim 5 frames from the media once the parent starts.
99
- const currentSequenceStart = cumulatedFrom + from;
112
+ const currentSequenceStart = cumulatedFrom + effectiveRelativeFrom;
100
113
  const parentSequenceStart = parentSequence
101
114
  ? parentSequence.cumulatedFrom + parentSequence.relativeFrom
102
115
  : 0;
@@ -110,7 +123,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
110
123
  return {
111
124
  absoluteFrom,
112
125
  cumulatedFrom,
113
- relativeFrom: from,
126
+ relativeFrom: effectiveRelativeFrom,
114
127
  cumulatedNegativeFrom,
115
128
  durationInFrames: actualDurationInFrames,
116
129
  parentFrom: (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.relativeFrom) !== null && _a !== void 0 ? _a : 0,
@@ -125,7 +138,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
125
138
  }, [
126
139
  cumulatedFrom,
127
140
  absoluteFrom,
128
- from,
141
+ effectiveRelativeFrom,
129
142
  actualDurationInFrames,
130
143
  parentSequence,
131
144
  id,
@@ -149,6 +162,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
149
162
  const stackRef = (0, react_1.useRef)(null);
150
163
  stackRef.current = stack !== null && stack !== void 0 ? stack : inheritedStack;
151
164
  const registeredFrozenFrame = typeof freeze === 'number' ? freeze : null;
165
+ const registeredTrimBefore = trimBefore === 0 ? null : trimBefore;
152
166
  const parentCumulatedNegativeFrom = (_c = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.cumulatedNegativeFrom) !== null && _c !== void 0 ? _c : 0;
153
167
  const startMediaFrom = isMedia && isMedia.type !== 'image'
154
168
  ? isMedia.data.startMediaFrom +
@@ -182,6 +196,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
182
196
  documentationLink: resolvedDocumentationLink,
183
197
  duration: actualDurationInFrames,
184
198
  from,
199
+ trimBefore: registeredTrimBefore,
185
200
  id,
186
201
  loopDisplay,
187
202
  nonce: nonce.get(),
@@ -207,6 +222,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
207
222
  doesVolumeChange: isMedia.data.doesVolumeChange,
208
223
  duration: actualDurationInFrames,
209
224
  from,
225
+ trimBefore: registeredTrimBefore,
210
226
  id,
211
227
  loopDisplay,
212
228
  nonce: nonce.get(),
@@ -232,6 +248,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
232
248
  }
233
249
  registerSequence({
234
250
  from,
251
+ trimBefore: registeredTrimBefore,
235
252
  duration: actualDurationInFrames,
236
253
  id,
237
254
  displayName: timelineClipName,
@@ -265,6 +282,8 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
265
282
  actualDurationInFrames,
266
283
  rootId,
267
284
  from,
285
+ trimBefore,
286
+ registeredTrimBefore,
268
287
  showInTimeline,
269
288
  nonce,
270
289
  loopDisplay,
@@ -377,12 +396,14 @@ exports.SequenceWithoutSchema = SequenceInner;
377
396
  */
378
397
  exports.Sequence = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
379
398
  Component: SequenceInner,
399
+ componentName: '<Sequence>',
380
400
  componentIdentity: 'dev.remotion.remotion.Sequence',
381
401
  schema: interactivity_schema_js_1.sequenceSchema,
382
402
  supportsEffects: false,
383
403
  });
384
404
  exports.SequenceWithoutFrom = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
385
405
  Component: SequenceInner,
406
+ componentName: '<Sequence>',
386
407
  componentIdentity: null,
387
408
  schema: interactivity_schema_js_1.sequenceSchemaWithoutFrom,
388
409
  supportsEffects: false,
@@ -175,6 +175,7 @@ const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, lo
175
175
  };
176
176
  exports.AnimatedImage = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
177
177
  Component: AnimatedImageInner,
178
+ componentName: '<AnimatedImage>',
178
179
  componentIdentity: 'dev.remotion.remotion.AnimatedImage',
179
180
  schema: animatedImageSchema,
180
181
  supportsEffects: true,
@@ -66,7 +66,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
66
66
  throw new Error('typecheck error');
67
67
  }
68
68
  const [mediaVolume] = (0, volume_position_state_js_1.useMediaVolumeState)();
69
- const [mediaMuted] = (0, volume_position_state_js_1.useMediaMutedState)();
69
+ const [playerMuted] = (0, volume_position_state_js_1.usePlayerMutedState)();
70
70
  const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)(loopVolumeCurveBehavior !== null && loopVolumeCurveBehavior !== void 0 ? loopVolumeCurveBehavior : 'repeat');
71
71
  if (!src) {
72
72
  throw new TypeError("No 'src' was passed to <Html5Audio>.");
@@ -87,7 +87,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
87
87
  });
88
88
  const propsToPass = (0, react_2.useMemo)(() => {
89
89
  return {
90
- muted: muted || mediaMuted || userPreferredVolume <= 0,
90
+ muted: muted || playerMuted || userPreferredVolume <= 0,
91
91
  src: preloadedSrc,
92
92
  loop: _remotionInternalNativeLoopPassed,
93
93
  crossOrigin: crossOriginValue,
@@ -95,7 +95,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
95
95
  };
96
96
  }, [
97
97
  _remotionInternalNativeLoopPassed,
98
- mediaMuted,
98
+ playerMuted,
99
99
  muted,
100
100
  nativeProps,
101
101
  preloadedSrc,
@@ -49,6 +49,13 @@ export declare const canvasImageSchema: {
49
49
  readonly step: 1;
50
50
  readonly hiddenFromList: true;
51
51
  };
52
+ readonly trimBefore: {
53
+ readonly type: "number";
54
+ readonly default: 0;
55
+ readonly min: 0;
56
+ readonly step: 1;
57
+ readonly hiddenFromList: true;
58
+ };
52
59
  readonly freeze: {
53
60
  readonly type: "number";
54
61
  readonly default: null;
@@ -281,7 +281,7 @@ const CanvasImageContent = (0, react_1.forwardRef)(({ src, width, height, fit =
281
281
  return (jsx_runtime_1.jsx("canvas", { ...canvasProps, ref: canvasRef, width: width, height: height, className: className, style: style, id: id }));
282
282
  });
283
283
  CanvasImageContent.displayName = 'CanvasImageContent';
284
- const CanvasImageInner = (0, react_1.forwardRef)(({ src, width, height, fit, effects = [], className, style, id, onError, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, durationInFrames, from, freeze, hidden, name, showInTimeline, stack, controls, _remotionInternalDocumentationLink, outlineRef, ...canvasProps }, ref) => {
284
+ const CanvasImageInner = (0, react_1.forwardRef)(({ src, width, height, fit, effects = [], className, style, id, onError, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, durationInFrames, from, trimBefore, freeze, hidden, name, showInTimeline, stack, controls, _remotionInternalDocumentationLink, outlineRef, ...canvasProps }, ref) => {
285
285
  if (!src) {
286
286
  throw new Error('No "src" prop was passed to <CanvasImage>.');
287
287
  }
@@ -290,7 +290,7 @@ const CanvasImageInner = (0, react_1.forwardRef)(({ src, width, height, fit, eff
290
290
  (0, react_1.useImperativeHandle)(ref, () => {
291
291
  return actualRef.current;
292
292
  }, []);
293
- 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, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, name: name !== null && name !== void 0 ? name : '<CanvasImage>', _remotionInternalDocumentationLink: _remotionInternalDocumentationLink !== null && _remotionInternalDocumentationLink !== void 0 ? _remotionInternalDocumentationLink : 'https://www.remotion.dev/docs/canvasimage', controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, _remotionInternalIsMedia: { type: 'image', src }, _remotionInternalStack: stack, outlineRef: outlineRef !== null && outlineRef !== void 0 ? outlineRef : actualRef, children: jsx_runtime_1.jsx(CanvasImageContent, { ref: actualRef, src: src, width: width, height: height, fit: fit, effects: effects, controls: controls, className: className, style: style, id: id, onError: onError, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, refForOutline: outlineRef !== null && outlineRef !== void 0 ? outlineRef : null, ...canvasProps }) }));
293
+ return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, trimBefore: trimBefore, durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, name: name !== null && name !== void 0 ? name : '<CanvasImage>', _remotionInternalDocumentationLink: _remotionInternalDocumentationLink !== null && _remotionInternalDocumentationLink !== void 0 ? _remotionInternalDocumentationLink : 'https://www.remotion.dev/docs/canvasimage', controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, _remotionInternalIsMedia: { type: 'image', src }, _remotionInternalStack: stack, outlineRef: outlineRef !== null && outlineRef !== void 0 ? outlineRef : actualRef, children: jsx_runtime_1.jsx(CanvasImageContent, { ref: actualRef, src: src, width: width, height: height, fit: fit, effects: effects, controls: controls, className: className, style: style, id: id, onError: onError, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, refForOutline: outlineRef !== null && outlineRef !== void 0 ? outlineRef : null, ...canvasProps }) }));
294
294
  });
295
295
  /*
296
296
  * @description Renders a static image to a `<canvas>` and applies Remotion effects.
@@ -298,6 +298,7 @@ const CanvasImageInner = (0, react_1.forwardRef)(({ src, width, height, fit, eff
298
298
  */
299
299
  exports.CanvasImage = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
300
300
  Component: CanvasImageInner,
301
+ componentName: '<CanvasImage>',
301
302
  componentIdentity: 'dev.remotion.remotion.CanvasImage',
302
303
  schema: exports.canvasImageSchema,
303
304
  supportsEffects: true,