Skip to content

Get the duration of an media file (audio, video) from local storage or URL

License

Notifications You must be signed in to change notification settings

vickvasquez/get-media-duration

Repository files navigation

get-media-duration

Install

pnpm add get-media-duration

Usage

import { getDuration, getDurationInMinutes } from 'get-media-duration'

getDuration('./audio.mp3')
  .then(duration => console.log(duration))
  .catch(console.log)


getDuration('https://samplelib.com/lib/preview/mp3/sample-3s.mp3')
  .then(duration => console.log(duration))
  .catch(console.log)

getDurationInMinutes('./audio.mp3')
  .then(duration => console.log(duration))
  .catch(console.log)


getDurationInMinutes('https://samplelib.com/lib/preview/mp3/sample-3s.mp3')
  .then(duration => console.log(duration))
  .catch(console.log)

About

Get the duration of an media file (audio, video) from local storage or URL

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published