Skip to content

jagonzalr/useMediaRecorder

Repository files navigation

npm version

useMediaRecorder

MediaRecorder API using React hooks.

Table of Contents

Getting started

npm install --save use-media-recorder

  • Supports both video audio and audio only recordings.
  • Currently it generates video/webm and audio/webm.

Usage

Video and audio

import { useMediaRecorder } from 'use-media-recorder'
const [isRecording, setIsRecording] = useState(false)
const [setCaptureRef, data, err] = useMediaRecorder({ isRecording })

Audio only

import { useMediaRecorder } from 'use-media-recorder'
const [isRecording, setIsRecording] = useState(false)
const [setCaptureRef, data, err] = useMediaRecorder({ isRecording, audioOnly: true })

Full example can be found here

Demo

git clone [email protected]:jagonzalr/useMediaRecorder.git
cd useMediaRecorder
npm intall
npm start

License

useMediaRecorder is MIT licensed.