ai / audio-recorder-polyfill

MediaRecorder polyfill to record audio in Edge and Safari
https://ai.github.io/audio-recorder-polyfill/
MIT License
584 stars 79 forks source link

How to integrate with NEXT JS #84

Closed Javeed-JargonHandlers closed 3 years ago

Javeed-JargonHandlers commented 3 years ago

I would like to integrate with next js

Please help me

ai commented 3 years ago

I do not use Next.js so I can’t help you here.

omidh28 commented 2 years ago
  async function requestRecorder() {
    const stream = await navigator.mediaDevices.getUserMedia({ audio: true })
    if (!window.AudioRecorder) {
      const polyfillModule = await import("audio-recorder-polyfill");
      const AudioRecorder = polyfillModule.default;
      window.AudioRecorder = AudioRecorder;
    }

    return new window.AudioRecorder(stream)
  }

I know, not the cleanest solution but gets the job done.

lucasotanez commented 1 year ago

I would like to integrate with next js

Hi. I forked this package and made some changes for it to work on server side rendering applications such as Nextjs. Feel free to install it using the following command:

npm install git+https://github.com/lucasotanez/audio-recorder-polyfill-next.git

Make sure to read the updated docs to get started. Hopefully it works for your use case.