🎥 Make videos programmatically with React
NewMuxVideo
Jonny Burger4604c3190ace
diff --git a/packages/docs/blog/2022-11-17-remotion-3-3.md b/packages/docs/blog/2022-11-17-remotion-3-3.mdindex 46203f8c80..c719d22634 100644--- a/packages/docs/blog/2022-11-17-remotion-3-3.md+++ b/packages/docs/blog/2022-11-17-remotion-3-3.md@@ -10,7 +10,7 @@ image: https://remotion-still.herokuapp.com/PreviewCard.png?title=Remotion%203.3import Tabs from '@theme/Tabs';import TabItem from '@theme/TabItem';-import {MuxVideo} from '../src/components/MuxVideo';+import {NewMuxVideo} from '../src/components/MuxVideo';import {TableOfContents} from '../components/TableOfContents/paths';import {FfmpegVideo} from '../components/FFmpegVideo'@@ -35,7 +35,7 @@ This package contains two components: [`<Trail>`](/docs/motion-blur/trail) and [A quick demo of what is now called [`<Trail>`](/docs/motion-blur/trail):-<MuxVideo muxId="XPgKwILbTR4jZPxuR2ewfKjRF9cnThudkXPIkSSvQBM" style={{+<NewMuxVideo muxId="XPgKwILbTR4jZPxuR2ewfKjRF9cnThudkXPIkSSvQBM" style={{width: '100%'}} controls />@@ -45,7 +45,7 @@ This package offers easy, type-safe, pure functions for getting creative with noA video demo of how you can create interesting effects with noise:-<MuxVideo muxId="5o013raWoyw1Jv01MJo02INMEQ5scAt01PveIQ800yYkEhQk" style={{+<NewMuxVideo muxId="5o013raWoyw1Jv01MJo02INMEQ5scAt01PveIQ800yYkEhQk" style={{width: '100%'}} controls />@@ -63,7 +63,7 @@ By pressing <kbd>Cmd+K</kbd>, you can trigger a new Quick Switcher. It has three- Type `> ` followed by an item in the menu bar to trigger that action.- Type `? ` followed by a search term to query the docs.-<MuxVideo muxId="t00Mj7y1CLLGjaMvQyoBqcjdy4PIzVrFaT4317fKbzx00" style={{+<NewMuxVideo muxId="t00Mj7y1CLLGjaMvQyoBqcjdy4PIzVrFaT4317fKbzx00" style={{width: '100%'}} controls />@@ -97,7 +97,7 @@ If your device supports multitouch, you can now pinch to zoom the composition. AUsing two fingers, you can move the canvas around and pressing <kbd>0</kbd> will reset the canvas. For the latter, there is also a button in the top-right corner that you can click.-<MuxVideo muxId="5I01hwK6hs7w0200Ho1KNho7rfU700UVKYDnd7FItANR32U" style={{+<NewMuxVideo muxId="5I01hwK6hs7w0200Ho1KNho7rfU700UVKYDnd7FItANR32U" style={{width: '100%'}} controls />diff --git a/packages/docs/src/components/MuxVideo.tsx b/packages/docs/src/components/MuxVideo.tsxindex 4443018dc8..d29ea8a836 100644--- a/packages/docs/src/components/MuxVideo.tsx+++ b/packages/docs/src/components/MuxVideo.tsx@@ -1,3 +1,4 @@+import BrowserOnly from "@docusaurus/BrowserOnly";import Hls from "hls.js";import React, {forwardRef,@@ -5,6 +6,7 @@ import React, {useImperativeHandle,useRef,} from "react";+import { VideoPlayerWithControls } from "./VideoPlayerWithControls";const getVideoToPlayUrl = (muxId: string) => {return `https://stream.mux.com/${muxId}.m3u8`;@@ -52,3 +54,23 @@ const MuxVideoForward: React.ForwardRefRenderFunction<};export const MuxVideo = forwardRef(MuxVideoForward);++export const NewMuxVideo: React.FC<{+ muxId: string;+}> = ({ muxId }) => {+ return (+ <BrowserOnly>+ {() => (+ <VideoPlayerWithControls+ playbackId={muxId}+ poster={"https://image.mux.com/" + muxId + "/thumbnail.png"}+ onError={(error) => {+ console.log(error);+ }}+ onLoaded={() => undefined}+ onSize={() => undefined}+ />+ )}+ </BrowserOnly>+ );+};diff --git a/packages/docs/src/components/tutorials.tsx b/packages/docs/src/components/tutorials.tsxindex 81402e3e5e..13b2b7ad64 100644--- a/packages/docs/src/components/tutorials.tsx+++ b/packages/docs/src/components/tutorials.tsx@@ -1,24 +1,10 @@import BrowserOnly from "@docusaurus/BrowserOnly";import React from "react";import { AlsoAvailableAsVideo } from "./AlsoAvailableAsVideo";-import { VideoPlayerWithControls } from "./VideoPlayerWithControls";+import { NewMuxVideo } from "./MuxVideo";export const AppleFireworksTutorial = () => {- return (- <BrowserOnly>- {() => (- <VideoPlayerWithControls- playbackId="eEsG2GbZXAqNxays7TqDz24FS1OGCyYVuGYjRg2w2IM"- poster="https://image.mux.com/eEsG2GbZXAqNxays7TqDz24FS1OGCyYVuGYjRg2w2IM/thumbnail.png"- onError={(error) => {- console.log(error);- }}- onLoaded={() => undefined}- onSize={() => undefined}- />- )}- </BrowserOnly>- );+ return <NewMuxVideo muxId="eEsG2GbZXAqNxays7TqDz24FS1OGCyYVuGYjRg2w2IM" />;};export const TransformsTutorial = () => {diff --git a/packages/docs/success-stories/2021-09-16-makestories.md b/packages/docs/success-stories/2021-09-16-makestories.mdindex 0e5380a162..c075a324c7 100644--- a/packages/docs/success-stories/2021-09-16-makestories.md+++ b/packages/docs/success-stories/2021-09-16-makestories.md@@ -4,7 +4,7 @@ title: How MakeStories uses Remotion to render Web Storiesimage: /img/makestories.png----import {MuxVideo} from '../src/components/MuxVideo';+import {NewMuxVideo} from '../src/components/MuxVideo';:::noteThis is the first article in our new series: Success Stories. We interview companies and creators that we find inspiring and which have successfully implemented Remotion in their stack. Let us know what you think!@@ -12,7 +12,7 @@ This is the first article in our new series: Success Stories. We interview compaMakeStories is in the business of [Web Stories](https://stories.google/) - a format by Google to bring stories to the web. Appearing directly in Google Search, they are an opportunity for publishers to increase their audience massively.-<MuxVideo muxId="eB9pPF17zyOrmEas4kwsa3OvTeQV3cDlLQ5U01CHrfcg" style={{+<NewMuxVideo muxId="eB9pPF17zyOrmEas4kwsa3OvTeQV3cDlLQ5U01CHrfcg" style={{width: '100%'}} controls poster="/img/makestories.png"/>diff --git a/packages/docs/success-stories/2022-09-16-YARX.md b/packages/docs/success-stories/2022-09-16-YARX.mdindex a8340137fa..8ca738b759 100644--- a/packages/docs/success-stories/2022-09-16-YARX.md+++ b/packages/docs/success-stories/2022-09-16-YARX.md@@ -4,11 +4,11 @@ title: Personalized marathon finisher videos with Remotionimage: /img/yarx-image.png----import {MuxVideo} from '../src/components/MuxVideo';+import {NewMuxVideo} from '../src/components/MuxVideo';[YARX](https://www.yarx.ch/start) is a young and dynamic company, specializing in the development of mobile and web apps. They also provide services for cloud computing and websites.-<MuxVideo muxId="hQodJfIe701qG8AAiaLttVl8SVxo9W012fXHJPIsdVFIg" style={{+<NewMuxVideo muxId="hQodJfIe701qG8AAiaLttVl8SVxo9W012fXHJPIsdVFIg" style={{width: '100%'}} controls muted autoPlay poster="/img/yarx-image.png"/>diff --git a/packages/docs/success-stories/2023-11-01-Shortvid.md b/packages/docs/success-stories/2023-11-01-Shortvid.mdindex 370ffbff3d..90c647a53d 100644--- a/packages/docs/success-stories/2023-11-01-Shortvid.md+++ b/packages/docs/success-stories/2023-11-01-Shortvid.md@@ -3,11 +3,11 @@ slug: shortvid-video-conftitle: Generating conference event assets with Remotion----import {MuxVideo} from '../src/components/MuxVideo';+import {NewMuxVideo} from '../src/components/MuxVideo';[Shortvid.io](https://shortvid.io) is an open-source project that exposes a set of Remotion customizable compositions for event communication assets.-<MuxVideo muxId="Fy2affKrTwxQHYm8vLL6xxKNHeEXGA7vq2VVUICBxLQ" style={{+<NewMuxVideo muxId="Fy2affKrTwxQHYm8vLL6xxKNHeEXGA7vq2VVUICBxLQ" style={{width: '100%'}} controls poster="/img/blog/success-stories/shortvid.png"/>