@remotion/studio 4.0.372 → 4.0.374

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.
package/dist/Studio.js CHANGED
@@ -17,8 +17,8 @@ const Studio = ({ rootComponent, readOnly }) => {
17
17
  (0, react_1.useLayoutEffect)(() => {
18
18
  (0, inject_css_1.injectCSS)();
19
19
  }, []);
20
- return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.RemotionRoot, { audioEnabled: window.remotion_audioEnabled, videoEnabled: window.remotion_videoEnabled, logLevel: window.remotion_logLevel, numberOfAudioTags: window.remotion_numberOfAudioTags, onlyRenderComposition: null, currentCompositionMetadata: null, audioLatencyHint: (_a = window.remotion_audioLatencyHint) !== null && _a !== void 0 ? _a : 'interactive', children: (0, jsx_runtime_1.jsxs)(EditorContexts_1.EditorContexts, { readOnlyStudio: readOnly, children: [(0, jsx_runtime_1.jsx)(Editor_1.Editor, { readOnlyStudio: readOnly, Root: rootComponent }), readOnly
21
- ? null
22
- : (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(ServerDisconnected_1.ServerDisconnected, {}), getServerDisconnectedDomElement())] }) }));
20
+ return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.CompositionManagerProvider, { onlyRenderComposition: null, currentCompositionMetadata: null, initialCompositions: [], initialCanvasContent: null, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.RemotionRoot, { frameState: null, audioEnabled: window.remotion_audioEnabled, videoEnabled: window.remotion_videoEnabled, logLevel: window.remotion_logLevel, numberOfAudioTags: window.remotion_numberOfAudioTags, audioLatencyHint: (_a = window.remotion_audioLatencyHint) !== null && _a !== void 0 ? _a : 'interactive', children: (0, jsx_runtime_1.jsxs)(EditorContexts_1.EditorContexts, { readOnlyStudio: readOnly, children: [(0, jsx_runtime_1.jsx)(Editor_1.Editor, { readOnlyStudio: readOnly, Root: rootComponent }), readOnly
21
+ ? null
22
+ : (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(ServerDisconnected_1.ServerDisconnected, {}), getServerDisconnectedDomElement())] }) }) }));
23
23
  };
24
24
  exports.Studio = Studio;
@@ -5,7 +5,7 @@ const react_1 = require("react");
5
5
  const remotion_1 = require("remotion");
6
6
  const playbackrate_1 = require("../state/playbackrate");
7
7
  const PlaybackRatePersistor = () => {
8
- const { setPlaybackRate, playbackRate } = (0, react_1.useContext)(remotion_1.Internals.Timeline.TimelineContext);
8
+ const { setPlaybackRate, playbackRate } = (0, react_1.useContext)(remotion_1.Internals.TimelineContext);
9
9
  (0, react_1.useEffect)(() => {
10
10
  setPlaybackRate((0, playbackrate_1.loadPlaybackRate)());
11
11
  }, [setPlaybackRate]);
@@ -73,7 +73,7 @@ const padding = {
73
73
  width: timeline_layout_1.TIMELINE_PADDING,
74
74
  };
75
75
  const PreviewToolbar = ({ readOnlyStudio, bufferStateDelayInMilliseconds }) => {
76
- const { playbackRate, setPlaybackRate } = (0, react_1.useContext)(remotion_1.Internals.Timeline.TimelineContext);
76
+ const { playbackRate, setPlaybackRate } = (0, react_1.useContext)(remotion_1.Internals.TimelineContext);
77
77
  const { mediaMuted } = (0, react_1.useContext)(remotion_1.Internals.MediaVolumeContext);
78
78
  const { setMediaMuted } = (0, react_1.useContext)(remotion_1.Internals.SetMediaVolumeContext);
79
79
  const isVideoComposition = (0, is_current_selected_still_1.useIsVideoComposition)();
@@ -11,7 +11,7 @@ let lastTimelinePositionWhileScrolling = null;
11
11
  const TimelinePlayCursorSyncer = () => {
12
12
  var _a, _b;
13
13
  const video = remotion_1.Internals.useVideo();
14
- const timelineContext = (0, react_1.useContext)(remotion_1.Internals.Timeline.TimelineContext);
14
+ const timelineContext = (0, react_1.useContext)(remotion_1.Internals.TimelineContext);
15
15
  const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
16
16
  const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
17
17
  const { zoom: zoomMap } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
@@ -75,7 +75,8 @@ const drawSlot = ({ frame, ctx, filledSlots, visualizationWidth, timestamp, segm
75
75
  filledSlots.set(timestamp, frame.timestamp);
76
76
  };
77
77
  const fillWithCachedFrames = ({ ctx, visualizationWidth, filledSlots, src, segmentDuration, fromSeconds, }) => {
78
- const keys = Array.from(frame_database_1.frameDatabase.keys()).filter((k) => k.startsWith(src));
78
+ const prefix = (0, frame_database_1.getFrameDatabaseKeyPrefix)(src);
79
+ const keys = Array.from(frame_database_1.frameDatabase.keys()).filter((k) => k.startsWith(prefix));
79
80
  const targets = Array.from(filledSlots.keys());
80
81
  for (const timestamp of targets) {
81
82
  let bestKey;
@@ -142,6 +143,12 @@ const TimelineVideoInfo = ({ src, visualizationWidth, startFrom, durationInFrame
142
143
  const ref = (0, react_1.useRef)(null);
143
144
  const [error, setError] = (0, react_1.useState)(null);
144
145
  const aspectRatio = (0, react_1.useRef)((0, frame_database_1.getAspectRatioFromCache)(src));
146
+ (0, react_1.useEffect)(() => {
147
+ return () => {
148
+ (0, frame_database_1.clearFramesForSrc)(src);
149
+ };
150
+ }, [src]);
151
+ // for rendering frames
145
152
  (0, react_1.useEffect)(() => {
146
153
  if (error) {
147
154
  return;
@@ -203,7 +210,8 @@ const TimelineVideoInfo = ({ src, visualizationWidth, startFrom, durationInFrame
203
210
  return Array.from(filledSlots.keys()).map((timestamp) => timestamp / WEBCODECS_TIMESCALE);
204
211
  },
205
212
  src,
206
- onFrame: (frame) => {
213
+ onVideoSample: (sample) => {
214
+ const frame = sample.toVideoFrame();
207
215
  const scale = (HEIGHT / frame.displayHeight) * window.devicePixelRatio;
208
216
  const transformed = (0, resize_video_frame_1.resizeVideoFrame)({
209
217
  frame,
@@ -27,6 +27,13 @@ const TriggerWebRender = () => {
27
27
  fps: video.fps,
28
28
  durationInFrames: video.durationInFrames,
29
29
  frame,
30
+ }).then((blob) => {
31
+ const url = URL.createObjectURL(blob);
32
+ const a = document.createElement('a');
33
+ a.href = url;
34
+ a.download = 'composed.png';
35
+ a.click();
36
+ URL.revokeObjectURL(url);
30
37
  });
31
38
  }, [video, frame]);
32
39
  return ((0, jsx_runtime_1.jsx)(Button_1.Button, { id: "render-modal-button", onClick: onClick, buttonContainerStyle: button, disabled: false, children: (0, jsx_runtime_1.jsx)("span", { children: "Render" }) }));