Angular 记录器不是构造函数
Angular Recorder is not a constructor
在Angular8中,我想将通过浏览器捕获的音频转换为ogg格式。为此,我正在使用 opus-recorder 库:https://github.com/chris-rudmin/opus-recorder
我做到了npm install opus-recorder
const opusRecorder = require('opus-recorder');
startRecording() {
var options = {
encoderPath: './assets/encoderWorker.min.js'
};
let recorder = new opusRecorder.Recorder(options);
recorder.start().catch(function(e) {
console.log('Error encountered:', e.message );
});
}
github 存储库说 The Recorder object is available in the global namespace and supports CommonJS and AMD imports.
调用 startRecording() 时出现以下错误:
ERROR TypeError: opusRecorder.Recorder is not a constructor
我是否正确使用了库?我是否正确导入了它?可以用在Angular吗?
我通过 import * as opusRecorder from 'opus-recorder';
然后 let recorder = new opusRecorder1(options);
解决了它
在Angular8中,我想将通过浏览器捕获的音频转换为ogg格式。为此,我正在使用 opus-recorder 库:https://github.com/chris-rudmin/opus-recorder
我做到了npm install opus-recorder
const opusRecorder = require('opus-recorder');
startRecording() {
var options = {
encoderPath: './assets/encoderWorker.min.js'
};
let recorder = new opusRecorder.Recorder(options);
recorder.start().catch(function(e) {
console.log('Error encountered:', e.message );
});
}
github 存储库说 The Recorder object is available in the global namespace and supports CommonJS and AMD imports.
调用 startRecording() 时出现以下错误:
ERROR TypeError: opusRecorder.Recorder is not a constructor
我是否正确使用了库?我是否正确导入了它?可以用在Angular吗?
我通过 import * as opusRecorder from 'opus-recorder';
然后 let recorder = new opusRecorder1(options);