remotion 3.2.4 → 3.2.9

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.
@@ -1,5 +1,5 @@
1
- remotion:build: cache hit, replaying output e51675c52d445313
1
+ remotion:build: cache hit, replaying output b7e34247803ef5aa
2
2
  remotion:build: 
3
- remotion:build: > remotion@3.2.3 build /Users/jonathanburger/remotion/packages/core
3
+ remotion:build: > remotion@3.2.8 build /Users/jonathanburger/remotion/packages/core
4
4
  remotion:build: > tsc -d
5
5
  remotion:build: 
package/README.md CHANGED
@@ -26,22 +26,23 @@ Remotion is a suite of libraries building a foundation for **creating videos pro
26
26
  - **"The X in MDX" talk** [Watch](https://twitter.com/pomber/status/1359556846688886789) • [Source code](https://github.com/pomber/record-talk-with-remotion) • A re-recording of [this talk](https://www.youtube.com/watch?v=xEu3t-KJVVg) using Remotion.
27
27
  - **Redesigning the Scatterplot** [Watch](https://twitter.com/BrooksLybrand/status/1371547875109445635) • [Source code](https://github.com/brookslybrand/redesigning-scatterplots) • An animated section of Edward R. Tufte's book [The Visual Display of Quantitative Information](https://www.amazon.com/Visual-Display-Quantitative-Information/dp/0961392142/ref=sr_1_1?crid=3HQZSBUUROV09&dchild=1&keywords=the+visual+display+of+quantitative+information&qid=1615907320&sprefix=the+visual+disp%2Caps%2C190&sr=8-1).
28
28
  - **News Podcast Maker** [Watch](https://www.youtube.com/watch?v=Mwo5iNlWryg) • [Source code](https://github.com/FelippeChemello/podcast-maker/) • A fully automated News Podcast Maker.
29
+ - **This video was made with code. But how?** [Watch](https://youtu.be/deg8bOoziaE) • [Source code](https://github.com/wcandillon/remotion-fireship) • A YouTube tutorial about Remotion, made with Remotion
29
30
 
30
- Feel free to pull request your creations!
31
+ See even more creations in the [Showcase](https://remotion.dev/showcase).
31
32
 
32
33
  ## Get started
33
34
 
34
- If you already have Yarn and FFMPEG installed, type
35
+ If you already have Node.JS and FFMPEG installed, type
35
36
 
36
37
  ```console
37
- yarn create video
38
+ npm init video
38
39
  ```
39
40
 
40
41
  to get started. Otherwise, read the [installation page](https://www.remotion.dev/docs/) in the documentation.
41
42
 
42
43
  ## Documentation
43
44
 
44
- Head to [**remotion.dev**](https://www.remotion.dev) to learn the in and outs of Remotion!
45
+ Head to [**remotion.dev/docs**](https://www.remotion.dev/docs) to learn the in and outs of Remotion!
45
46
 
46
47
  ## License
47
48
 
@@ -50,6 +50,7 @@ export declare type TAsset = {
50
50
  mediaFrame: number;
51
51
  playbackRate: number;
52
52
  };
53
+ declare type BaseMetadata = Pick<TCompMetadata, 'durationInFrames' | 'fps' | 'defaultProps' | 'height' | 'width'>;
53
54
  export declare type CompositionManagerContext = {
54
55
  compositions: TComposition[];
55
56
  registerComposition: <T>(comp: TComposition<T>) => void;
@@ -58,6 +59,8 @@ export declare type CompositionManagerContext = {
58
59
  unregisterFolder: (name: string, parent: string | null) => void;
59
60
  currentComposition: string | null;
60
61
  setCurrentComposition: (curr: string) => void;
62
+ setCurrentCompositionMetadata: (metadata: BaseMetadata) => void;
63
+ currentCompositionMetadata: BaseMetadata | null;
61
64
  registerSequence: (seq: TSequence) => void;
62
65
  unregisterSequence: (id: string) => void;
63
66
  registerAsset: (asset: TAsset) => void;
@@ -34,6 +34,7 @@ exports.CompositionManager = (0, react_1.createContext)({
34
34
  unregisterFolder: () => undefined,
35
35
  currentComposition: null,
36
36
  setCurrentComposition: () => undefined,
37
+ setCurrentCompositionMetadata: () => undefined,
37
38
  registerSequence: () => undefined,
38
39
  unregisterSequence: () => undefined,
39
40
  registerAsset: () => undefined,
@@ -41,6 +42,7 @@ exports.CompositionManager = (0, react_1.createContext)({
41
42
  sequences: [],
42
43
  assets: [],
43
44
  folders: [],
45
+ currentCompositionMetadata: null,
44
46
  });
45
47
  exports.compositionsRef = react_1.default.createRef();
46
48
  const CompositionManagerProvider = ({ children }) => {
@@ -51,6 +53,7 @@ const CompositionManagerProvider = ({ children }) => {
51
53
  const [assets, setAssets] = (0, react_1.useState)([]);
52
54
  const [folders, setFolders] = (0, react_1.useState)([]);
53
55
  const [sequences, setSequences] = (0, react_1.useState)([]);
56
+ const [currentCompositionMetadata, setCurrentCompositionMetadata] = (0, react_1.useState)(null);
54
57
  const registerComposition = (0, react_1.useCallback)((comp) => {
55
58
  setCompositions((comps) => {
56
59
  if (comps.find((c) => c.id === comp.id)) {
@@ -127,21 +130,24 @@ const CompositionManagerProvider = ({ children }) => {
127
130
  folders,
128
131
  registerFolder,
129
132
  unregisterFolder,
133
+ currentCompositionMetadata,
134
+ setCurrentCompositionMetadata,
130
135
  };
131
136
  }, [
132
137
  compositions,
133
- currentComposition,
134
138
  registerComposition,
135
- registerSequence,
136
139
  unregisterComposition,
140
+ currentComposition,
141
+ registerSequence,
137
142
  unregisterSequence,
138
143
  registerAsset,
139
144
  unregisterAsset,
140
145
  sequences,
141
146
  assets,
147
+ folders,
142
148
  registerFolder,
143
149
  unregisterFolder,
144
- folders,
150
+ currentCompositionMetadata,
145
151
  ]);
146
152
  return ((0, jsx_runtime_1.jsx)(exports.CompositionManager.Provider, { value: contextValue, children: children }));
147
153
  };
package/dist/Sequence.js CHANGED
@@ -5,11 +5,11 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const AbsoluteFill_1 = require("./AbsoluteFill");
7
7
  const CompositionManager_1 = require("./CompositionManager");
8
+ const get_environment_1 = require("./get-environment");
8
9
  const get_timeline_clip_name_1 = require("./get-timeline-clip-name");
9
10
  const nonce_1 = require("./nonce");
10
11
  const timeline_position_state_1 = require("./timeline-position-state");
11
- const use_current_frame_1 = require("./use-current-frame");
12
- const use_unsafe_video_config_1 = require("./use-unsafe-video-config");
12
+ const use_video_config_1 = require("./use-video-config");
13
13
  exports.SequenceContext = (0, react_1.createContext)(null);
14
14
  const Sequence = ({ from, durationInFrames = Infinity, children, name, showInTimeline = true, showLoopTimesInTimeline, ...other }) => {
15
15
  const { layout = 'absolute-fill' } = other;
@@ -19,7 +19,6 @@ const Sequence = ({ from, durationInFrames = Infinity, children, name, showInTim
19
19
  const cumulatedFrom = parentSequence
20
20
  ? parentSequence.cumulatedFrom + parentSequence.relativeFrom
21
21
  : 0;
22
- const actualFrom = cumulatedFrom + from;
23
22
  const nonce = (0, nonce_1.useNonce)();
24
23
  if (layout !== 'absolute-fill' && layout !== 'none') {
25
24
  throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
@@ -44,16 +43,12 @@ const Sequence = ({ from, durationInFrames = Infinity, children, name, showInTim
44
43
  if (from % 1 !== 0) {
45
44
  throw new TypeError(`The "from" prop of a sequence must be an integer, but got ${from}.`);
46
45
  }
47
- const absoluteFrame = (0, use_current_frame_1.useAbsoluteCurrentFrame)();
48
- const unsafeVideoConfig = (0, use_unsafe_video_config_1.useUnsafeVideoConfig)();
49
- const compositionDuration = unsafeVideoConfig
50
- ? unsafeVideoConfig.durationInFrames
51
- : 0;
52
- const actualDurationInFrames = Math.min(compositionDuration - from, parentSequence
53
- ? Math.min(parentSequence.durationInFrames +
54
- (parentSequence.cumulatedFrom + parentSequence.relativeFrom) -
55
- actualFrom, durationInFrames)
56
- : durationInFrames);
46
+ const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
47
+ const videoConfig = (0, use_video_config_1.useVideoConfig)();
48
+ const parentSequenceDuration = parentSequence
49
+ ? Math.min(parentSequence.durationInFrames - from, durationInFrames)
50
+ : durationInFrames;
51
+ const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
57
52
  const { registerSequence, unregisterSequence } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
58
53
  const contextValue = (0, react_1.useMemo)(() => {
59
54
  var _a;
@@ -76,6 +71,9 @@ const Sequence = ({ from, durationInFrames = Infinity, children, name, showInTim
76
71
  }, [children, name]);
77
72
  (0, react_1.useEffect)(() => {
78
73
  var _a;
74
+ if ((0, get_environment_1.getRemotionEnvironment)() !== 'preview') {
75
+ return;
76
+ }
79
77
  registerSequence({
80
78
  from,
81
79
  duration: actualDurationInFrames,
@@ -93,7 +91,6 @@ const Sequence = ({ from, durationInFrames = Infinity, children, name, showInTim
93
91
  };
94
92
  }, [
95
93
  durationInFrames,
96
- actualFrom,
97
94
  id,
98
95
  name,
99
96
  registerSequence,
@@ -107,10 +104,8 @@ const Sequence = ({ from, durationInFrames = Infinity, children, name, showInTim
107
104
  nonce,
108
105
  showLoopTimesInTimeline,
109
106
  ]);
110
- const endThreshold = (() => {
111
- return actualFrom + durationInFrames - 1;
112
- })();
113
- const content = absoluteFrame < actualFrom
107
+ const endThreshold = cumulatedFrom + from + durationInFrames - 1;
108
+ const content = absoluteFrame < cumulatedFrom + from
114
109
  ? null
115
110
  : absoluteFrame > endThreshold
116
111
  ? null
package/dist/Still.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import type { StillProps } from './Composition';
2
3
  export declare const Still: <T>(props: StillProps<T>) => JSX.Element;
@@ -1,7 +1,8 @@
1
+ import type { ForwardRefExoticComponent, RefAttributes } from 'react';
1
2
  import React from 'react';
2
- export declare const AudioForDevelopment: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
3
+ export declare const AudioForDevelopment: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
3
4
  volume?: import("../volume-prop").VolumeProp | undefined;
4
5
  playbackRate?: number | undefined;
5
6
  } & {
6
7
  shouldPreMountAudioTags: boolean;
7
- }, "id" | "style" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "src" | "volume" | "playbackRate" | "controlsList" | "crossOrigin" | "mediaGroup" | "muted" | "playsInline" | "preload" | "key" | "shouldPreMountAudioTags"> & React.RefAttributes<HTMLAudioElement>>;
8
+ } & RefAttributes<HTMLAudioElement>>;
@@ -1,3 +1,6 @@
1
+ import type { ForwardRefExoticComponent, RefAttributes } from 'react';
1
2
  import React from 'react';
2
- import type { RemotionAudioProps } from './props';
3
- export declare const AudioForRendering: React.ForwardRefExoticComponent<Pick<RemotionAudioProps, "id" | "style" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "src" | "volume" | "playbackRate" | "controlsList" | "crossOrigin" | "mediaGroup" | "muted" | "playsInline" | "preload" | "key"> & React.RefAttributes<HTMLAudioElement>>;
3
+ export declare const AudioForRendering: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
4
+ volume?: import("../volume-prop").VolumeProp | undefined;
5
+ playbackRate?: number | undefined;
6
+ } & RefAttributes<HTMLAudioElement>>;
@@ -7,12 +7,13 @@ const absolute_src_1 = require("../absolute-src");
7
7
  const CompositionManager_1 = require("../CompositionManager");
8
8
  const random_1 = require("../random");
9
9
  const Sequence_1 = require("../Sequence");
10
+ const timeline_position_state_1 = require("../timeline-position-state");
10
11
  const use_current_frame_1 = require("../use-current-frame");
11
12
  const volume_prop_1 = require("../volume-prop");
12
13
  const use_audio_frame_1 = require("./use-audio-frame");
13
14
  const AudioForRenderingRefForwardingFunction = (props, ref) => {
14
15
  const audioRef = (0, react_1.useRef)(null);
15
- const absoluteFrame = (0, use_current_frame_1.useAbsoluteCurrentFrame)();
16
+ const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
16
17
  const volumePropFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
17
18
  const frame = (0, use_current_frame_1.useCurrentFrame)();
18
19
  const sequenceContext = (0, react_1.useContext)(Sequence_1.SequenceContext);
package/dist/index.d.ts CHANGED
@@ -20,10 +20,11 @@ declare global {
20
20
  remotion_envVariables: string;
21
21
  remotion_collectAssets: () => TAsset[];
22
22
  remotion_isPlayer: boolean;
23
- remotion_imported: boolean;
24
23
  remotion_isBuilding: undefined | (() => void);
25
24
  remotion_finishedBuilding: undefined | (() => void);
26
25
  siteVersion: '4';
26
+ remotion_version: string;
27
+ remotion_imported: string | boolean;
27
28
  }
28
29
  }
29
30
  export declare type BundleState = {
@@ -33,6 +34,11 @@ export declare type BundleState = {
33
34
  } | {
34
35
  type: 'composition';
35
36
  compositionName: string;
37
+ compositionDefaultProps: unknown;
38
+ compositionHeight: number;
39
+ compositionDurationInFrames: number;
40
+ compositionWidth: number;
41
+ compositionFps: number;
36
42
  };
37
43
  export * from './AbsoluteFill';
38
44
  export * from './audio';
@@ -60,5 +66,6 @@ export * from './Still';
60
66
  export type { PlayableMediaTag } from './timeline-position-state';
61
67
  export { useCurrentFrame } from './use-current-frame';
62
68
  export * from './use-video-config';
69
+ export * from './version';
63
70
  export * from './video';
64
71
  export * from './video-config';
package/dist/index.js CHANGED
@@ -51,5 +51,6 @@ __exportStar(require("./Still"), exports);
51
51
  var use_current_frame_1 = require("./use-current-frame");
52
52
  Object.defineProperty(exports, "useCurrentFrame", { enumerable: true, get: function () { return use_current_frame_1.useCurrentFrame; } });
53
53
  __exportStar(require("./use-video-config"), exports);
54
+ __exportStar(require("./version"), exports);
54
55
  __exportStar(require("./video"), exports);
55
56
  __exportStar(require("./video-config"), exports);
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { Configuration } from 'webpack';
2
3
  import type { CompProps } from './Composition';
3
4
  import type { CompositionManagerContext, TAsset, TCompMetadata, TComposition, TSequence } from './CompositionManager';
@@ -16,7 +17,18 @@ export declare const Internals: {
16
17
  RemotionRoot: import("react").FC<{
17
18
  children: import("react").ReactNode;
18
19
  }>;
19
- useVideo: () => TComposition<unknown> | null;
20
+ useVideo: () => {
21
+ height: number;
22
+ width: number;
23
+ fps: number;
24
+ durationInFrames: number;
25
+ defaultProps: unknown;
26
+ id: string;
27
+ folderName: string | null;
28
+ parentFolderName: string | null;
29
+ component: import("react").LazyExoticComponent<import("react").ComponentType<unknown>>;
30
+ nonce: number;
31
+ } | null;
20
32
  getRoot: () => import("react").FC<{}> | null;
21
33
  useMediaVolumeState: () => readonly [number, (u: number) => void];
22
34
  useMediaMutedState: () => readonly [boolean, (u: import("react").SetStateAction<boolean>) => void];
@@ -59,7 +71,6 @@ export declare const Internals: {
59
71
  getCompositions: () => TCompMetadata[];
60
72
  }>;
61
73
  DELAY_RENDER_CALLSTACK_TOKEN: string;
62
- useAbsoluteCurrentFrame: () => number;
63
74
  portalNode: () => HTMLElement;
64
75
  waitForRoot: (fn: (comp: import("react").FC<{}>) => void) => () => void;
65
76
  validateOffthreadVideoImageFormat: (input: unknown) => void;
package/dist/internals.js CHANGED
@@ -39,7 +39,6 @@ const Sequence_1 = require("./Sequence");
39
39
  const setup_env_variables_1 = require("./setup-env-variables");
40
40
  const TimelinePosition = __importStar(require("./timeline-position-state"));
41
41
  const truthy_1 = require("./truthy");
42
- const use_current_frame_1 = require("./use-current-frame");
43
42
  const use_lazy_component_1 = require("./use-lazy-component");
44
43
  const use_unsafe_video_config_1 = require("./use-unsafe-video-config");
45
44
  const use_video_1 = require("./use-video");
@@ -83,7 +82,6 @@ exports.Internals = {
83
82
  getPreviewDomElement: get_preview_dom_element_1.getPreviewDomElement,
84
83
  compositionsRef: CompositionManager_1.compositionsRef,
85
84
  DELAY_RENDER_CALLSTACK_TOKEN: delay_render_1.DELAY_RENDER_CALLSTACK_TOKEN,
86
- useAbsoluteCurrentFrame: use_current_frame_1.useAbsoluteCurrentFrame,
87
85
  portalNode: portal_node_1.portalNode,
88
86
  waitForRoot: register_root_1.waitForRoot,
89
87
  validateOffthreadVideoImageFormat: validate_offthreadvideo_image_format_1.validateOffthreadVideoImageFormat,
@@ -2,10 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Loop = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const __1 = require("..");
5
+ const Sequence_1 = require("../Sequence");
6
+ const use_video_config_1 = require("../use-video-config");
6
7
  const validate_duration_in_frames_1 = require("../validation/validate-duration-in-frames");
7
8
  const Loop = ({ durationInFrames, times = Infinity, children, layout, name, }) => {
8
- const { durationInFrames: compDuration } = (0, __1.useVideoConfig)();
9
+ const { durationInFrames: compDuration } = (0, use_video_config_1.useVideoConfig)();
9
10
  (0, validate_duration_in_frames_1.validateDurationInFrames)(durationInFrames, 'of the <Loop /> component');
10
11
  if (typeof times !== 'number') {
11
12
  throw new TypeError(`You passed to "times" an argument of type ${typeof times}, but it must be a number.`);
@@ -19,7 +20,7 @@ const Loop = ({ durationInFrames, times = Infinity, children, layout, name, }) =
19
20
  const maxTimes = Math.ceil(compDuration / durationInFrames);
20
21
  const actualTimes = Math.min(maxTimes, times);
21
22
  return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: new Array(actualTimes).fill(true).map((_, i) => {
22
- return ((0, jsx_runtime_1.jsx)(__1.Sequence
23
+ return ((0, jsx_runtime_1.jsx)(Sequence_1.Sequence
23
24
  // eslint-disable-next-line react/no-array-index-key
24
25
  , { durationInFrames: durationInFrames, from: i * durationInFrames, layout: layout, name: name, showLoopTimesInTimeline: actualTimes, showInTimeline: i === 0, children: children }, `loop-${i}`));
25
26
  }) }));
@@ -1,13 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkMultipleRemotionVersions = void 0;
4
+ const truthy_1 = require("./truthy");
5
+ const version_1 = require("./version");
4
6
  const checkMultipleRemotionVersions = () => {
5
- if (typeof window === 'undefined') {
7
+ if (typeof globalThis === 'undefined') {
6
8
  return;
7
9
  }
8
- if (window.remotion_imported) {
9
- console.error('🚨 Multiple versions of Remotion detected. Multiple versions will cause conflicting React contexts and things may break in an unexpected way. Please check your dependency tree and make sure only one version of Remotion is on the page.');
10
+ const alreadyImported = globalThis.remotion_imported ||
11
+ (typeof window !== 'undefined' && window.remotion_imported);
12
+ if (alreadyImported) {
13
+ throw new TypeError(`🚨 Multiple versions of Remotion detected: ${[
14
+ version_1.VERSION,
15
+ typeof alreadyImported === 'string'
16
+ ? alreadyImported
17
+ : 'an older version',
18
+ ]
19
+ .filter(truthy_1.truthy)
20
+ .join(' and ')}. This will cause things to break in an unexpected way.\nCheck that all your Remotion packages are on the same version. If your dependencies depend on Remotion, make them peer dependencies. You can also run \`npx remotion versions\` from your terminal to see which versions are mismatching.`);
21
+ }
22
+ globalThis.remotion_imported = true;
23
+ if (typeof window !== 'undefined') {
24
+ window.remotion_imported = version_1.VERSION;
10
25
  }
11
- window.remotion_imported = true;
12
26
  };
13
27
  exports.checkMultipleRemotionVersions = checkMultipleRemotionVersions;
@@ -1,4 +1,3 @@
1
- export declare const useAbsoluteCurrentFrame: () => number;
2
1
  /**
3
2
  * Get the current frame of the video.
4
3
  * Frames are 0-indexed, meaning the first frame is 0, the last frame is the duration of the composition in frames minus one.
@@ -1,15 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useCurrentFrame = exports.useAbsoluteCurrentFrame = void 0;
3
+ exports.useCurrentFrame = void 0;
4
4
  const react_1 = require("react");
5
5
  const CanUseRemotionHooks_1 = require("./CanUseRemotionHooks");
6
6
  const Sequence_1 = require("./Sequence");
7
7
  const timeline_position_state_1 = require("./timeline-position-state");
8
- const useAbsoluteCurrentFrame = () => {
9
- const timelinePosition = (0, timeline_position_state_1.useTimelinePosition)();
10
- return timelinePosition;
11
- };
12
- exports.useAbsoluteCurrentFrame = useAbsoluteCurrentFrame;
13
8
  /**
14
9
  * Get the current frame of the video.
15
10
  * Frames are 0-indexed, meaning the first frame is 0, the last frame is the duration of the composition in frames minus one.
@@ -23,7 +18,7 @@ const useCurrentFrame = () => {
23
18
  }
24
19
  throw new Error(`useCurrentFrame() can only be called inside a component that was registered as a composition. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions`);
25
20
  }
26
- const frame = (0, exports.useAbsoluteCurrentFrame)();
21
+ const frame = (0, timeline_position_state_1.useTimelinePosition)();
27
22
  const context = (0, react_1.useContext)(Sequence_1.SequenceContext);
28
23
  const contextOffset = context
29
24
  ? context.cumulatedFrom + context.relativeFrom
@@ -5,6 +5,7 @@ const react_1 = require("react");
5
5
  const use_audio_frame_1 = require("./audio/use-audio-frame");
6
6
  const CompositionManager_1 = require("./CompositionManager");
7
7
  const get_asset_file_name_1 = require("./get-asset-file-name");
8
+ const get_environment_1 = require("./get-environment");
8
9
  const nonce_1 = require("./nonce");
9
10
  const play_and_handle_not_allowed_error_1 = require("./play-and-handle-not-allowed-error");
10
11
  const Sequence_1 = require("./Sequence");
@@ -32,11 +33,9 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, })
32
33
  const [id] = (0, react_1.useState)(() => String(Math.random()));
33
34
  const [initialVolume] = (0, react_1.useState)(() => volume);
34
35
  const nonce = (0, nonce_1.useNonce)();
35
- const duration = (() => {
36
- return parentSequence
37
- ? Math.min(parentSequence.durationInFrames, videoConfig.durationInFrames)
38
- : videoConfig.durationInFrames;
39
- })();
36
+ const duration = parentSequence
37
+ ? Math.min(parentSequence.durationInFrames, videoConfig.durationInFrames)
38
+ : videoConfig.durationInFrames;
40
39
  const doesVolumeChange = typeof volume === 'function';
41
40
  const volumes = (0, react_1.useMemo)(() => {
42
41
  if (typeof volume === 'number') {
@@ -66,6 +65,10 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, })
66
65
  if (!src) {
67
66
  throw new Error('No src passed');
68
67
  }
68
+ if ((0, get_environment_1.getRemotionEnvironment)() !== 'preview' &&
69
+ process.env.NODE_ENV !== 'test') {
70
+ return;
71
+ }
69
72
  registerSequence({
70
73
  type: mediaType,
71
74
  src,
@@ -12,7 +12,7 @@ const warn_about_non_seekable_media_1 = require("./warn-about-non-seekable-media
12
12
  const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybackRate, onlyWarnForMediaSeekingError, }) => {
13
13
  const { playbackRate: globalPlaybackRate } = (0, react_1.useContext)(timeline_position_state_1.TimelineContext);
14
14
  const frame = (0, use_current_frame_1.useCurrentFrame)();
15
- const absoluteFrame = (0, use_current_frame_1.useAbsoluteCurrentFrame)();
15
+ const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
16
16
  const [playing] = (0, timeline_position_state_1.usePlayingState)();
17
17
  const { fps } = (0, use_video_config_1.useVideoConfig)();
18
18
  const mediaStartsAt = (0, use_audio_frame_1.useMediaStartsAt)();
@@ -1 +1,13 @@
1
- export declare const useVideo: () => import("./CompositionManager").TComposition<unknown> | null;
1
+ /// <reference types="react" />
2
+ export declare const useVideo: () => {
3
+ height: number;
4
+ width: number;
5
+ fps: number;
6
+ durationInFrames: number;
7
+ defaultProps: unknown;
8
+ id: string;
9
+ folderName: string | null;
10
+ parentFolderName: string | null;
11
+ component: import("react").LazyExoticComponent<import("react").ComponentType<unknown>>;
12
+ nonce: number;
13
+ } | null;
package/dist/use-video.js CHANGED
@@ -7,9 +7,22 @@ const useVideo = () => {
7
7
  const context = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
8
8
  return (0, react_1.useMemo)(() => {
9
9
  var _a;
10
- return (_a = context.compositions.find((c) => {
10
+ const selected = context.compositions.find((c) => {
11
11
  return c.id === context.currentComposition;
12
- })) !== null && _a !== void 0 ? _a : null;
13
- }, [context.compositions, context.currentComposition]);
12
+ });
13
+ if (selected) {
14
+ return {
15
+ ...selected,
16
+ // We override the selected metadata with the metadata that was passed to renderMedia(),
17
+ // and don't allow it to be changed during render anymore
18
+ ...((_a = context.currentCompositionMetadata) !== null && _a !== void 0 ? _a : {}),
19
+ };
20
+ }
21
+ return null;
22
+ }, [
23
+ context.compositions,
24
+ context.currentComposition,
25
+ context.currentCompositionMetadata,
26
+ ]);
14
27
  };
15
28
  exports.useVideo = useVideo;
@@ -0,0 +1 @@
1
+ export declare const VERSION = "3.2.9";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VERSION = void 0;
4
+ // Automatically generated on publish
5
+ exports.VERSION = '3.2.9';
@@ -11,13 +11,14 @@ const Img_1 = require("../Img");
11
11
  const internals_1 = require("../internals");
12
12
  const random_1 = require("../random");
13
13
  const Sequence_1 = require("../Sequence");
14
+ const timeline_position_state_1 = require("../timeline-position-state");
14
15
  const use_current_frame_1 = require("../use-current-frame");
15
16
  const use_unsafe_video_config_1 = require("../use-unsafe-video-config");
16
17
  const volume_prop_1 = require("../volume-prop");
17
18
  const get_current_time_1 = require("./get-current-time");
18
19
  const DEFAULT_IMAGE_FORMAT = 'jpeg';
19
20
  const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, imageFormat, ...props }) => {
20
- const absoluteFrame = (0, use_current_frame_1.useAbsoluteCurrentFrame)();
21
+ const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
21
22
  const frame = (0, use_current_frame_1.useCurrentFrame)();
22
23
  const volumePropsFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
23
24
  const videoConfig = (0, use_unsafe_video_config_1.useUnsafeVideoConfig)();
@@ -1,7 +1,8 @@
1
+ import type { ForwardRefExoticComponent, RefAttributes } from 'react';
1
2
  import React from 'react';
2
- export declare const VideoForDevelopment: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
3
+ export declare const VideoForDevelopment: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
3
4
  volume?: import("../volume-prop").VolumeProp | undefined;
4
5
  playbackRate?: number | undefined;
5
6
  } & {
6
7
  onlyWarnForMediaSeekingError: boolean;
7
- }, "id" | "height" | "width" | "style" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "src" | "volume" | "playbackRate" | "controlsList" | "crossOrigin" | "mediaGroup" | "muted" | "playsInline" | "preload" | "key" | "poster" | "disablePictureInPicture" | "disableRemotePlayback" | "onlyWarnForMediaSeekingError"> & React.RefAttributes<HTMLVideoElement>>;
8
+ } & RefAttributes<HTMLVideoElement>>;
@@ -50,7 +50,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
50
50
  var _a;
51
51
  if (current === null || current === void 0 ? void 0 : current.error) {
52
52
  console.error('Error occurred in video', current === null || current === void 0 ? void 0 : current.error);
53
- throw new Error(`The browser threw an error while playing the video: Code ${current.error.code} - ${(_a = current === null || current === void 0 ? void 0 : current.error) === null || _a === void 0 ? void 0 : _a.message}. See https://remotion.dev/docs/media-playback-error for help`);
53
+ throw new Error(`The browser threw an error while playing the video ${nativeProps.src}: Code ${current.error.code} - ${(_a = current === null || current === void 0 ? void 0 : current.error) === null || _a === void 0 ? void 0 : _a.message}. See https://remotion.dev/docs/media-playback-error for help`);
54
54
  }
55
55
  else {
56
56
  throw new Error('The browser threw an error');
@@ -60,7 +60,8 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
60
60
  return () => {
61
61
  current.removeEventListener('error', errorHandler);
62
62
  };
63
- }, []);
63
+ }, [nativeProps.src]);
64
64
  return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, ...nativeProps }));
65
65
  };
66
+ // Copy types from forwardRef but not necessary to remove ref
66
67
  exports.VideoForDevelopment = (0, react_1.forwardRef)(VideoForDevelopmentRefForwardingFunction);
@@ -1,3 +1,6 @@
1
+ import type { ForwardRefExoticComponent, RefAttributes } from 'react';
1
2
  import React from 'react';
2
- import type { RemotionVideoProps } from './props';
3
- export declare const VideoForRendering: React.ForwardRefExoticComponent<Pick<RemotionVideoProps, "id" | "height" | "width" | "style" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "src" | "volume" | "playbackRate" | "controlsList" | "crossOrigin" | "mediaGroup" | "muted" | "playsInline" | "preload" | "key" | "poster" | "disablePictureInPicture" | "disableRemotePlayback"> & React.RefAttributes<HTMLVideoElement>>;
3
+ export declare const VideoForRendering: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
4
+ volume?: import("../volume-prop").VolumeProp | undefined;
5
+ playbackRate?: number | undefined;
6
+ } & RefAttributes<HTMLVideoElement>>;
@@ -10,13 +10,14 @@ const delay_render_1 = require("../delay-render");
10
10
  const is_approximately_the_same_1 = require("../is-approximately-the-same");
11
11
  const random_1 = require("../random");
12
12
  const Sequence_1 = require("../Sequence");
13
+ const timeline_position_state_1 = require("../timeline-position-state");
13
14
  const use_current_frame_1 = require("../use-current-frame");
14
15
  const use_unsafe_video_config_1 = require("../use-unsafe-video-config");
15
16
  const volume_prop_1 = require("../volume-prop");
16
17
  const warn_about_non_seekable_media_1 = require("../warn-about-non-seekable-media");
17
18
  const get_current_time_1 = require("./get-current-time");
18
19
  const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbackRate, ...props }, ref) => {
19
- const absoluteFrame = (0, use_current_frame_1.useAbsoluteCurrentFrame)();
20
+ const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
20
21
  const frame = (0, use_current_frame_1.useCurrentFrame)();
21
22
  const volumePropsFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
22
23
  const videoConfig = (0, use_unsafe_video_config_1.useUnsafeVideoConfig)();
@@ -138,7 +139,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
138
139
  var _a;
139
140
  if (current === null || current === void 0 ? void 0 : current.error) {
140
141
  console.error('Error occurred in video', current === null || current === void 0 ? void 0 : current.error);
141
- throw new Error(`The browser threw an error while playing the video: Code ${current.error.code} - ${(_a = current === null || current === void 0 ? void 0 : current.error) === null || _a === void 0 ? void 0 : _a.message}. See https://remotion.dev/docs/media-playback-error for help`);
142
+ throw new Error(`The browser threw an error while playing the video ${props.src}: Code ${current.error.code} - ${(_a = current === null || current === void 0 ? void 0 : current.error) === null || _a === void 0 ? void 0 : _a.message}. See https://remotion.dev/docs/media-playback-error for help`);
142
143
  }
143
144
  else {
144
145
  throw new Error('The browser threw an error');
@@ -0,0 +1,24 @@
1
+ const path = require('node:path');
2
+ const fs = require('node:fs');
3
+ const cp = require('node:child_process');
4
+
5
+ const packageJson = JSON.parse(fs.readFileSync('package.json'));
6
+ const {version} = packageJson;
7
+ const src =
8
+ `
9
+ // Automatically generated on publish
10
+ export const VERSION = '${version}';
11
+ `.trim() + '\n';
12
+
13
+ fs.writeFileSync(path.resolve(process.cwd(), 'src/version.ts'), src);
14
+
15
+ cp.execSync('npx tsc');
16
+
17
+ const distFile = fs.readFileSync('dist/version.js', 'utf-8');
18
+
19
+ if (!distFile.includes(version)) {
20
+ console.log('In dist file, did not include version');
21
+ process.exit(1);
22
+ }
23
+
24
+ console.log('Updated version to v' + version);
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "3.2.4",
3
+ "version": "3.2.9",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "sideEffects": false,
8
8
  "scripts": {
9
+ "prepublish": "node ensure-correct-version.js && cp ../../README.md .",
9
10
  "lint": "eslint src --ext ts,tsx",
10
11
  "test": "vitest --run",
11
12
  "build": "tsc -d",
12
- "watch": "tsc -w",
13
- "prerelease": "cp ../../README.md ."
13
+ "watch": "tsc -w"
14
14
  },
15
15
  "repository": {
16
16
  "url": "https://github.com/remotion-dev/remotion"
@@ -54,5 +54,5 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "gitHead": "ee420b99227e0e5bcf093c108e3695f5d46e3658"
57
+ "gitHead": "66eceb7252865747a2808fc51cdbd2b57bb38486"
58
58
  }
package/version.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/version';
package/version.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/version');