react-media-recorder icon indicating copy to clipboard operation
react-media-recorder copied to clipboard

MediaConstraints object not working

Open SahilMahadwar opened this issue 3 years ago • 0 comments

Hey can anyone please tell me how to pass the MediaConstraints object properly I tried many things but nothing seems to be working

here is my code

import React from 'react';
import { useReactMediaRecorder } from 'react-media-recorder';

export default function test() {
  const Constraints = {
    audio: true,
    video: {
      width: {
        min: '300',
        max: '640',
      },
      height: {
        min: '200',
        max: '480',
      },
    },
  };

  const { status, startRecording, stopRecording, mediaBlobUrl, error } =
    useReactMediaRecorder(Constraints);

  return (
    <div>
      <p>{status}</p>
      <p>{error}</p>
      <button onClick={startRecording}>Start Recording</button>
      <button onClick={stopRecording}>Stop Recording</button>
      <video src={mediaBlobUrl} controls autoPlay loop />
    </div>
  );
}

it will be a lot of help for me thank you

SahilMahadwar avatar Jan 19 '22 15:01 SahilMahadwar