vidvid-info

0.1.7 • Public • Published

Fetch info of a video

Fetch the duration, height and width of a video.

Installing

vidvid-info is an ES module meant to be used in browsers.

vidvid = import('https://unpkg.com/vidvid-info?module')

Usage

vidvid = import('https://unpkg.com/vidvid-info?module')
 
const src =
  'https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4'
 
await vidvid.info(src)
//=> {duration: 596.503219, videoHeight: 360, videoWidth: 640}
 
await vidvid.info(src, { timeout: 10 })
//=> Timed out in 10ms.

API

# vidvid.info(src[, options]) · Source, Examples

Fetches the video metadata at the specified src URL. It returns a Promise that resolves an Object with the following fields:

  • duration: the video duration in seconds
  • videoHeight: the video height in px
  • videoWidth: the video width in px

It timeouts after options.timeout (in ms) or one day by default.

If options.crossOrigin is specified, CORS is used to fetch the video metadata. By default, no CORS is used.

Credits

Developed for the LIRIS M2i project by Sylvain Lesage

Package Sidebar

Install

npm i vidvid-info

Weekly Downloads

8

Version

0.1.7

License

MIT

Unpacked Size

3.82 kB

Total Files

3

Last publish

Collaborators

  • severo_bo