Skip to content

🎥 Make videos programmatically with React

return car slideshow

Jonny Burgerb92037d7e26d
diff --git a/packages/player-example/src/CarSlideshow.tsx b/packages/player-example/src/CarSlideshow.tsx
index a9ed64869a..cd4783d8e9 100644
--- a/packages/player-example/src/CarSlideshow.tsx
+++ b/packages/player-example/src/CarSlideshow.tsx
@@ -8,7 +8,6 @@ import {
staticFile,
Sequence,
Experimental,
- AbsoluteFill,
} from 'remotion';
type Props = {
@@ -21,10 +20,10 @@ export const playerExampleComp = createRef<{
triggerError: () => void;
}>();
-const show = true;
-
const CarSlideshow = ({title, bgColor, color}: Props) => {
+ const frame = useCurrentFrame();
const {width, height, durationInFrames} = useVideoConfig();
+ const left = interpolate(frame, [0, durationInFrames], [width, width * -1]);
const [shouldThrowError, setThrowError] = useState(false);
@@ -58,23 +57,35 @@ const CarSlideshow = ({title, bgColor, color}: Props) => {
top: 0,
}}
>
- <AbsoluteFill
+ <Experimental.Clipper height={100} width={100} x={0} y={0} />
+ <h1
style={{
- width: '50%',
+ fontSize: '5em',
+ fontWeight: 'bold',
+ position: 'absolute',
+ top: height / 2 - 100,
+ left,
+ color,
+ whiteSpace: 'nowrap',
}}
>
- <Video src="https://media.repliq.co/images/5PfG7Oj6LgaWgYiPCT6kiOxXMwa2/69012e32/69012e32_myScreen.mp4" />
- </AbsoluteFill>
- {show ? (
- <AbsoluteFill
+ {title} {dummyText()}
+ </h1>
+ <Img
+ src={staticFile('/logo.png')}
+ style={{
+ height: 40,
+ width: 40,
+ }}
+ />
+ <Sequence from={10}>
+ <Video
style={{
- left: '50%',
- width: '50%',
+ height: 200,
}}
- >
- <Video src="https://app.repliq.co/videos/videoExample1_20.mp4" />
- </AbsoluteFill>
- ) : null}
+ src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
+ />
+ </Sequence>
</div>
);
};