React hook for easily recording screen using MediaStream APIs.
yarn add use-screen-recorder
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>
);
};
A boolean value indicating if audio track should be added.
type: boolean
default: false
A MediaRecorderOptions
object.
type: object
default: {}
MIT © ishan-chhabra See the LICENSE file for more information
This hook is created using create-react-hook.