remotion 4.0.72 → 4.0.74

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.
@@ -11,5 +11,6 @@ export declare const Audio: React.ForwardRefExoticComponent<Pick<Omit<React.Deta
11
11
  acceptableTimeShiftInSeconds?: number | undefined;
12
12
  allowAmplificationDuringRender?: boolean | undefined;
13
13
  _remotionInternalNeedsDurationCalculation?: boolean | undefined;
14
+ _remotionInternalNativeLoopPassed?: boolean | undefined;
14
15
  toneFrequency?: number | undefined;
15
- } & RemotionMainAudioProps, "id" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "volume" | "allowAmplificationDuringRender" | "controlsList" | "crossOrigin" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "src" | "name" | "playbackRate" | "acceptableTimeShiftInSeconds" | "_remotionInternalNeedsDurationCalculation" | "toneFrequency" | keyof RemotionMainAudioProps> & React.RefAttributes<HTMLAudioElement>>;
16
+ } & RemotionMainAudioProps, "id" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "volume" | "allowAmplificationDuringRender" | "controlsList" | "crossOrigin" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "src" | "name" | "playbackRate" | "acceptableTimeShiftInSeconds" | "_remotionInternalNeedsDurationCalculation" | "_remotionInternalNativeLoopPassed" | "toneFrequency" | keyof RemotionMainAudioProps> & React.RefAttributes<HTMLAudioElement>>;
@@ -19,7 +19,7 @@ const AudioForDevelopment_js_1 = require("./AudioForDevelopment.js");
19
19
  const AudioForRendering_js_1 = require("./AudioForRendering.js");
20
20
  const shared_audio_tags_js_1 = require("./shared-audio-tags.js");
21
21
  const AudioRefForwardingFunction = (props, ref) => {
22
- var _a;
22
+ var _a, _b;
23
23
  const audioContext = (0, react_1.useContext)(shared_audio_tags_js_1.SharedAudioContext);
24
24
  const { startFrom, endAt, name, ...otherProps } = props;
25
25
  const { loop, ...propsOtherThanLoop } = props;
@@ -52,7 +52,7 @@ const AudioRefForwardingFunction = (props, ref) => {
52
52
  mediaDuration: duration,
53
53
  playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
54
54
  startFrom,
55
- }), children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...propsOtherThanLoop, ref: ref }) }));
55
+ }), children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
56
56
  }
57
57
  if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
58
58
  (0, validate_start_from_props_js_1.validateStartFromProps)(startFrom, endAt);
@@ -64,7 +64,7 @@ const AudioRefForwardingFunction = (props, ref) => {
64
64
  if (environment.isRendering) {
65
65
  return ((0, jsx_runtime_1.jsx)(AudioForRendering_js_1.AudioForRendering, { onDuration: onDuration, ...props, ref: ref, onError: onError, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
66
66
  }
67
- return ((0, jsx_runtime_1.jsx)(AudioForDevelopment_js_1.AudioForDevelopment, { shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError, onDuration: onDuration, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
67
+ return ((0, jsx_runtime_1.jsx)(AudioForDevelopment_js_1.AudioForDevelopment, { _remotionInternalNativeLoopPassed: (_b = props._remotionInternalNativeLoopPassed) !== null && _b !== void 0 ? _b : false, shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError, onDuration: onDuration, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
68
68
  };
69
69
  /**
70
70
  * @description With this component, you can add audio to your video. All audio formats which are supported by Chromium are supported by the component.
@@ -7,8 +7,10 @@ export declare const AudioForDevelopment: ForwardRefExoticComponent<Omit<React.D
7
7
  acceptableTimeShiftInSeconds?: number | undefined;
8
8
  allowAmplificationDuringRender?: boolean | undefined;
9
9
  _remotionInternalNeedsDurationCalculation?: boolean | undefined;
10
+ _remotionInternalNativeLoopPassed?: boolean | undefined;
10
11
  toneFrequency?: number | undefined;
11
12
  } & {
12
13
  shouldPreMountAudioTags: boolean;
13
14
  onDuration: (src: string, durationInSeconds: number) => void;
15
+ _remotionInternalNativeLoopPassed: boolean;
14
16
  } & RefAttributes<HTMLAudioElement>>;
@@ -21,7 +21,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
21
21
  const [mediaVolume] = (0, volume_position_state_js_1.useMediaVolumeState)();
22
22
  const [mediaMuted] = (0, volume_position_state_js_1.useMediaMutedState)();
23
23
  const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
24
- const { volume, muted, playbackRate, shouldPreMountAudioTags, src, onDuration, acceptableTimeShiftInSeconds, _remotionInternalNeedsDurationCalculation, allowAmplificationDuringRender, name, ...nativeProps } = props;
24
+ const { volume, muted, playbackRate, shouldPreMountAudioTags, src, onDuration, acceptableTimeShiftInSeconds, _remotionInternalNeedsDurationCalculation, _remotionInternalNativeLoopPassed, allowAmplificationDuringRender, name, ...nativeProps } = props;
25
25
  if (!src) {
26
26
  throw new TypeError("No 'src' was passed to <Audio>.");
27
27
  }
@@ -30,9 +30,16 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
30
30
  return {
31
31
  muted: muted || mediaMuted,
32
32
  src: preloadedSrc,
33
+ loop: _remotionInternalNativeLoopPassed,
33
34
  ...nativeProps,
34
35
  };
35
- }, [mediaMuted, muted, nativeProps, preloadedSrc]);
36
+ }, [
37
+ _remotionInternalNativeLoopPassed,
38
+ mediaMuted,
39
+ muted,
40
+ nativeProps,
41
+ preloadedSrc,
42
+ ]);
36
43
  const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
37
44
  // Generate a string that's as unique as possible for this asset
38
45
  // but at the same time deterministic. We use it to combat strict mode issues.
@@ -7,6 +7,7 @@ export declare const AudioForRendering: ForwardRefExoticComponent<Omit<React.Det
7
7
  acceptableTimeShiftInSeconds?: number | undefined;
8
8
  allowAmplificationDuringRender?: boolean | undefined;
9
9
  _remotionInternalNeedsDurationCalculation?: boolean | undefined;
10
+ _remotionInternalNativeLoopPassed?: boolean | undefined;
10
11
  toneFrequency?: number | undefined;
11
12
  } & {
12
13
  onDuration: (src: string, durationInSeconds: number) => void;
@@ -30,7 +30,7 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
30
30
  sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom,
31
31
  sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames,
32
32
  ]);
33
- const { volume: volumeProp, playbackRate, allowAmplificationDuringRender, onDuration, toneFrequency, _remotionInternalNeedsDurationCalculation, acceptableTimeShiftInSeconds, name, ...nativeProps } = props;
33
+ const { volume: volumeProp, playbackRate, allowAmplificationDuringRender, onDuration, toneFrequency, _remotionInternalNeedsDurationCalculation, _remotionInternalNativeLoopPassed, acceptableTimeShiftInSeconds, name, ...nativeProps } = props;
34
34
  const volume = (0, volume_prop_js_1.evaluateVolume)({
35
35
  volume: volumeProp,
36
36
  frame: volumePropFrame,
@@ -11,5 +11,6 @@ export type RemotionAudioProps = Omit<React.DetailedHTMLProps<React.AudioHTMLAtt
11
11
  acceptableTimeShiftInSeconds?: number;
12
12
  allowAmplificationDuringRender?: boolean;
13
13
  _remotionInternalNeedsDurationCalculation?: boolean;
14
+ _remotionInternalNativeLoopPassed?: boolean;
14
15
  toneFrequency?: number;
15
16
  };
@@ -30,6 +30,14 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
30
30
  const { fps } = (0, use_video_config_js_1.useVideoConfig)();
31
31
  const mediaStartsAt = (0, use_audio_frame_js_1.useMediaStartsAt)();
32
32
  const playbackRate = localPlaybackRate * globalPlaybackRate;
33
+ // For short audio, a lower acceptable time shift is used
34
+ const acceptableTimeShiftButLessThanDuration = (() => {
35
+ var _a;
36
+ if ((_a = mediaRef.current) === null || _a === void 0 ? void 0 : _a.duration) {
37
+ return Math.min(mediaRef.current.duration, acceptableTimeshift !== null && acceptableTimeshift !== void 0 ? acceptableTimeshift : exports.DEFAULT_ACCEPTABLE_TIMESHIFT);
38
+ }
39
+ return acceptableTimeshift;
40
+ })();
33
41
  (0, react_1.useEffect)(() => {
34
42
  var _a;
35
43
  if (!playing) {
@@ -62,7 +70,7 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
62
70
  : desiredUnclampedTime;
63
71
  const isTime = mediaRef.current.currentTime;
64
72
  const timeShift = Math.abs(shouldBeTime - isTime);
65
- if (timeShift > acceptableTimeshift) {
73
+ if (timeShift > acceptableTimeShiftButLessThanDuration) {
66
74
  // If scrubbing around, adjust timing
67
75
  // or if time shift is bigger than 0.45sec
68
76
  seek(mediaRef, shouldBeTime);
@@ -101,6 +109,7 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
101
109
  localPlaybackRate,
102
110
  onlyWarnForMediaSeekingError,
103
111
  acceptableTimeshift,
112
+ acceptableTimeShiftButLessThanDuration,
104
113
  ]);
105
114
  };
106
115
  exports.useMediaPlayback = useMediaPlayback;
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.72";
1
+ export declare const VERSION = "4.0.74";
@@ -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.72';
5
+ exports.VERSION = '4.0.74';
@@ -36,6 +36,6 @@ const OffthreadVideo = (props) => {
36
36
  return (0, jsx_runtime_1.jsx)(OffthreadVideoForRendering_js_1.OffthreadVideoForRendering, { ...otherProps });
37
37
  }
38
38
  const { transparent, ...withoutTransparent } = otherProps;
39
- return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_js_1.VideoForDevelopment, { onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...withoutTransparent }));
39
+ return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_js_1.VideoForDevelopment, { _remotionInternalNativeLoopPassed: false, onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...withoutTransparent }));
40
40
  };
41
41
  exports.OffthreadVideo = OffthreadVideo;
@@ -18,7 +18,7 @@ const VideoForDevelopment_js_1 = require("./VideoForDevelopment.js");
18
18
  const VideoForRendering_js_1 = require("./VideoForRendering.js");
19
19
  const VideoForwardingFunction = (props, ref) => {
20
20
  var _a;
21
- const { startFrom, endAt, name, ...otherProps } = props;
21
+ const { startFrom, endAt, name, _remotionInternalNativeLoopPassed, ...otherProps } = props;
22
22
  const { loop, ...propsOtherThanLoop } = props;
23
23
  const { fps } = (0, use_video_config_js_1.useVideoConfig)();
24
24
  const environment = (0, get_remotion_environment_js_1.getRemotionEnvironment)();
@@ -40,7 +40,7 @@ const VideoForwardingFunction = (props, ref) => {
40
40
  mediaDuration,
41
41
  playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
42
42
  startFrom,
43
- }), layout: "none", name: name, children: (0, jsx_runtime_1.jsx)(exports.Video, { ...propsOtherThanLoop, ref: ref }) }));
43
+ }), layout: "none", name: name, children: (0, jsx_runtime_1.jsx)(exports.Video, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
44
44
  }
45
45
  if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
46
46
  (0, validate_start_from_props_js_1.validateStartFromProps)(startFrom, endAt);
@@ -52,7 +52,7 @@ const VideoForwardingFunction = (props, ref) => {
52
52
  if (environment.isRendering) {
53
53
  return ((0, jsx_runtime_1.jsx)(VideoForRendering_js_1.VideoForRendering, { onDuration: onDuration, ...otherProps, ref: ref }));
54
54
  }
55
- return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_js_1.VideoForDevelopment, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref, onDuration: onDuration }));
55
+ return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_js_1.VideoForDevelopment, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref, onDuration: onDuration, _remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed !== null && _remotionInternalNativeLoopPassed !== void 0 ? _remotionInternalNativeLoopPassed : false }));
56
56
  };
57
57
  const forward = react_1.forwardRef;
58
58
  /**
@@ -10,4 +10,5 @@ export declare const VideoForDevelopment: ForwardRefExoticComponent<Omit<React.D
10
10
  } & {
11
11
  onlyWarnForMediaSeekingError: boolean;
12
12
  onDuration: (src: string, durationInSeconds: number) => void;
13
+ _remotionInternalNativeLoopPassed: boolean;
13
14
  } & RefAttributes<HTMLVideoElement>>;
@@ -21,7 +21,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
21
21
  const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
22
22
  const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, onDuration,
23
23
  // @ts-expect-error
24
- acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, name, ...nativeProps } = props;
24
+ acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, name, _remotionInternalNativeLoopPassed, ...nativeProps } = props;
25
25
  if (typeof acceptableTimeShift !== 'undefined') {
26
26
  throw new Error('acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.');
27
27
  }
@@ -129,7 +129,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
129
129
  current.preload = 'auto';
130
130
  }
131
131
  }, []);
132
- return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, ...nativeProps }));
132
+ return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, loop: _remotionInternalNativeLoopPassed, ...nativeProps }));
133
133
  };
134
134
  // Copy types from forwardRef but not necessary to remove ref
135
135
  exports.VideoForDevelopment = (0, react_1.forwardRef)(VideoForDevelopmentRefForwardingFunction);
@@ -17,7 +17,7 @@ const use_unsafe_video_config_js_1 = require("../use-unsafe-video-config.js");
17
17
  const volume_prop_js_1 = require("../volume-prop.js");
18
18
  const warn_about_non_seekable_media_js_1 = require("../warn-about-non-seekable-media.js");
19
19
  const get_current_time_js_1 = require("./get-current-time.js");
20
- const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAmplificationDuringRender, playbackRate, onDuration, toneFrequency, name, ...props }, ref) => {
20
+ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAmplificationDuringRender, playbackRate, onDuration, toneFrequency, name, acceptableTimeShiftInSeconds, ...props }, ref) => {
21
21
  const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
22
22
  const frame = (0, use_current_frame_js_1.useCurrentFrame)();
23
23
  const volumePropsFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
@@ -3,6 +3,10 @@ import type { VolumeProp } from '../volume-prop.js';
3
3
  export type RemotionMainVideoProps = {
4
4
  startFrom?: number;
5
5
  endAt?: number;
6
+ /**
7
+ * @deprecated Only for internal `transparent` use
8
+ */
9
+ _remotionInternalNativeLoopPassed?: boolean;
6
10
  };
7
11
  export type RemotionVideoProps = Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, 'autoPlay' | 'controls' | 'onEnded' | 'nonce'> & {
8
12
  name?: string;
@@ -59,7 +59,7 @@ function truthy(value) {
59
59
  }
60
60
 
61
61
  // Automatically generated on publish
62
- const VERSION = '4.0.72';
62
+ const VERSION = '4.0.74';
63
63
 
64
64
  const checkMultipleRemotionVersions = () => {
65
65
  if (typeof globalThis === 'undefined') {
@@ -1878,6 +1878,14 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
1878
1878
  const { fps } = useVideoConfig();
1879
1879
  const mediaStartsAt = useMediaStartsAt();
1880
1880
  const playbackRate = localPlaybackRate * globalPlaybackRate;
1881
+ // For short audio, a lower acceptable time shift is used
1882
+ const acceptableTimeShiftButLessThanDuration = (() => {
1883
+ var _a;
1884
+ if ((_a = mediaRef.current) === null || _a === void 0 ? void 0 : _a.duration) {
1885
+ return Math.min(mediaRef.current.duration, acceptableTimeshift !== null && acceptableTimeshift !== void 0 ? acceptableTimeshift : DEFAULT_ACCEPTABLE_TIMESHIFT);
1886
+ }
1887
+ return acceptableTimeshift;
1888
+ })();
1881
1889
  useEffect(() => {
1882
1890
  var _a;
1883
1891
  if (!playing) {
@@ -1904,13 +1912,25 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
1904
1912
  startFrom: -mediaStartsAt,
1905
1913
  mediaType,
1906
1914
  });
1915
+ console.log({
1916
+ desiredUnclampedTime,
1917
+ cur: mediaRef.current.currentTime,
1918
+ paused: mediaRef.current.paused,
1919
+ ended: mediaRef.current.ended,
1920
+ loadedStart: mediaRef.current.seekable.length > 0
1921
+ ? mediaRef.current.seekable.start(0)
1922
+ : null,
1923
+ loadedEnd: mediaRef.current.seekable.length > 0
1924
+ ? mediaRef.current.seekable.end(0)
1925
+ : null,
1926
+ });
1907
1927
  const { duration } = mediaRef.current;
1908
1928
  const shouldBeTime = !Number.isNaN(duration) && Number.isFinite(duration)
1909
1929
  ? Math.min(duration, desiredUnclampedTime)
1910
1930
  : desiredUnclampedTime;
1911
1931
  const isTime = mediaRef.current.currentTime;
1912
1932
  const timeShift = Math.abs(shouldBeTime - isTime);
1913
- if (timeShift > acceptableTimeshift) {
1933
+ if (timeShift > acceptableTimeShiftButLessThanDuration) {
1914
1934
  // If scrubbing around, adjust timing
1915
1935
  // or if time shift is bigger than 0.45sec
1916
1936
  seek(mediaRef, shouldBeTime);
@@ -1949,6 +1969,7 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
1949
1969
  localPlaybackRate,
1950
1970
  onlyWarnForMediaSeekingError,
1951
1971
  acceptableTimeshift,
1972
+ acceptableTimeShiftButLessThanDuration,
1952
1973
  ]);
1953
1974
  };
1954
1975
 
@@ -2250,7 +2271,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
2250
2271
  const [mediaVolume] = useMediaVolumeState();
2251
2272
  const [mediaMuted] = useMediaMutedState();
2252
2273
  const volumePropFrame = useFrameForVolumeProp();
2253
- const { volume, muted, playbackRate, shouldPreMountAudioTags, src, onDuration, acceptableTimeShiftInSeconds, _remotionInternalNeedsDurationCalculation, allowAmplificationDuringRender, name, ...nativeProps } = props;
2274
+ const { volume, muted, playbackRate, shouldPreMountAudioTags, src, onDuration, acceptableTimeShiftInSeconds, _remotionInternalNeedsDurationCalculation, _remotionInternalNativeLoopPassed, allowAmplificationDuringRender, name, ...nativeProps } = props;
2254
2275
  if (!src) {
2255
2276
  throw new TypeError("No 'src' was passed to <Audio>.");
2256
2277
  }
@@ -2259,9 +2280,16 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
2259
2280
  return {
2260
2281
  muted: muted || mediaMuted,
2261
2282
  src: preloadedSrc,
2283
+ loop: _remotionInternalNativeLoopPassed,
2262
2284
  ...nativeProps,
2263
2285
  };
2264
- }, [mediaMuted, muted, nativeProps, preloadedSrc]);
2286
+ }, [
2287
+ _remotionInternalNativeLoopPassed,
2288
+ mediaMuted,
2289
+ muted,
2290
+ nativeProps,
2291
+ preloadedSrc,
2292
+ ]);
2265
2293
  const sequenceContext = useContext(SequenceContext);
2266
2294
  // Generate a string that's as unique as possible for this asset
2267
2295
  // but at the same time deterministic. We use it to combat strict mode issues.
@@ -2463,7 +2491,7 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
2463
2491
  sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom,
2464
2492
  sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames,
2465
2493
  ]);
2466
- const { volume: volumeProp, playbackRate, allowAmplificationDuringRender, onDuration, toneFrequency, _remotionInternalNeedsDurationCalculation, acceptableTimeShiftInSeconds, name, ...nativeProps } = props;
2494
+ const { volume: volumeProp, playbackRate, allowAmplificationDuringRender, onDuration, toneFrequency, _remotionInternalNeedsDurationCalculation, _remotionInternalNativeLoopPassed, acceptableTimeShiftInSeconds, name, ...nativeProps } = props;
2467
2495
  const volume = evaluateVolume({
2468
2496
  volume: volumeProp,
2469
2497
  frame: volumePropFrame,
@@ -2555,7 +2583,7 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
2555
2583
  const AudioForRendering = forwardRef(AudioForRenderingRefForwardingFunction);
2556
2584
 
2557
2585
  const AudioRefForwardingFunction = (props, ref) => {
2558
- var _a;
2586
+ var _a, _b;
2559
2587
  const audioContext = useContext(SharedAudioContext);
2560
2588
  const { startFrom, endAt, name, ...otherProps } = props;
2561
2589
  const { loop, ...propsOtherThanLoop } = props;
@@ -2588,7 +2616,7 @@ const AudioRefForwardingFunction = (props, ref) => {
2588
2616
  mediaDuration: duration,
2589
2617
  playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
2590
2618
  startFrom,
2591
- }), children: jsx(Audio, { ...propsOtherThanLoop, ref: ref }) }));
2619
+ }), children: jsx(Audio, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
2592
2620
  }
2593
2621
  if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
2594
2622
  validateStartFromProps(startFrom, endAt);
@@ -2600,7 +2628,7 @@ const AudioRefForwardingFunction = (props, ref) => {
2600
2628
  if (environment.isRendering) {
2601
2629
  return (jsx(AudioForRendering, { onDuration: onDuration, ...props, ref: ref, onError: onError, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
2602
2630
  }
2603
- return (jsx(AudioForDevelopment, { shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError, onDuration: onDuration, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
2631
+ return (jsx(AudioForDevelopment, { _remotionInternalNativeLoopPassed: (_b = props._remotionInternalNativeLoopPassed) !== null && _b !== void 0 ? _b : false, shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError, onDuration: onDuration, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
2604
2632
  };
2605
2633
  /**
2606
2634
  * @description With this component, you can add audio to your video. All audio formats which are supported by Chromium are supported by the component.
@@ -4486,7 +4514,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
4486
4514
  const parentSequence = useContext(SequenceContext);
4487
4515
  const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, onDuration,
4488
4516
  // @ts-expect-error
4489
- acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, name, ...nativeProps } = props;
4517
+ acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, name, _remotionInternalNativeLoopPassed, ...nativeProps } = props;
4490
4518
  if (typeof acceptableTimeShift !== 'undefined') {
4491
4519
  throw new Error('acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.');
4492
4520
  }
@@ -4594,7 +4622,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
4594
4622
  current.preload = 'auto';
4595
4623
  }
4596
4624
  }, []);
4597
- return (jsx("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, ...nativeProps }));
4625
+ return (jsx("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, loop: _remotionInternalNativeLoopPassed, ...nativeProps }));
4598
4626
  };
4599
4627
  // Copy types from forwardRef but not necessary to remove ref
4600
4628
  const VideoForDevelopment = forwardRef(VideoForDevelopmentRefForwardingFunction);
@@ -4626,10 +4654,10 @@ const OffthreadVideo = (props) => {
4626
4654
  return jsx(OffthreadVideoForRendering, { ...otherProps });
4627
4655
  }
4628
4656
  const { transparent, ...withoutTransparent } = otherProps;
4629
- return (jsx(VideoForDevelopment, { onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...withoutTransparent }));
4657
+ return (jsx(VideoForDevelopment, { _remotionInternalNativeLoopPassed: false, onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...withoutTransparent }));
4630
4658
  };
4631
4659
 
4632
- const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAmplificationDuringRender, playbackRate, onDuration, toneFrequency, name, ...props }, ref) => {
4660
+ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAmplificationDuringRender, playbackRate, onDuration, toneFrequency, name, acceptableTimeShiftInSeconds, ...props }, ref) => {
4633
4661
  const absoluteFrame = useTimelinePosition();
4634
4662
  const frame = useCurrentFrame();
4635
4663
  const volumePropsFrame = useFrameForVolumeProp();
@@ -4823,7 +4851,7 @@ const VideoForRendering = forwardRef(VideoForRenderingForwardFunction);
4823
4851
 
4824
4852
  const VideoForwardingFunction = (props, ref) => {
4825
4853
  var _a;
4826
- const { startFrom, endAt, name, ...otherProps } = props;
4854
+ const { startFrom, endAt, name, _remotionInternalNativeLoopPassed, ...otherProps } = props;
4827
4855
  const { loop, ...propsOtherThanLoop } = props;
4828
4856
  const { fps } = useVideoConfig();
4829
4857
  const environment = getRemotionEnvironment();
@@ -4845,7 +4873,7 @@ const VideoForwardingFunction = (props, ref) => {
4845
4873
  mediaDuration,
4846
4874
  playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
4847
4875
  startFrom,
4848
- }), layout: "none", name: name, children: jsx(Video, { ...propsOtherThanLoop, ref: ref }) }));
4876
+ }), layout: "none", name: name, children: jsx(Video, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
4849
4877
  }
4850
4878
  if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
4851
4879
  validateStartFromProps(startFrom, endAt);
@@ -4857,7 +4885,7 @@ const VideoForwardingFunction = (props, ref) => {
4857
4885
  if (environment.isRendering) {
4858
4886
  return (jsx(VideoForRendering, { onDuration: onDuration, ...otherProps, ref: ref }));
4859
4887
  }
4860
- return (jsx(VideoForDevelopment, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref, onDuration: onDuration }));
4888
+ return (jsx(VideoForDevelopment, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref, onDuration: onDuration, _remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed !== null && _remotionInternalNativeLoopPassed !== void 0 ? _remotionInternalNativeLoopPassed : false }));
4861
4889
  };
4862
4890
  const forward = forwardRef;
4863
4891
  /**
@@ -1,4 +1,4 @@
1
1
  // Automatically generated on publish
2
- const VERSION = '4.0.72';
2
+ const VERSION = '4.0.74';
3
3
 
4
4
  export { VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "4.0.72",
3
+ "version": "4.0.74",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",