remotion 4.0.356 → 4.0.358

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 (40) hide show
  1. package/dist/cjs/Composition.js +7 -3
  2. package/dist/cjs/CompositionManager.d.ts +1 -2
  3. package/dist/cjs/audio/Audio.d.ts +31 -0
  4. package/dist/cjs/audio/Audio.js +20 -15
  5. package/dist/cjs/audio/AudioForPreview.js +11 -5
  6. package/dist/cjs/audio/AudioForRendering.js +1 -1
  7. package/dist/cjs/audio/index.d.ts +1 -1
  8. package/dist/cjs/audio/index.js +4 -1
  9. package/dist/cjs/audio/shared-audio-tags.d.ts +1 -1
  10. package/dist/cjs/audio/shared-audio-tags.js +1 -1
  11. package/dist/cjs/calculate-media-duration.d.ts +6 -0
  12. package/dist/cjs/calculate-media-duration.js +17 -0
  13. package/dist/cjs/get-static-files.d.ts +1 -1
  14. package/dist/cjs/index.d.ts +5 -3
  15. package/dist/cjs/index.js +12 -7
  16. package/dist/cjs/internals.d.ts +40 -2
  17. package/dist/cjs/internals.js +5 -0
  18. package/dist/cjs/use-media-in-timeline.d.ts +21 -6
  19. package/dist/cjs/use-media-in-timeline.js +51 -69
  20. package/dist/cjs/use-media-playback.js +1 -1
  21. package/dist/cjs/use-media-tag.d.ts +9 -0
  22. package/dist/cjs/use-media-tag.js +54 -0
  23. package/dist/cjs/validate-media-props.d.ts +1 -1
  24. package/dist/cjs/version.d.ts +1 -1
  25. package/dist/cjs/version.js +1 -1
  26. package/dist/cjs/video/OffthreadVideo.js +1 -1
  27. package/dist/cjs/video/Video.d.ts +30 -0
  28. package/dist/cjs/video/Video.js +20 -15
  29. package/dist/cjs/video/VideoForPreview.js +10 -4
  30. package/dist/cjs/video/VideoForRendering.js +2 -2
  31. package/dist/cjs/video/index.d.ts +1 -1
  32. package/dist/cjs/video/index.js +2 -1
  33. package/dist/esm/index.mjs +252 -179
  34. package/dist/esm/version.mjs +1 -1
  35. package/ensure-correct-version.ts +1 -1
  36. package/package.json +81 -80
  37. package/LICENSE.md +0 -49
  38. package/bunfig.toml +0 -2
  39. package/dist/cjs/calculate-loop.d.ts +0 -6
  40. package/dist/cjs/calculate-loop.js +0 -17
@@ -28,7 +28,7 @@ const Fallback = () => {
28
28
  return null;
29
29
  };
30
30
  const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultProps, schema, ...compProps }) => {
31
- var _a, _b;
31
+ var _a, _b, _c;
32
32
  const compManager = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionSetters);
33
33
  const { registerComposition, unregisterComposition } = compManager;
34
34
  const video = (0, use_video_js_1.useVideo)();
@@ -41,6 +41,10 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
41
41
  const isPlayer = (0, is_player_js_1.useIsPlayer)();
42
42
  const environment = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
43
43
  const canUseComposition = (0, react_1.useContext)(CanUseRemotionHooks_js_1.CanUseRemotionHooks);
44
+ // Record seen composition IDs as early as possible so that overlays can access them
45
+ if (typeof window !== 'undefined') {
46
+ window.remotion_seenCompositionIds = Array.from(new Set([...((_a = window.remotion_seenCompositionIds) !== null && _a !== void 0 ? _a : []), id]));
47
+ }
44
48
  if (canUseComposition) {
45
49
  if (isPlayer) {
46
50
  throw new Error('<Composition> was mounted inside the `component` that was passed to the <Player>. See https://remotion.dev/docs/wrong-composition-mount for help.');
@@ -104,7 +108,7 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
104
108
  resolved.type !== 'success-and-refreshing')) {
105
109
  return null;
106
110
  }
107
- return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(loading_indicator_js_1.Loading, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...((_a = resolved.result.props) !== null && _a !== void 0 ? _a : {}) }) }) }), (0, portal_node_js_1.portalNode)());
111
+ return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(loading_indicator_js_1.Loading, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...((_b = resolved.result.props) !== null && _b !== void 0 ? _b : {}) }) }) }), (0, portal_node_js_1.portalNode)());
108
112
  }
109
113
  if (environment.isRendering && video && video.component === lazy) {
110
114
  const Comp = lazy;
@@ -113,7 +117,7 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
113
117
  resolved.type !== 'success-and-refreshing')) {
114
118
  return null;
115
119
  }
116
- return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Fallback, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...((_b = resolved.result.props) !== null && _b !== void 0 ? _b : {}) }) }) }), (0, portal_node_js_1.portalNode)());
120
+ return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Fallback, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...((_c = resolved.result.props) !== null && _c !== void 0 ? _c : {}) }) }) }), (0, portal_node_js_1.portalNode)());
117
121
  }
118
122
  return null;
119
123
  };
@@ -75,10 +75,9 @@ export type InlineAudioAsset = {
75
75
  id: string;
76
76
  audio: number[];
77
77
  frame: number;
78
- sampleRate: number;
79
- numberOfChannels: number;
80
78
  timestamp: number;
81
79
  duration: number;
80
+ toneFrequency: number;
82
81
  };
83
82
  type DiscriminatedArtifact = {
84
83
  contentType: 'binary';
@@ -1,5 +1,36 @@
1
1
  import React from 'react';
2
2
  import type { RemotionMainAudioProps } from './props.js';
3
+ /**
4
+ * @description With this component, you can add audio to your video. All audio formats which are supported by Chromium are supported by the component.
5
+ * @see [Documentation](https://remotion.dev/docs/html5-audio)
6
+ */
7
+ export declare const Html5Audio: React.ForwardRefExoticComponent<Omit<import("./props.js").NativeAudioProps & {
8
+ name?: string;
9
+ volume?: import("../volume-prop.js").VolumeProp;
10
+ playbackRate?: number;
11
+ acceptableTimeShiftInSeconds?: number;
12
+ allowAmplificationDuringRender?: boolean;
13
+ _remotionInternalNeedsDurationCalculation?: boolean;
14
+ _remotionInternalNativeLoopPassed?: boolean;
15
+ toneFrequency?: number;
16
+ useWebAudioApi?: boolean;
17
+ pauseWhenBuffering?: boolean;
18
+ showInTimeline?: boolean;
19
+ delayRenderTimeoutInMilliseconds?: number;
20
+ delayRenderRetries?: number;
21
+ loopVolumeCurveBehavior?: import("./use-audio-frame.js").LoopVolumeCurveBehavior;
22
+ onError?: (err: Error) => void;
23
+ audioStreamIndex?: number;
24
+ } & RemotionMainAudioProps & {
25
+ /**
26
+ * @deprecated For internal use only
27
+ */
28
+ readonly stack?: string;
29
+ }, "ref"> & React.RefAttributes<HTMLAudioElement>>;
30
+ /**
31
+ * @deprecated This component has been renamed to `Html5Audio`.
32
+ * @see [Documentation](https://remotion.dev/docs/mediabunny/new-video)
33
+ */
3
34
  export declare const Audio: React.ForwardRefExoticComponent<Omit<import("./props.js").NativeAudioProps & {
4
35
  name?: string;
5
36
  volume?: import("../volume-prop.js").VolumeProp;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Audio = void 0;
3
+ exports.Audio = exports.Html5Audio = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  /* eslint-disable @typescript-eslint/no-use-before-define */
6
6
  const react_1 = require("react");
7
7
  const Sequence_js_1 = require("../Sequence.js");
8
8
  const absolute_src_js_1 = require("../absolute-src.js");
9
- const calculate_loop_js_1 = require("../calculate-loop.js");
9
+ const calculate_media_duration_js_1 = require("../calculate-media-duration.js");
10
10
  const cancel_render_js_1 = require("../cancel-render.js");
11
11
  const enable_sequence_stack_traces_js_1 = require("../enable-sequence-stack-traces.js");
12
12
  const index_js_1 = require("../loop/index.js");
@@ -28,7 +28,7 @@ const AudioRefForwardingFunction = (props, ref) => {
28
28
  const environment = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
29
29
  const { durations, setDurations } = (0, react_1.useContext)(duration_state_js_1.DurationsContext);
30
30
  if (typeof props.src !== 'string') {
31
- throw new TypeError(`The \`<Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
31
+ throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
32
32
  }
33
33
  const preloadedSrc = (0, prefetch_js_1.usePreload)(props.src);
34
34
  const onError = (0, react_1.useCallback)((e) => {
@@ -63,21 +63,21 @@ const AudioRefForwardingFunction = (props, ref) => {
63
63
  });
64
64
  if (loop && durationFetched !== undefined) {
65
65
  if (!Number.isFinite(durationFetched)) {
66
- return ((0, jsx_runtime_1.jsx)(exports.Audio, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }));
66
+ return ((0, jsx_runtime_1.jsx)(exports.Html5Audio, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }));
67
67
  }
68
68
  const duration = durationFetched * fps;
69
- return ((0, jsx_runtime_1.jsx)(index_js_1.Loop, { layout: "none", durationInFrames: (0, calculate_loop_js_1.calculateLoopDuration)({
70
- endAt: trimAfterValue,
71
- mediaDuration: duration,
69
+ return ((0, jsx_runtime_1.jsx)(index_js_1.Loop, { layout: "none", durationInFrames: (0, calculate_media_duration_js_1.calculateMediaDuration)({
70
+ trimAfter: trimAfterValue,
71
+ mediaDurationInFrames: duration,
72
72
  playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
73
- startFrom: trimBeforeValue,
74
- }), children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
73
+ trimBefore: trimBeforeValue,
74
+ }), children: (0, jsx_runtime_1.jsx)(exports.Html5Audio, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
75
75
  }
76
76
  if (typeof trimBeforeValue !== 'undefined' ||
77
77
  typeof trimAfterValue !== 'undefined') {
78
- return ((0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { layout: "none", from: 0 - (trimBeforeValue !== null && trimBeforeValue !== void 0 ? trimBeforeValue : 0), showInTimeline: false, durationInFrames: trimAfterValue, name: name, children: (0, jsx_runtime_1.jsx)(exports.Audio, { _remotionInternalNeedsDurationCalculation: Boolean(loop), pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, ...otherProps, ref: ref }) }));
78
+ return ((0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { layout: "none", from: 0 - (trimBeforeValue !== null && trimBeforeValue !== void 0 ? trimBeforeValue : 0), showInTimeline: false, durationInFrames: trimAfterValue, name: name, children: (0, jsx_runtime_1.jsx)(exports.Html5Audio, { _remotionInternalNeedsDurationCalculation: Boolean(loop), pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, ...otherProps, ref: ref }) }));
79
79
  }
80
- (0, validate_media_props_js_1.validateMediaProps)({ playbackRate: props.playbackRate, volume: props.volume }, 'Audio');
80
+ (0, validate_media_props_js_1.validateMediaProps)({ playbackRate: props.playbackRate, volume: props.volume }, 'Html5Audio');
81
81
  if (environment.isRendering) {
82
82
  return ((0, jsx_runtime_1.jsx)(AudioForRendering_js_1.AudioForRendering, { onDuration: onDuration, ...props, ref: ref, onNativeError: onError, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
83
83
  }
@@ -85,9 +85,14 @@ const AudioRefForwardingFunction = (props, ref) => {
85
85
  // Proposal: Make this default to true in v5
86
86
  pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, _remotionInternalNeedsDurationCalculation: Boolean(loop), showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true }));
87
87
  };
88
- /*
88
+ /**
89
89
  * @description With this component, you can add audio to your video. All audio formats which are supported by Chromium are supported by the component.
90
- * @see [Documentation](https://remotion.dev/docs/audio)
90
+ * @see [Documentation](https://remotion.dev/docs/html5-audio)
91
91
  */
92
- exports.Audio = (0, react_1.forwardRef)(AudioRefForwardingFunction);
93
- (0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(exports.Audio);
92
+ exports.Html5Audio = (0, react_1.forwardRef)(AudioRefForwardingFunction);
93
+ (0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(exports.Html5Audio);
94
+ /**
95
+ * @deprecated This component has been renamed to `Html5Audio`.
96
+ * @see [Documentation](https://remotion.dev/docs/mediabunny/new-video)
97
+ */
98
+ exports.Audio = exports.Html5Audio;
@@ -12,6 +12,7 @@ const random_js_1 = require("../random.js");
12
12
  const use_amplification_js_1 = require("../use-amplification.js");
13
13
  const use_media_in_timeline_js_1 = require("../use-media-in-timeline.js");
14
14
  const use_media_playback_js_1 = require("../use-media-playback.js");
15
+ const use_media_tag_js_1 = require("../use-media-tag.js");
15
16
  const volume_position_state_js_1 = require("../volume-position-state.js");
16
17
  const volume_prop_js_1 = require("../volume-prop.js");
17
18
  const volume_safeguard_js_1 = require("../volume-safeguard.js");
@@ -36,7 +37,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
36
37
  const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)(loopVolumeCurveBehavior !== null && loopVolumeCurveBehavior !== void 0 ? loopVolumeCurveBehavior : 'repeat');
37
38
  const { hidden } = (0, react_1.useContext)(SequenceManager_js_1.SequenceVisibilityToggleContext);
38
39
  if (!src) {
39
- throw new TypeError("No 'src' was passed to <Audio>.");
40
+ throw new TypeError("No 'src' was passed to <Html5Audio>.");
40
41
  }
41
42
  const preloadedSrc = (0, prefetch_js_1.usePreload)(src);
42
43
  const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
@@ -92,7 +93,6 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
92
93
  (0, use_media_in_timeline_js_1.useMediaInTimeline)({
93
94
  volume,
94
95
  mediaVolume,
95
- mediaRef: audioRef,
96
96
  src,
97
97
  mediaType: 'audio',
98
98
  playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
@@ -102,9 +102,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
102
102
  showInTimeline,
103
103
  premountDisplay: (_b = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.premountDisplay) !== null && _b !== void 0 ? _b : null,
104
104
  postmountDisplay: (_c = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.postmountDisplay) !== null && _c !== void 0 ? _c : null,
105
- onAutoPlayError: null,
106
- isPremounting: Boolean(sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.premounting),
107
- isPostmounting: Boolean(sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.postmounting),
105
+ loopDisplay: undefined,
108
106
  });
109
107
  // putting playback before useVolume
110
108
  // because volume looks at playbackrate
@@ -120,6 +118,14 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
120
118
  pauseWhenBuffering,
121
119
  onAutoPlayError: null,
122
120
  });
121
+ (0, use_media_tag_js_1.useMediaTag)({
122
+ id: timelineId,
123
+ isPostmounting: Boolean(sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.postmounting),
124
+ isPremounting: Boolean(sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.premounting),
125
+ mediaRef: audioRef,
126
+ mediaType: 'audio',
127
+ onAutoPlayError: null,
128
+ });
123
129
  (0, use_amplification_js_1.useVolume)({
124
130
  logLevel,
125
131
  mediaRef: audioRef,
@@ -98,7 +98,7 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
98
98
  if (!needsToRenderAudioTag) {
99
99
  return;
100
100
  }
101
- const newHandle = delayRender('Loading <Audio> duration with src=' + src, {
101
+ const newHandle = delayRender('Loading <Html5Audio> duration with src=' + src, {
102
102
  retries: delayRenderRetries !== null && delayRenderRetries !== void 0 ? delayRenderRetries : undefined,
103
103
  timeoutInMilliseconds: delayRenderTimeoutInMilliseconds !== null && delayRenderTimeoutInMilliseconds !== void 0 ? delayRenderTimeoutInMilliseconds : undefined,
104
104
  });
@@ -1,2 +1,2 @@
1
- export * from './Audio.js';
1
+ export { Audio, Html5Audio } from './Audio.js';
2
2
  export * from './props.js';
@@ -14,5 +14,8 @@ 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
- __exportStar(require("./Audio.js"), exports);
17
+ exports.Html5Audio = exports.Audio = void 0;
18
+ var Audio_js_1 = require("./Audio.js");
19
+ Object.defineProperty(exports, "Audio", { enumerable: true, get: function () { return Audio_js_1.Audio; } });
20
+ Object.defineProperty(exports, "Html5Audio", { enumerable: true, get: function () { return Audio_js_1.Html5Audio; } });
18
21
  __exportStar(require("./props.js"), exports);
@@ -5,7 +5,7 @@ import type { SharedElementSourceNode } from './shared-element-source-node.js';
5
5
  * This functionality of Remotion will keep a certain amount
6
6
  * of <audio> tags pre-mounted and by default filled with an empty audio track.
7
7
  * If the user interacts, the empty audio will be played.
8
- * If one of Remotions <Audio /> tags get mounted, the audio will not be rendered at this location, but into one of the prerendered audio tags.
8
+ * If one of Remotions <Html5Audio /> tags get mounted, the audio will not be rendered at this location, but into one of the prerendered audio tags.
9
9
  *
10
10
  * This helps with autoplay issues on iOS Safari and soon other browsers,
11
11
  * which only allow audio playback upon user interaction.
@@ -133,7 +133,7 @@ const SharedAudioContextProvider = ({ children, numberOfAudioTags, component, au
133
133
  }
134
134
  const firstFreeAudio = takenAudios.current.findIndex((a) => a === false);
135
135
  if (firstFreeAudio === -1) {
136
- throw new Error(`Tried to simultaneously mount ${numberOfAudioTags + 1} <Audio /> tags at the same time. With the current settings, the maximum amount of <Audio /> tags is limited to ${numberOfAudioTags} at the same time. Remotion pre-mounts silent audio tags to help avoid browser autoplay restrictions. See https://remotion.dev/docs/player/autoplay#using-the-numberofsharedaudiotags-prop for more information on how to increase this limit.`);
136
+ throw new Error(`Tried to simultaneously mount ${numberOfAudioTags + 1} <Html5Audio /> tags at the same time. With the current settings, the maximum amount of <Html5Audio /> tags is limited to ${numberOfAudioTags} at the same time. Remotion pre-mounts silent audio tags to help avoid browser autoplay restrictions. See https://remotion.dev/docs/player/autoplay#using-the-numberofsharedaudiotags-prop for more information on how to increase this limit.`);
137
137
  }
138
138
  const { id, ref, mediaElementSourceNode } = refs[firstFreeAudio];
139
139
  const cloned = [...takenAudios.current];
@@ -0,0 +1,6 @@
1
+ export declare const calculateMediaDuration: ({ trimAfter, mediaDurationInFrames, playbackRate, trimBefore, }: {
2
+ mediaDurationInFrames: number;
3
+ playbackRate: number;
4
+ trimBefore: number | undefined;
5
+ trimAfter: number | undefined;
6
+ }) => number;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateMediaDuration = void 0;
4
+ const calculateMediaDuration = ({ trimAfter, mediaDurationInFrames, playbackRate, trimBefore, }) => {
5
+ let duration = mediaDurationInFrames;
6
+ // Account for trimAfter
7
+ if (typeof trimAfter !== 'undefined') {
8
+ duration = trimAfter;
9
+ }
10
+ // Account for trimBefore
11
+ if (typeof trimBefore !== 'undefined') {
12
+ duration -= trimBefore;
13
+ }
14
+ const actualDuration = duration / playbackRate;
15
+ return Math.floor(actualDuration);
16
+ };
17
+ exports.calculateMediaDuration = calculateMediaDuration;
@@ -1,7 +1,7 @@
1
1
  export declare const getStaticFiles: () => StaticFile[];
2
2
  export type StaticFile = {
3
3
  /**
4
- * A string that you can pass to the `src` attribute of an `<Audio>`, `<Img>` and `<Video>` element.
4
+ * A string that you can pass to the `src` attribute of an `<Audio>`, `<Img>`, `<Video>`, `<Html5Audio>`, `<Html5Video>` or `<OffthreadVideo>` element.
5
5
  */
6
6
  src: string;
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import './_check-rsc.js';
2
2
  import './asset-types.js';
3
3
  import type { Codec } from './codec.js';
4
- import type { AnyCompMetadata, AnyComposition, AudioOrVideoAsset, TRenderAsset } from './CompositionManager.js';
4
+ import type { AnyCompMetadata, AnyComposition, AudioOrVideoAsset, LoopDisplay, TRenderAsset } from './CompositionManager.js';
5
5
  import type { StaticFile } from './get-static-files.js';
6
6
  import type { LogLevel } from './log.js';
7
7
  import type { PixelFormat, VideoImageFormat } from './render-types.js';
@@ -22,6 +22,7 @@ declare global {
22
22
  };
23
23
  remotion_cancelledError: string | undefined;
24
24
  remotion_getCompositionNames: () => string[];
25
+ remotion_seenCompositionIds: string[];
25
26
  getStaticCompositions: () => Promise<VideoConfigWithSerializedProps[]>;
26
27
  remotion_calculateComposition: (compId: string) => Promise<VideoConfigWithSerializedProps>;
27
28
  remotion_setBundleMode: (bundleMode: BundleState) => void;
@@ -85,7 +86,7 @@ export type BundleState = BundleIndexState | BundleEvaluationState | BundleCompo
85
86
  export * from './AbsoluteFill.js';
86
87
  export * from './animated-image/index.js';
87
88
  export { Artifact } from './Artifact.js';
88
- export * from './audio/index.js';
89
+ export { Audio, Html5Audio, RemotionAudioProps } from './audio/index.js';
89
90
  export type { LoopVolumeCurveBehavior } from './audio/use-audio-frame.js';
90
91
  export { cancelRender } from './cancel-render.js';
91
92
  export { CalculateMetadataFunction, Composition, CompositionProps, CompProps, StillProps, } from './Composition.js';
@@ -122,7 +123,7 @@ export { useRemotionEnvironment } from './use-remotion-environment.js';
122
123
  export * from './use-video-config.js';
123
124
  export * from './version.js';
124
125
  export * from './video-config.js';
125
- export * from './video/index.js';
126
+ export { Html5Video, OffthreadVideo, OffthreadVideoProps, RemotionMainVideoProps, RemotionOffthreadVideoProps, RemotionVideoProps, Video, } from './video/index.js';
126
127
  export type { OnVideoFrame } from './video/props.js';
127
128
  export type { VolumeProp } from './volume-prop.js';
128
129
  export { watchStaticFile } from './watch-static-file.js';
@@ -148,4 +149,5 @@ export type _InternalTypes = {
148
149
  AnyCompMetadata: AnyCompMetadata;
149
150
  AudioOrVideoAsset: AudioOrVideoAsset;
150
151
  TRenderAsset: TRenderAsset;
152
+ LoopDisplay: LoopDisplay;
151
153
  };
package/dist/cjs/index.js CHANGED
@@ -14,7 +14,7 @@ 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.watchStaticFile = exports.useRemotionEnvironment = exports.useDelayRender = exports.useCurrentScale = exports.useCurrentFrame = exports.useBufferState = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.prefetch = exports.random = exports.interpolate = exports.Loop = exports.interpolateColors = exports.Img = exports.getStaticFiles = exports.getRemotionEnvironment = exports.delayRender = exports.continueRender = exports.getInputProps = exports.Composition = exports.cancelRender = exports.Artifact = void 0;
17
+ exports.Config = exports.Experimental = exports.watchStaticFile = exports.Video = exports.OffthreadVideo = exports.Html5Video = exports.useRemotionEnvironment = exports.useDelayRender = exports.useCurrentScale = exports.useCurrentFrame = exports.useBufferState = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.prefetch = exports.random = exports.interpolate = exports.Loop = exports.interpolateColors = exports.Img = exports.getStaticFiles = exports.getRemotionEnvironment = exports.delayRender = exports.continueRender = exports.getInputProps = exports.Composition = exports.cancelRender = exports.Html5Audio = exports.Audio = exports.Artifact = void 0;
18
18
  require("./_check-rsc.js");
19
19
  require("./asset-types.js");
20
20
  const Clipper_js_1 = require("./Clipper.js");
@@ -28,7 +28,9 @@ __exportStar(require("./AbsoluteFill.js"), exports);
28
28
  __exportStar(require("./animated-image/index.js"), exports);
29
29
  var Artifact_js_1 = require("./Artifact.js");
30
30
  Object.defineProperty(exports, "Artifact", { enumerable: true, get: function () { return Artifact_js_1.Artifact; } });
31
- __exportStar(require("./audio/index.js"), exports);
31
+ var index_js_1 = require("./audio/index.js");
32
+ Object.defineProperty(exports, "Audio", { enumerable: true, get: function () { return index_js_1.Audio; } });
33
+ Object.defineProperty(exports, "Html5Audio", { enumerable: true, get: function () { return index_js_1.Html5Audio; } });
32
34
  var cancel_render_js_1 = require("./cancel-render.js");
33
35
  Object.defineProperty(exports, "cancelRender", { enumerable: true, get: function () { return cancel_render_js_1.cancelRender; } });
34
36
  var Composition_js_1 = require("./Composition.js");
@@ -51,8 +53,8 @@ Object.defineProperty(exports, "Img", { enumerable: true, get: function () { ret
51
53
  __exportStar(require("./internals.js"), exports);
52
54
  var interpolate_colors_js_1 = require("./interpolate-colors.js");
53
55
  Object.defineProperty(exports, "interpolateColors", { enumerable: true, get: function () { return interpolate_colors_js_1.interpolateColors; } });
54
- var index_js_1 = require("./loop/index.js");
55
- Object.defineProperty(exports, "Loop", { enumerable: true, get: function () { return index_js_1.Loop; } });
56
+ var index_js_2 = require("./loop/index.js");
57
+ Object.defineProperty(exports, "Loop", { enumerable: true, get: function () { return index_js_2.Loop; } });
56
58
  var no_react_1 = require("./no-react");
57
59
  Object.defineProperty(exports, "interpolate", { enumerable: true, get: function () { return no_react_1.interpolate; } });
58
60
  Object.defineProperty(exports, "random", { enumerable: true, get: function () { return no_react_1.random; } });
@@ -62,8 +64,8 @@ var register_root_js_1 = require("./register-root.js");
62
64
  Object.defineProperty(exports, "registerRoot", { enumerable: true, get: function () { return register_root_js_1.registerRoot; } });
63
65
  var Sequence_js_2 = require("./Sequence.js");
64
66
  Object.defineProperty(exports, "Sequence", { enumerable: true, get: function () { return Sequence_js_2.Sequence; } });
65
- var index_js_2 = require("./series/index.js");
66
- Object.defineProperty(exports, "Series", { enumerable: true, get: function () { return index_js_2.Series; } });
67
+ var index_js_3 = require("./series/index.js");
68
+ Object.defineProperty(exports, "Series", { enumerable: true, get: function () { return index_js_3.Series; } });
67
69
  __exportStar(require("./spring/index.js"), exports);
68
70
  var static_file_js_1 = require("./static-file.js");
69
71
  Object.defineProperty(exports, "staticFile", { enumerable: true, get: function () { return static_file_js_1.staticFile; } });
@@ -81,7 +83,10 @@ Object.defineProperty(exports, "useRemotionEnvironment", { enumerable: true, get
81
83
  __exportStar(require("./use-video-config.js"), exports);
82
84
  __exportStar(require("./version.js"), exports);
83
85
  __exportStar(require("./video-config.js"), exports);
84
- __exportStar(require("./video/index.js"), exports);
86
+ var index_js_4 = require("./video/index.js");
87
+ Object.defineProperty(exports, "Html5Video", { enumerable: true, get: function () { return index_js_4.Html5Video; } });
88
+ Object.defineProperty(exports, "OffthreadVideo", { enumerable: true, get: function () { return index_js_4.OffthreadVideo; } });
89
+ Object.defineProperty(exports, "Video", { enumerable: true, get: function () { return index_js_4.Video; } });
85
90
  var watch_static_file_js_1 = require("./watch-static-file.js");
86
91
  Object.defineProperty(exports, "watchStaticFile", { enumerable: true, get: function () { return watch_static_file_js_1.watchStaticFile; } });
87
92
  exports.Experimental = {
@@ -31,7 +31,7 @@ export declare const Internals: {
31
31
  readonly validateMediaProps: (props: {
32
32
  volume: import("./volume-prop.js").VolumeProp | undefined;
33
33
  playbackRate: number | undefined;
34
- }, component: "Video" | "Audio") => void;
34
+ }, component: "Html5Video" | "Html5Audio" | "Audio" | "Video") => void;
35
35
  readonly resolveTrimProps: ({ startFrom, endAt, trimBefore, trimAfter, }: {
36
36
  startFrom: number | undefined;
37
37
  endAt: number | undefined;
@@ -85,6 +85,20 @@ export declare const Internals: {
85
85
  readonly getRoot: () => import("react").FC<{}> | null;
86
86
  readonly useMediaVolumeState: () => readonly [number, (u: number) => void];
87
87
  readonly useMediaMutedState: () => readonly [boolean, (u: React.SetStateAction<boolean>) => void];
88
+ readonly useMediaInTimeline: ({ volume, mediaVolume, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, }: {
89
+ volume: import("./volume-prop.js").VolumeProp | undefined;
90
+ mediaVolume: number;
91
+ src: string | undefined;
92
+ mediaType: "audio" | "video";
93
+ playbackRate: number;
94
+ displayName: string | null;
95
+ id: string;
96
+ stack: string | null;
97
+ showInTimeline: boolean;
98
+ premountDisplay: number | null;
99
+ postmountDisplay: number | null;
100
+ loopDisplay: import("./CompositionManager.js").LoopDisplay | undefined;
101
+ }) => void;
88
102
  readonly useLazyComponent: <Props>({ compProps, componentName, noSuspense, }: {
89
103
  compProps: CompProps<Props>;
90
104
  componentName: string;
@@ -132,6 +146,12 @@ export declare const Internals: {
132
146
  readonly audioLatencyHint: AudioContextLatencyCategory;
133
147
  }>;
134
148
  readonly invalidCompositionErrorMessage: string;
149
+ readonly calculateMediaDuration: ({ trimAfter, mediaDurationInFrames, playbackRate, trimBefore, }: {
150
+ mediaDurationInFrames: number;
151
+ playbackRate: number;
152
+ trimBefore: number | undefined;
153
+ trimAfter: number | undefined;
154
+ }) => number;
135
155
  readonly isCompositionIdValid: (id: string) => RegExpMatchArray | null;
136
156
  readonly getPreviewDomElement: () => HTMLElement | null;
137
157
  readonly compositionsRef: import("react").RefObject<{
@@ -283,7 +303,7 @@ export declare const Internals: {
283
303
  } | null>;
284
304
  readonly RemotionEnvironmentContext: import("react").Context<RemotionEnvironment | null>;
285
305
  readonly warnAboutTooHighVolume: (volume: number) => void;
286
- readonly AudioForPreview: import("react").ForwardRefExoticComponent<Omit<import("./index.js").NativeAudioProps & {
306
+ readonly AudioForPreview: import("react").ForwardRefExoticComponent<Omit<import("./audio/props.js").NativeAudioProps & {
287
307
  name?: string;
288
308
  volume?: import("./volume-prop.js").VolumeProp;
289
309
  playbackRate?: number;
@@ -312,5 +332,23 @@ export declare const Internals: {
312
332
  }, "ref"> & import("react").RefAttributes<HTMLAudioElement>>;
313
333
  readonly OBJECTFIT_CONTAIN_CLASS_NAME: "__remotion_objectfitcontain";
314
334
  readonly InnerOffthreadVideo: import("react").FC<import("./video/props.js").AllOffthreadVideoProps>;
335
+ readonly useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType, src, displayName, trimBefore, trimAfter, playbackRate, }: {
336
+ volume: import("./volume-prop.js").VolumeProp | undefined;
337
+ mediaVolume: number;
338
+ mediaType: "audio" | "video";
339
+ src: string | undefined;
340
+ displayName: string | null;
341
+ trimBefore: number | undefined;
342
+ trimAfter: number | undefined;
343
+ playbackRate: number;
344
+ }) => {
345
+ volumes: string | number;
346
+ duration: number;
347
+ doesVolumeChange: boolean;
348
+ nonce: number;
349
+ rootId: string;
350
+ isStudio: boolean;
351
+ finalDisplayName: string;
352
+ };
315
353
  };
316
354
  export type { CompositionManagerContext, CompProps, LoggingContextValue, MediaVolumeContextValue, RemotionEnvironment, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, TCompMetadata, TComposition, TimelineContextValue, TRenderAsset, TSequence, WatchRemotionStaticFilesPayload, };
@@ -40,6 +40,7 @@ const AudioForPreview_js_1 = require("./audio/AudioForPreview.js");
40
40
  const shared_audio_tags_js_1 = require("./audio/shared-audio-tags.js");
41
41
  const use_audio_frame_js_1 = require("./audio/use-audio-frame.js");
42
42
  const buffering_js_1 = require("./buffering.js");
43
+ const calculate_media_duration_js_1 = require("./calculate-media-duration.js");
43
44
  const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
44
45
  const CompositionManager_js_1 = require("./CompositionManager.js");
45
46
  const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
@@ -71,6 +72,7 @@ const timeline_position_state_js_1 = require("./timeline-position-state.js");
71
72
  const truthy_js_1 = require("./truthy.js");
72
73
  const use_current_scale_js_1 = require("./use-current-scale.js");
73
74
  const use_lazy_component_js_1 = require("./use-lazy-component.js");
75
+ const use_media_in_timeline_js_1 = require("./use-media-in-timeline.js");
74
76
  const use_unsafe_video_config_js_1 = require("./use-unsafe-video-config.js");
75
77
  const use_video_js_1 = require("./use-video.js");
76
78
  const validate_media_props_js_1 = require("./validate-media-props.js");
@@ -110,6 +112,7 @@ exports.Internals = {
110
112
  getRoot: register_root_js_1.getRoot,
111
113
  useMediaVolumeState: volume_position_state_js_1.useMediaVolumeState,
112
114
  useMediaMutedState: volume_position_state_js_1.useMediaMutedState,
115
+ useMediaInTimeline: use_media_in_timeline_js_1.useMediaInTimeline,
113
116
  useLazyComponent: use_lazy_component_js_1.useLazyComponent,
114
117
  truthy: truthy_js_1.truthy,
115
118
  SequenceContext: SequenceContext_js_1.SequenceContext,
@@ -123,6 +126,7 @@ exports.Internals = {
123
126
  SharedAudioContext: shared_audio_tags_js_1.SharedAudioContext,
124
127
  SharedAudioContextProvider: shared_audio_tags_js_1.SharedAudioContextProvider,
125
128
  invalidCompositionErrorMessage: validate_composition_id_js_1.invalidCompositionErrorMessage,
129
+ calculateMediaDuration: calculate_media_duration_js_1.calculateMediaDuration,
126
130
  isCompositionIdValid: validate_composition_id_js_1.isCompositionIdValid,
127
131
  getPreviewDomElement: get_preview_dom_element_js_1.getPreviewDomElement,
128
132
  compositionsRef: CompositionManager_js_1.compositionsRef,
@@ -171,4 +175,5 @@ exports.Internals = {
171
175
  AudioForPreview: AudioForPreview_js_1.AudioForPreview,
172
176
  OBJECTFIT_CONTAIN_CLASS_NAME: default_css_js_1.OBJECTFIT_CONTAIN_CLASS_NAME,
173
177
  InnerOffthreadVideo: OffthreadVideo_js_1.InnerOffthreadVideo,
178
+ useBasicMediaInTimeline: use_media_in_timeline_js_1.useBasicMediaInTimeline,
174
179
  };
@@ -1,9 +1,26 @@
1
- import type { RefObject } from 'react';
1
+ import type { LoopDisplay } from './CompositionManager.js';
2
2
  import type { VolumeProp } from './volume-prop.js';
3
- export declare const useMediaInTimeline: ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, onAutoPlayError, isPremounting, isPostmounting, }: {
3
+ export declare const useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType, src, displayName, trimBefore, trimAfter, playbackRate, }: {
4
+ volume: VolumeProp | undefined;
5
+ mediaVolume: number;
6
+ mediaType: "audio" | "video";
7
+ src: string | undefined;
8
+ displayName: string | null;
9
+ trimBefore: number | undefined;
10
+ trimAfter: number | undefined;
11
+ playbackRate: number;
12
+ }) => {
13
+ volumes: string | number;
14
+ duration: number;
15
+ doesVolumeChange: boolean;
16
+ nonce: number;
17
+ rootId: string;
18
+ isStudio: boolean;
19
+ finalDisplayName: string;
20
+ };
21
+ export declare const useMediaInTimeline: ({ volume, mediaVolume, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, }: {
4
22
  volume: VolumeProp | undefined;
5
23
  mediaVolume: number;
6
- mediaRef: RefObject<HTMLAudioElement | HTMLVideoElement | null>;
7
24
  src: string | undefined;
8
25
  mediaType: "audio" | "video";
9
26
  playbackRate: number;
@@ -13,7 +30,5 @@ export declare const useMediaInTimeline: ({ volume, mediaVolume, mediaRef, src,
13
30
  showInTimeline: boolean;
14
31
  premountDisplay: number | null;
15
32
  postmountDisplay: number | null;
16
- onAutoPlayError: null | (() => void);
17
- isPremounting: boolean;
18
- isPostmounting: boolean;
33
+ loopDisplay: LoopDisplay | undefined;
19
34
  }) => void;