# @wbe/react-video-player

> React video player for native vimeo and youtube video

Latest version **2.7.1** (published 2022-07-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wbe/react-video-player
pnpm add @wbe/react-video-player
yarn add @wbe/react-video-player
bun add @wbe/react-video-player
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.7.1 |
| Published | 2022-07-26 |
| First published | 2020-08-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 981 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Willy Brauner |
| Maintainers | willybe |
| Keywords | react |

## Links

- npm: https://www.npmjs.com/package/@wbe/react-video-player
- Repository: https://github.com/willybrauner/react-libraries
- Homepage: https://github.com/willybrauner/react-libraries#readme
- Issues: https://github.com/willybrauner/react-libraries/issues
- npm.io page: https://npm.io/package/@wbe/react-video-player

## Dependencies (2)

- [@vimeo/player](https://npm.io/package/@vimeo/player.md) ^2.17.1
- [youtube-player](https://npm.io/package/youtube-player.md) ^5.5.2

## 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

- 2.7.1 (latest) — 2022-07-26
- 2.7.0 — 2022-05-02
- 2.6.0-beta.1 — 2022-03-04
- 2.5.0 — 2022-03-02
- 2.5.0-alpha.0 — 2022-01-07
- 2.4.3-alpha.0 — 2022-01-07
- 2.4.0 — 2021-08-25
- 2.3.0 — 2021-07-21
- 2.2.0-alpha.0 — 2021-07-12
- 2.1.0 — 2021-07-07
- 2.0.0 — 2021-07-07
- 2.0.0-alpha.14 — 2021-07-07
- 2.0.0-alpha.11 — 2021-07-07
- 2.0.0-alpha.10 — 2021-07-06
- 2.0.0-alpha.7 — 2021-07-02
- … 17 more at https://npm.io/package/@wbe/react-video-player/versions

## README

# @wbe/react-video-player

React video player is a wrapper component for native, vimeo and youtube video.

![](https://img.shields.io/npm/v/@wbe/react-video-player/latest.svg)
![](https://img.shields.io/bundlephobia/minzip/@wbe/react-video-player.svg)
![](https://img.shields.io/david/willybrauner/libraries.svg?path=packages%2Freact-components%2Freact-video-player)
![](https://img.shields.io/npm/dt/@wbe/react-video-player.svg)
![](https://img.shields.io/npm/l/@wbe/react-video-player.svg)

## Installation

```shell script
$ npm install -s @wbe/react-video-player
```

## How to use

Import VideoPlayer:

```jsx
import { VideoPlayer, EVideoType } from "@wbe/react-video-player";
// ...
const App = () => {
  return (
    <VideoPlayer
      type={EVideoType.NATIVE}
      className={`native`}
      url={"https://video-url"}
      play={true}
      style={{ display: "block" }}
      controls={false}
      muted={true}
      autoPlay={true}
      onPause={e => console.log("pause callback", e)}
      onPlay={e => console.log("play callback", e)}
      onEnded={e => console.log("ended callback", e)}
      onReady={e => console.log("ready callback", e)}
    />
  );
};
```

Or import an available sub video component to access extra available props:

- [NativeVideo](./src/NativeVideo.tsx)
- [VimeoVideo](./src/VimeoVideo.tsx)
- [YoutubeVideo](./src/YoutubeVideo.tsx)

```jsx
import { YoutubeVideo } from "@wbe/react-video-player";
// ...
const App = () => {
  return (
    <YoutubeVideo
      id={"youtube-id"}
      play={true}
      // specific props available only for youtube video
      fs={false}
    />
  );
};
```

You can easily create your own VideoPlayer component and import sub video component as needed.

## Parameters / Props

| props (\* non optional) | type                | description                              | default value | @type           |
| ----------------------- | ------------------- | ---------------------------------------- | ------------- | --------------- |
| type\*                  | EVideoType          | Type of video                            | /             | /               |
| id                      | string              | Video ID (ID will overwrite URL)         | /             | VIMEO & YOUTUBE |
| url                     | string              | Video URL                                | /             | all             |
| play                    | boolean             | Play, pause, resume video                | /             | all             |
| style                   | CSSProperties       | Add root component style                 | /             | all             |
| autoPlay                | boolean             | Autoplay video on init                   | false         | all             |
| controls                | boolean             | Show controls on video                   | true          | all             |
| loop                    | boolean             | Loop video                               | false         | all             |
| playsInline             | boolean             | Plays inline video on mobile             | true          | all             |
| muted                   | boolean             | Mute video                               | false         | all             |
| onReady                 | (event:any) => void | Execute function when video is ready     | /             | all             |
| onPlay                  | (event:any) => void | Execute callback function on play state  | /             | all             |
| onPause                 | (event:any) => void | Execute callback function on pause state | /             | all             |
| onEnded                 | (event:any) => void | Execute callback function on ended state | /             | all             |
| className               | string              | class list                               | /             | all             |

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