Skip to content

🎥 Make videos programmatically with React

_remotionInternalNativeLoopPassed

Jonny Burger1f3d20fc442e
diff --git a/packages/core/src/audio/Audio.tsx b/packages/core/src/audio/Audio.tsx
index 717e828a89..0e13a6d595 100644
--- a/packages/core/src/audio/Audio.tsx
+++ b/packages/core/src/audio/Audio.tsx
@@ -122,7 +122,9 @@ const AudioRefForwardingFunction: React.ForwardRefRenderFunction<
return (
<AudioForDevelopment
- nativeLoopPassed={props._remotionInternalNativeLoopPassed ?? false}
+ _remotionInternalNativeLoopPassed={
+ props._remotionInternalNativeLoopPassed ?? false
+ }
shouldPreMountAudioTags={
audioContext !== null && audioContext.numberOfAudioTags > 0
}
diff --git a/packages/core/src/audio/AudioForDevelopment.tsx b/packages/core/src/audio/AudioForDevelopment.tsx
index dd79429e30..ed9f984291 100644
--- a/packages/core/src/audio/AudioForDevelopment.tsx
+++ b/packages/core/src/audio/AudioForDevelopment.tsx
@@ -29,7 +29,7 @@ import {useFrameForVolumeProp} from './use-audio-frame.js';
type AudioForDevelopmentProps = RemotionAudioProps & {
shouldPreMountAudioTags: boolean;
onDuration: (src: string, durationInSeconds: number) => void;
- nativeLoopPassed: boolean;
+ _remotionInternalNativeLoopPassed: boolean;
};
const AudioForDevelopmentForwardRefFunction: React.ForwardRefRenderFunction<
@@ -62,7 +62,6 @@ const AudioForDevelopmentForwardRefFunction: React.ForwardRefRenderFunction<
_remotionInternalNativeLoopPassed,
allowAmplificationDuringRender,
name,
- nativeLoopPassed,
...nativeProps
} = props;
@@ -76,10 +75,16 @@ const AudioForDevelopmentForwardRefFunction: React.ForwardRefRenderFunction<
return {
muted: muted || mediaMuted,
src: preloadedSrc,
- loop: nativeLoopPassed,
+ loop: _remotionInternalNativeLoopPassed,
...nativeProps,
};
- }, [mediaMuted, muted, nativeLoopPassed, nativeProps, preloadedSrc]);
+ }, [
+ _remotionInternalNativeLoopPassed,
+ mediaMuted,
+ muted,
+ nativeProps,
+ preloadedSrc,
+ ]);
const sequenceContext = useContext(SequenceContext);
diff --git a/packages/core/src/use-media-playback.ts b/packages/core/src/use-media-playback.ts
index f326d53a9a..83a1342e04 100644
--- a/packages/core/src/use-media-playback.ts
+++ b/packages/core/src/use-media-playback.ts
@@ -56,6 +56,7 @@ export const useMediaPlayback = ({
const playbackRate = localPlaybackRate * globalPlaybackRate;
+ // For short audio, a lower acceptable time shift is used
const acceptableTimeShiftButLessThanDuration = (() => {
if (mediaRef.current?.duration) {
return Math.min(
diff --git a/packages/core/src/video/OffthreadVideo.tsx b/packages/core/src/video/OffthreadVideo.tsx
index 1e1e6b52be..1edf5153ec 100644
--- a/packages/core/src/video/OffthreadVideo.tsx
+++ b/packages/core/src/video/OffthreadVideo.tsx
@@ -63,7 +63,7 @@ export const OffthreadVideo: React.FC<Omit<OffthreadVideoProps, 'loop'>> = (
return (
<VideoForDevelopment
- nativeLoopPassed={false}
+ _remotionInternalNativeLoopPassed={false}
onDuration={onDuration}
onlyWarnForMediaSeekingError
{...withoutTransparent}
diff --git a/packages/core/src/video/Video.tsx b/packages/core/src/video/Video.tsx
index 67d04d4518..8adb4f75cd 100644
--- a/packages/core/src/video/Video.tsx
+++ b/packages/core/src/video/Video.tsx
@@ -18,7 +18,13 @@ const VideoForwardingFunction: React.ForwardRefRenderFunction<
HTMLVideoElement,
RemotionVideoProps & RemotionMainVideoProps
> = (props, ref) => {
- const {startFrom, endAt, name, ...otherProps} = props;
+ const {
+ startFrom,
+ endAt,
+ name,
+ _remotionInternalNativeLoopPassed,
+ ...otherProps
+ } = props;
const {loop, ...propsOtherThanLoop} = props;
const {fps} = useVideoConfig();
const environment = getRemotionEnvironment();
@@ -101,7 +107,9 @@ const VideoForwardingFunction: React.ForwardRefRenderFunction<
{...otherProps}
ref={ref}
onDuration={onDuration}
- nativeLoopPassed={props._remotionInternalNativeLoopPassed ?? false}
+ _remotionInternalNativeLoopPassed={
+ _remotionInternalNativeLoopPassed ?? false
+ }
/>
);
};
diff --git a/packages/core/src/video/VideoForDevelopment.tsx b/packages/core/src/video/VideoForDevelopment.tsx
index a4ab05d29a..28eff2bbbf 100644
--- a/packages/core/src/video/VideoForDevelopment.tsx
+++ b/packages/core/src/video/VideoForDevelopment.tsx
@@ -27,7 +27,7 @@ import {isIosSafari, useAppendVideoFragment} from './video-fragment.js';
type VideoForDevelopmentProps = RemotionVideoProps & {
onlyWarnForMediaSeekingError: boolean;
onDuration: (src: string, durationInSeconds: number) => void;
- nativeLoopPassed: boolean;
+ _remotionInternalNativeLoopPassed: boolean;
};
const VideoForDevelopmentRefForwardingFunction: React.ForwardRefRenderFunction<
@@ -52,7 +52,8 @@ const VideoForDevelopmentRefForwardingFunction: React.ForwardRefRenderFunction<
acceptableTimeShiftInSeconds,
toneFrequency,
name,
- nativeLoopPassed,
+ _remotionInternalNativeLoopPassed,
+
...nativeProps
} = props;
if (typeof acceptableTimeShift !== 'undefined') {
@@ -196,7 +197,7 @@ const VideoForDevelopmentRefForwardingFunction: React.ForwardRefRenderFunction<
muted={muted || mediaMuted}
playsInline
src={actualSrc}
- loop={nativeLoopPassed}
+ loop={_remotionInternalNativeLoopPassed}
{...nativeProps}
/>
);