abd*_*ral 8 audio html5 microphone capture
有人可以帮助我如何使用HTML5从默认麦克风捕获音频?有许多样本可用,但它们似乎都没有工作.我尝试使用HTML5进行音频捕获 因为它只适用于启用了标志的chrome.但它得到了NavigatorUserMediaError.地址栏上的视频图标有一个红色十字标志,其工具提示显示"此页面已被阻止访问您的摄像头和麦克风"
关于HTML5 Rocks有一些很棒的文章.这只是我拉的一个. http://updates.html5rocks.com/2012/09/Live-Web-Audio-Input-Enabled
// success callback when requesting audio input stream
function successCallback(stream) {
var audioContext = new (window.webkitAudioContext)();
// Create an AudioNode from the stream.
var mediaStreamSource = audioContext.createMediaStreamSource( stream );
// Connect it to the destination to hear yourself (or any other node for processing!)
mediaStreamSource.connect( audioContext.destination );
}
function errorCallback() {
console.log("The following error occurred: " + err);
}
navigator.webkitGetUserMedia( {audio:true}, successCallback, errorCallback );
Run Code Online (Sandbox Code Playgroud)