Skip to content

🎥 Make videos programmatically with React

`@remotion/media`: Document fallback logic

JonnyBurgerd0fc94bdcb5d
diff --git a/packages/docs/docs/media/fallback.mdx b/packages/docs/docs/media/fallback.mdx
new file mode 100644
index 0000000000..df43607868
--- /dev/null
+++ b/packages/docs/docs/media/fallback.mdx
@@ -0,0 +1,26 @@
+---
+title: 'Fallback from @remotion/media to <OffthreadVideo> or <Audio>'
+sidebar_label: 'Fallback to <OffthreadVideo>'
+crumb: '@remotion/media'
+---
+
+Sometimes, a media file cannot be embedded using [`@remotion/media`](/docs/media)'s [`<Video>`](/docs/media/video) and [`<Audio>`](/docs/media/audio) tags.
+In such cases, a fallback to [`<OffthreadVideo>`](/docs/offthreadvideo) or [`<Audio>`](/docs/audio) from the `remotion` package is attempted.
+
+## When a fallback is attempted
+
+Here are some cases where [`@remotion/media`](/docs/media) may fall back to [`<OffthreadVideo>`](/docs/offthreadvideo) or [`<Audio>`](/docs/audio) from `remotion`:
+
+- The resource fails to load due to [CORS restrictions](/docs/cors-issues)
+- The container format is not supported by [Mediabunny](/docs/mediabunny/formats)
+- The codec cannot be decoded by WebCodecs (e.g. a H.265 stream during rendering)
+
+## Observing when a fallback happens
+
+If [`@remotion/media`](/docs/media) falls back to another tag, then a warning message will be logged in the render:
+
+```
+Cannot decode /public/video-h265.mp4, falling back to <OffthreadVideo>
+```
+
+If you are rendering on an environment where the logs are not immediately visible (e.g. Lambda), observe whether a fallback has happened by visiting the logs (e.g. CloudWatch).
diff --git a/packages/docs/docs/media/support.mdx b/packages/docs/docs/media/support.mdx
index 153c7ad049..2e2f5412a0 100644
--- a/packages/docs/docs/media/support.mdx
+++ b/packages/docs/docs/media/support.mdx
@@ -25,4 +25,6 @@ Prefer non-Matroska-based files (`.mp4`, `.mov`, `.m4a`) when you are doing dist
## Fallback to `<OffthreadVideo>`
-If a media file cannot be decoded, be it because of an unsupported codec or because it does not support CORS, then we plan on automatically falling back to [`<OffthreadVideo>`](/docs/offthreadvideo) if available. This is currently not yet implemented.
+If a media file cannot be decoded, be it because of an unsupported codec or because it does not support CORS, then `@remotion/media` automatically falls back to [`<OffthreadVideo>`](/docs/offthreadvideo) or [`<Audio>`](/docs/audio) from the [`remotion`](/docs/remotion) package.
+
+See: [Fallback from `@remotion/media` to `<OffthreadVideo>` or `<Audio>`](/docs/media/fallback)
diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.ts
index 631eb99236..069634ea7f 100644
--- a/packages/docs/sidebars.ts
+++ b/packages/docs/sidebars.ts
@@ -398,7 +398,7 @@ const sidebars: SidebarsConfig = {
type: 'doc',
id: 'media/index',
},
- items: ['media/audio', 'media/video', 'media/support'],
+ items: ['media/audio', 'media/video', 'media/support', 'media/fallback'],
},
{
type: 'category',