Skip to content

🎥 Make videos programmatically with React

Update prefetch.md

Jonny Burgerab27291e15ba
diff --git a/packages/docs/docs/prefetch.md b/packages/docs/docs/prefetch.md
index 73376392e5..89d1ecf9b7 100644
--- a/packages/docs/docs/prefetch.md
+++ b/packages/docs/docs/prefetch.md
@@ -56,7 +56,7 @@ The function takes a `src`, which can be a remote URL, an imported asset or an a
### `options`
-#### `method`<AvailableFrom v="3.2.35" />
+#### `method?`<AvailableFrom v="3.2.35" />
_previously defaulted to `blob-url`_
@@ -67,6 +67,10 @@ Either `blob-url` or `base64`.
Read below for which option is suitable for you.
+#### `contentType?`<AvailableFrom v="4.0.40" />
+
+Set a content type for the blob. By default, the content type from the HTTP response is taken. We recommend setting an appropriate content type for the media, e.g `video/mp4` only if the HTTP resource does not contain the right one by default.
+
## Return value
An object with:
@@ -81,6 +85,12 @@ In Safari, even though it is a local URL, Safari may not be instantly playing th
Use `base64` in Safari if you notice that your audio file plays with hickups even though the `<Player>` requests a `blob:` URL.
+## Setting the right content type
+
+Files loaded from the internet should be served with a proper content type, e.g. `video/mp4` for an MP4 file. When the file gets loaded into a blob URL, the file extension gets removed and the browser loses the information about the content type.
+
+This can lead to the video file not playing correctly in the browser. If you cannot influence the servre, you can also set the content type manually using the [`contentType`](#contenttype) option.
+
## See also
- [`@remotion/preload`](/docs/preload)