Get duration of video file in browser
npm install nano-metadata
or
yarn add nano-metadata
import nanoMetadata from 'nano-metadata'
change(e) {
const file = e.target.files[0]
nanoMetadata.video.duration(file).then((duration) => {
console.log(duration) // will show you video duration in seconds
})
}
Video | Audio | |
---|---|---|
Duration | ✅ | ❌ |
other features? |
- Clone repo
git clone git@github.com:kalashnikovisme/nano-metadata
- Run
yarn
- To run linter
make linter
Just run Codespace
This package uses onloadedmetadata
event to store video duration. We use js-dom for web implementation in the tests. Looks like it does not support this event for now.
We will rewrite tests with chrome headless and selenium soon