🎥 Make videos programmatically with React
Showcase section on homepage
MehmetAdemif99226a4899b
diff --git a/packages/docs/components/LandingPage/CommunityStatItems.tsx b/packages/docs/components/LandingPage/CommunityStatItems.tsxindex ab0f4493a0..12e662b17a 100644--- a/packages/docs/components/LandingPage/CommunityStatItems.tsx+++ b/packages/docs/components/LandingPage/CommunityStatItems.tsx@@ -51,7 +51,7 @@ export const InstallsPerMonth: React.FC = () => {}}><StatItemContent- content="100k"+ content="200k"width="100px"fontSize="2.5rem"fontWeight="bold"diff --git a/packages/docs/components/LandingPage/VideoAppsShowcase.module.css b/packages/docs/components/LandingPage/VideoAppsShowcase.module.cssnew file mode 100644index 0000000000..c9adf21f2e--- /dev/null+++ b/packages/docs/components/LandingPage/VideoAppsShowcase.module.css@@ -0,0 +1,144 @@+.container {+ max-width: 1200px;+ margin: 0 auto;+ padding: 2rem;+}++.tabs {+ display: flex;+ justify-content: center;+ margin-bottom: 1rem;+}++.tab {+ background: none;+ border: none;+ padding: 0.2rem 0.5rem;+ margin: 0.2rem 0.6rem;+ cursor: pointer;+ font-size: 1.2rem;+ font-weight: bold;+ transition: color 0.3s ease;+ color: #888; /* Light gray for inactive tabs */+}++.activeTab {+ color: #007bff;+ border-bottom: 2px solid #007bff;+}++.content {+ display: flex;+ align-items: stretch;+ border: 5px solid var(--text-color); /* Add black border */+ border-radius: 16px; /* Rounded corners */+ overflow: hidden; /* Ensure content doesn't overflow rounded corners */+ padding: 16px; /* Add padding inside the border */+}++.videoWrapper {+ flex: 1;+ display: flex;+ justify-content: center;+ align-items: center;+}++.videoContainer {+ width: 100%;+ max-width: 500px; /* Adjust this value as needed */+ aspect-ratio: 1 / 1;+ position: relative;+ border-radius: 8px; /* Add rounded corners to the video container */+ overflow: hidden; /* Ensure video doesn't overflow rounded corners */+ background-color: rgba(104, 104, 104, 0.171);+}++.video {+ position: absolute;+ top: 50%;+ left: 50%;+ transform: translate(-50%, -50%);++ height: 100%;++ border-radius: 8px;+}++.playButton {+ position: absolute;+ top: 50%;+ left: 50%;+ transform: translate(-50%, -50%);+ background: rgba(84, 84, 84, 0.816);+ color: white;+ border-radius: 50%;+ width: 60px;+ height: 60px;+ display: flex;+ justify-content: center;+ align-items: center;+ font-size: 30px;+ cursor: pointer;+ transition: background-color 0.1s ease;+}++.playButton:hover {+ background: rgba(11, 131, 243, 0.8);+}++.textContent {+ flex: 1;+ padding-left: 16px; /* Add some space between video and text */+ padding: 2rem;+ display: flex;+ flex-direction: column;+ justify-content: center;+}++.textContent h1 {+ font-size: 2.5rem;+ margin-bottom: 1rem;+ font-weight: bold;+}++.textContent p {+ margin-bottom: 1rem;+ font-size: 1.2rem;+}++.visitLink {+ display: inline-block;+ margin-top: 1rem;+ padding: 0.5rem 1rem;+ background-color: #007bff;+ color: white;+ text-decoration: none;+ border-radius: 4px;+}++@media (max-width: 900px) {+ .content {+ flex-direction: column;+ padding: 12px; /* Slightly less padding on mobile */+ }++ .textContent {+ padding-left: 0;+ padding-top: 16px; /* Add space between video and text on mobile */+ }+}++.titleContainer {+ text-align: center;+ margin-bottom: 2rem;+}++.title {+ font-size: 2.5rem;+ font-weight: bold;+ line-height: 1.2;+}++.highlight {+ color: #007bff; /* or any color you prefer for "video apps" */+}diff --git a/packages/docs/components/LandingPage/VideoAppsShowcase.tsx b/packages/docs/components/LandingPage/VideoAppsShowcase.tsxnew file mode 100644index 0000000000..dde8f06935--- /dev/null+++ b/packages/docs/components/LandingPage/VideoAppsShowcase.tsx@@ -0,0 +1,168 @@+import React, {useEffect, useRef, useState} from 'react';++import {MuxVideo} from '../../src/components/MuxVideo';+import {BlueButton} from '../layout/Button';+import styles from './VideoAppsShowcase.module.css';++const tabs = [+ 'Captions',+ 'Screencast',+ 'Music visualization',+ 'Year in review',+];++const videoApps = [+ {+ title: 'Submagic',+ description:+ 'A video editor for creating short-form content fast. Designed for creators, teams and agencies.',+ additionalInfo:+ 'Accelerates video editing with AI-powered features such as descriptions, zooms, sound effects and music.',+ link: 'https://www.submagic.co/?ref=remotion',+ videoWidth: 540,+ videoHeight: 1080,+ muxId: 'pxqGEjlBBntnXrEe4v00pYUBw3FPgUPKumfhSym00Vs004',+ thumbnailSrc: '/img/homepage-showcase/submagic-thumbnail.png',+ buttonText: 'Submagic website',+ },+ {+ title: 'Remotion Recorder',+ description:+ 'The Remotion Recorder is a video production tool built entirely in JavaScript. Create high-quality videos that feel native on each platform while only editing them once.',+ additionalInfo: 'Various templates optimized for sharing on social media.',+ link: 'https://www.remotion.pro/recorder',+ videoWidth: 1080,+ videoHeight: 1080,+ muxId: 'pHlwqDZFUH00Aubo9M001ty3gZ6YW8z689XTd9R479ayE',+ thumbnailSrc: '/img/homepage-showcase/remotion-recorder-thumbnail.png',+ buttonText: 'More infos',+ },+ {+ title: 'Banger.Show',+ description:+ 'The all-in-one 3D visual creation tool for ambitious artists. Seamlessly craft visuals that match your sound and propel your brand forward.',+ link: 'https://banger.show?ref=remotion',+ videoWidth: 1080,+ videoHeight: 1080,+ muxId: 'riYdneJ2zu1Vqiayoe1qAZXcSIRq0201tHgSBbh9JbtlU',+ thumbnailSrc: '/img/homepage-showcase/banger-show-thumbnail.png',+ buttonText: 'Banger.Show website',+ },+ {+ title: 'GitHub Unwrapped',+ description:+ 'Your coding year in review. Get a personalized video of your GitHub activity.',+ additionalInfo:+ 'Uncover your go-to language, peak productivity hours, and track your GitHub impact – all in one video.',+ link: 'https://githubunwrapped.com/',+ videoWidth: 1080,+ videoHeight: 1080,+ muxId: 'OwQFvqomOR00q6yj5SWwaA7DBg01NaCPKcOvczoZqCty00',+ thumbnailSrc: '/img/homepage-showcase/GHU-thumbnail.png',+ buttonText: 'GitHub Unwrapped website',+ },+];++const AUDIO_VOLUME = 0.05; // Adjust this value between 0 and 1 as needed++const VideoAppsShowcase: React.FC = () => {+ const [activeTab, setActiveTab] = useState(0);+ const [isPlaying, setIsPlaying] = useState(false);+ const videoRef = useRef<HTMLVideoElement>(null);++ useEffect(() => {+ // Generate a random index when the component mounts+ const randomIndex = Math.floor(Math.random() * tabs.length);+ setActiveTab(randomIndex);+ }, []); // Empty dependency array ensures this runs only once on mount++ const handlePlayPause = () => {+ if (videoRef.current) {+ if (videoRef.current.paused) {+ videoRef.current.volume = AUDIO_VOLUME;+ videoRef.current.play();+ setIsPlaying(true);+ } else {+ videoRef.current.pause();+ setIsPlaying(false);+ }+ }+ };++ return (+ <div className={styles.container}>+ <div className={styles.titleContainer}>+ <h2 className={styles.title}>+ Create not just videos.+ <br />+ Create <span className={styles.highlight}>video apps.</span>+ </h2>+ </div>+ <div className={styles.tabs}>+ {tabs.map((tab, index) => (+ <button+ key={tab}+ type="button"+ className={`${styles.tab} ${index === activeTab ? styles.activeTab : ''}`}+ onClick={() => setActiveTab(index)}+ >+ {tab}+ </button>+ ))}+ </div>+ <div className={styles.content}>+ <div className={styles.videoWrapper}>+ <div className={styles.videoContainer} onClick={handlePlayPause}>+ <MuxVideo+ ref={videoRef}+ muxId={videoApps[activeTab].muxId}+ style={{+ aspectRatio: `${videoApps[activeTab].videoWidth} / ${videoApps[activeTab].videoHeight}`,+ }}+ className={styles.video}+ poster={videoApps[activeTab].thumbnailSrc}+ loop+ playsInline+ />+ {!isPlaying && (+ <div className={styles.playButton}>+ <span>▶</span>+ </div>+ )}+ </div>+ </div>+ <div className={styles.textContent}>+ <h1>{videoApps[activeTab].title}</h1>+ <p>{videoApps[activeTab].description}</p>+ <p>{videoApps[activeTab].additionalInfo}</p>+ <a+ target="_blank"+ href={videoApps[activeTab].link}+ style={{textDecoration: 'none'}}+ >+ <BlueButton loading={false} fullWidth={false} size="sm">+ {videoApps[activeTab].buttonText}+ </BlueButton>+ </a>+ </div>+ </div>+ <div+ style={{+ marginTop: '1rem',+ justifyContent: 'center',+ display: 'flex',+ }}+ >+ <div+ style={{+ fontFamily: 'GTPlanar',+ }}+ >+ For more examples see our <a href="../showcase">showcase page</a>.+ </div>+ </div>+ </div>+ );+};++export default VideoAppsShowcase;diff --git a/packages/docs/src/data/showcase-videos.tsx b/packages/docs/src/data/showcase-videos.tsxindex 7958cd9eca..f0f578563f 100644--- a/packages/docs/src/data/showcase-videos.tsx+++ b/packages/docs/src/data/showcase-videos.tsx@@ -369,6 +369,27 @@ export const showcaseVideos: ShowcaseVideo[] = [},],},+ {+ title: 'AnySticker In App Assets',+ type: 'mux_video',+ time: '29.5',+ muxId: 'HL4G1x01aX8lizSXFGuQG8do6LLKcI1mup6WjIz6OEFE',+ description:+ 'This video will welcome users in the newest version of AnySticker.',+ height: 1920,+ width: 1080,+ submittedOn: new Date('25-03-2021'),+ links: [+ {+ type: 'source_code',+ url: 'https://github.com/JonnyBurger/anysticker-tutorials',+ },+ ],+ author: {+ name: 'Jonny Burger',+ url: 'https://twitter.com/JNYBGR',+ },+ },/*{diff --git a/packages/docs/src/pages/index.tsx b/packages/docs/src/pages/index.tsxindex 2eeea419f7..710f586403 100644--- a/packages/docs/src/pages/index.tsx+++ b/packages/docs/src/pages/index.tsx@@ -12,6 +12,7 @@ import EvaluateRemotionSection from '../../components/LandingPage/EvaluateRemotiimport {NewsletterButton} from '../../components/LandingPage/NewsletterButton';import {Pricing} from '../../components/LandingPage/Pricing';import TrustedByBanner from '../../components/LandingPage/TrustedByBanner';+import VideoAppsShowcase from '../../components/LandingPage/VideoAppsShowcase';import {WriteInReact} from '../../components/LandingPage/WriteInReact';import {LightningFastEditor} from '../../components/LandingPage/editor';import {IfYouKnowReact} from '../../components/LandingPage/if-you-know-react';@@ -61,7 +62,8 @@ const NewLanding: React.FC = () => {<VideoAppsTitle /><VideoApps active="remotion" /><br />- <br />+ <VideoAppsShowcase />+<CommunityStats /><br /><br />diff --git a/packages/docs/static/img/homepage-showcase/GHU-thumbnail.png b/packages/docs/static/img/homepage-showcase/GHU-thumbnail.pngnew file mode 100644index 0000000000..5e93e3b156Binary files /dev/null and b/packages/docs/static/img/homepage-showcase/GHU-thumbnail.png differdiff --git a/packages/docs/static/img/homepage-showcase/banger-show-thumbnail.png b/packages/docs/static/img/homepage-showcase/banger-show-thumbnail.pngnew file mode 100644index 0000000000..9be2029069Binary files /dev/null and b/packages/docs/static/img/homepage-showcase/banger-show-thumbnail.png differdiff --git a/packages/docs/static/img/homepage-showcase/remotion-recorder-thumbnail.png b/packages/docs/static/img/homepage-showcase/remotion-recorder-thumbnail.pngnew file mode 100644index 0000000000..278f169e56Binary files /dev/null and b/packages/docs/static/img/homepage-showcase/remotion-recorder-thumbnail.png differdiff --git a/packages/docs/static/img/homepage-showcase/submagic-thumbnail.png b/packages/docs/static/img/homepage-showcase/submagic-thumbnail.pngnew file mode 100644index 0000000000..f40f68b783Binary files /dev/null and b/packages/docs/static/img/homepage-showcase/submagic-thumbnail.png differ