fbaiodias / react-video-recorder

https://react-video-recorder.vercel.app/
MIT License
189 stars 155 forks source link

Feature request #55

Open asadrazashah opened 4 years ago

asadrazashah commented 4 years ago

Options for aspect ratio and video resolution ?

Jonnathangte68 commented 4 years ago

Any update about this?

asadrazashah commented 4 years ago

The recorder component accepts constraint as a prop that can be used to add different resolutions .

agrezo commented 4 years ago

You can set video resolution with constraints.

constraints={{
  audio: true,
  video: {
     width: 1280,
     height: 720,
  },
}}

More details here: https://developer.mozilla.org/fr/docs/Web/API/MediaDevices/getUserMedia

rorlich commented 10 months ago

On android devices it seems the constraints does not take any effect.

           <VideoRecorder
              countdownTime={0}
              timeLimit={secondsPerQuestion * maxQuestions * 1000}
              constraints={{ audio: false, video: { width: 1280, height: 720 } }}
              className="react-player absolute top-0 left-0 w-full h-full"
              onRecordingComplete={(videoBlob) => {
                console.log("videoBlob", videoBlob);
                // do something
              }} 
              onRecordingError={(err) => {
                console.log("err", err);
              }}
              onStartRecording={() => {
                // do something
              }}
              onStopRecording={() => {
                // so something
              }}
            />

the output video file on Android device ignore the constraints and the video is:

  1. resolution is 640x480 (should be 720x1280)
  2. with audio (should be without)
  3. without creation time metadata

on iOS and desktops, it works as expected. anyone know how to make it work on Android?

simonho1025 commented 3 months ago

You can set video resolution with constraints.

constraints={{
  audio: true,
  video: {
     width: 1280,
     height: 720,
  },
}}

More details here: https://developer.mozilla.org/fr/docs/Web/API/MediaDevices/getUserMedia

worked for me after set width and height, even on Android