Skip to content

🎥 Make videos programmatically with React

nice

Jonny Burgera87eb7082dff
diff --git a/packages/docs/docs/integration-frameworks/angular.mdx b/packages/docs/docs/angular.mdx
similarity index 96%
rename from packages/docs/docs/integration-frameworks/angular.mdx
rename to packages/docs/docs/angular.mdx
index b54d188088..bd820b86ac 100644
--- a/packages/docs/docs/integration-frameworks/angular.mdx
+++ b/packages/docs/docs/angular.mdx
@@ -1,16 +1,16 @@
---
-image: /generated/articles-docs-integration-frameworks-angular.png
+image: /generated/articles-docs-angular.png
id: angular
-sidebar_label: 'Angular'
+sidebar_label: 'Integration into Angular'
title: 'Angular'
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-# Using Remotion with Angular
+# Using Remotion in Angular
-This guide explains how to integrate **Remotion** into an **Angular** project.
+This guide explains how to integrate Remotion into an **Angular** project.
## Install required packages
@@ -174,7 +174,10 @@ export class PlayerViewWrapper implements AfterViewInit, OnDestroy {
}
protected render() {
- if (!this.containerRef || !this.containerRef.nativeElement) return;
+ if (!this.containerRef || !this.containerRef.nativeElement) {
+ return;
+ }
+
this.root?.render(
<PlayerView
playerRefInstance={this.playerRef}
@@ -222,6 +225,7 @@ export const PlayerView: React.FC<{
});
}
}, []);
+
return (
<Player
ref={playerRef}
@@ -247,7 +251,7 @@ To display the Remotion player within an Angular template, add your new wrapper
This Angular component tag will render the Remotion player, allowing you to pass data or configuration as needed through Angular's data binding.
-You're no able to use the [`API`](/docs/player/player) of the player via `this.playerRef()`
+You're now able to use the [`API`](/docs/player/player) of the player via `this.playerRef()`.
## Configure TailwindCSS (optional)
diff --git a/packages/docs/docs/integration-frameworks/vue-js.mdx b/packages/docs/docs/vue-js.mdx
similarity index 81%
rename from packages/docs/docs/integration-frameworks/vue-js.mdx
rename to packages/docs/docs/vue-js.mdx
index afe370062d..6b4c6ea572 100644
--- a/packages/docs/docs/integration-frameworks/vue-js.mdx
+++ b/packages/docs/docs/vue-js.mdx
@@ -1,16 +1,16 @@
---
-image: /generated/articles-docs-integration-frameworks-vue-js.png
+image: /generated/articles-docs-vue-js.png
id: vue-js
-sidebar_label: 'VueJS'
+sidebar_label: 'Integration into Vue'
title: 'VueJS'
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-# Using Remotion with VueJS
+# Using Remotion in VueJS
-This guide explains how to integrate **Remotion** into a **VueJS** project.
+This guide explains how to integrate Remotion into a **VueJS** project.
## Install required packages
@@ -96,12 +96,12 @@ To enable JSX support in VueJS, update the `tsconfig.app.json` file by setting `
```
:::note
-The "jsxImportSource": "" setting is also recommended to prevent build issues.
+The "jsxImportSource": "" setting is recommended to prevent build issues.
:::
## Configure Vite for React
-To enable React support in Vite, update the `vite.config.ts` file by setting adding react to the plugins.
+To enable React support in Vite, update the `vite.config.ts` file by adding `react` to the plugins.
```ts title="vite.config.ts"
import {fileURLToPath, URL} from 'node:url';
@@ -130,50 +130,60 @@ To embed Remotion components in VueJS, create a **wrapper component**:
1. In your `remotion` folder, create a file named `PlayerViewWrapper.vue`.
-```ts title="PlayerViewWrapper.vue"
+```html title="PlayerViewWrapper.vue"
<script lang="ts" setup>
- import {onBeforeUnmount, onMounted, ref, watch} from 'vue';
- import {type PlayerSchema, PlayerView} from "@/remotion/PlayerView";
- import {createRoot, type Root} from "react-dom/client";
- import * as React from "react";
+ import {onBeforeUnmount, onMounted, ref, watch} from 'vue';
+ import {type PlayerSchema, PlayerView} from '@/remotion/PlayerView';
+ import {createRoot, type Root} from 'react-dom/client';
+ import * as React from 'react';
- interface PlayerData {
- data: PlayerSchema;
- }
+ interface PlayerData {
+ data: PlayerSchema;
+ }
- const playerRef = ref()
- const reactRoot = ref();
- let root: Root;
- const emit = defineEmits(['paused'])
+ const playerRef = ref();
+ const reactRoot = ref();
+ let root: Root;
+ const emit = defineEmits(['paused']);
- const props = defineProps<PlayerData>()
+ const props = defineProps<PlayerData>();
- onMounted(() => {
- root = createRoot(reactRoot.value);
- render()
- });
+ onMounted(() => {
+ root = createRoot(reactRoot.value);
+ render();
+ });
- function render() {
- root.render(React.createElement(PlayerView, {
+ function render() {
+ root.render(
+ React.createElement(PlayerView, {
data: props.data,
playerRefInstance: playerRef,
onPaused: () => emit('paused'),
- }));
- }
+ }),
+ );
+ }
- watch(() => playerRef, (newData, oldData) => {
+ watch(
+ () => playerRef,
+ (newData, oldData) => {
playerRef.value.play();
- }, {deep: true})
+ },
+ {deep: true},
+ );
- watch(() => props.data, (newData, oldData) => {
- render()
- }, {deep: true})
+ watch(
+ () => props.data,
+ (newData, oldData) => {
+ render();
+ },
+ {deep: true},
+ );
- onBeforeUnmount(() => {
- if (root) {
- root.unmount();
- }
- });
+ onBeforeUnmount(() => {
+ if (root) {
+ root.unmount();
+ }
+ });
</script>
<template>
@@ -183,7 +193,7 @@ To embed Remotion components in VueJS, create a **wrapper component**:
This wrapper component will serve as the bridge between VueJs and Remotion’s React components.
-## Create a wrapper for the Remotion player
+## Create a wrapper for the Remotion Player
1. In your `remotion` folder, create a file named `PlayerView.tsx`.
2. Ensure each `.tsx` file imports React explicitly at the top of the file:
@@ -242,7 +252,7 @@ export const PlayerView = ({
## Use the component in VueJS
-To display the Remotion player within an VueJS template, add your new wrapper component wherever you'd like the player to appear:
+To display the Remotion player within an VueJS template, add your new wrapper component wherever you'd like the Player to appear:
```html
<PlayerWrapper @paused="onPaused" :data="data" />
@@ -250,7 +260,7 @@ To display the Remotion player within an VueJS template, add your new wrapper co
This VueJS component tag will render the Remotion player, allowing you to pass data or configuration as needed through VueJS's data binding.
-You're no able to use the [`API`](/docs/player/player) of the player via `this.playerRef()`
+You're now able to use the [`API`](/docs/player/player) of the player via `this.playerRef()`
## Configure TailwindCSS (optional)
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index c6f09b7eba..d8d13550fc 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -848,14 +848,8 @@ module.exports = {
'font-picker',
'building-a-timeline',
'multiple-fps',
- ],
- },
- {
- type: 'category',
- label: 'Integration into other frameworks',
- items: [
- 'integration-frameworks/angular',
- 'integration-frameworks/vue-js',
+ 'angular',
+ 'vue-js',
],
},
{
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index 91cf520107..5f0569bbdb 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -34,6 +34,13 @@ export const articles = [
compId: 'articles-docs-skia-skia-canvas',
crumb: '@remotion/skia',
},
+ {
+ id: 'vue-js',
+ title: 'VueJS',
+ relativePath: 'docs/vue-js.mdx',
+ compId: 'articles-docs-vue-js',
+ crumb: null,
+ },
{
id: 'spring',
title: 'spring()',
@@ -692,6 +699,13 @@ export const articles = [
compId: 'articles-docs-wrong-composition-mount',
crumb: 'Troubleshooting',
},
+ {
+ id: 'angular',
+ title: 'Angular',
+ relativePath: 'docs/angular.mdx',
+ compId: 'articles-docs-angular',
+ crumb: null,
+ },
{
id: 'flickering',
title: 'Flickering',
@@ -3649,7 +3663,7 @@ export const articles = [
crumb: 'How To',
},
{
- id: '"null"',
+ id: "'null'",
title: '<Experimental.Null>',
relativePath: 'docs/null.mdx',
compId: 'articles-docs-null',
diff --git a/packages/docs/static/generated/articles-docs-angular.png b/packages/docs/static/generated/articles-docs-angular.png
new file mode 100644
index 0000000000..995019894e
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-angular.png differ
diff --git a/packages/docs/static/generated/articles-docs-vue-js.png b/packages/docs/static/generated/articles-docs-vue-js.png
new file mode 100644
index 0000000000..3cdd13812c
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-vue-js.png differ