我正在为我的网页制作音频转录脚本,我希望它在捕获静音时停止监听用户,我可以捕获静音,但无法删除或关闭事件“ stopped_speaking”。有办法吗?如果没有,我该如何解决我的问题?谢谢。
这是我的代码:
iframe.contentWindow.console.log = function(a) { alert(a) /* nop */ };
错误:
function bg_startRecording() {
navigator.mediaDevices.getUserMedia({
video: false,
audio: true
}).then(async function(stream) {
recorder = RecordRTC(stream, {
type: 'audio',
mimeType: 'audio/wav',
recorderType: StereoAudioRecorder,
disableLogs: false,
numberOfAudioChannels: 1,
});
recorder.startRecording();
var options = {};
speechEvents = hark(stream, options);
speechEvents.on('stopped_speaking', function() {
speechEvents.off('stopped_speaking'); <----- throw an error
bg_stopRecording() //function to stop recording and transcript
});
})
};