Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arthurdenner/679d773c30443d62031ae385517e84dc to your computer and use it in GitHub Desktop.
Save arthurdenner/679d773c30443d62031ae385517e84dc to your computer and use it in GitHub Desktop.
Remotion - Video duration bug
// Place the code below in the file below to reproduce it:
// https://github.com/remotion-dev/remotion/blob/main/packages/example/src/RemoteVideo/index.tsx
import {useRef} from 'react';
import {interpolate, useCurrentFrame, Video} from 'remotion';
const RemoteVideo: React.FC = () => {
const frame = useCurrentFrame();
const ref = useRef<HTMLVideoElement>(null);
return (
<Video
ref={ref}
volume={interpolate(frame, [0, 500], [1, 0], {extrapolateRight: 'clamp'})}
crossOrigin="anonymous"
src="https://iandevlin.github.io/mdn/video-player-with-captions/video/sintel-short.mp4"
startFrom={600}
/>
);
};
// Place the code below in the file below to reproduce it:
// https://github.com/remotion-dev/remotion/blob/main/packages/example/src/Video.tsx
import React from 'react';
import {Composition} from 'remotion';
import RemoteVideo from './RemoteVideo';
export const Index: React.FC = () => {
return (
<Composition
id="remote-video"
component={RemoteVideo}
width={1280}
height={720}
fps={30}
durationInFrames={600}
/>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment