简体   繁体   中英

React JS MediaRecorder not a constructor

I am trying to build an App in which you can Record Audio on all Browsers. (Chrome, Firefox, Safari +11). So I am using the "audio-recorder-polyfill" Library to eypose it to React.

The problem is now, that if I try to call

new MediaRecorder(stream);

I get an error saying:

Unhandled Rejection (TypeError): 
__WEBPACK_IMPORTED_MODULE_2_audio_recorder_polyfill__.MediaRecorder is 
not a constructor

Now I saw examples where people dont have that problem. I just dont know where to start as I am not using Typescript as well.

The compiler can see and recognizes const stream = await navigator.mediaDevices.getUserMedia({audio: true}); But thats it.

Help would really be appreciated.

Thanks in advance

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM