remotion 4.0.207 → 4.0.208

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.
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export declare const HideSequence: React.FC<{
3
+ readonly from: number;
4
+ readonly durationInFrames: number;
5
+ readonly children: React.ReactNode;
6
+ }>;
7
+ export declare const useCustomFrame: () => number;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.useCustomFrame = exports.HideSequence = void 0;
27
+ const jsx_runtime_1 = require("react/jsx-runtime");
28
+ const react_1 = __importStar(require("react"));
29
+ const use_current_frame_1 = require("./use-current-frame");
30
+ const context = react_1.default.createContext(null);
31
+ const HideSequence = ({ from, durationInFrames, children }) => {
32
+ var _a, _b, _c;
33
+ const parent = react_1.default.useContext(context);
34
+ const frame = (0, use_current_frame_1.useCurrentFrame)();
35
+ const actualFrame = (_a = parent === null || parent === void 0 ? void 0 : parent.frame) !== null && _a !== void 0 ? _a : frame;
36
+ const cascadedFrame = actualFrame + ((_b = parent === null || parent === void 0 ? void 0 : parent.from) !== null && _b !== void 0 ? _b : 0);
37
+ const visible = cascadedFrame >= from &&
38
+ cascadedFrame < from + durationInFrames &&
39
+ ((_c = parent === null || parent === void 0 ? void 0 : parent.visible) !== null && _c !== void 0 ? _c : true);
40
+ const value = (0, react_1.useMemo)(() => {
41
+ return {
42
+ from,
43
+ durationInFrames,
44
+ visible,
45
+ frame: cascadedFrame,
46
+ };
47
+ }, [cascadedFrame, durationInFrames, from, visible]);
48
+ return (0, jsx_runtime_1.jsx)(context.Provider, { value: value, children: children });
49
+ };
50
+ exports.HideSequence = HideSequence;
51
+ const useCustomFrame = () => {
52
+ const ctx = react_1.default.useContext(context);
53
+ const frame = (0, use_current_frame_1.useCurrentFrame)();
54
+ if (!ctx) {
55
+ return frame;
56
+ }
57
+ return ctx.frame;
58
+ };
59
+ exports.useCustomFrame = useCustomFrame;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("react");
4
+ if (typeof react_1.createContext !== 'function') {
5
+ throw new Error('React 18 is required for Remotion');
6
+ }
@@ -3,4 +3,4 @@
3
3
  * @see [Documentation](https://remotion.dev/docs/version)
4
4
  * @returns {string} The current version of the remotion package
5
5
  */
6
- export declare const VERSION = "4.0.207";
6
+ export declare const VERSION = "4.0.208";
@@ -7,4 +7,4 @@ exports.VERSION = void 0;
7
7
  * @see [Documentation](https://remotion.dev/docs/version)
8
8
  * @returns {string} The current version of the remotion package
9
9
  */
10
- exports.VERSION = '4.0.207';
10
+ exports.VERSION = '4.0.208';
@@ -19,7 +19,7 @@ const VideoForRendering_js_1 = require("./VideoForRendering.js");
19
19
  const duration_state_js_1 = require("./duration-state.js");
20
20
  const VideoForwardingFunction = (props, ref) => {
21
21
  var _a, _b;
22
- const { startFrom, endAt, name, pauseWhenBuffering, stack, _remotionInternalNativeLoopPassed, showInTimeline, onAutoPlayError, onVideoFrame, crossOrigin, ...otherProps } = props;
22
+ const { startFrom, endAt, name, pauseWhenBuffering, stack, _remotionInternalNativeLoopPassed, showInTimeline, onAutoPlayError, crossOrigin, ...otherProps } = props;
23
23
  const { loop, _remotionDebugSeeking, ...propsOtherThanLoop } = props;
24
24
  const { fps } = (0, use_video_config_js_1.useVideoConfig)();
25
25
  const environment = (0, get_remotion_environment_js_1.getRemotionEnvironment)();
@@ -34,6 +34,7 @@ const VideoForwardingFunction = (props, ref) => {
34
34
  const onDuration = (0, react_1.useCallback)((src, durationInSeconds) => {
35
35
  setDurations({ type: 'got-duration', durationInSeconds, src });
36
36
  }, [setDurations]);
37
+ const onVideoFrame = (0, react_1.useCallback)(() => { }, []);
37
38
  const durationFetched = (_a = durations[(0, absolute_src_js_1.getAbsoluteSrc)(preloadedSrc)]) !== null && _a !== void 0 ? _a : durations[(0, absolute_src_js_1.getAbsoluteSrc)(props.src)];
38
39
  if (loop && durationFetched !== undefined) {
39
40
  const mediaDuration = durationFetched * fps;
@@ -42,19 +43,19 @@ const VideoForwardingFunction = (props, ref) => {
42
43
  mediaDuration,
43
44
  playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
44
45
  startFrom,
45
- }), layout: "none", name: name, children: (0, jsx_runtime_1.jsx)(exports.Video, { ...propsOtherThanLoop, ref: ref, onVideoFrame: onVideoFrame, _remotionInternalNativeLoopPassed: true }) }));
46
+ }), layout: "none", name: name, children: (0, jsx_runtime_1.jsx)(exports.Video, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
46
47
  }
47
48
  if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
48
49
  (0, validate_start_from_props_js_1.validateStartFromProps)(startFrom, endAt);
49
50
  const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
50
51
  const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
51
- return ((0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, name: name, children: (0, jsx_runtime_1.jsx)(exports.Video, { pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, onVideoFrame: onVideoFrame, ...otherProps, ref: ref }) }));
52
+ return ((0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, name: name, children: (0, jsx_runtime_1.jsx)(exports.Video, { pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, ...otherProps, ref: ref }) }));
52
53
  }
53
54
  (0, validate_media_props_js_1.validateMediaProps)(props, 'Video');
54
55
  if (environment.isRendering) {
55
56
  return ((0, jsx_runtime_1.jsx)(VideoForRendering_js_1.VideoForRendering, { onDuration: onDuration, onVideoFrame: onVideoFrame !== null && onVideoFrame !== void 0 ? onVideoFrame : null, ...otherProps, ref: ref }));
56
57
  }
57
- return ((0, jsx_runtime_1.jsx)(VideoForPreview_js_1.VideoForPreview, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref, onVideoFrame: onVideoFrame !== null && onVideoFrame !== void 0 ? onVideoFrame : null,
58
+ return ((0, jsx_runtime_1.jsx)(VideoForPreview_js_1.VideoForPreview, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref, onVideoFrame: null,
58
59
  // Proposal: Make this default to true in v5
59
60
  pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, onDuration: onDuration, _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, _remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed !== null && _remotionInternalNativeLoopPassed !== void 0 ? _remotionInternalNativeLoopPassed : false, _remotionDebugSeeking: _remotionDebugSeeking !== null && _remotionDebugSeeking !== void 0 ? _remotionDebugSeeking : false, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, onAutoPlayError: onAutoPlayError !== null && onAutoPlayError !== void 0 ? onAutoPlayError : undefined, crossOrigin: crossOrigin }));
60
61
  };
@@ -9,7 +9,6 @@ export type RemotionMainVideoProps = {
9
9
  */
10
10
  _remotionInternalNativeLoopPassed?: boolean;
11
11
  _remotionDebugSeeking?: boolean;
12
- onVideoFrame?: OnVideoFrame;
13
12
  };
14
13
  export type RemotionVideoProps = Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, 'autoPlay' | 'controls' | 'onEnded' | 'nonce' | 'onError' | 'disableRemotePlayback'> & {
15
14
  name?: string;
@@ -155,7 +155,7 @@ function truthy(value) {
155
155
  }
156
156
 
157
157
  // src/version.ts
158
- var VERSION = "4.0.207";
158
+ var VERSION = "4.0.208";
159
159
 
160
160
  // src/multiple-versions-warning.ts
161
161
  var checkMultipleRemotionVersions = () => {
@@ -6601,7 +6601,6 @@ var VideoForwardingFunction = (props2, ref) => {
6601
6601
  _remotionInternalNativeLoopPassed,
6602
6602
  showInTimeline,
6603
6603
  onAutoPlayError,
6604
- onVideoFrame,
6605
6604
  crossOrigin,
6606
6605
  ...otherProps
6607
6606
  } = props2;
@@ -6619,6 +6618,8 @@ var VideoForwardingFunction = (props2, ref) => {
6619
6618
  const onDuration = useCallback15((src, durationInSeconds) => {
6620
6619
  setDurations({ type: "got-duration", durationInSeconds, src });
6621
6620
  }, [setDurations]);
6621
+ const onVideoFrame = useCallback15(() => {
6622
+ }, []);
6622
6623
  const durationFetched = durations[getAbsoluteSrc(preloadedSrc)] ?? durations[getAbsoluteSrc(props2.src)];
6623
6624
  if (loop4 && durationFetched !== undefined) {
6624
6625
  const mediaDuration = durationFetched * fps;
@@ -6634,7 +6635,6 @@ var VideoForwardingFunction = (props2, ref) => {
6634
6635
  children: jsx33(Video, {
6635
6636
  ...propsOtherThanLoop,
6636
6637
  ref,
6637
- onVideoFrame,
6638
6638
  _remotionInternalNativeLoopPassed: true
6639
6639
  })
6640
6640
  });
@@ -6651,7 +6651,6 @@ var VideoForwardingFunction = (props2, ref) => {
6651
6651
  name,
6652
6652
  children: jsx33(Video, {
6653
6653
  pauseWhenBuffering: pauseWhenBuffering ?? false,
6654
- onVideoFrame,
6655
6654
  ...otherProps,
6656
6655
  ref
6657
6656
  })
@@ -6670,7 +6669,7 @@ var VideoForwardingFunction = (props2, ref) => {
6670
6669
  onlyWarnForMediaSeekingError: false,
6671
6670
  ...otherProps,
6672
6671
  ref,
6673
- onVideoFrame: onVideoFrame ?? null,
6672
+ onVideoFrame: null,
6674
6673
  pauseWhenBuffering: pauseWhenBuffering ?? false,
6675
6674
  onDuration,
6676
6675
  _remotionInternalStack: stack ?? null,
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "4.0.207";
2
+ var VERSION = "4.0.208";
3
3
  export {
4
4
  VERSION
5
5
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/core"
4
4
  },
5
5
  "name": "remotion",
6
- "version": "4.0.207",
6
+ "version": "4.0.208",
7
7
  "description": "Make videos programmatically",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",