1.0.5 • Published 3 years ago

@andoto/react v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

@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);
  });
1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago