我正在嘗試通過 React 應用程序從瀏覽器記錄 wav 并將其發(fā)送到我的 nodeJS API。這在原型 html5 示例中工作正常。但現(xiàn)在我將其移至 React/Typescript。我對打字稿很陌生,所以一切都感覺有點hacky。我正在使用 RecordRTC,到目前為止的代碼是:聲明文件,因為 recordRTC 沒有 @types/recordrtc:declare module "recordrtc";實際代碼:startRecording() { this.record = true this.captureUserMedia((stream: any) => { this.recordAudio = RecordRTC(stream, { recorderType: 'StereoAudioRecorder', type: 'audio', mimeType: 'audio/wav' }); this.recordAudio.startRecording(); }); }當我調(diào)用 startRecording 時,我得到了這個:Uncaught TypeError: Recorder is not a constructor at initRecorder (RecordRTC.js:87) at Object.startRecording (RecordRTC.js:70) at PracticeScreen.tsx:143chrome 瀏覽器中顯示的是:我猜它與 .d.ts 文件有關,但我什至不知道從哪里開始。
RTCRecorder:TypeError Recorder 不是構(gòu)造函數(shù)
猛跑小豬
2021-09-30 15:29:48