@andoto/react

1.0.5 • Public • Published

@andoto/react

https://www.npmjs.com/package/@andoto/react

Installation

NPM: npm install @andoto/react --save

Yarn: yarn add @andoto/react

How to use

import React from "react";
import { Video, useVideoControls } from "@andoto/react";

const MyComponent = props => {
  const videoId = `yourVideoId`;
  const controls = useVideoControls(videoId);

  return (
    <div>
      <Video id={videoId} />
      <button onClick={() => controls.play()}>Play Video</button>
      <button onClick={() => controls.pause()}>Pause Video</button>
    </div>
  );
};

export default MyComponent;

Video Controls

play(): Promise<void, (Error)>

Play the video, if it is paused.

controls
  .play()
  .then(() => {
    // the video is now playing
  })
  .catch(error => {
    console.error(error);
  });

Readme

Keywords

Package Sidebar

Install

npm i @andoto/react

Weekly Downloads

1

Version

1.0.5

License

ISC

Unpacked Size

268 kB

Total Files

5

Last publish

Collaborators

  • davekiss