# get-blob-duration

> Convenience method to patch Chromium bug when getting duration of HTML5 video or audio Blob.

Latest version **1.2.0** (published 2021-04-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install get-blob-duration
pnpm add get-blob-duration
yarn add get-blob-duration
bun add get-blob-duration
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2021-04-03 |
| First published | 2018-02-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 55 |
| Author | Ezekiel Victor |
| Maintainers | evictor |
| Keywords | html5, video, audio, blob, mediastream, mediatrack, duration, length, seconds |

## Links

- npm: https://www.npmjs.com/package/get-blob-duration
- Repository: https://github.com/evictor/get-blob-duration
- Homepage: https://github.com/evictor/get-blob-duration#readme
- Issues: https://github.com/evictor/get-blob-duration/issues
- npm.io page: https://npm.io/package/get-blob-duration

## Dependencies (1)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) 7.11.2

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2021-04-03
- 1.1.2 — 2020-07-16
- 1.1.1 — 2020-06-10
- 1.1.0 — 2019-07-27
- 1.0.1 — 2018-12-19
- 1.0.0 — 2018-02-15

## README

# get-blob-duration
Convenience method to patch Chromium bug when getting duration of HTML5 video or audio Blob.

# Installation 

`npm install --save get-blob-duration`   

or

`yarn add get-blob-duration`

## Usage

Import the method however you like (browser, module, etc.). Once you have it in scope:

```javascript
// Returns Promise<Number>
getBlobDuration(blob).then(function(duration) {
  console.log(duration + ' seconds');
});
```

Or use ECMAScript 6:

```javascript
import getBlobDuration from 'get-blob-duration'

(async function() {
  const duration = await getBlobDuration(blob)
  console.log(duration + ' seconds')
})()
```

Or pass an object URL string if you already have one:

```javascript
import getBlobDuration from 'get-blob-duration'

(async function() {
  const blobUrl = 'blob:https://mdn.mozillademos.org/012345678-9abc-def0-1234-56789abcdef0'
  const duration = await getBlobDuration(blobUrl)
  console.log(duration + ' seconds')
})()
```

## Changelog

### 1.2.0

- **Security:** Update deps
- **Bug:** Fix #8 (thx @fheyen for bug report)
- **Task:** Pin deps
- **Improvement:** Introduce Github Actions
- **Improvement:** Promise rejects if video el throws an error (thx @Stopa for code)

### 1.1.2

- Bump lodash from 4.17.15 to 4.17.19 [pull #6](https://github.com/evictor/get-blob-duration/pull/6/files)
- Audit fix + npm up

### 1.1.1

- Update deps

### 1.1.0

- Allow usage with blob URL - [kandros](https://github.com/kandros)
- Typescript typings - [kandros](https://github.com/kandros)
- Fix npm audits + various package upgrades

### 1.0.1

- Typescript defs (thanks [kandros](https://github.com/kandros))
- Fix audits + gulp update to ^4.0.0

### 1.0.0

Initial release

---
_Source: https://npm.io/package/get-blob-duration · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
