Chrome网络音频不播放我的音频
问题描述:
我只是有最基本的(我认为)实现Chrome的Web音频。Chrome网络音频不播放我的音频
我在Chrome 13上启用了网络音频,但我的声音无法播放。我看到它被加载(http://pieterhordijk.com/sandbox/html5-audio-api/webkit-audiocontext-interface),但它只是不玩。
window.onload = init;
var context;
var source;
function loadSample(url) {
var request = new XMLHttpRequest();
request.open("GET", url, true);
request.responseType = "arraybuffer";
request.onload = function() {
source.buffer = context.createBuffer(request.response, false);
source.looping = true;
source.noteOn(0);
}
request.send();
}
function init()
{
context = new webkitAudioContext();
source = context.createBufferSource();
loadSample("/sandbox/test.oga");
}
答
好吧,我自己找到答案我不得不将它连接到输出。
source.connect(context.destination);