Skip to main content

Readers

warning

Unstable API: This package is experimental. The API may change in the future.
The API for getting video metadata is stable and may be used in production.

The parseMedia() function takes a reader interface which defines how the source is being read.

The following reader interfaces are available:

Defaults

The default reader for parseMedia(), parseAndDownloadMedia() and convertMedia() is webReader and can be configured using the reader field.

The default reader for parseMediaOnWebWorker() is webReader. It cannot be configured.

The default reader for parseMediaOnServerWorker() is universalReader. It cannot be configured.

Which reader should I choose?

If you are using parseMedia() on a backend runtime like Node.js or Bun, and are reading files from a local file path, you should use nodeReader.

Otherwise, you should use webReader. You don't need to explicitly specify it because it is the default.

Custom readers

To create a custom reader, create an objet that satisfies the ReaderInterface type. To see a reference of it, look at the source code of any reader, which is linked at the bottom of it's documentation page.