I am trying to record from a microphone using HTML5 in Chrome 29 Beta for Android (it turned on web audio support in beta 29). In the code below, ProcessAudio is a web audio filter function in which I receive an input buffer from a microphone. I get the correct sample size. However, the pcm audio samples in mobile chrome are always null. Does Chrome turn off input sound filters in its mobile version? Has anyone received an audio recording using HTML5 in the Chrome version of Chrome? The following code works fine in chrome (desktop version).
<!DOCTYPE HTML> <html> <head> <script> function GetMedia(obj, fnSuccess, fnFailure) { if(navigator.getUserMedia) { return navigator.getUserMedia(obj, fnSuccess, fnFailure); } else if(navigator.webkitGetUserMedia) { return navigator.webkitGetUserMedia(obj, fnSuccess, fnFailure); } else if(navigator.mozGetUserMedia) { return navigator.mozGetUserMedia(obj, fnSuccess, fnFailure); } else if(navigator.msGetUserMedia) { return navigator.msGetUserMedia(obj, fnSuccess, fnFailure); } alert("no audio capture"); } var incrementer = 0; function ProcessAudio(e) { var inputBuffer = e.inputBuffer.getChannelData(0); var outputBuffer = e.outputBuffer.getChannelData(0); outputBuffer.set(inputBuffer, 0); document.getElementById("display").innerText = incrementer + " " + inputBuffer[0]; incrementer++; } var context = null; function Success(localMediaStream) { context = new window.webkitAudioContext(); var microphone = context.createMediaStreamSource(localMediaStream); var node = context.createScriptProcessor(4096, 1, 1); node.onaudioprocess = ProcessAudio; microphone.connect(node); node.connect(context.destination); } function Error(err) { alert("no audio support"); } function load(e) { GetMedia({audio:true,video:false}, Success, Error); } </script> </head> <body onload="load(event)"> <div>Audio Player</div> <div id="display"></div> <video id="localvideo" autoplay="autoplay" style="opacity:1"></video> </body> </html>
source share