remotion 4.0.77 → 4.0.80

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.
Files changed (36) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/CatchError.d.ts +15 -0
  3. package/dist/cjs/CatchError.js +68 -0
  4. package/dist/cjs/CompositionManager.d.ts +1 -0
  5. package/dist/cjs/Img.d.ts +1 -1
  6. package/dist/cjs/Sequence.d.ts +6 -0
  7. package/dist/cjs/Sequence.js +20 -7
  8. package/dist/cjs/SequenceContext.d.ts +2 -0
  9. package/dist/cjs/SequenceManager.d.ts +5 -0
  10. package/dist/cjs/SequenceManager.js +16 -3
  11. package/dist/cjs/audio/Audio.d.ts +6 -1
  12. package/dist/cjs/audio/Audio.js +4 -2
  13. package/dist/cjs/audio/AudioForDevelopment.d.ts +1 -0
  14. package/dist/cjs/audio/AudioForDevelopment.js +11 -3
  15. package/dist/cjs/enable-sequence-stack-traces.d.ts +1 -0
  16. package/dist/cjs/enable-sequence-stack-traces.js +34 -0
  17. package/dist/cjs/index.js +5 -2
  18. package/dist/cjs/internals.d.ts +2 -0
  19. package/dist/cjs/internals.js +3 -0
  20. package/dist/cjs/loop/index.js +1 -1
  21. package/dist/cjs/series/index.js +4 -2
  22. package/dist/cjs/use-media-in-timeline.d.ts +3 -1
  23. package/dist/cjs/use-media-in-timeline.js +3 -2
  24. package/dist/cjs/use-unsafe-video-config.js +7 -5
  25. package/dist/cjs/version.d.ts +1 -1
  26. package/dist/cjs/version.js +1 -1
  27. package/dist/cjs/video/OffthreadVideo.d.ts +1 -1
  28. package/dist/cjs/video/OffthreadVideo.js +2 -2
  29. package/dist/cjs/video/Video.d.ts +6 -1
  30. package/dist/cjs/video/Video.js +4 -2
  31. package/dist/cjs/video/VideoForDevelopment.d.ts +1 -0
  32. package/dist/cjs/video/VideoForDevelopment.js +17 -5
  33. package/dist/cjs/video/props.d.ts +4 -0
  34. package/dist/esm/index.mjs +226 -167
  35. package/dist/esm/version.mjs +1 -1
  36. package/package.json +1 -1
@@ -21,7 +21,7 @@ const warnOnce = (message) => {
21
21
  console.warn(message);
22
22
  didWarn[message] = true;
23
23
  };
24
- const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, displayName, }) => {
24
+ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, displayName, id, stack, }) => {
25
25
  const videoConfig = (0, use_video_config_js_1.useVideoConfig)();
26
26
  const { rootId, audioAndVideoTags } = (0, react_1.useContext)(timeline_position_state_js_1.TimelineContext);
27
27
  const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
@@ -31,7 +31,6 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
31
31
  const [playing] = (0, timeline_position_state_js_1.usePlayingState)();
32
32
  const startsAt = (0, use_audio_frame_js_1.useMediaStartsAt)();
33
33
  const { registerSequence, unregisterSequence } = (0, react_1.useContext)(SequenceManager_js_1.SequenceManager);
34
- const [id] = (0, react_1.useState)(() => String(Math.random()));
35
34
  const [initialVolume] = (0, react_1.useState)(() => volume);
36
35
  const nonce = (0, nonce_js_1.useNonce)();
37
36
  const duration = parentSequence
@@ -86,6 +85,7 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
86
85
  doesVolumeChange,
87
86
  loopDisplay: undefined,
88
87
  playbackRate,
88
+ stack,
89
89
  });
90
90
  return () => {
91
91
  unregisterSequence(id);
@@ -108,6 +108,7 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
108
108
  startsAt,
109
109
  playbackRate,
110
110
  displayName,
111
+ stack,
111
112
  ]);
112
113
  (0, react_1.useEffect)(() => {
113
114
  const tag = {
@@ -5,9 +5,11 @@ const react_1 = require("react");
5
5
  const SequenceContext_js_1 = require("./SequenceContext.js");
6
6
  const use_video_js_1 = require("./use-video.js");
7
7
  const useUnsafeVideoConfig = () => {
8
- var _a;
8
+ var _a, _b, _c;
9
9
  const context = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
10
- const ctxDuration = (_a = context === null || context === void 0 ? void 0 : context.durationInFrames) !== null && _a !== void 0 ? _a : null;
10
+ const ctxWidth = (_a = context === null || context === void 0 ? void 0 : context.width) !== null && _a !== void 0 ? _a : null;
11
+ const ctxHeight = (_b = context === null || context === void 0 ? void 0 : context.height) !== null && _b !== void 0 ? _b : null;
12
+ const ctxDuration = (_c = context === null || context === void 0 ? void 0 : context.durationInFrames) !== null && _c !== void 0 ? _c : null;
11
13
  const video = (0, use_video_js_1.useVideo)();
12
14
  return (0, react_1.useMemo)(() => {
13
15
  if (!video) {
@@ -16,14 +18,14 @@ const useUnsafeVideoConfig = () => {
16
18
  const { id, durationInFrames, fps, height, width, defaultProps, props, defaultCodec, } = video;
17
19
  return {
18
20
  id,
19
- width,
20
- height,
21
+ width: ctxWidth !== null && ctxWidth !== void 0 ? ctxWidth : width,
22
+ height: ctxHeight !== null && ctxHeight !== void 0 ? ctxHeight : height,
21
23
  fps,
22
24
  durationInFrames: ctxDuration !== null && ctxDuration !== void 0 ? ctxDuration : durationInFrames,
23
25
  defaultProps,
24
26
  props,
25
27
  defaultCodec,
26
28
  };
27
- }, [ctxDuration, video]);
29
+ }, [ctxDuration, ctxHeight, ctxWidth, video]);
28
30
  };
29
31
  exports.useUnsafeVideoConfig = useUnsafeVideoConfig;
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.77";
1
+ export declare const VERSION = "4.0.80";
@@ -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.77';
5
+ exports.VERSION = '4.0.80';
@@ -4,4 +4,4 @@ import type { OffthreadVideoProps } from './props.js';
4
4
  * @description This method imports and displays a video, similar to <Video />. During rendering, it extracts the exact frame from the video and displays it in an <img> tag
5
5
  * @see [Documentation](https://www.remotion.dev/docs/offthreadvideo)
6
6
  */
7
- export declare const OffthreadVideo: React.FC<Omit<OffthreadVideoProps, 'loop'>>;
7
+ export declare const OffthreadVideo: React.FC<OffthreadVideoProps>;
@@ -16,7 +16,7 @@ const VideoForDevelopment_js_1 = require("./VideoForDevelopment.js");
16
16
  const OffthreadVideo = (props) => {
17
17
  // Should only destruct `startFrom` and `endAt` from props,
18
18
  // rest gets drilled down
19
- const { startFrom, endAt, name, ...otherProps } = props;
19
+ const { startFrom, endAt, name, stack, ...otherProps } = props;
20
20
  const environment = (0, get_remotion_environment_js_1.getRemotionEnvironment)();
21
21
  const onDuration = (0, react_1.useCallback)(() => undefined, []);
22
22
  if (typeof props.src !== 'string') {
@@ -36,6 +36,6 @@ const OffthreadVideo = (props) => {
36
36
  return (0, jsx_runtime_1.jsx)(OffthreadVideoForRendering_js_1.OffthreadVideoForRendering, { ...otherProps });
37
37
  }
38
38
  const { transparent, ...withoutTransparent } = otherProps;
39
- return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_js_1.VideoForDevelopment, { _remotionInternalNativeLoopPassed: false, onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...withoutTransparent }));
39
+ return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_js_1.VideoForDevelopment, { _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, _remotionInternalNativeLoopPassed: false, onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...withoutTransparent }));
40
40
  };
41
41
  exports.OffthreadVideo = OffthreadVideo;
@@ -11,4 +11,9 @@ export declare const Video: (props: Omit<React.DetailedHTMLProps<React.VideoHTML
11
11
  acceptableTimeShiftInSeconds?: number | undefined;
12
12
  allowAmplificationDuringRender?: boolean | undefined;
13
13
  toneFrequency?: number | undefined;
14
- } & RemotionMainVideoProps & React.RefAttributes<HTMLVideoElement | null>) => React.ReactElement | null;
14
+ } & RemotionMainVideoProps & {
15
+ /**
16
+ * @deprecated For internal use only
17
+ */
18
+ stack?: string | undefined;
19
+ } & React.RefAttributes<HTMLVideoElement | null>) => React.ReactElement | null;
@@ -6,6 +6,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_1 = require("react");
7
7
  const absolute_src_js_1 = require("../absolute-src.js");
8
8
  const calculate_loop_js_1 = require("../calculate-loop.js");
9
+ const enable_sequence_stack_traces_js_1 = require("../enable-sequence-stack-traces.js");
9
10
  const get_remotion_environment_js_1 = require("../get-remotion-environment.js");
10
11
  const index_js_1 = require("../loop/index.js");
11
12
  const prefetch_js_1 = require("../prefetch.js");
@@ -18,7 +19,7 @@ const VideoForDevelopment_js_1 = require("./VideoForDevelopment.js");
18
19
  const VideoForRendering_js_1 = require("./VideoForRendering.js");
19
20
  const VideoForwardingFunction = (props, ref) => {
20
21
  var _a;
21
- const { startFrom, endAt, name, _remotionInternalNativeLoopPassed, ...otherProps } = props;
22
+ const { startFrom, endAt, name, stack, _remotionInternalNativeLoopPassed, ...otherProps } = props;
22
23
  const { loop, ...propsOtherThanLoop } = props;
23
24
  const { fps } = (0, use_video_config_js_1.useVideoConfig)();
24
25
  const environment = (0, get_remotion_environment_js_1.getRemotionEnvironment)();
@@ -52,7 +53,7 @@ const VideoForwardingFunction = (props, ref) => {
52
53
  if (environment.isRendering) {
53
54
  return ((0, jsx_runtime_1.jsx)(VideoForRendering_js_1.VideoForRendering, { onDuration: onDuration, ...otherProps, ref: ref }));
54
55
  }
55
- return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_js_1.VideoForDevelopment, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref, onDuration: onDuration, _remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed !== null && _remotionInternalNativeLoopPassed !== void 0 ? _remotionInternalNativeLoopPassed : false }));
56
+ return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_js_1.VideoForDevelopment, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref, onDuration: onDuration, _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, _remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed !== null && _remotionInternalNativeLoopPassed !== void 0 ? _remotionInternalNativeLoopPassed : false }));
56
57
  };
57
58
  const forward = react_1.forwardRef;
58
59
  /**
@@ -60,3 +61,4 @@ const forward = react_1.forwardRef;
60
61
  * @see [Documentation](https://www.remotion.dev/docs/video)
61
62
  */
62
63
  exports.Video = forward(VideoForwardingFunction);
64
+ (0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(exports.Video);
@@ -11,4 +11,5 @@ export declare const VideoForDevelopment: ForwardRefExoticComponent<Omit<React.D
11
11
  onlyWarnForMediaSeekingError: boolean;
12
12
  onDuration: (src: string, durationInSeconds: number) => void;
13
13
  _remotionInternalNativeLoopPassed: boolean;
14
+ _remotionInternalStack: string | null;
14
15
  } & RefAttributes<HTMLVideoElement>>;
@@ -6,6 +6,7 @@ const react_1 = require("react");
6
6
  const use_audio_frame_js_1 = require("../audio/use-audio-frame.js");
7
7
  const prefetch_js_1 = require("../prefetch.js");
8
8
  const SequenceContext_js_1 = require("../SequenceContext.js");
9
+ const SequenceManager_js_1 = require("../SequenceManager.js");
9
10
  const use_media_in_timeline_js_1 = require("../use-media-in-timeline.js");
10
11
  const use_media_playback_js_1 = require("../use-media-playback.js");
11
12
  const use_media_tag_volume_js_1 = require("../use-media-tag-volume.js");
@@ -14,14 +15,17 @@ const use_video_config_js_1 = require("../use-video-config.js");
14
15
  const volume_position_state_js_1 = require("../volume-position-state.js");
15
16
  const video_fragment_js_1 = require("./video-fragment.js");
16
17
  const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
17
- var _a, _b;
18
+ var _a, _b, _c;
18
19
  const videoRef = (0, react_1.useRef)(null);
19
20
  const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
20
21
  const { fps, durationInFrames } = (0, use_video_config_js_1.useVideoConfig)();
21
22
  const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
23
+ const { hidden } = (0, react_1.useContext)(SequenceManager_js_1.SequenceVisibilityToggleContext);
24
+ const [timelineId] = (0, react_1.useState)(() => String(Math.random()));
25
+ const isSequenceHidden = (_a = hidden[timelineId]) !== null && _a !== void 0 ? _a : false;
22
26
  const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, onDuration,
23
27
  // @ts-expect-error
24
- acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, name, _remotionInternalNativeLoopPassed, ...nativeProps } = props;
28
+ acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, name, _remotionInternalNativeLoopPassed, _remotionInternalStack, style, ...nativeProps } = props;
25
29
  if (typeof acceptableTimeShift !== 'undefined') {
26
30
  throw new Error('acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.');
27
31
  }
@@ -34,8 +38,10 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
34
38
  mediaVolume,
35
39
  mediaType: 'video',
36
40
  src,
37
- playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
41
+ playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
38
42
  displayName: name !== null && name !== void 0 ? name : null,
43
+ id: timelineId,
44
+ stack: props._remotionInternalStack,
39
45
  });
40
46
  (0, use_sync_volume_with_media_tag_js_1.useSyncVolumeWithMediaTag)({
41
47
  volumePropFrame,
@@ -48,7 +54,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
48
54
  mediaRef: videoRef,
49
55
  src,
50
56
  mediaType: 'video',
51
- playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
57
+ playbackRate: (_c = props.playbackRate) !== null && _c !== void 0 ? _c : 1,
52
58
  onlyWarnForMediaSeekingError,
53
59
  acceptableTimeshift: acceptableTimeShiftInSeconds !== null && acceptableTimeShiftInSeconds !== void 0 ? acceptableTimeShiftInSeconds : use_media_playback_js_1.DEFAULT_ACCEPTABLE_TIMESHIFT,
54
60
  });
@@ -130,7 +136,13 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
130
136
  current.preload = 'auto';
131
137
  }
132
138
  }, []);
133
- return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, loop: _remotionInternalNativeLoopPassed, ...nativeProps }));
139
+ const actualStyle = (0, react_1.useMemo)(() => {
140
+ return {
141
+ ...style,
142
+ opacity: isSequenceHidden ? 0 : 1,
143
+ };
144
+ }, [isSequenceHidden, style]);
145
+ return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, loop: _remotionInternalNativeLoopPassed, style: actualStyle, ...nativeProps }));
134
146
  };
135
147
  // Copy types from forwardRef but not necessary to remove ref
136
148
  exports.VideoForDevelopment = (0, react_1.forwardRef)(VideoForDevelopmentRefForwardingFunction);
@@ -36,5 +36,9 @@ export type OffthreadVideoProps = {
36
36
  allowAmplificationDuringRender?: boolean;
37
37
  toneFrequency?: number;
38
38
  transparent?: boolean;
39
+ /**
40
+ * @deprecated For internal use only
41
+ */
42
+ stack?: string;
39
43
  } & RemotionMainVideoProps & DeprecatedOffthreadVideoProps;
40
44
  export {};