remotion 4.0.357 → 4.0.360

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.
@@ -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)({
69
+ return ((0, jsx_runtime_1.jsx)(index_js_1.Loop, { layout: "none", durationInFrames: (0, calculate_media_duration_js_1.calculateMediaDuration)({
70
70
  trimAfter: trimAfterValue,
71
71
  mediaDurationInFrames: duration,
72
72
  playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
73
73
  trimBefore: trimBeforeValue,
74
- }), children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
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;
@@ -37,7 +37,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
37
37
  const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)(loopVolumeCurveBehavior !== null && loopVolumeCurveBehavior !== void 0 ? loopVolumeCurveBehavior : 'repeat');
38
38
  const { hidden } = (0, react_1.useContext)(SequenceManager_js_1.SequenceVisibilityToggleContext);
39
39
  if (!src) {
40
- throw new TypeError("No 'src' was passed to <Audio>.");
40
+ throw new TypeError("No 'src' was passed to <Html5Audio>.");
41
41
  }
42
42
  const preloadedSrc = (0, prefetch_js_1.usePreload)(src);
43
43
  const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
@@ -102,6 +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
+ loopDisplay: undefined,
105
106
  });
106
107
  // putting playback before useVolume
107
108
  // because volume looks at playbackrate
@@ -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];
@@ -1,4 +1,4 @@
1
- export declare const calculateLoopDuration: ({ trimAfter, mediaDurationInFrames, playbackRate, trimBefore, }: {
1
+ export declare const calculateMediaDuration: ({ trimAfter, mediaDurationInFrames, playbackRate, trimBefore, }: {
2
2
  mediaDurationInFrames: number;
3
3
  playbackRate: number;
4
4
  trimBefore: number | undefined;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.calculateLoopDuration = void 0;
4
- const calculateLoopDuration = ({ trimAfter, mediaDurationInFrames, playbackRate, trimBefore, }) => {
3
+ exports.calculateMediaDuration = void 0;
4
+ const calculateMediaDuration = ({ trimAfter, mediaDurationInFrames, playbackRate, trimBefore, }) => {
5
5
  let duration = mediaDurationInFrames;
6
6
  // Account for trimAfter
7
7
  if (typeof trimAfter !== 'undefined') {
@@ -14,4 +14,4 @@ const calculateLoopDuration = ({ trimAfter, mediaDurationInFrames, playbackRate,
14
14
  const actualDuration = duration / playbackRate;
15
15
  return Math.floor(actualDuration);
16
16
  };
17
- exports.calculateLoopDuration = calculateLoopDuration;
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';
@@ -86,7 +86,7 @@ export type BundleState = BundleIndexState | BundleEvaluationState | BundleCompo
86
86
  export * from './AbsoluteFill.js';
87
87
  export * from './animated-image/index.js';
88
88
  export { Artifact } from './Artifact.js';
89
- export * from './audio/index.js';
89
+ export { Audio, Html5Audio, RemotionAudioProps } from './audio/index.js';
90
90
  export type { LoopVolumeCurveBehavior } from './audio/use-audio-frame.js';
91
91
  export { cancelRender } from './cancel-render.js';
92
92
  export { CalculateMetadataFunction, Composition, CompositionProps, CompProps, StillProps, } from './Composition.js';
@@ -123,7 +123,7 @@ export { useRemotionEnvironment } from './use-remotion-environment.js';
123
123
  export * from './use-video-config.js';
124
124
  export * from './version.js';
125
125
  export * from './video-config.js';
126
- export * from './video/index.js';
126
+ export { Html5Video, OffthreadVideo, OffthreadVideoProps, RemotionMainVideoProps, RemotionOffthreadVideoProps, RemotionVideoProps, Video, } from './video/index.js';
127
127
  export type { OnVideoFrame } from './video/props.js';
128
128
  export type { VolumeProp } from './volume-prop.js';
129
129
  export { watchStaticFile } from './watch-static-file.js';
@@ -149,4 +149,5 @@ export type _InternalTypes = {
149
149
  AnyCompMetadata: AnyCompMetadata;
150
150
  AudioOrVideoAsset: AudioOrVideoAsset;
151
151
  TRenderAsset: TRenderAsset;
152
+ LoopDisplay: LoopDisplay;
152
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,7 +85,7 @@ 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, }: {
88
+ readonly useMediaInTimeline: ({ volume, mediaVolume, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, }: {
89
89
  volume: import("./volume-prop.js").VolumeProp | undefined;
90
90
  mediaVolume: number;
91
91
  src: string | undefined;
@@ -97,6 +97,7 @@ export declare const Internals: {
97
97
  showInTimeline: boolean;
98
98
  premountDisplay: number | null;
99
99
  postmountDisplay: number | null;
100
+ loopDisplay: import("./CompositionManager.js").LoopDisplay | undefined;
100
101
  }) => void;
101
102
  readonly useLazyComponent: <Props>({ compProps, componentName, noSuspense, }: {
102
103
  compProps: CompProps<Props>;
@@ -145,7 +146,7 @@ export declare const Internals: {
145
146
  readonly audioLatencyHint: AudioContextLatencyCategory;
146
147
  }>;
147
148
  readonly invalidCompositionErrorMessage: string;
148
- readonly calculateLoopDuration: ({ trimAfter, mediaDurationInFrames, playbackRate, trimBefore, }: {
149
+ readonly calculateMediaDuration: ({ trimAfter, mediaDurationInFrames, playbackRate, trimBefore, }: {
149
150
  mediaDurationInFrames: number;
150
151
  playbackRate: number;
151
152
  trimBefore: number | undefined;
@@ -302,7 +303,7 @@ export declare const Internals: {
302
303
  } | null>;
303
304
  readonly RemotionEnvironmentContext: import("react").Context<RemotionEnvironment | null>;
304
305
  readonly warnAboutTooHighVolume: (volume: number) => void;
305
- readonly AudioForPreview: import("react").ForwardRefExoticComponent<Omit<import("./index.js").NativeAudioProps & {
306
+ readonly AudioForPreview: import("react").ForwardRefExoticComponent<Omit<import("./audio/props.js").NativeAudioProps & {
306
307
  name?: string;
307
308
  volume?: import("./volume-prop.js").VolumeProp;
308
309
  playbackRate?: number;
@@ -331,5 +332,23 @@ export declare const Internals: {
331
332
  }, "ref"> & import("react").RefAttributes<HTMLAudioElement>>;
332
333
  readonly OBJECTFIT_CONTAIN_CLASS_NAME: "__remotion_objectfitcontain";
333
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
+ };
334
353
  };
335
354
  export type { CompositionManagerContext, CompProps, LoggingContextValue, MediaVolumeContextValue, RemotionEnvironment, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, TCompMetadata, TComposition, TimelineContextValue, TRenderAsset, TSequence, WatchRemotionStaticFilesPayload, };
@@ -40,7 +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_loop_js_1 = require("./calculate-loop.js");
43
+ const calculate_media_duration_js_1 = require("./calculate-media-duration.js");
44
44
  const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
45
45
  const CompositionManager_js_1 = require("./CompositionManager.js");
46
46
  const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
@@ -126,7 +126,7 @@ exports.Internals = {
126
126
  SharedAudioContext: shared_audio_tags_js_1.SharedAudioContext,
127
127
  SharedAudioContextProvider: shared_audio_tags_js_1.SharedAudioContextProvider,
128
128
  invalidCompositionErrorMessage: validate_composition_id_js_1.invalidCompositionErrorMessage,
129
- calculateLoopDuration: calculate_loop_js_1.calculateLoopDuration,
129
+ calculateMediaDuration: calculate_media_duration_js_1.calculateMediaDuration,
130
130
  isCompositionIdValid: validate_composition_id_js_1.isCompositionIdValid,
131
131
  getPreviewDomElement: get_preview_dom_element_js_1.getPreviewDomElement,
132
132
  compositionsRef: CompositionManager_js_1.compositionsRef,
@@ -175,4 +175,5 @@ exports.Internals = {
175
175
  AudioForPreview: AudioForPreview_js_1.AudioForPreview,
176
176
  OBJECTFIT_CONTAIN_CLASS_NAME: default_css_js_1.OBJECTFIT_CONTAIN_CLASS_NAME,
177
177
  InnerOffthreadVideo: OffthreadVideo_js_1.InnerOffthreadVideo,
178
+ useBasicMediaInTimeline: use_media_in_timeline_js_1.useBasicMediaInTimeline,
178
179
  };
@@ -1,5 +1,24 @@
1
+ import type { LoopDisplay } from './CompositionManager.js';
1
2
  import type { VolumeProp } from './volume-prop.js';
2
- export declare const useMediaInTimeline: ({ volume, mediaVolume, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, }: {
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, }: {
3
22
  volume: VolumeProp | undefined;
4
23
  mediaVolume: number;
5
24
  src: string | undefined;
@@ -11,4 +30,5 @@ export declare const useMediaInTimeline: ({ volume, mediaVolume, src, mediaType,
11
30
  showInTimeline: boolean;
12
31
  premountDisplay: number | null;
13
32
  postmountDisplay: number | null;
33
+ loopDisplay: LoopDisplay | undefined;
14
34
  }) => void;
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useMediaInTimeline = void 0;
3
+ exports.useMediaInTimeline = exports.useBasicMediaInTimeline = void 0;
4
4
  const react_1 = require("react");
5
5
  const SequenceContext_js_1 = require("./SequenceContext.js");
6
6
  const SequenceManager_js_1 = require("./SequenceManager.js");
7
7
  const use_audio_frame_js_1 = require("./audio/use-audio-frame.js");
8
+ const calculate_media_duration_js_1 = require("./calculate-media-duration.js");
8
9
  const get_asset_file_name_js_1 = require("./get-asset-file-name.js");
9
10
  const nonce_js_1 = require("./nonce.js");
10
11
  const timeline_position_state_js_1 = require("./timeline-position-state.js");
@@ -20,21 +21,23 @@ const warnOnce = (message) => {
20
21
  console.warn(message);
21
22
  didWarn[message] = true;
22
23
  };
23
- const useMediaInTimeline = ({ volume, mediaVolume, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, }) => {
24
- const videoConfig = (0, use_video_config_js_1.useVideoConfig)();
25
- const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
26
- const actualFrom = parentSequence
27
- ? parentSequence.relativeFrom + parentSequence.cumulatedFrom
28
- : 0;
24
+ const useBasicMediaInTimeline = ({ volume, mediaVolume, mediaType, src, displayName, trimBefore, trimAfter, playbackRate, }) => {
25
+ if (!src) {
26
+ throw new Error('No src passed');
27
+ }
29
28
  const startsAt = (0, use_audio_frame_js_1.useMediaStartsAt)();
30
- const { registerSequence, unregisterSequence } = (0, react_1.useContext)(SequenceManager_js_1.SequenceManager);
29
+ const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
30
+ const videoConfig = (0, use_video_config_js_1.useVideoConfig)();
31
31
  const [initialVolume] = (0, react_1.useState)(() => volume);
32
- const nonce = (0, nonce_js_1.useNonce)();
33
- const { rootId } = (0, react_1.useContext)(timeline_position_state_js_1.TimelineContext);
32
+ const mediaDuration = (0, calculate_media_duration_js_1.calculateMediaDuration)({
33
+ mediaDurationInFrames: videoConfig.durationInFrames,
34
+ playbackRate,
35
+ trimBefore,
36
+ trimAfter,
37
+ });
34
38
  const duration = parentSequence
35
- ? Math.min(parentSequence.durationInFrames, videoConfig.durationInFrames)
36
- : videoConfig.durationInFrames;
37
- const doesVolumeChange = typeof volume === 'function';
39
+ ? Math.min(parentSequence.durationInFrames, mediaDuration)
40
+ : mediaDuration;
38
41
  const volumes = (0, react_1.useMemo)(() => {
39
42
  if (typeof volume === 'number') {
40
43
  return volume;
@@ -55,13 +58,41 @@ const useMediaInTimeline = ({ volume, mediaVolume, src, mediaType, playbackRate,
55
58
  warnOnce(`Remotion: The ${mediaType} with src ${src} has changed it's volume. Prefer the callback syntax for setting volume to get better timeline display: https://www.remotion.dev/docs/audio/volume`);
56
59
  }
57
60
  }, [initialVolume, mediaType, src, volume]);
61
+ const doesVolumeChange = typeof volume === 'function';
62
+ const nonce = (0, nonce_js_1.useNonce)();
63
+ const { rootId } = (0, react_1.useContext)(timeline_position_state_js_1.TimelineContext);
58
64
  const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
65
+ return {
66
+ volumes,
67
+ duration,
68
+ doesVolumeChange,
69
+ nonce,
70
+ rootId,
71
+ isStudio: env.isStudio,
72
+ finalDisplayName: displayName !== null && displayName !== void 0 ? displayName : (0, get_asset_file_name_js_1.getAssetDisplayName)(src),
73
+ };
74
+ };
75
+ exports.useBasicMediaInTimeline = useBasicMediaInTimeline;
76
+ const useMediaInTimeline = ({ volume, mediaVolume, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, }) => {
77
+ const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
78
+ const startsAt = (0, use_audio_frame_js_1.useMediaStartsAt)();
79
+ const { registerSequence, unregisterSequence } = (0, react_1.useContext)(SequenceManager_js_1.SequenceManager);
80
+ const { volumes, duration, doesVolumeChange, nonce, rootId, isStudio, finalDisplayName, } = (0, exports.useBasicMediaInTimeline)({
81
+ volume,
82
+ mediaVolume,
83
+ mediaType,
84
+ src,
85
+ displayName,
86
+ trimAfter: undefined,
87
+ trimBefore: undefined,
88
+ playbackRate,
89
+ });
59
90
  (0, react_1.useEffect)(() => {
60
91
  var _a, _b, _c;
61
92
  if (!src) {
62
93
  throw new Error('No src passed');
63
94
  }
64
- if (!env.isStudio && ((_b = (_a = window.process) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.NODE_ENV) !== 'test') {
95
+ if (!isStudio && ((_b = (_a = window.process) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.NODE_ENV) !== 'test') {
65
96
  return;
66
97
  }
67
98
  if (!showInTimeline) {
@@ -74,14 +105,14 @@ const useMediaInTimeline = ({ volume, mediaVolume, src, mediaType, playbackRate,
74
105
  duration,
75
106
  from: 0,
76
107
  parent: (_c = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _c !== void 0 ? _c : null,
77
- displayName: displayName !== null && displayName !== void 0 ? displayName : (0, get_asset_file_name_js_1.getAssetDisplayName)(src),
108
+ displayName: finalDisplayName,
78
109
  rootId,
79
110
  volume: volumes,
80
111
  showInTimeline: true,
81
112
  nonce,
82
113
  startMediaFrom: 0 - startsAt,
83
114
  doesVolumeChange,
84
- loopDisplay: undefined,
115
+ loopDisplay,
85
116
  playbackRate,
86
117
  stack,
87
118
  premountDisplay,
@@ -91,27 +122,26 @@ const useMediaInTimeline = ({ volume, mediaVolume, src, mediaType, playbackRate,
91
122
  unregisterSequence(id);
92
123
  };
93
124
  }, [
94
- actualFrom,
95
125
  duration,
96
126
  id,
97
127
  parentSequence,
98
128
  src,
99
129
  registerSequence,
100
- rootId,
101
130
  unregisterSequence,
102
- videoConfig,
103
131
  volumes,
104
132
  doesVolumeChange,
105
133
  nonce,
106
134
  mediaType,
107
135
  startsAt,
108
136
  playbackRate,
109
- displayName,
110
137
  stack,
111
138
  showInTimeline,
112
139
  premountDisplay,
113
140
  postmountDisplay,
114
- env.isStudio,
141
+ isStudio,
142
+ loopDisplay,
143
+ rootId,
144
+ finalDisplayName,
115
145
  ]);
116
146
  };
117
147
  exports.useMediaInTimeline = useMediaInTimeline;
@@ -141,7 +141,7 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
141
141
  }, [mediaRef, playbackRate]);
142
142
  (0, react_1.useEffect)(() => {
143
143
  var _a, _b, _c;
144
- const tagName = mediaType === 'audio' ? '<Audio>' : '<Video>';
144
+ const tagName = mediaType === 'audio' ? '<Html5Audio>' : '<Html5Video>';
145
145
  if (!mediaRef.current) {
146
146
  throw new Error(`No ${mediaType} ref found`);
147
147
  }
@@ -2,4 +2,4 @@ import type { VolumeProp } from './volume-prop.js';
2
2
  export declare const validateMediaProps: (props: {
3
3
  volume: VolumeProp | undefined;
4
4
  playbackRate: number | undefined;
5
- }, component: "Video" | "Audio") => void;
5
+ }, component: "Html5Video" | "Html5Audio" | "Audio" | "Video") => void;
@@ -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.357";
6
+ export declare const VERSION = "4.0.360";
@@ -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.357';
10
+ exports.VERSION = '4.0.360';
@@ -39,7 +39,7 @@ const InnerOffthreadVideo = (props) => {
39
39
  };
40
40
  exports.InnerOffthreadVideo = InnerOffthreadVideo;
41
41
  /*
42
- * @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
42
+ * @description This method imports and displays a video, similar to <Html5Video />. During rendering, it extracts the exact frame from the video and displays it in an <img> tag
43
43
  * @see [Documentation](https://www.remotion.dev/docs/offthreadvideo)
44
44
  */
45
45
  const OffthreadVideo = ({ src, acceptableTimeShiftInSeconds, allowAmplificationDuringRender, audioStreamIndex, className, crossOrigin, delayRenderRetries, delayRenderTimeoutInMilliseconds, id, loopVolumeCurveBehavior, muted, name, onAutoPlayError, onError, onVideoFrame, pauseWhenBuffering, playbackRate, showInTimeline, style, toneFrequency, toneMapped, transparent, trimAfter, trimBefore, useWebAudioApi, volume, _remotionInternalNativeLoopPassed, endAt, stack, startFrom, imageFormat, }) => {