Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kalashnikovisme/nano-metadata
Get duration of video file in browser
https://github.com/kalashnikovisme/nano-metadata
Last synced: 1 day ago
JSON representation
Get duration of video file in browser
- Host: GitHub
- URL: https://github.com/kalashnikovisme/nano-metadata
- Owner: kalashnikovisme
- Created: 2022-10-14T21:35:27.000Z (about 2 years ago)
- Default Branch: develop
- Last Pushed: 2023-04-26T22:04:20.000Z (over 1 year ago)
- Last Synced: 2024-12-29T06:35:25.031Z (12 days ago)
- Language: JavaScript
- Size: 115 KB
- Stars: 24
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nano-metadata [![Linter](https://github.com/kalashnikovisme/nano-metadata/actions/workflows/linter.yml/badge.svg?branch=main)](https://github.com/kalashnikovisme/nano-metadata/actions/workflows/linter.yml) [![Test](https://github.com/kalashnikovisme/nano-metadata/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/kalashnikovisme/nano-metadata/actions/workflows/test.yml)
[Why do tests fail?](https://github.com/kalashnikovisme/nano-metadata#why-do-tests-fail)# Description
Get duration of video file in browser
# Install
```
npm install nano-metadata
```or
```
yarn add nano-metadata
```# Usage
## Video duration
```javascript
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
})
}
```# Features
| | Video | Audio |
| ------------- | ------------- | ------------- |
| Duration | ✅ | ❌ |
| *other features?* | | |# Contribute
## Option 1
1. Clone repo `git clone [email protected]:kalashnikovisme/nano-metadata`
2. Run `yarn`
3. To run linter `make linter`## Option 2
Just run Codespace
## Why do tests fail?
This package uses `onloadedmetadata` event to store video duration. We use [js-dom](https://github.com/jsdom/jsdom) for web implementation in the tests. Looks like it does not support this event for now.
### Solutions
We will rewrite tests with chrome headless and selenium soon