我有一个简单的aurelia.js应用程序,它应该使用recorder-js录制音频。
我正在使用一个名为"simple-recorderjs-demo“的github项目的代码来启动一个recorder-js记录器。它在他们的演示中工作得很好,这是现场https://addpipe.com/simple-recorderjs-demo/。
但是在我创建的记录器对象上不存在函数".record()“。我怎么才能让它工作呢?
https://github.com/addpipe/simple-recorderjs-demo/blob/master/js/app.js
发布于 2020-07-05 13:29:10
第一种解决方案: app.html
<template>
<button click.trigger="startRecording()" id="recordButton">Record</button>
</template>app.ts
export class App {
gumStream: any;
rec: any;
input: any;
AudioContext = window.AudioContext;
audioContext: AudioContext;
startRecording(){
// copy code from example here without dom elements refs
}
}第二种解决方案:
attached() {
// all magic with dom/jquery plugins, etc here
let recordButton = <HTMLButtonElement>document.getElementById("recordButton");
recordButton.addEventListener("click", this.startRecording);
}
startRecording(){
// code here
// don't use native html elements(like document.getById('#id')) here
}更新添加示例https://gist.dumber.app/?gist=c04207dc496d5bb5a0344983497a7c18
https://stackoverflow.com/questions/62730802
复制相似问题