react-record-webcam icon indicating copy to clipboard operation
react-record-webcam copied to clipboard

applyConstraints, mediaTrackConstraints object

Open uixmat opened this issue 1 year ago • 0 comments

Hey, amazing package! I came across this ts bug related to the mediaTrackConstraints obj in the useRecordWebcam initialisation.

// At initialization
const { applyOptions, applyConstraints } = useRecordWebcam({
  options: { fileName: 'custom-name', fileType: 'webm', timeSlice: 1000 },
  mediaRecorderOptions: { mimeType: 'video/webm; codecs=vp8' },
  mediaTrackConstraints: { video: true, audio: true } // 🪲 This line
});

// Dynamically applying options
applyOptions(recording.id, { fileName: 'updated-name' }); // Update file name
applyConstraints(recording.id, { aspectRatio: 0.56 }) // Change aspect ratio to portrait

Error:

Object literal may only specify known properties, and 'video/aduio' does not exist in type 'Partial<MediaTrackConstraints>'.ts(2353)

uixmat avatar Jun 15 '24 08:06 uixmat