# react-sproutvideo

> Sproutvideo React library

Latest version **0.1.0** (published 2023-08-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-sproutvideo
pnpm add react-sproutvideo
yarn add react-sproutvideo
bun add react-sproutvideo
```

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2023-08-29 |
| First published | 2023-08-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | rcbxd |
| Maintainers | askorupskyy |
| Keywords | react, video-player |

## Links

- npm: https://www.npmjs.com/package/react-sproutvideo
- Repository: https://github.com/rcbxd/react-sproutvideo
- Homepage: https://github.com/rcbxd/react-sproutvideo#readme
- Issues: https://github.com/rcbxd/react-sproutvideo/issues
- npm.io page: https://npm.io/package/react-sproutvideo

## 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.0 (latest) — 2023-08-29
- 0.0.6 — 2023-08-29
- 0.0.5 — 2023-08-29
- 0.0.4 — 2023-08-14
- 0.0.3 — 2023-08-14

## README

# SproutVideo React Implementation

This is a typescript-safe React version of SproutVideo API. It allows you to embed SV videos as a React component and use in your project (via iframes).

## Installation

`npm install react-sproutvideo`

## Usage

Import the video object

```tsx
// import at the top of the file
import {
  SproutVideoPlayer,
  type SproutVideoPlayerRef,
} from "react-sproutvideo";

export function MyVideoPlayer() {
  // create a ref to have custom controls over the video
  const videoRef = useRef<SproutVideoPlayerRef>(null);

  // render in your component
  return (
    <>
      <SproutVideoPlayer
        id="123123"
        url="https://videos.sproutvideo.com/embed/123123/456456456"
        ref={videoRef}
      />

      <button onClick={() => videoRef.current?.play()}>Play</button>
    </>
  );
}
```

## Props

```tsx
<SproutVideoPlayer
  id="123123123" // video ID
  url="https://videos.sproutvideo.com/embed/123123123/321321312" // embed Link, can contain other settings from Sprout
  className="w-[700px] h-[400px]" // className for video container, by default invisible unless you give it dimentions
  styles={{}} // same as above, I'm using Tailwind in the example
  ref={videoRef} // videoRef object
  onVideoReady={() => {
    // on video ready callback, in this case used to autoplay the video
    console.log("video ready");
    videoRef.current?.play();
  }}
/>
```

## Contibuting

All the contributions are welcome, please let me know if you want any additional features through issues.

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