# video-snapshot

> Get snapshots from a video file in the browser

Latest version **1.0.11** (published 2020-12-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install video-snapshot
pnpm add video-snapshot
yarn add video-snapshot
bun add video-snapshot
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2020-12-03 |
| First published | 2018-02-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=8.5.0 |
| Dependencies | 0 |
| Unpacked size | 19.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 94 |
| Author | Hector Leon Zarco Garcia |
| Maintainers | zzarcon |
| Keywords | video, snapshot, preview, screenshot, capture, image |

## Links

- npm: https://www.npmjs.com/package/video-snapshot
- Repository: git@github.com:zzarcon/video-snapshot
- npm.io page: https://npm.io/package/video-snapshot

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.11 (latest) — 2020-12-03
- 1.0.9 — 2020-11-19
- 1.0.3 — 2018-12-18
- 1.0.2 — 2018-11-01
- 1.0.1 — 2018-04-04
- 0.0.3 — 2018-02-11

## README

<div align="center">
  <img src="video-snapshot.gif" alt="Logo" height="400">
  <br><br>
</div>

# video-snapshot [![Build Status](https://travis-ci.org/zzarcon/video-snapshot.svg?branch=master)](https://travis-ci.org/zzarcon/video-snapshot)
> Get snapshots from a video file in the browser

# Demo 💅
[https://zzarcon.github.io/video-snapshot](https://zzarcon.github.io/video-snapshot)

# Install 🚀

```
$ yarn add video-snapshot
```

# Usage ⛏

```javascript
import VideoSnapshot from 'video-snapshot';

document.querySelector('input[type="file"]').addEventListener('change', onChange);

const onChange = async (e) => {
  const snapshoter = new VideoSnapshot(e.target.files[0]);
  const previewSrc = await snapshoter.takeSnapshot();
  const img = document.createElement('img');

  img.src = previewSrc;

  document.body.appendChild(img);
};
```

# Api 👀

```typescript
type CustomVideoTime = 'start' | 'middle' | 'end';
type VideoTime = number | CustomVideoTime;

class VideoSnapshot {
  constructor(blob: Blob) {};
  takeSnapshot(time?: VideoTime): Promise<string>;
  end(): void;
}
```

# Features 💸

* Dependency free
* [2kb size](https://bundlephobia.com/result?p=video-snapshot@1.0.1)
* Take snapshot at any time
* You can pass **smart times** to easily get better previews

# Author 🦄

[@zzarcon](https://twitter.com/zzarcon)

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