remotion 4.0.75 → 4.0.76

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.
@@ -8,6 +8,9 @@ const input_props_js_1 = require("./config/input-props.js");
8
8
  const EditorProps_js_1 = require("./EditorProps.js");
9
9
  const get_remotion_environment_js_1 = require("./get-remotion-environment.js");
10
10
  const resolve_video_config_js_1 = require("./resolve-video-config.js");
11
+ const validate_dimensions_js_1 = require("./validation/validate-dimensions.js");
12
+ const validate_duration_in_frames_js_1 = require("./validation/validate-duration-in-frames.js");
13
+ const validate_fps_js_1 = require("./validation/validate-fps.js");
11
14
  exports.ResolveCompositionContext = (0, react_1.createContext)(null);
12
15
  exports.resolveCompositionsRef = (0, react_1.createRef)();
13
16
  const needsResolution = (composition) => {
@@ -182,6 +185,13 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
182
185
  };
183
186
  }
184
187
  if (!(0, exports.needsResolution)(composition)) {
188
+ (0, validate_duration_in_frames_js_1.validateDurationInFrames)(composition.durationInFrames, {
189
+ allowFloats: false,
190
+ component: `in <Composition id="${composition.id}">`,
191
+ });
192
+ (0, validate_fps_js_1.validateFps)(composition.fps, `in <Composition id="${composition.id}">`, false);
193
+ (0, validate_dimensions_js_1.validateDimension)(composition.width, 'width', `in <Composition id="${composition.id}">`);
194
+ (0, validate_dimensions_js_1.validateDimension)(composition.height, 'height', `in <Composition id="${composition.id}">`);
185
195
  return {
186
196
  type: 'success',
187
197
  result: {
@@ -13,4 +13,4 @@ export declare const Audio: React.ForwardRefExoticComponent<Pick<Omit<React.Deta
13
13
  _remotionInternalNeedsDurationCalculation?: boolean | undefined;
14
14
  _remotionInternalNativeLoopPassed?: boolean | undefined;
15
15
  toneFrequency?: number | undefined;
16
- } & RemotionMainAudioProps, "id" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "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" | "volume" | "allowAmplificationDuringRender" | "controlsList" | "crossOrigin" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "src" | "name" | "playbackRate" | "acceptableTimeShiftInSeconds" | "_remotionInternalNeedsDurationCalculation" | "_remotionInternalNativeLoopPassed" | "toneFrequency" | keyof RemotionMainAudioProps> & React.RefAttributes<HTMLAudioElement>>;
16
+ } & RemotionMainAudioProps, "id" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "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" | "muted" | "volume" | "allowAmplificationDuringRender" | "controlsList" | "crossOrigin" | "loop" | "mediaGroup" | "playsInline" | "preload" | "src" | "name" | "playbackRate" | "acceptableTimeShiftInSeconds" | "_remotionInternalNeedsDurationCalculation" | "_remotionInternalNativeLoopPassed" | "toneFrequency" | keyof RemotionMainAudioProps> & React.RefAttributes<HTMLAudioElement>>;
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.useSharedAudio = exports.SharedAudioContextProvider = exports.SharedAudioContext = void 0;
27
27
  const jsx_runtime_1 = require("react/jsx-runtime");
28
28
  const react_1 = __importStar(require("react"));
29
+ const play_and_handle_not_allowed_error_js_1 = require("../play-and-handle-not-allowed-error.js");
29
30
  const EMPTY_AUDIO = 'data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV';
30
31
  const compareProps = (obj1, obj2) => {
31
32
  const keysA = Object.keys(obj1).sort();
@@ -157,8 +158,7 @@ const SharedAudioContextProvider = ({ children, numberOfAudioTags, component })
157
158
  }, [rerenderAudios]);
158
159
  const playAllAudios = (0, react_1.useCallback)(() => {
159
160
  refs.forEach((ref) => {
160
- var _a;
161
- (_a = ref.ref.current) === null || _a === void 0 ? void 0 : _a.play();
161
+ (0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)(ref.ref, 'audio');
162
162
  });
163
163
  }, [refs]);
164
164
  const value = (0, react_1.useMemo)(() => {
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.75";
1
+ export declare const VERSION = "4.0.76";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Automatically generated on publish
5
- exports.VERSION = '4.0.75';
5
+ exports.VERSION = '4.0.76';
@@ -0,0 +1,8 @@
1
+ export declare const seekToTime: (element: HTMLVideoElement, desiredTime: number) => {
2
+ wait: Promise<number>;
3
+ cancel: () => void;
4
+ };
5
+ export declare const seekToTimeMultipleUntilRight: (element: HTMLVideoElement, desiredTime: number, fps: number) => {
6
+ prom: Promise<void>;
7
+ cancel: () => void;
8
+ };
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.seekToTimeMultipleUntilRight = exports.seekToTime = void 0;
4
+ const seekToTime = (element, desiredTime) => {
5
+ element.currentTime = desiredTime;
6
+ let cancel;
7
+ const prom = new Promise((resolve) => {
8
+ cancel = element.requestVideoFrameCallback((_cb, metadata) => {
9
+ resolve(metadata.mediaTime);
10
+ });
11
+ });
12
+ return {
13
+ wait: prom,
14
+ cancel: () => {
15
+ element.cancelVideoFrameCallback(cancel);
16
+ },
17
+ };
18
+ };
19
+ exports.seekToTime = seekToTime;
20
+ const seekToTimeMultipleUntilRight = (element, desiredTime, fps) => {
21
+ const threshold = 1 / fps / 2;
22
+ let currentCancel = () => undefined;
23
+ const prom = new Promise((resolve, reject) => {
24
+ const firstSeek = (0, exports.seekToTime)(element, desiredTime + threshold);
25
+ firstSeek.wait.then((seekedTo) => {
26
+ const difference = Math.abs(desiredTime - seekedTo);
27
+ const ident = Math.random();
28
+ if (difference < threshold) {
29
+ return resolve();
30
+ }
31
+ const sign = desiredTime > seekedTo ? 1 : -1;
32
+ const newSeek = (0, exports.seekToTime)(element, seekedTo + threshold * sign);
33
+ currentCancel = newSeek.cancel;
34
+ newSeek.wait
35
+ .then((newTime) => {
36
+ const newDifference = Math.abs(desiredTime - newTime);
37
+ console.log(ident, 'before', seekedTo, 'after', newTime, 'desired', desiredTime);
38
+ if (newDifference < threshold) {
39
+ return resolve();
40
+ }
41
+ const thirdSeek = (0, exports.seekToTime)(element, desiredTime);
42
+ currentCancel = thirdSeek.cancel;
43
+ thirdSeek.wait.then(() => {
44
+ resolve();
45
+ });
46
+ })
47
+ .catch((err) => {
48
+ reject(err);
49
+ });
50
+ });
51
+ currentCancel = firstSeek.cancel;
52
+ });
53
+ return {
54
+ prom,
55
+ cancel: () => {
56
+ currentCancel();
57
+ },
58
+ };
59
+ };
60
+ exports.seekToTimeMultipleUntilRight = seekToTimeMultipleUntilRight;
@@ -59,7 +59,7 @@ function truthy(value) {
59
59
  }
60
60
 
61
61
  // Automatically generated on publish
62
- const VERSION = '4.0.75';
62
+ const VERSION = '4.0.76';
63
63
 
64
64
  const checkMultipleRemotionVersions = () => {
65
65
  if (typeof globalThis === 'undefined') {
@@ -824,6 +824,13 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
824
824
  };
825
825
  }
826
826
  if (!needsResolution(composition)) {
827
+ validateDurationInFrames(composition.durationInFrames, {
828
+ allowFloats: false,
829
+ component: `in <Composition id="${composition.id}">`,
830
+ });
831
+ validateFps(composition.fps, `in <Composition id="${composition.id}">`, false);
832
+ validateDimension(composition.width, 'width', `in <Composition id="${composition.id}">`);
833
+ validateDimension(composition.height, 'height', `in <Composition id="${composition.id}">`);
827
834
  return {
828
835
  type: 'success',
829
836
  result: {
@@ -2176,8 +2183,7 @@ const SharedAudioContextProvider = ({ children, numberOfAudioTags, component })
2176
2183
  }, [rerenderAudios]);
2177
2184
  const playAllAudios = useCallback(() => {
2178
2185
  refs.forEach((ref) => {
2179
- var _a;
2180
- (_a = ref.ref.current) === null || _a === void 0 ? void 0 : _a.play();
2186
+ playAndHandleNotAllowedError(ref.ref, 'audio');
2181
2187
  });
2182
2188
  }, [refs]);
2183
2189
  const value = useMemo(() => {
@@ -1,4 +1,4 @@
1
1
  // Automatically generated on publish
2
- const VERSION = '4.0.75';
2
+ const VERSION = '4.0.76';
3
3
 
4
4
  export { VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "4.0.75",
3
+ "version": "4.0.76",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",