Skip to content

🎥 Make videos programmatically with React

Add `playsInline` to all videos in the docs

Jonny Burgerc75bed18e5f8
diff --git a/packages/docs/components/OverlayDemo.tsx b/packages/docs/components/OverlayDemo.tsx
index 0576ca5c52..939f270be2 100644
--- a/packages/docs/components/OverlayDemo.tsx
+++ b/packages/docs/components/OverlayDemo.tsx
@@ -1,63 +1,64 @@
-import React, { useCallback, useRef } from "react";
-import "./transparent-video.css";
+import React, {useCallback, useRef} from 'react';
+import './transparent-video.css';
export const OverlayDemo: React.FC = () => {
- const ref = useRef<HTMLVideoElement>(null);
- const onClick = useCallback(() => {
- ref.current?.classList.toggle("transparent");
- }, []);
- return (
- <div>
- <div
- style={{
- alignItems: "flex-start",
- flexDirection: "row",
- display: "flex",
- }}
- >
- <div
- style={{
- display: "flex",
- width: "70%",
- flexDirection: "column",
- }}
- >
- <div
- style={{
- display: "flex",
- flexDirection: "column",
- border: "1px solid var(--ifm-color-emphasis-300)",
- borderRadius: "var(--ifm-pre-border-radius)",
- overflow: "hidden",
- }}
- >
- <video
- ref={ref}
- className="transparent"
- src="/img/overlay.webm"
- autoPlay
- loop
- muted
- />
- </div>
- <div style={{ marginTop: "8px" }} />
- <p className="tr-centered" onClick={onClick}>
- <button type="button">Toggle transparency</button>
- </p>
- </div>
+ const ref = useRef<HTMLVideoElement>(null);
+ const onClick = useCallback(() => {
+ ref.current?.classList.toggle('transparent');
+ }, []);
+ return (
+ <div>
+ <div
+ style={{
+ alignItems: 'flex-start',
+ flexDirection: 'row',
+ display: 'flex',
+ }}
+ >
+ <div
+ style={{
+ display: 'flex',
+ width: '70%',
+ flexDirection: 'column',
+ }}
+ >
+ <div
+ style={{
+ display: 'flex',
+ flexDirection: 'column',
+ border: '1px solid var(--ifm-color-emphasis-300)',
+ borderRadius: 'var(--ifm-pre-border-radius)',
+ overflow: 'hidden',
+ }}
+ >
+ <video
+ ref={ref}
+ className="transparent"
+ src="/img/overlay.webm"
+ autoPlay
+ loop
+ playsInline
+ muted
+ />
+ </div>
+ <div style={{marginTop: '8px'}} />
+ <p className="tr-centered" onClick={onClick}>
+ <button type="button">Toggle transparency</button>
+ </p>
+ </div>
- <p style={{ marginLeft: "10px" }}>
- {" "}
- Use our template by cloning the{" "}
- <a
- href="https://github.com/remotion-dev/template-overlay"
- target="_blank"
- >
- GitHub repo
- </a>{" "}
- or running <code>npx create-video --overlay</code>.
- </p>
- </div>
- </div>
- );
+ <p style={{marginLeft: '10px'}}>
+ {' '}
+ Use our template by cloning the{' '}
+ <a
+ href="https://github.com/remotion-dev/template-overlay"
+ target="_blank"
+ >
+ GitHub repo
+ </a>{' '}
+ or running <code>npx create-video --overlay</code>.
+ </p>
+ </div>
+ </div>
+ );
};
diff --git a/packages/docs/components/OverlayInDavinci.tsx b/packages/docs/components/OverlayInDavinci.tsx
index 777b0431ea..56b930d014 100644
--- a/packages/docs/components/OverlayInDavinci.tsx
+++ b/packages/docs/components/OverlayInDavinci.tsx
@@ -12,6 +12,7 @@ export const OverlayInDavinci: React.FC = () => {
controls
autoPlay
loop
+ playsInline
/>
</div>
);
diff --git a/packages/docs/components/SpringsWithDurationDemo.tsx b/packages/docs/components/SpringsWithDurationDemo.tsx
index 0bd6270d06..8f534eda36 100644
--- a/packages/docs/components/SpringsWithDurationDemo.tsx
+++ b/packages/docs/components/SpringsWithDurationDemo.tsx
@@ -1,18 +1,19 @@
-import { useColorMode } from "@docusaurus/theme-common";
-import React from "react";
+import {useColorMode} from '@docusaurus/theme-common';
+import React from 'react';
export const SpringsWithDurationDemo: React.FC = () => {
- const { colorMode } = useColorMode();
- return (
- <video
- src={
- colorMode === "dark"
- ? "/img/springs-dark.mp4"
- : "/img/springs-light.mp4"
- }
- loop
- muted
- autoPlay
- />
- );
+ const {colorMode} = useColorMode();
+ return (
+ <video
+ src={
+ colorMode === 'dark'
+ ? '/img/springs-dark.mp4'
+ : '/img/springs-light.mp4'
+ }
+ loop
+ muted
+ autoPlay
+ playsInline
+ />
+ );
};
diff --git a/packages/docs/components/TransparentVideoDemo.tsx b/packages/docs/components/TransparentVideoDemo.tsx
index 2f40610a52..292dc3c673 100644
--- a/packages/docs/components/TransparentVideoDemo.tsx
+++ b/packages/docs/components/TransparentVideoDemo.tsx
@@ -1,23 +1,24 @@
-import React, { useCallback, useRef } from "react";
-import "./transparent-video.css";
+import React, {useCallback, useRef} from 'react';
+import './transparent-video.css';
export const TransparentVideoDemo: React.FC = () => {
- const ref = useRef<HTMLVideoElement>(null);
- const onClick = useCallback(() => {
- ref.current?.classList.toggle("transparent");
- }, []);
- return (
- <div>
- <video
- ref={ref}
- src="/img/transparent-video.webm"
- controls
- autoPlay
- loop
- />
- <p className="tr-centered" onClick={onClick}>
- <button type="button">Toggle transparency</button>
- </p>
- </div>
- );
+ const ref = useRef<HTMLVideoElement>(null);
+ const onClick = useCallback(() => {
+ ref.current?.classList.toggle('transparent');
+ }, []);
+ return (
+ <div>
+ <video
+ ref={ref}
+ src="/img/transparent-video.webm"
+ controls
+ autoPlay
+ loop
+ playsInline
+ />
+ <p className="tr-centered" onClick={onClick}>
+ <button type="button">Toggle transparency</button>
+ </p>
+ </div>
+ );
};
diff --git a/packages/docs/docs/recorder/editing/scenes.mdx b/packages/docs/docs/recorder/editing/scenes.mdx
index e9caeab02a..0260893996 100644
--- a/packages/docs/docs/recorder/editing/scenes.mdx
+++ b/packages/docs/docs/recorder/editing/scenes.mdx
@@ -20,6 +20,7 @@ To add a new scene, click on `+` in the right sidebar.
muted
controls
loop
+ playsInline
/>
</div>
@@ -32,16 +33,16 @@ There are multiple type of scenes you can choose from:
<div
style={{
- display: "flex",
- flexDirection: "row",
- justifyContent: "space-around",
+ display: 'flex',
+ flexDirection: 'row',
+ justifyContent: 'space-around',
}}
>
<div
style={{
- display: "flex",
- flexDirection: "column",
- alignItems: "center",
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
gap: 6,
}}
>
@@ -50,9 +51,9 @@ There are multiple type of scenes you can choose from:
</div>
<div
style={{
- display: "flex",
- flexDirection: "column",
- alignItems: "center",
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
gap: 6,
}}
>
@@ -61,9 +62,9 @@ There are multiple type of scenes you can choose from:
</div>
<div
style={{
- display: "flex",
- flexDirection: "column",
- alignItems: "center",
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
gap: 6,
}}
>
diff --git a/packages/docs/docs/recorder/index.mdx b/packages/docs/docs/recorder/index.mdx
index 711e6d659a..e4e7ef40cf 100644
--- a/packages/docs/docs/recorder/index.mdx
+++ b/packages/docs/docs/recorder/index.mdx
@@ -8,14 +8,8 @@ hide_title: true
<p align="center">
<picture>
- <source
- media="(prefers-color-scheme: dark)"
- srcset="/recorder/recorder-logo-dark.gif"
- />
- <img
- alt="Animated Remotion Recorder Logo"
- src="/recorder/recorder-logo-light.gif"
- />
+ <source media="(prefers-color-scheme: dark)" srcset="/recorder/recorder-logo-dark.gif" />
+ <img alt="Animated Remotion Recorder Logo" src="/recorder/recorder-logo-light.gif" />
</picture>
</p>
@@ -163,7 +157,7 @@ AI will make mistakes - so we make it easy to correct them.
<table style={{ tableLayout: "fixed", width: 950}}>
<tr style={{borderTop: 0}}>
<td valign="top" style={{width: 950/ 3}}>
- <video style={{height: 300}} src="/recorder/subseditor.webm" autoPlay muted playsInline loop></video>
+ <video style={{height: 300}} src="/recorder/subseditor.webm" autoPlay muted playsInline loop></video>
Fix captions quickly by clicking on a word
</td>
<td valign="top" style={{width: 950/ 3}}>