🎥 Make videos programmatically with React
better document this
Jonny Burger4a125da30809
diff --git a/packages/docs/docs/miscellaneous/cross-origin-isolation.mdx b/packages/docs/docs/miscellaneous/cross-origin-isolation.mdxnew file mode 100644index 0000000000..1bbe50d4bf--- /dev/null+++ b/packages/docs/docs/miscellaneous/cross-origin-isolation.mdx@@ -0,0 +1,50 @@+---+image: /generated/articles-docs-miscellaneous-cross-origin-isolation.png+title: 'Cross-Origin Isolation'+sidebar_label: 'Cross-Origin Isolation'+id: cross-origin-isolation+crumb: 'Miscellaneous'+---++A website can either be cross-origin-isolated or not.++## How cross-origin isolation affects pages++Enabling cross-origin isolation is required for some web features. For example, the [SharedArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) API, which is required for the [`@remotion/whisper-web`](/docs/whisper-web) package to work, is only available in cross-origin isolated pages.++Cross-origin isolation will put some restrictions on the page as well.+For example, HTML5 tags like `<video>` and `<audio>` that load media from a different origin will not work unless they have the `crossorigin="anonymous"` attribute.+If those assets then do not support CORS, they will not load at all.++This also affects the following Remotion tags: [`<Video>`](/docs/video), [`<Audio>`](/docs/audio), [`<OffthreadVideo>`](/docs/offthreadvideo), [`<Img>`](/docs/img).++## Enabling cross-origin isolation++Cross-origin isolation is disabled by default.++### On your server++To enable cross-origin isolation on your page, the server must send the following HTTP headers:++```+Cross-Origin-Embedder-Policy: require-corp+Cross-Origin-Opener-Policy: same-origin+```++See also:++- [Enabling Cross-origin isolation in Next.js](https://vercel.com/guides/fix-shared-array-buffer-not-defined-nextjs-react#enable-cross-origin-isolation)++### In the Remotion Studio++**In the config file**: To enable it, you can use the [`setEnableCrossSiteIsolation()`](/docs/config#setenablecrosssiteisolation) function in your `remotion.config.ts` file.++**Via CLI flag**: You can also enable it by passing the `--cross-site-isolation` flag to the Remotion CLI.++## Checking if a page is cross-origin isolated++You can check if a page is cross-origin isolated by calling the `window.crossOriginIsolated` property.++```ts+window.crossOriginIsolated; // true+```diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex 547b78e9e2..644266fe49 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -1246,6 +1246,7 @@ module.exports = {'deno','standalone','miscellaneous/emojis',+ 'miscellaneous/cross-origin-isolation','media-fragments','react-native',],diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.tsindex 7434b55d78..c8d9671ebd 100644--- a/packages/docs/src/data/articles.ts+++ b/packages/docs/src/data/articles.ts@@ -3077,6 +3077,15 @@ export const articles = [noAi: false,slug: 'miscellaneous/cloud-gpu',},+ {+ id: 'cross-origin-isolation',+ title: 'Cross-Origin Isolation',+ relativePath: 'docs/miscellaneous/cross-origin-isolation.mdx',+ compId: 'articles-docs-miscellaneous-cross-origin-isolation',+ crumb: 'Miscellaneous',+ noAi: false,+ slug: 'miscellaneous/cross-origin-isolation',+ },{id: 'embed-studio',title: 'Can I embed the Remotion Studio?',diff --git a/packages/docs/static/generated/articles-docs-miscellaneous-cross-origin-isolation.png b/packages/docs/static/generated/articles-docs-miscellaneous-cross-origin-isolation.pngnew file mode 100644index 0000000000..1e2c8dc97bBinary files /dev/null and b/packages/docs/static/generated/articles-docs-miscellaneous-cross-origin-isolation.png differdiff --git a/packages/whisper-web/src/can-use-whisper-web.ts b/packages/whisper-web/src/can-use-whisper-web.tsindex 0528518c49..9594353b78 100644--- a/packages/whisper-web/src/can-use-whisper-web.ts+++ b/packages/whisper-web/src/can-use-whisper-web.ts@@ -36,7 +36,7 @@ export const canUseWhisperWeb = async (supported: false,reason: WhisperWebUnsupportedReason.NotCrossOriginIsolated,detailedReason:- 'The document is not cross-origin isolated (window.crossOriginIsolated = false). This prevents the usage of SharedArrayBuffer, which is required by `@remotion/whisper-web`. Make sure the document is served with the HTTP header `Cross-Origin-Opener-Policy: same-origin` and `Cross-Origin-Embedder-Policy: require-corp`: https://developer.mozilla.org/en-US/docs/Web/API/Window/crossOriginIsolated',+ 'The document is not cross-origin isolated (window.crossOriginIsolated = false). This prevents the usage of SharedArrayBuffer, which is required by `@remotion/whisper-web`. Make sure the document is served with the HTTP header `Cross-Origin-Opener-Policy: same-origin` and `Cross-Origin-Embedder-Policy: require-corp`: https://remotion.dev/docs/miscellaneous/cross-origin-isolation',};}