AudioContext createScriptProcessor随机停止,没有错误

时间:2014-12-07 02:59:52

标签: javascript web-audio

我将麦克风输入节点getUserMedia({audio:true})连接到createScriptProcessor节点,onaudioprocess事件回调刚停止发生,我无法弄清楚原因。

我打印出每个回调的事件。中间的一个看起来像这样:

AudioProcessingEvent {outputBuffer: AudioBuffer, inputBuffer: AudioBuffer, playbackTime: 5.479909297052155, clipboardData: undefined, path: NodeList[0]…}
bubbles: true
cancelBubble: false
cancelable: false
clipboardData: undefined
currentTarget: ScriptProcessorNode
defaultPrevented: false
eventPhase: 0
inputBuffer: AudioBuffer
outputBuffer: AudioBuffer
path: NodeList[0]
playbackTime: 5.479909297052155
returnValue: true
srcElement: ScriptProcessorNode
target: ScriptProcessorNode
timeStamp: 1417920765179
type: "audioprocess"
__proto__: AudioProcessingEvent

最后一个看起来像这样:

AudioProcessingEvent {outputBuffer: AudioBuffer, inputBuffer: AudioBuffer, playbackTime: 5.944308390022676, clipboardData: undefined, path: NodeList[0]…}
bubbles: true
cancelBubble: false
cancelable: false
clipboardData: undefined
currentTarget: ScriptProcessorNode
defaultPrevented: false
eventPhase: 0
inputBuffer: AudioBuffer
outputBuffer: AudioBuffer
path: NodeList[0]
playbackTime: 5.944308390022676
returnValue: true
srcElement: ScriptProcessorNode
target: ScriptProcessorNode
timeStamp: 1417920765643
type: "audioprocess"
__proto__: AudioProcessingEvent

对我来说没什么不同。我希望该活动包含某种通知。或者至少在控制台中出错。

有没有办法绑定某种错误事件或什么?我不确定如何进一步解决问题。有时它会在一毫秒后停止。分钟后有时候。我似乎无法确定问题所在。

1 个答案:

答案 0 :(得分:3)

这听起来像垃圾收集。你能指出代码吗?