angular web audio recorder - problem with importing libraries

572 Views Asked by At

What I want to achive: I am trying to build an angular app, where I can record audio from the browser. Some of the libraries I tried work ok, but I am getting .wav files which are too big. I want to eventually get a small file, preferably mp3. I have done some research and tried several libraries:

  • mic-recorder-to-mp3
  • recordmp3js
  • web-audio-recorder-js
  • recordrtc(with MediaStreamRecorder I was able to get a small size of the audio, but it is taking a very long time to get it - for example, from ending a recording till it appeared in an audio element )

Most of the time I'm stumbling upon errors about missing modules or that a file cannot be found. As far as I read mp3 cannot be recorded directly from the browser, but needs to be converted to first. The libraries that I tried have references to other libraries, like lamejs for converting.

Currently I am trying to use web-audio-recorder-js.

I installed it through:

npm install --save web-audio-recorder-js

Then I just wanted to instantiate the WebAudioRecorder (temporarily passed null, just to see if it's working, also tried with 'real' argumentes)

but I am getting

ERROR in ./node_modules/web-audio-recorder-js/index.js
Module not found: Error: Can't resolve './lib-minified/Mp3LameEncoder.min.js.mem.min' in 'D:\projekty 2020\web audio\webaudio\node_modules\web-audio-recorder-js'
ERROR in ./node_modules/web-audio-recorder-js/lib-minified/WebAudioRecorderMp3.min.js
Module not found: Error: Can't resolve 'fs' in 'D:\projekty 2020\web audio\webaudio\node_modules\web-audio-recorder-js\lib-minified'

Screenshot of package and angular.json

I'm guessing that I am doing something wrong while importing - I would be very grateful if someone could point me towards a solution.

Using: Angular CLI: 8.3.29 Node: 12.18.3

0

There are 0 best solutions below