vidvid-info
v0.1.7
Published
Fetch info of a video
Downloads
30
Maintainers
Readme
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 secondsvideoHeight
: the video height in pxvideoWidth
: 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