remotion 4.0.82 → 4.0.83

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.
@@ -125,5 +125,6 @@ export declare const Internals: {
125
125
  readonly isIosSafari: () => boolean;
126
126
  readonly WATCH_REMOTION_STATIC_FILES: "remotion_staticFilesChanged";
127
127
  readonly addSequenceStackTraces: (component: unknown) => void;
128
+ readonly useMediaStartsAt: () => number;
128
129
  };
129
130
  export type { TComposition, TimelinePosition as Timeline, TCompMetadata, TSequence, TRenderAsset as TAsset, TimelineContextValue, SetTimelineContextValue, CompProps, CompositionManagerContext, MediaVolumeContextValue, SetMediaVolumeContextValue, RemotionEnvironment, SerializedJSONWithCustomFields, WatchRemotionStaticFilesPayload, };
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.Internals = void 0;
27
27
  const shared_audio_tags_js_1 = require("./audio/shared-audio-tags.js");
28
+ const use_audio_frame_js_1 = require("./audio/use-audio-frame.js");
28
29
  const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
29
30
  const Composition_js_1 = require("./Composition.js");
30
31
  const CompositionManager_js_1 = require("./CompositionManager.js");
@@ -117,4 +118,5 @@ exports.Internals = {
117
118
  isIosSafari: video_fragment_js_1.isIosSafari,
118
119
  WATCH_REMOTION_STATIC_FILES: watch_static_file_js_1.WATCH_REMOTION_STATIC_FILES,
119
120
  addSequenceStackTraces: enable_sequence_stack_traces_js_1.addSequenceStackTraces,
121
+ useMediaStartsAt: use_audio_frame_js_1.useMediaStartsAt,
120
122
  };
@@ -29,4 +29,14 @@ export declare const NoReactInternals: {
29
29
  bundleMapName: string;
30
30
  deserializeJSONWithCustomFields: (data: string) => Record<string, unknown>;
31
31
  DELAY_RENDER_CALLSTACK_TOKEN: string;
32
+ getOffthreadVideoSource: ({ src, transparent, currentTime, }: {
33
+ src: string;
34
+ transparent: boolean;
35
+ currentTime: number;
36
+ }) => string;
37
+ getExpectedMediaFrameUncorrected: ({ frame, playbackRate, startFrom, }: {
38
+ frame: number;
39
+ playbackRate: number;
40
+ startFrom: number;
41
+ }) => number;
32
42
  };
@@ -14,6 +14,8 @@ const validate_default_props_1 = require("./validation/validate-default-props");
14
14
  const validate_dimensions_1 = require("./validation/validate-dimensions");
15
15
  const validate_duration_in_frames_1 = require("./validation/validate-duration-in-frames");
16
16
  const validate_fps_1 = require("./validation/validate-fps");
17
+ const get_current_time_1 = require("./video/get-current-time");
18
+ const offthread_video_source_1 = require("./video/offthread-video-source");
17
19
  exports.NoReactInternals = {
18
20
  processColor: interpolate_colors_1.processColor,
19
21
  truthy: truthy_1.truthy,
@@ -27,4 +29,6 @@ exports.NoReactInternals = {
27
29
  bundleMapName: 'bundle.js.map',
28
30
  deserializeJSONWithCustomFields: input_props_serialization_1.deserializeJSONWithCustomFields,
29
31
  DELAY_RENDER_CALLSTACK_TOKEN: delay_render_1.DELAY_RENDER_CALLSTACK_TOKEN,
32
+ getOffthreadVideoSource: offthread_video_source_1.getOffthreadVideoSource,
33
+ getExpectedMediaFrameUncorrected: get_current_time_1.getExpectedMediaFrameUncorrected,
30
34
  };
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.82";
1
+ export declare const VERSION = "4.0.83";
@@ -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.82';
5
+ exports.VERSION = '4.0.83';
@@ -17,6 +17,7 @@ const use_current_frame_js_1 = require("../use-current-frame.js");
17
17
  const use_unsafe_video_config_js_1 = require("../use-unsafe-video-config.js");
18
18
  const volume_prop_js_1 = require("../volume-prop.js");
19
19
  const get_current_time_js_1 = require("./get-current-time.js");
20
+ const offthread_video_source_js_1 = require("./offthread-video-source.js");
20
21
  const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, allowAmplificationDuringRender, transparent = false, toneFrequency, name, ...props }) => {
21
22
  const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
22
23
  const frame = (0, use_current_frame_js_1.useCurrentFrame)();
@@ -91,7 +92,7 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
91
92
  }) / videoConfig.fps);
92
93
  }, [frame, mediaStartsAt, playbackRate, videoConfig.fps]);
93
94
  const actualSrc = (0, react_1.useMemo)(() => {
94
- return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent((0, absolute_src_js_1.getAbsoluteSrc)(src))}&time=${encodeURIComponent(currentTime)}&transparent=${String(transparent)}`;
95
+ return (0, offthread_video_source_js_1.getOffthreadVideoSource)({ src, currentTime, transparent });
95
96
  }, [currentTime, src, transparent]);
96
97
  const onErr = (0, react_1.useCallback)((e) => {
97
98
  if (onError) {
@@ -137,9 +137,10 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
137
137
  }
138
138
  }, []);
139
139
  const actualStyle = (0, react_1.useMemo)(() => {
140
+ var _a;
140
141
  return {
141
142
  ...style,
142
- opacity: isSequenceHidden ? 0 : 1,
143
+ opacity: isSequenceHidden ? 0 : (_a = style === null || style === void 0 ? void 0 : style.opacity) !== null && _a !== void 0 ? _a : 1,
143
144
  };
144
145
  }, [isSequenceHidden, style]);
145
146
  return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, loop: _remotionInternalNativeLoopPassed, style: actualStyle, ...nativeProps }));
@@ -0,0 +1,5 @@
1
+ export declare const getOffthreadVideoSource: ({ src, transparent, currentTime, }: {
2
+ src: string;
3
+ transparent: boolean;
4
+ currentTime: number;
5
+ }) => string;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOffthreadVideoSource = void 0;
4
+ const absolute_src_1 = require("../absolute-src");
5
+ const getOffthreadVideoSource = ({ src, transparent, currentTime, }) => {
6
+ return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent((0, absolute_src_1.getAbsoluteSrc)(src))}&time=${encodeURIComponent(currentTime)}&transparent=${String(transparent)}`;
7
+ };
8
+ exports.getOffthreadVideoSource = getOffthreadVideoSource;
@@ -132,7 +132,7 @@ function truthy(value) {
132
132
  }
133
133
 
134
134
  // Automatically generated on publish
135
- const VERSION = '4.0.82';
135
+ const VERSION = '4.0.83';
136
136
 
137
137
  const checkMultipleRemotionVersions = () => {
138
138
  if (typeof globalThis === 'undefined') {
@@ -3701,6 +3701,7 @@ const Internals = {
3701
3701
  isIosSafari,
3702
3702
  WATCH_REMOTION_STATIC_FILES,
3703
3703
  addSequenceStackTraces,
3704
+ useMediaStartsAt,
3704
3705
  };
3705
3706
 
3706
3707
  /**
@@ -4117,6 +4118,10 @@ const validateFrame = ({ allowFloats, durationInFrames, frame, }) => {
4117
4118
  }
4118
4119
  };
4119
4120
 
4121
+ const getOffthreadVideoSource = ({ src, transparent, currentTime, }) => {
4122
+ return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(getAbsoluteSrc(src))}&time=${encodeURIComponent(currentTime)}&transparent=${String(transparent)}`;
4123
+ };
4124
+
4120
4125
  const flattenChildren = (children) => {
4121
4126
  const childrenArray = React.Children.toArray(children);
4122
4127
  return childrenArray.reduce((flatChildren, child) => {
@@ -4544,7 +4549,7 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
4544
4549
  }) / videoConfig.fps);
4545
4550
  }, [frame, mediaStartsAt, playbackRate, videoConfig.fps]);
4546
4551
  const actualSrc = useMemo(() => {
4547
- return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(getAbsoluteSrc(src))}&time=${encodeURIComponent(currentTime)}&transparent=${String(transparent)}`;
4552
+ return getOffthreadVideoSource({ src, currentTime, transparent });
4548
4553
  }, [currentTime, src, transparent]);
4549
4554
  const onErr = useCallback((e) => {
4550
4555
  if (onError) {
@@ -4685,9 +4690,10 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
4685
4690
  }
4686
4691
  }, []);
4687
4692
  const actualStyle = useMemo(() => {
4693
+ var _a;
4688
4694
  return {
4689
4695
  ...style,
4690
- opacity: isSequenceHidden ? 0 : 1,
4696
+ opacity: isSequenceHidden ? 0 : (_a = style === null || style === void 0 ? void 0 : style.opacity) !== null && _a !== void 0 ? _a : 1,
4691
4697
  };
4692
4698
  }, [isSequenceHidden, style]);
4693
4699
  return (jsx("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, loop: _remotionInternalNativeLoopPassed, style: actualStyle, ...nativeProps }));
@@ -731,6 +731,22 @@ function validateFps(fps, location, isGif) {
731
731
  }
732
732
  }
733
733
 
734
+ // Calculate the `.currentTime` of a video or audio element
735
+ const getExpectedMediaFrameUncorrected = ({ frame, playbackRate, startFrom, }) => {
736
+ return interpolate(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
737
+ };
738
+
739
+ const getAbsoluteSrc = (relativeSrc) => {
740
+ if (typeof window === 'undefined') {
741
+ return relativeSrc;
742
+ }
743
+ return new URL(relativeSrc, window.location.origin).href;
744
+ };
745
+
746
+ const getOffthreadVideoSource = ({ src, transparent, currentTime, }) => {
747
+ return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(getAbsoluteSrc(src))}&time=${encodeURIComponent(currentTime)}&transparent=${String(transparent)}`;
748
+ };
749
+
734
750
  const NoReactInternals = {
735
751
  processColor,
736
752
  truthy,
@@ -744,6 +760,8 @@ const NoReactInternals = {
744
760
  bundleMapName: 'bundle.js.map',
745
761
  deserializeJSONWithCustomFields,
746
762
  DELAY_RENDER_CALLSTACK_TOKEN,
763
+ getOffthreadVideoSource,
764
+ getExpectedMediaFrameUncorrected,
747
765
  };
748
766
 
749
767
  export { NoReactInternals, interpolate, random };
@@ -1,4 +1,4 @@
1
1
  // Automatically generated on publish
2
- const VERSION = '4.0.82';
2
+ const VERSION = '4.0.83';
3
3
 
4
4
  export { VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "4.0.82",
3
+ "version": "4.0.83",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",
@@ -83,7 +83,7 @@
83
83
  "formatting": "prettier src --check",
84
84
  "lint": "eslint src --ext ts,tsx",
85
85
  "test": "vitest --run",
86
- "build": "tsc -d && rollup --config rollup-version.config.js && rollup --config rollup-no-react.config.js && rollup --config rollup.config.js",
86
+ "build": "tsc -d && rollup --failAfterWarnings --config rollup-version.config.js && rollup --failAfterWarnings --config rollup-no-react.config.js && rollup --failAfterWarnings --config rollup.config.js",
87
87
  "watch": "tsc -w"
88
88
  }
89
89
  }