Javascript 如何在Firefox中停止音频播放&使用source.connect()hack

Javascript 如何在Firefox中停止音频播放&使用source.connect()hack,javascript,firefox,audio,getusermedia,Javascript,Firefox,Audio,Getusermedia,我正在开发一个webapp,它使用recorder.js部分录制一些音频,并将其发送到服务器。我正试图以Firefox为目标,因此我必须使用此黑客来防止音频源被切断: // Hack for a Firefox bug that stops input after a few seconds window.source = audio_context.createMediaStreamSource(stream); source.connect(audio_context.destination

我正在开发一个webapp,它使用recorder.js部分录制一些音频,并将其发送到服务器。我正试图以Firefox为目标,因此我必须使用此黑客来防止音频源被切断:

// Hack for a Firefox bug that stops input after a few seconds
window.source = audio_context.createMediaStreamSource(stream);
source.connect(audio_context.destination);
我认为这会导致音频通过电脑扬声器播放,但我不确定。说到网络音频,我是个新手。我的目标是消除扬声器中播放的音频

编辑:


这里有一个指向Github上我的JS文件的链接:

您必须将源连接到用于检索要记录的数据的节点,将this.node替换为您分配给YOUR的变量名或用于处理的节点

window.source.connect(this.node);
//this.node.connect(this.context.destination);

编辑:刚刚选中,连接到目的地不是必须的,还要确保您的节点变量不会被垃圾收集,我假设在您的情况下会发生这种情况,因为录制会在几秒钟后停止。

谢谢,但它仍然不起作用。我相信输入中断是Firefox中一个有记录的bug。我为这个项目在Github repo中添加了一个指向我的原始帖子的链接。