有人可以帮助我如何使用
HTML5从默认麦克风捕获音频?
有许多样本可用,但它们似乎都没有工作.
我试过 Audio capturing with HTML5
因为它只适用于启用了标志的chrome.但它得到了NavigatorUserMediaError.地址栏上的视频图标带有红色十字标志,其工具提示显示“此页面已被阻止访问您的相机和麦克风”
有许多样本可用,但它们似乎都没有工作.
我试过 Audio capturing with HTML5
因为它只适用于启用了标志的chrome.但它得到了NavigatorUserMediaError.地址栏上的视频图标带有红色十字标志,其工具提示显示“此页面已被阻止访问您的相机和麦克风”
解决方法
关于HTML5 Rocks有一些很棒的文章.这只是我拉的一个.
http://updates.html5rocks.com/2012/09/Live-Web-Audio-Input-Enabled
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 );