Author Topic: AudioContext().createScriptProcessor().onaudioprocess never gets called  (Read 3613 times)

0 Members and 1 Guest are viewing this topic.

REDACTED

  • Guest
Hiya! So I've got a tiny little hacked together website, and one of the hacked together features on my tiny little website is a live audio streaming service. What I do with this is I take input from the mic, use AudioContext's script processors to get at the raw data, then use lamejs to encode it and websockets to ship it all off. This works just peachy on every browser I've tried. Chrome, Firefox, Firefox for Android, Opera for Android, all that good stuff. Problem is, it doesn't work on Avast SafeZone. It seems to work okay, up until my script gets to the point where it passes the torch off to the script processor. The script processor's onaudioprocess triggers lamejs to start encoding and that entire half of the process, but it just never gets called. Any idea what's up?

To test things, I wrote this bit of script into the console and stopped when something went wrong.

Code: [Select]
var stream; // Will hold our microphone stream.
var promise = navigator.mediaDevices.getUserMedia({audio: true}).then(function(s){stream = s}); // Ask permission for the mic stream.
var context = new AudioContext(); // Create a new WebAudio Audio Context.
var processor = context.createScriptProcessor(4096, 2, 0); // Create a script processor node to access all the raw audio samples.

processor.onaudioprocess = function(e) {console.log('literally anything')}; // This *should* get called like 10 times a second, right? But it never does.

mic = context.createMediaStreamSource(stream); // Introduce our media stream into the audio context.
mic.connect(processor); // And plug it into our processor and watch in amazement as nothing happens. :P