Git Product home page Git Product logo

react-record-webcam's People

Contributors

dependabot[bot] avatar gabrielcartier avatar indreshp135 avatar kidqueb avatar samuelweckstrom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-record-webcam's Issues

How to close webcam on component unmount?

Tried this in useEffect cleanup:

useEffect( () => () => recordWebcam.close(), [recordWebcam] );

but it fires every time recordWebcam changes, so will close when it opens.

Fix MediaRecorder is not defined on SSR

When i using with SSR, I got this error.

[1] ReferenceError: MediaRecorder is not defined
[1]     at /Users/xxx/video_recorder/codec.ts:63:5
[1]     at Array.forEach (<anonymous>)
[1]     at containers.reduce.mimeType (/Users/xx/video_recorder/codec.ts:61:11)

So, in the codec.ts should add check typeof MediaRecorder !== 'undefined'
Thanks

NPM Dependency error

I was using this the other week, and it was fine. Now working on a new project I tried downloading it, and it states that there is a dependency error.

npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: [email protected] npm ERR! Found: [email protected] npm ERR! node_modules/react npm ERR! react@"^18.2.0" from the root project npm ERR! peer react@"^18.0.0" from @testing-library/[email protected] npm ERR! node_modules/@testing-library/react npm ERR! @testing-library/react@"^13.4.0" from the root project npm ERR! 4 more (react-dom, react-router, react-router-dom, react-scripts) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"^16.3" from [email protected] npm ERR! node_modules/react-record-webcam npm ERR! react-record-webcam@"^0.0.18" from the root project npm ERR! npm ERR! Conflicting peer dependency: [email protected] npm ERR! node_modules/react npm ERR! peer react@"^16.3" from [email protected] npm ERR! node_modules/react-record-webcam npm ERR! react-record-webcam@"^0.0.18" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See /Users/example/.npm/eresolve-report.txt for a full report.

Feels like it should be fine since all the dependency is asking for is any version of react newer than 16.3, but I might be missing something here. Any help would be greatly appreciated

Pass mimeType option not working

I try pass mimeType to options props is "video/mp4" but the output is always "video/x-matroska;codecs=avc1,opus".
Seems mimeType option is not working.

License

Which license is your library under?

Thank you in advance.

Long recordings fail on iOS

Attempting to record videos which are too big (I've found this to be about 4 minutes at 480x720) results in a failure and no video data saved on iOS. Users of my app have reported this problem on various (new) iPhone models, and I have reproduced the failure on an iPhone X. The dataavailable event has data.size of 0, and as a result the recording is left with status = "RECORDING" and no objectURL. This seems to be a result of calling recording.recorder.start() with no parameters instead of specifying a timeslice. Other platforms I have tested (Chrome on Android and Chrome on macOS) are able to record longer videos without a problem, but it seems that on iPhone, trying to get the entire video in a single Blob can be problematic.

Getting recorded video object

Hi, thanks for this great package.
I want to access to the recorded video in order to upload to my webserver. But I couldn't figure out how to get recorded video object. Can you give me an example?

Thanks.

File type change and undefined id

Hi there,

I have a an issue/question, not sure if its on my end im doing something wrong

I have a start func

  const start = async () => {
    if(activeRecordings.length){
      await clearAllRecordings()
    }
    const recording = await createRecording();
    if (recording && recording.id) {
        const rec = await openCamera(recording.id);
        if(rec){
          setIsCameraOn(true)
        }
        setRecordingId(recording.id);
      }
  };

which is being by a useEffect when the user enters the page, that way the camera opens automatically.
However when doing that the recording id is always "undefined-undefined"

image

MediaRecorder is not defined

i've seen a similar error patched recently but i'm still having a problem. i've run quite a few different tests but this time, just by copying the demo code, it doesn't work and this error appears. I can't find a solution. As long as = useRecordWebcam() is in the code, it won't start with this error...
ReferenceError: MediaRecorder is not defined
image

can't run demo

all npm run options failing with the error of

Cannot find module 'react-record-webcam' or its corresponding type declarations.

getting only blobChunks and no complete blob

I used the example:

  async function record() {
    const recording = await createRecording();
    await openCamera(recording.id);
    await startRecording(recording.id);
    await new Promise((resolve) => setTimeout(resolve, 3000)); // Record for 3 seconds
    const recorded = await stopRecording(recording.id);
    console.log(recorded)

    // Upload the blob to a back-end
    const formData = new FormData();
    formData.append('file', recorded.blob, 'recorded.webm');
  };

however there is no such thing as recorded.blob, I have only see a blobChunks array

according to the doc I should receive chucks and complete blob

How to Add Duration Metadata to WebM Files

Hello,

I am currently working on a project that requires video recording and this library works pretty well and straight forward to use.

However, I've noticed that the WebM files it produces lack duration metadata, which we need to display the video duration. For video display, we're using Vidstack.

I've discovered a library called fix-webm-duration that seems capable of adding duration metadata to the WebM Blob. I was wondering if there are other solutions available for this issue.

Any assistance would be greatly appreciated!

Edit Webcam Recorder

Hi,
I was wondering is there any possible way to edit the size of the webcam itself and have audio on for the playback clips
Thank you

How can someone send the recorded video to an api?

Hi dear developers, I am not so professional at react and js, I just integrated your project into my own and it works well so far.

Just wondering if there is any way to send the recording directly to a given api? and how would you implement it.

Thank you.

Camera IOS not working

Opening a Project with default hook on ios doesn't work.

If you open the Camera you get a permission Request for mic and Camera but only a blackscreen.
No Video is Captured.

Using: IPhone 13 Pro Max
Browser: Chrome / Safari

Error trying to record on osx

Screenshot 2024-01-31 at 00 18 02 recording always ends up with this ERROR non specified.

Im on OSX latest trying it firefox webdev latest.

Is there a way to bette debug understand why this happens?

In the browser i seem to get a

Uncaught (in promise) DOMException: MediaRecorder constructor: video/webm;codecs=vp9 indicates an unsupported codec
    startRecording index.js:365
    __async index.js:36
    __async index.js:20
    startRecording index.js:360
    quickDemo App.tsx:42
3 [index.js:365:6](http://localhost:5173/node_modules/.pnpm/[email protected][email protected]/node_modules/react-record-webcam/dist/index.js)

Im using your demo from the repro. after initial camera select and click record it fails.
Camera is shown though.

It seems to always use the v9 code no matter what i set the property to in the demo

const options = {  mimeType: 'video/webm;codecs=avc1' }

  const {
    activeRecordings,
    cancelRecording,
    clearPreview,
    closeCamera,
    createRecording,
    devicesByType,
    devicesById,
    download,
    muteRecording,
    openCamera,
    pauseRecording,
    resumeRecording,
    startRecording,
    stopRecording,
  } = useRecordWebcam(options);

I probably need an older codes to be cross browser compatible but the options object seems to be not picked up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.