Skip to content

Latest commit

 

History

History
76 lines (53 loc) · 1.55 KB

README.md

File metadata and controls

76 lines (53 loc) · 1.55 KB

use-screen-recorder

React hook for easily recording screen using MediaStream APIs.

NPM JavaScript Style Guide

Demo

Install

yarn add use-screen-recorder

Usage

import * as React from "react";

import useScreenRecorder from "use-screen-recorder";

const Example = () => {
  const {
    blobUrl,
    pauseRecording,
    resetRecording,
    resumeRecording,
    startRecording,
    status,
    stopRecording,
  } = useScreenRecorder();

  return (
    <div>
      <video src={blobUrl} />

      <small>Status: {status}</small>

      <button onClick={startRecording}>Start Recording</button>
      <button onClick={stopRecording}>Stop Recording</button>
      <button onClick={pauseRecording}>Pause Recording</button>
      <button onClick={resumeRecording}>Resume Recording</button>
      <button onClick={resetRecording}>Reset Recording</button>
    </div>
  );
};

Props

audio

A boolean value indicating if audio track should be added.

type: boolean
default: false

options

A MediaRecorderOptions object.

type: object
default: {}

License

MIT © ishan-chhabra See the LICENSE file for more information


This hook is created using create-react-hook.