remotion 4.0.0-alpha.185 → 4.0.0-alpha.217

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,6 +1,6 @@
1
1
  import type { ComponentType, PropsWithChildren } from 'react';
2
2
  import React from 'react';
3
- import { z } from 'zod';
3
+ import type { z } from 'zod';
4
4
  import type { PropsIfHasProps } from './props-if-has-props.js';
5
5
  declare type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
6
6
  export declare type CompProps<Props> = {
@@ -4,7 +4,6 @@ exports.ClipComposition = exports.Composition = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const react_dom_1 = require("react-dom");
7
- const zod_1 = require("zod");
8
7
  const AbsoluteFill_js_1 = require("./AbsoluteFill.js");
9
8
  const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
10
9
  const CompositionManager_js_1 = require("./CompositionManager.js");
@@ -76,7 +75,7 @@ const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, s
76
75
  defaultProps: defaultProps,
77
76
  nonce,
78
77
  parentFolderName: parentName,
79
- schema: schema !== null && schema !== void 0 ? schema : zod_1.z.any(),
78
+ schema: schema !== null && schema !== void 0 ? schema : null,
80
79
  });
81
80
  return () => {
82
81
  unregisterComposition(id);
@@ -13,7 +13,7 @@ export declare type TComposition<Schema extends z.ZodTypeAny, Props> = {
13
13
  parentFolderName: string | null;
14
14
  component: LazyExoticComponent<ComponentType<Props>>;
15
15
  nonce: number;
16
- schema: Schema;
16
+ schema: Schema | null;
17
17
  } & PropsIfHasProps<Schema, Props>;
18
18
  export declare type AnyComposition = TComposition<z.ZodTypeAny, unknown>;
19
19
  export declare type TCompMetadata<Schema extends z.ZodTypeAny, Props> = Pick<TComposition<Schema, Props>, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames' | 'defaultProps'>;
@@ -83,5 +83,6 @@ export declare const compositionsRef: React.RefObject<{
83
83
  }>;
84
84
  export declare const CompositionManagerProvider: React.FC<{
85
85
  children: React.ReactNode;
86
+ numberOfAudioTags: number;
86
87
  }>;
87
88
  export {};
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.CompositionManagerProvider = exports.compositionsRef = exports.CompositionManager = void 0;
27
27
  const jsx_runtime_1 = require("react/jsx-runtime");
28
28
  const react_1 = __importStar(require("react"));
29
+ const shared_audio_tags_js_1 = require("./audio/shared-audio-tags.js");
29
30
  exports.CompositionManager = (0, react_1.createContext)({
30
31
  compositions: [],
31
32
  registerComposition: () => undefined,
@@ -45,7 +46,8 @@ exports.CompositionManager = (0, react_1.createContext)({
45
46
  currentCompositionMetadata: null,
46
47
  });
47
48
  exports.compositionsRef = react_1.default.createRef();
48
- const CompositionManagerProvider = ({ children }) => {
49
+ const CompositionManagerProvider = ({ children, numberOfAudioTags }) => {
50
+ var _a;
49
51
  // Wontfix, expected to have
50
52
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
53
  const [compositions, setCompositions] = (0, react_1.useState)([]);
@@ -159,6 +161,7 @@ const CompositionManagerProvider = ({ children }) => {
159
161
  unregisterFolder,
160
162
  currentCompositionMetadata,
161
163
  ]);
162
- return ((0, jsx_runtime_1.jsx)(exports.CompositionManager.Provider, { value: contextValue, children: children }));
164
+ const composition = (_a = compositions.find((c) => c.id === currentComposition)) === null || _a === void 0 ? void 0 : _a.component;
165
+ return ((0, jsx_runtime_1.jsx)(exports.CompositionManager.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(shared_audio_tags_js_1.SharedAudioContextProvider, { numberOfAudioTags: numberOfAudioTags, component: composition !== null && composition !== void 0 ? composition : null, children: children }) }));
163
166
  };
164
167
  exports.CompositionManagerProvider = CompositionManagerProvider;
package/dist/cjs/Img.js CHANGED
@@ -3,6 +3,7 @@ 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 cancel_render_js_1 = require("./cancel-render.js");
6
7
  const delay_render_js_1 = require("./delay-render.js");
7
8
  const prefetch_js_1 = require("./prefetch.js");
8
9
  function exponentialBackoff(errorCount) {
@@ -53,7 +54,7 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
53
54
  retryIn(backoff);
54
55
  return;
55
56
  }
56
- console.error('Error loading image with src:', (_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src, e, 'Handle the event using the onError() prop to make this message disappear.');
57
+ (0, cancel_render_js_1.cancelRender)('Error loading image with src: ' + ((_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src));
57
58
  }, [maxRetries, onError, retryIn]);
58
59
  (0, react_1.useLayoutEffect)(() => {
59
60
  if (process.env.NODE_ENV === 'test') {
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RemotionRoot = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const shared_audio_tags_js_1 = require("./audio/shared-audio-tags.js");
7
6
  const CompositionManager_js_1 = require("./CompositionManager.js");
8
7
  const delay_render_js_1 = require("./delay-render.js");
9
8
  const EditorProps_js_1 = require("./EditorProps.js");
@@ -68,10 +67,6 @@ const RemotionRoot = ({ children, numberOfAudioTags }) => {
68
67
  }
69
68
  }
70
69
  }, []);
71
- return ((0, jsx_runtime_1.jsx)(nonce_js_1.NonceContext.Provider, { value: nonceContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_js_1.TimelineContext.Provider, { value: timelineContextValue, children: (0, jsx_runtime_1.jsx)(timeline_position_state_js_1.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(EditorProps_js_1.EditorPropsProvider, { children: (0, jsx_runtime_1.jsx)(prefetch_state_js_1.PrefetchProvider, { children: (0, jsx_runtime_1.jsx)(NativeLayers_js_1.NativeLayersProvider, { children: (0, jsx_runtime_1.jsx)(CompositionManager_js_1.CompositionManagerProvider, { children: (0, jsx_runtime_1.jsx)(duration_state_js_1.DurationsContextProvider, { children: (0, jsx_runtime_1.jsx)(shared_audio_tags_js_1.SharedAudioContextProvider
72
- // In the preview, which is mostly played on Desktop, we opt out of the autoplay policy fix as described in https://github.com/remotion-dev/remotion/pull/554, as it mostly applies to mobile.
73
- , {
74
- // In the preview, which is mostly played on Desktop, we opt out of the autoplay policy fix as described in https://github.com/remotion-dev/remotion/pull/554, as it mostly applies to mobile.
75
- numberOfAudioTags: numberOfAudioTags, children: children }) }) }) }) }) }) }) }) }));
70
+ return ((0, jsx_runtime_1.jsx)(nonce_js_1.NonceContext.Provider, { value: nonceContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_js_1.TimelineContext.Provider, { value: timelineContextValue, children: (0, jsx_runtime_1.jsx)(timeline_position_state_js_1.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(EditorProps_js_1.EditorPropsProvider, { children: (0, jsx_runtime_1.jsx)(prefetch_state_js_1.PrefetchProvider, { children: (0, jsx_runtime_1.jsx)(NativeLayers_js_1.NativeLayersProvider, { children: (0, jsx_runtime_1.jsx)(CompositionManager_js_1.CompositionManagerProvider, { numberOfAudioTags: numberOfAudioTags, children: (0, jsx_runtime_1.jsx)(duration_state_js_1.DurationsContextProvider, { children: children }) }) }) }) }) }) }) }));
76
71
  };
77
72
  exports.RemotionRoot = RemotionRoot;
@@ -9,4 +9,4 @@ export declare const Audio: React.ForwardRefExoticComponent<Pick<Omit<React.Deta
9
9
  playbackRate?: number | undefined;
10
10
  acceptableTimeShiftInSeconds?: number | undefined;
11
11
  allowAmplificationDuringRender?: boolean | undefined;
12
- } & 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" | "src" | "volume" | "playbackRate" | "allowAmplificationDuringRender" | "crossOrigin" | "controlsList" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "acceptableTimeShiftInSeconds" | keyof RemotionMainAudioProps> & React.RefAttributes<HTMLAudioElement>>;
12
+ } & 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" | "playbackRate" | "acceptableTimeShiftInSeconds" | keyof RemotionMainAudioProps> & React.RefAttributes<HTMLAudioElement>>;
@@ -1,3 +1,4 @@
1
+ import type { ComponentType, LazyExoticComponent } from 'react';
1
2
  import React from 'react';
2
3
  import type { RemotionAudioProps } from './props.js';
3
4
  /**
@@ -32,6 +33,7 @@ export declare const SharedAudioContext: React.Context<SharedContext | null>;
32
33
  export declare const SharedAudioContextProvider: React.FC<{
33
34
  numberOfAudioTags: number;
34
35
  children: React.ReactNode;
36
+ component: LazyExoticComponent<ComponentType<unknown>> | null;
35
37
  }>;
36
38
  export declare const useSharedAudio: (aud: RemotionAudioProps, audioId: string) => AudioElem;
37
39
  export {};
@@ -59,7 +59,7 @@ const didPropChange = (key, newProp, prevProp) => {
59
59
  return true;
60
60
  };
61
61
  exports.SharedAudioContext = (0, react_1.createContext)(null);
62
- const SharedAudioContextProvider = ({ children, numberOfAudioTags }) => {
62
+ const SharedAudioContextProvider = ({ children, numberOfAudioTags, component }) => {
63
63
  const audios = (0, react_1.useRef)([]);
64
64
  const [initialNumberOfAudioTags] = (0, react_1.useState)(numberOfAudioTags);
65
65
  if (numberOfAudioTags !== initialNumberOfAudioTags) {
@@ -176,6 +176,22 @@ const SharedAudioContextProvider = ({ children, numberOfAudioTags }) => {
176
176
  unregisterAudio,
177
177
  updateAudio,
178
178
  ]);
179
+ // Fixing a bug: In React, if a component is unmounted using useInsertionEffect, then
180
+ // the cleanup function does sometimes not work properly. That is why when we
181
+ // are changing the composition, we reset the audio state.
182
+ // TODO: Possibly this does not save the problem completely, since the
183
+ // if an audio tag that is inside a sequence will also not be removed
184
+ // from the shared audios.
185
+ const resetAudio = (0, react_1.useCallback)(() => {
186
+ takenAudios.current = new Array(numberOfAudioTags).fill(false);
187
+ audios.current = [];
188
+ rerenderAudios();
189
+ }, [numberOfAudioTags, rerenderAudios]);
190
+ (0, react_1.useEffect)(() => {
191
+ return () => {
192
+ resetAudio();
193
+ };
194
+ }, [component, resetAudio]);
179
195
  return ((0, jsx_runtime_1.jsxs)(exports.SharedAudioContext.Provider, { value: value, children: [refs.map(({ id, ref }) => {
180
196
  return (0, jsx_runtime_1.jsx)("audio", { ref: ref, src: EMPTY_AUDIO }, id);
181
197
  }), children] }));
@@ -139,6 +139,11 @@ declare global {
139
139
  * Default: 'swangle' in Lambda, null elsewhere.
140
140
  */
141
141
  readonly setChromiumOpenGlRenderer: (renderer: 'swangle' | 'angle' | 'egl' | 'swiftshader') => void;
142
+ /**
143
+ * Set the user agent for Chrome. Only works during rendering.
144
+ * Default:
145
+ */
146
+ readonly setChromiumUserAgent: (userAgent: string | null) => void;
142
147
  };
143
148
  /**
144
149
  * @deprecated New flat config format: You can now replace `Config.Rendering.` with `Config.`
@@ -46,7 +46,6 @@ export declare type BundleState = {
46
46
  compositionWidth: number;
47
47
  compositionFps: number;
48
48
  };
49
- export { z } from 'zod';
50
49
  export * from './AbsoluteFill.js';
51
50
  export * from './audio/index.js';
52
51
  export { cancelRender } from './cancel-render.js';
@@ -79,7 +78,6 @@ export * from './use-video-config.js';
79
78
  export * from './version.js';
80
79
  export * from './video-config.js';
81
80
  export * from './video/index.js';
82
- export { zColor } from './z-color.js';
83
81
  export declare const Experimental: {
84
82
  /**
85
83
  * @description This is a special component that will cause Remotion to only partially capture the frame of the video.
package/dist/cjs/index.js CHANGED
@@ -14,15 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Config = exports.Experimental = exports.zColor = exports.useCurrentFrame = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.random = exports.prefetch = exports.Loop = exports.interpolate = exports.interpolateColors = exports.getStaticFiles = exports.delayRender = exports.continueRender = exports.getInputProps = exports.cancelRender = exports.z = void 0;
17
+ exports.Config = exports.Experimental = exports.useCurrentFrame = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.random = exports.prefetch = exports.Loop = exports.interpolate = exports.interpolateColors = exports.getStaticFiles = exports.delayRender = exports.continueRender = exports.getInputProps = exports.cancelRender = void 0;
18
18
  require("./asset-types.js");
19
19
  const Clipper_js_1 = require("./Clipper.js");
20
20
  const is_player_js_1 = require("./is-player.js");
21
21
  const multiple_versions_warning_js_1 = require("./multiple-versions-warning.js");
22
22
  const Null_js_1 = require("./Null.js");
23
23
  (0, multiple_versions_warning_js_1.checkMultipleRemotionVersions)();
24
- var zod_1 = require("zod");
25
- Object.defineProperty(exports, "z", { enumerable: true, get: function () { return zod_1.z; } });
26
24
  __exportStar(require("./AbsoluteFill.js"), exports);
27
25
  __exportStar(require("./audio/index.js"), exports);
28
26
  var cancel_render_js_1 = require("./cancel-render.js");
@@ -67,8 +65,6 @@ __exportStar(require("./use-video-config.js"), exports);
67
65
  __exportStar(require("./version.js"), exports);
68
66
  __exportStar(require("./video-config.js"), exports);
69
67
  __exportStar(require("./video/index.js"), exports);
70
- var z_color_js_1 = require("./z-color.js");
71
- Object.defineProperty(exports, "zColor", { enumerable: true, get: function () { return z_color_js_1.zColor; } });
72
68
  exports.Experimental = {
73
69
  /**
74
70
  * @description This is a special component that will cause Remotion to only partially capture the frame of the video.
@@ -3,6 +3,7 @@ import type { CompProps } from './Composition.js';
3
3
  import type { CompositionManagerContext, TAsset, TCompMetadata, TComposition, TSequence } from './CompositionManager.js';
4
4
  import * as CSSUtils from './default-css.js';
5
5
  import type { RemotionEnvironment } from './get-environment.js';
6
+ import { processColor } from './interpolate-colors.js';
6
7
  import type { SetTimelineContextValue, TimelineContextValue } from './timeline-position-state.js';
7
8
  import * as TimelinePosition from './timeline-position-state.js';
8
9
  import { truthy } from './truthy.js';
@@ -28,7 +29,7 @@ export declare const Internals: {
28
29
  parentFolderName: string | null;
29
30
  component: import("react").LazyExoticComponent<import("react").ComponentType<unknown>>;
30
31
  nonce: number;
31
- schema: import("zod").ZodTypeAny;
32
+ schema: import("zod").ZodTypeAny | null;
32
33
  } | null;
33
34
  getRoot: () => import("react").FC<{}> | null;
34
35
  useMediaVolumeState: () => readonly [number, (u: number) => void];
@@ -72,6 +73,7 @@ export declare const Internals: {
72
73
  SharedAudioContextProvider: import("react").FC<{
73
74
  numberOfAudioTags: number;
74
75
  children: import("react").ReactNode;
76
+ component: import("react").LazyExoticComponent<import("react").ComponentType<unknown>> | null;
75
77
  }>;
76
78
  invalidCompositionErrorMessage: string;
77
79
  isCompositionIdValid: (id: string) => RegExpMatchArray | null;
@@ -108,12 +110,6 @@ export declare const Internals: {
108
110
  }>;
109
111
  EditorPropsContext: import("react").Context<import("./EditorProps.js").EditorPropsContextType>;
110
112
  usePreload: (src: string) => string;
111
- REMOTION_COLOR_BRAND: string;
112
- parseColor: (value: string) => {
113
- a: number;
114
- r: number;
115
- g: number;
116
- b: number;
117
- };
113
+ processColor: typeof processColor;
118
114
  };
119
115
  export type { TComposition, Timeline, TCompMetadata, TSequence, TAsset, TimelineContextValue, SetTimelineContextValue, CompProps, CompositionManagerContext, MediaVolumeContextValue, SetMediaVolumeContextValue, RemotionEnvironment, };
@@ -32,6 +32,7 @@ const delay_render_js_1 = require("./delay-render.js");
32
32
  const EditorProps_js_1 = require("./EditorProps.js");
33
33
  const get_environment_js_1 = require("./get-environment.js");
34
34
  const get_preview_dom_element_js_1 = require("./get-preview-dom-element.js");
35
+ const interpolate_colors_js_1 = require("./interpolate-colors.js");
35
36
  const is_player_js_1 = require("./is-player.js");
36
37
  const portal_node_js_1 = require("./portal-node.js");
37
38
  const prefetch_state_js_1 = require("./prefetch-state.js");
@@ -54,7 +55,6 @@ const validate_offthreadvideo_image_format_js_1 = require("./validation/validate
54
55
  const duration_state_js_1 = require("./video/duration-state.js");
55
56
  const volume_position_state_js_1 = require("./volume-position-state.js");
56
57
  const wrap_remotion_context_js_1 = require("./wrap-remotion-context.js");
57
- const z_color_js_1 = require("./z-color.js");
58
58
  const Timeline = TimelinePosition;
59
59
  // Mark them as Internals so use don't assume this is public
60
60
  // API and are less likely to use it
@@ -102,6 +102,5 @@ exports.Internals = {
102
102
  EditorPropsProvider: EditorProps_js_1.EditorPropsProvider,
103
103
  EditorPropsContext: EditorProps_js_1.EditorPropsContext,
104
104
  usePreload: prefetch_js_1.usePreload,
105
- REMOTION_COLOR_BRAND: z_color_js_1.REMOTION_COLOR_BRAND,
106
- parseColor: z_color_js_1.parseColor,
105
+ processColor: interpolate_colors_js_1.processColor,
107
106
  };
@@ -10,5 +10,5 @@ export declare const useVideo: () => {
10
10
  parentFolderName: string | null;
11
11
  component: import("react").LazyExoticComponent<import("react").ComponentType<unknown>>;
12
12
  nonce: number;
13
- schema: import("zod").ZodTypeAny;
13
+ schema: import("zod").ZodTypeAny | null;
14
14
  } | null;
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.0-alpha.185+1b8f0e746";
1
+ export declare const VERSION = "4.0.0-alpha.217+27eff7599";
@@ -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.0-alpha.185+1b8f0e746';
5
+ exports.VERSION = '4.0.0-alpha.217+27eff7599';
@@ -13,19 +13,20 @@ const getMediaTime = ({ fps, frame, src, playbackRate, startFrom, mediaType, })
13
13
  playbackRate,
14
14
  startFrom,
15
15
  });
16
- if (src.endsWith('webm')) {
17
- // For WebM videos, we need to add a little bit of shift to get the right frame.
18
- const msPerFrame = 1000 / fps;
19
- const msShift = msPerFrame / 2;
20
- return (expectedFrame * msPerFrame + msShift) / 1000;
21
- }
22
- if (mediaType === 'video') {
16
+ const isChrome = typeof window !== 'undefined' &&
17
+ window.navigator.userAgent.match(/Chrome\/([0-9]+)/);
18
+ if (isChrome &&
19
+ Number(isChrome[1]) < 112 &&
20
+ mediaType === 'video' &&
21
+ src.endsWith('.mp4')) {
23
22
  // In Chrome, for MP4s, if 30fps, the first frame is still displayed at 0.033333
24
23
  // even though after that it increases by 0.033333333 each.
25
24
  // So frame = 0 in Remotion is like frame = 1 for the browser
26
25
  return (expectedFrame + 1) / fps;
27
26
  }
28
- // For audio, we don't do any shift correction
29
- return expectedFrame / fps;
27
+ // For WebM videos, we need to add a little bit of shift to get the right frame.
28
+ const msPerFrame = 1000 / fps;
29
+ const msShift = msPerFrame / 2;
30
+ return (expectedFrame * msPerFrame + msShift) / 1000;
30
31
  };
31
32
  exports.getMediaTime = getMediaTime;