# react-video-thumbnail-image

> Create a thumbnail image of video by providing any url.

Latest version **0.1.7** (published 2021-07-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-video-thumbnail-image
pnpm add react-video-thumbnail-image
yarn add react-video-thumbnail-image
bun add react-video-thumbnail-image
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.7 |
| Published | 2021-07-28 |
| First published | 2021-07-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 281.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | saad3074 |
| Maintainers | saad3074 |
| Keywords | react, thumbnail, thumnail, generator, creator, generate, create, video |

## Links

- npm: https://www.npmjs.com/package/react-video-thumbnail-image
- npm.io page: https://npm.io/package/react-video-thumbnail-image

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.7 (latest) — 2021-07-28
- 0.1.6 — 2021-07-28
- 0.1.5 — 2021-07-28
- 0.1.4 — 2021-07-28
- 0.1.3 — 2021-07-28
- 0.1.2 — 2021-07-28
- 0.1.0 — 2021-07-28

## README

# React Video Thumbnail Image
Given a video url, attempt to generate a video thumbnail image using HTML Canvas Element

Note*: The **`<Canvas>`** element will only be able to generate a thumbnail image, if CORS allows it.

If not, you may see a similar console error as below:
```
DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Canvas may not be exported.
```

Please read about [Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS), if you would like more details on how it works.


## Installation

```bash
git clone https://github.com/saad3074/react-video-thumbnail-image.git
```
OR
```bash
npm install --save-dev react-video-thumbnail-image
```

## Usage

```es6
import VideoImageThumbnail from 'react-video-thumbnail-image'; // use npm published version
...
<VideoImageThumbnail
    videoUrl="https://dl.dropboxusercontent.com/s/pkz1yguv8vcs7k1/cover.mp4?dl=0"
    thumbnailHandler={(thumbnail) => console.log(thumbnail)}
    width={120}
    height={80}
    alt="my test video"
    />
```


## Properties

| Prop Name | Type | Default | Description |
| --- | --- | --- | --- |
| **videoUrl** (Required) | **string** | | The url of the video you want to generate a thumbnail from |
| **cors** | **bool** | false |Whether or not to set **crossOrigin** attribute to **anonymous**. |
| **height** | **int** | | Resize thumbnail to specified height |
| **renderThumbnailHtml** | **bool** | true | Whether to render an image tag and show the thumbnail or return base 64 image only. |
| **snapshotAtTime** | **int** | 2 | The second at which the component should snap the image at. |
| **thumbnailHandler** | **func** | | Callback function that takes in **thumbnail** url as an argument |
| **width** | **int** | | Resize thumbnail to specified width |
| **alt** | **string** | | image alt text |

*Note: The longer the snapshotAtTime, the more video data it may have to download.

## Examples


## Contributors

- Saeed Ullah Khan [@saad3074](https://github.com/saad3074)

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