remotion 4.0.439 → 4.0.440

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.
@@ -39,6 +39,9 @@ type EnhancedTSequenceData = {
39
39
  doesVolumeChange: boolean;
40
40
  startMediaFrom: number;
41
41
  playbackRate: number;
42
+ } | {
43
+ type: 'image';
44
+ src: string;
42
45
  };
43
46
  export type LoopDisplay = {
44
47
  numberOfTimes: number;
package/dist/cjs/Img.d.ts CHANGED
@@ -7,6 +7,12 @@ export type ImgProps = NativeImgProps & {
7
7
  readonly delayRenderTimeoutInMilliseconds?: number;
8
8
  readonly onImageFrame?: (imageElement: HTMLImageElement) => void;
9
9
  readonly src: string;
10
+ readonly showInTimeline?: boolean;
11
+ readonly name?: string;
12
+ /**
13
+ * @deprecated For internal use only
14
+ */
15
+ readonly stack?: string;
10
16
  };
11
17
  export declare const Img: React.ForwardRefExoticComponent<Omit<ImgProps, "ref"> & React.RefAttributes<HTMLImageElement>>;
12
18
  export {};
package/dist/cjs/Img.js CHANGED
@@ -3,20 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Img = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
6
7
  const get_cross_origin_value_js_1 = require("./get-cross-origin-value.js");
7
8
  const prefetch_js_1 = require("./prefetch.js");
8
9
  const SequenceContext_js_1 = require("./SequenceContext.js");
9
10
  const use_buffer_state_js_1 = require("./use-buffer-state.js");
10
11
  const use_delay_render_js_1 = require("./use-delay-render.js");
12
+ const use_media_in_timeline_js_1 = require("./use-media-in-timeline.js");
11
13
  const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
12
14
  function exponentialBackoff(errorCount) {
13
15
  return 1000 * 2 ** (errorCount - 1);
14
16
  }
15
- const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRenderRetries, delayRenderTimeoutInMilliseconds, onImageFrame, crossOrigin, ...props }, ref) => {
17
+ const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRenderRetries, delayRenderTimeoutInMilliseconds, onImageFrame, crossOrigin, showInTimeline, name, stack, ...props }, ref) => {
18
+ var _a, _b;
16
19
  const imageRef = (0, react_1.useRef)(null);
17
20
  const errors = (0, react_1.useRef)({});
18
21
  const { delayPlayback } = (0, use_buffer_state_js_1.useBufferState)();
19
22
  const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
23
+ const [timelineId] = (0, react_1.useState)(() => String(Math.random()));
20
24
  if (!src) {
21
25
  throw new Error('No "src" prop was passed to <Img>.');
22
26
  }
@@ -27,6 +31,16 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, dela
27
31
  (0, react_1.useImperativeHandle)(ref, () => {
28
32
  return imageRef.current;
29
33
  }, []);
34
+ (0, use_media_in_timeline_js_1.useImageInTimeline)({
35
+ src,
36
+ displayName: name !== null && name !== void 0 ? name : null,
37
+ id: timelineId,
38
+ stack: stack !== null && stack !== void 0 ? stack : null,
39
+ showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true,
40
+ premountDisplay: (_a = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.premountDisplay) !== null && _a !== void 0 ? _a : null,
41
+ postmountDisplay: (_b = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.postmountDisplay) !== null && _b !== void 0 ? _b : null,
42
+ loopDisplay: undefined,
43
+ });
30
44
  const actualSrc = (0, prefetch_js_1.usePreload)(src);
31
45
  const retryIn = (0, react_1.useCallback)((timeout) => {
32
46
  if (!imageRef.current) {
@@ -175,3 +189,4 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, dela
175
189
  * @see [Documentation](https://remotion.dev/docs/img)
176
190
  */
177
191
  exports.Img = (0, react_1.forwardRef)(ImgRefForwarding);
192
+ (0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(exports.Img);
@@ -1,4 +1,4 @@
1
- export declare const validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "h264-ts", "gif"];
1
+ export declare const validCodecs: readonly ["h264", "h265", "vp8", "vp9", "av1", "mp3", "aac", "wav", "prores", "h264-mkv", "h264-ts", "gif"];
2
2
  export type Codec = (typeof validCodecs)[number];
3
3
  export type CodecOrUndefined = Codec | undefined;
4
4
  export declare const DEFAULT_CODEC: Codec;
package/dist/cjs/codec.js CHANGED
@@ -6,6 +6,7 @@ exports.validCodecs = [
6
6
  'h265',
7
7
  'vp8',
8
8
  'vp9',
9
+ 'av1',
9
10
  'mp3',
10
11
  'aac',
11
12
  'wav',
@@ -392,7 +392,7 @@ export declare const Internals: {
392
392
  readonly useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType, src, displayName, trimBefore, trimAfter, playbackRate, }: {
393
393
  volume: import("./volume-prop.js").VolumeProp | undefined;
394
394
  mediaVolume: number;
395
- mediaType: "audio" | "video";
395
+ mediaType: "audio" | "video" | "image";
396
396
  src: string | undefined;
397
397
  displayName: string | null;
398
398
  trimBefore: number | undefined;
@@ -3,7 +3,7 @@ import type { VolumeProp } from './volume-prop.js';
3
3
  export declare const useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType, src, displayName, trimBefore, trimAfter, playbackRate, }: {
4
4
  volume: VolumeProp | undefined;
5
5
  mediaVolume: number;
6
- mediaType: "audio" | "video";
6
+ mediaType: "audio" | "video" | "image";
7
7
  src: string | undefined;
8
8
  displayName: string | null;
9
9
  trimBefore: number | undefined;
@@ -18,6 +18,16 @@ export declare const useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType,
18
18
  isStudio: boolean;
19
19
  finalDisplayName: string;
20
20
  };
21
+ export declare const useImageInTimeline: ({ src, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, }: {
22
+ src: string | undefined;
23
+ displayName: string | null;
24
+ id: string;
25
+ stack: string | null;
26
+ showInTimeline: boolean;
27
+ premountDisplay: number | null;
28
+ postmountDisplay: number | null;
29
+ loopDisplay: LoopDisplay | undefined;
30
+ }) => void;
21
31
  export declare const useMediaInTimeline: ({ volume, mediaVolume, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, }: {
22
32
  volume: VolumeProp | undefined;
23
33
  mediaVolume: number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useMediaInTimeline = exports.useBasicMediaInTimeline = void 0;
3
+ exports.useMediaInTimeline = exports.useImageInTimeline = exports.useBasicMediaInTimeline = void 0;
4
4
  const react_1 = require("react");
5
5
  const use_audio_frame_js_1 = require("./audio/use-audio-frame.js");
6
6
  const calculate_media_duration_js_1 = require("./calculate-media-duration.js");
@@ -73,6 +73,69 @@ const useBasicMediaInTimeline = ({ volume, mediaVolume, mediaType, src, displayN
73
73
  };
74
74
  };
75
75
  exports.useBasicMediaInTimeline = useBasicMediaInTimeline;
76
+ const useImageInTimeline = ({ src, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, }) => {
77
+ const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
78
+ const { registerSequence, unregisterSequence } = (0, react_1.useContext)(SequenceManager_js_1.SequenceManager);
79
+ const { duration, nonce, rootId, isStudio, finalDisplayName } = (0, exports.useBasicMediaInTimeline)({
80
+ volume: undefined,
81
+ mediaVolume: 0,
82
+ mediaType: 'image',
83
+ src,
84
+ displayName,
85
+ trimAfter: undefined,
86
+ trimBefore: undefined,
87
+ playbackRate: 1,
88
+ });
89
+ (0, react_1.useEffect)(() => {
90
+ var _a, _b, _c;
91
+ if (!src) {
92
+ throw new Error('No src passed');
93
+ }
94
+ if (!isStudio && ((_b = (_a = window.process) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.NODE_ENV) !== 'test') {
95
+ return;
96
+ }
97
+ if (!showInTimeline) {
98
+ return;
99
+ }
100
+ registerSequence({
101
+ type: 'image',
102
+ src,
103
+ id,
104
+ duration,
105
+ from: 0,
106
+ parent: (_c = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _c !== void 0 ? _c : null,
107
+ displayName: finalDisplayName,
108
+ rootId,
109
+ showInTimeline: true,
110
+ nonce: nonce.get(),
111
+ loopDisplay,
112
+ stack,
113
+ premountDisplay,
114
+ postmountDisplay,
115
+ controls: null,
116
+ });
117
+ return () => {
118
+ unregisterSequence(id);
119
+ };
120
+ }, [
121
+ duration,
122
+ id,
123
+ parentSequence,
124
+ src,
125
+ registerSequence,
126
+ unregisterSequence,
127
+ nonce,
128
+ stack,
129
+ showInTimeline,
130
+ premountDisplay,
131
+ postmountDisplay,
132
+ isStudio,
133
+ loopDisplay,
134
+ rootId,
135
+ finalDisplayName,
136
+ ]);
137
+ };
138
+ exports.useImageInTimeline = useImageInTimeline;
76
139
  const useMediaInTimeline = ({ volume, mediaVolume, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, }) => {
77
140
  const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
78
141
  const startsAt = (0, use_audio_frame_js_1.useMediaStartsAt)();
@@ -3,4 +3,4 @@
3
3
  * @see [Documentation](https://remotion.dev/docs/version)
4
4
  * @returns {string} The current version of the remotion package
5
5
  */
6
- export declare const VERSION = "4.0.439";
6
+ export declare const VERSION = "4.0.440";
@@ -7,4 +7,4 @@ exports.VERSION = void 0;
7
7
  * @see [Documentation](https://remotion.dev/docs/version)
8
8
  * @returns {string} The current version of the remotion package
9
9
  */
10
- exports.VERSION = '4.0.439';
10
+ exports.VERSION = '4.0.440';
@@ -61,7 +61,7 @@ function truthy(value) {
61
61
  }
62
62
 
63
63
  // src/version.ts
64
- var VERSION = "4.0.439";
64
+ var VERSION = "4.0.440";
65
65
 
66
66
  // src/multiple-versions-warning.ts
67
67
  var checkMultipleRemotionVersions = () => {
@@ -3433,6 +3433,76 @@ var useBasicMediaInTimeline = ({
3433
3433
  finalDisplayName: displayName ?? getAssetDisplayName(src)
3434
3434
  };
3435
3435
  };
3436
+ var useImageInTimeline = ({
3437
+ src,
3438
+ displayName,
3439
+ id,
3440
+ stack,
3441
+ showInTimeline,
3442
+ premountDisplay,
3443
+ postmountDisplay,
3444
+ loopDisplay
3445
+ }) => {
3446
+ const parentSequence = useContext19(SequenceContext);
3447
+ const { registerSequence, unregisterSequence } = useContext19(SequenceManager);
3448
+ const { duration, nonce, rootId, isStudio, finalDisplayName } = useBasicMediaInTimeline({
3449
+ volume: undefined,
3450
+ mediaVolume: 0,
3451
+ mediaType: "image",
3452
+ src,
3453
+ displayName,
3454
+ trimAfter: undefined,
3455
+ trimBefore: undefined,
3456
+ playbackRate: 1
3457
+ });
3458
+ useEffect4(() => {
3459
+ if (!src) {
3460
+ throw new Error("No src passed");
3461
+ }
3462
+ if (!isStudio && window.process?.env?.NODE_ENV !== "test") {
3463
+ return;
3464
+ }
3465
+ if (!showInTimeline) {
3466
+ return;
3467
+ }
3468
+ registerSequence({
3469
+ type: "image",
3470
+ src,
3471
+ id,
3472
+ duration,
3473
+ from: 0,
3474
+ parent: parentSequence?.id ?? null,
3475
+ displayName: finalDisplayName,
3476
+ rootId,
3477
+ showInTimeline: true,
3478
+ nonce: nonce.get(),
3479
+ loopDisplay,
3480
+ stack,
3481
+ premountDisplay,
3482
+ postmountDisplay,
3483
+ controls: null
3484
+ });
3485
+ return () => {
3486
+ unregisterSequence(id);
3487
+ };
3488
+ }, [
3489
+ duration,
3490
+ id,
3491
+ parentSequence,
3492
+ src,
3493
+ registerSequence,
3494
+ unregisterSequence,
3495
+ nonce,
3496
+ stack,
3497
+ showInTimeline,
3498
+ premountDisplay,
3499
+ postmountDisplay,
3500
+ isStudio,
3501
+ loopDisplay,
3502
+ rootId,
3503
+ finalDisplayName
3504
+ ]);
3505
+ };
3436
3506
  var useMediaInTimeline = ({
3437
3507
  volume,
3438
3508
  mediaVolume,
@@ -5528,7 +5598,8 @@ import {
5528
5598
  useContext as useContext29,
5529
5599
  useImperativeHandle as useImperativeHandle6,
5530
5600
  useLayoutEffect as useLayoutEffect9,
5531
- useRef as useRef17
5601
+ useRef as useRef17,
5602
+ useState as useState15
5532
5603
  } from "react";
5533
5604
  import { jsx as jsx24 } from "react/jsx-runtime";
5534
5605
  function exponentialBackoff(errorCount) {
@@ -5543,12 +5614,16 @@ var ImgRefForwarding = ({
5543
5614
  delayRenderTimeoutInMilliseconds,
5544
5615
  onImageFrame,
5545
5616
  crossOrigin,
5617
+ showInTimeline,
5618
+ name,
5619
+ stack,
5546
5620
  ...props2
5547
5621
  }, ref) => {
5548
5622
  const imageRef = useRef17(null);
5549
5623
  const errors = useRef17({});
5550
5624
  const { delayPlayback } = useBufferState();
5551
5625
  const sequenceContext = useContext29(SequenceContext);
5626
+ const [timelineId] = useState15(() => String(Math.random()));
5552
5627
  if (!src) {
5553
5628
  throw new Error('No "src" prop was passed to <Img>.');
5554
5629
  }
@@ -5559,6 +5634,16 @@ var ImgRefForwarding = ({
5559
5634
  useImperativeHandle6(ref, () => {
5560
5635
  return imageRef.current;
5561
5636
  }, []);
5637
+ useImageInTimeline({
5638
+ src,
5639
+ displayName: name ?? null,
5640
+ id: timelineId,
5641
+ stack: stack ?? null,
5642
+ showInTimeline: showInTimeline ?? true,
5643
+ premountDisplay: sequenceContext?.premountDisplay ?? null,
5644
+ postmountDisplay: sequenceContext?.postmountDisplay ?? null,
5645
+ loopDisplay: undefined
5646
+ });
5562
5647
  const actualSrc = usePreload(src);
5563
5648
  const retryIn = useCallback13((timeout) => {
5564
5649
  if (!imageRef.current) {
@@ -5681,6 +5766,7 @@ var ImgRefForwarding = ({
5681
5766
  });
5682
5767
  };
5683
5768
  var Img = forwardRef8(ImgRefForwarding);
5769
+ addSequenceStackTraces(Img);
5684
5770
  // src/internals.ts
5685
5771
  import { createRef as createRef3 } from "react";
5686
5772
 
@@ -5694,7 +5780,7 @@ import {
5694
5780
  useImperativeHandle as useImperativeHandle7,
5695
5781
  useMemo as useMemo26,
5696
5782
  useRef as useRef18,
5697
- useState as useState15
5783
+ useState as useState16
5698
5784
  } from "react";
5699
5785
  import { jsx as jsx25 } from "react/jsx-runtime";
5700
5786
  var CompositionManagerProvider = ({
@@ -5704,9 +5790,9 @@ var CompositionManagerProvider = ({
5704
5790
  initialCompositions,
5705
5791
  initialCanvasContent
5706
5792
  }) => {
5707
- const [folders, setFolders] = useState15([]);
5708
- const [canvasContent, setCanvasContent] = useState15(initialCanvasContent);
5709
- const [compositions, setCompositions] = useState15(initialCompositions);
5793
+ const [folders, setFolders] = useState16([]);
5794
+ const [canvasContent, setCanvasContent] = useState16(initialCanvasContent);
5795
+ const [compositions, setCompositions] = useState16(initialCompositions);
5710
5796
  const currentcompositionsRef = useRef18(compositions);
5711
5797
  const updateCompositions = useCallback14((updateComps) => {
5712
5798
  setCompositions((comps) => {
@@ -6005,6 +6091,7 @@ var validCodecs = [
6005
6091
  "h265",
6006
6092
  "vp8",
6007
6093
  "vp9",
6094
+ "av1",
6008
6095
  "mp3",
6009
6096
  "aac",
6010
6097
  "wav",
@@ -6258,7 +6345,7 @@ var useCurrentScale = (options) => {
6258
6345
  };
6259
6346
 
6260
6347
  // src/use-schema.ts
6261
- import { useContext as useContext31, useMemo as useMemo29, useState as useState16 } from "react";
6348
+ import { useContext as useContext31, useMemo as useMemo29, useState as useState17 } from "react";
6262
6349
  var useSchema = (schema, currentValue) => {
6263
6350
  const env = useRemotionEnvironment();
6264
6351
  const earlyReturn = useMemo29(() => {
@@ -6273,7 +6360,7 @@ var useSchema = (schema, currentValue) => {
6273
6360
  if (earlyReturn) {
6274
6361
  return earlyReturn;
6275
6362
  }
6276
- const [overrideId] = useState16(() => String(Math.random()));
6363
+ const [overrideId] = useState17(() => String(Math.random()));
6277
6364
  const {
6278
6365
  visualModeEnabled,
6279
6366
  dragOverrides: overrides,
@@ -6350,7 +6437,7 @@ import {
6350
6437
  useEffect as useEffect14,
6351
6438
  useLayoutEffect as useLayoutEffect10,
6352
6439
  useMemo as useMemo30,
6353
- useState as useState17
6440
+ useState as useState18
6354
6441
  } from "react";
6355
6442
 
6356
6443
  // src/video/offthread-video-source.ts
@@ -6464,7 +6551,7 @@ var OffthreadVideoForRendering = ({
6464
6551
  toneMapped
6465
6552
  });
6466
6553
  }, [toneMapped, currentTime, src, transparent]);
6467
- const [imageSrc, setImageSrc] = useState17(null);
6554
+ const [imageSrc, setImageSrc] = useState18(null);
6468
6555
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
6469
6556
  useLayoutEffect10(() => {
6470
6557
  if (!window.remotion_videoEnabled) {
@@ -6575,7 +6662,7 @@ import React30, {
6575
6662
  useImperativeHandle as useImperativeHandle8,
6576
6663
  useMemo as useMemo31,
6577
6664
  useRef as useRef19,
6578
- useState as useState18
6665
+ useState as useState19
6579
6666
  } from "react";
6580
6667
 
6581
6668
  // src/video/emit-video-frame.ts
@@ -6670,7 +6757,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
6670
6757
  const { hidden } = useContext34(SequenceVisibilityToggleContext);
6671
6758
  const logLevel = useLogLevel();
6672
6759
  const mountTime = useMountTime();
6673
- const [timelineId] = useState18(() => String(Math.random()));
6760
+ const [timelineId] = useState19(() => String(Math.random()));
6674
6761
  const isSequenceHidden = hidden[timelineId] ?? false;
6675
6762
  if (typeof acceptableTimeShift !== "undefined") {
6676
6763
  throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");
@@ -6736,7 +6823,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
6736
6823
  useImperativeHandle8(ref, () => {
6737
6824
  return videoRef.current;
6738
6825
  }, []);
6739
- useState18(() => playbackLogging({
6826
+ useState19(() => playbackLogging({
6740
6827
  logLevel,
6741
6828
  message: `Mounting video with source = ${actualSrc}, v=${VERSION}, user agent=${typeof navigator === "undefined" ? "server" : navigator.userAgent}`,
6742
6829
  tag: "video",
@@ -695,6 +695,7 @@ var validCodecs = [
695
695
  "h265",
696
696
  "vp8",
697
697
  "vp9",
698
+ "av1",
698
699
  "mp3",
699
700
  "aac",
700
701
  "wav",
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "4.0.439";
2
+ var VERSION = "4.0.440";
3
3
  export {
4
4
  VERSION
5
5
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/core"
4
4
  },
5
5
  "name": "remotion",
6
- "version": "4.0.439",
6
+ "version": "4.0.440",
7
7
  "description": "Make videos programmatically",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "react-dom": "19.2.3",
36
36
  "webpack": "5.105.0",
37
37
  "zod": "4.3.6",
38
- "@remotion/eslint-config-internal": "4.0.439",
38
+ "@remotion/eslint-config-internal": "4.0.440",
39
39
  "eslint": "9.19.0",
40
40
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
41
41
  },