Skip to content

πŸŽ₯ Make videos programmatically with React

helpful error messages

Jonny Burger4bec07e6f5ac
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index 29f7fab143..a13bded83b 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -34,14 +34,15 @@ const onPageError = async (info: OnPageErrorInfo) => {
);
} else {
Log.error(
- `The following error occurred when trying to render frame ${info.frame}`
+ `The following error occurred when trying to render frame ${info.frame}:`
);
}
Log.error(info.error);
- if (String(info.error.message).match(/Could not play video with/g)) {
- Log.error(
- '\nUnsupportedCodecError: Unsupported video codec found. Make sure your browser supports the codec or use chrome.'
+ if (info.error.message.includes('Could not play video with')) {
+ Log.info();
+ Log.info(
+ 'πŸ’‘ Get help for this issue at https://remotion.dev/docs/media-playback-error.'
);
}
diff --git a/packages/docs/docs/video-error.md b/packages/docs/docs/video-error.md
new file mode 100644
index 0000000000..653434e109
--- /dev/null
+++ b/packages/docs/docs/video-error.md
@@ -0,0 +1,37 @@
+---
+id: media-playback-error
+title: "Could not play video/audio with src"
+sidebar_label: Media playback error
+---
+
+The following error may occur in your Remotion project during development or while rendering:
+
+```diff
+- Error: Could not play video with src [source]
+```
+
+or
+
+```diff
+- Error: Could not play audio with src [source]
+```
+
+This error happens when you are trying to embed a `<Video/>` or `<Audio/>` tag in your Remotion project but the browser is unable to load and play the media. Although the browser does not report the exact error, there are two common reasons for this error.
+
+## Codec not supported by Chromium
+
+Unlike Google Chrome, the Chromium Browser does not include proprietary codecs. This means you cannot play MP4/H.264 videos and not play MP3/AAC audio files (more codecs may not be supported).
+
+**Workaround**: Convert videos to WebM or [use Chrome instead of Chromium](/docs/config#setbrowserexecutable).
+
+## Invalid source
+
+Make sure you are trying to load a video that is either available locally or publicly on the internet. Typoing the `src` prop will lead to this error.
+
+## Other unsupported codecs
+
+You might be importing a video that is not compatible with Chrome at all, e.g. FLV.
+
+## See also
+
+- [Codec support](/docs/config#setbrowserexecutable)
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index 6a973333e2..b1ee1c73f0 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -33,7 +33,6 @@ module.exports = {
"legacy-babel",
],
},
-
"cli",
"config",
{
@@ -87,7 +86,7 @@ module.exports = {
{
type: "category",
label: "Troubleshooting",
- items: ["timeout", "performance"],
+ items: ["timeout", "media-playback-error", "performance"],
},
"2-0-migration",
"license",