Đang cố gắng tìm hiểu API âm thanh, nhưng tôi gặp lỗi tham chiếu Uncaught cho lớp BufferLoader. Tôi đang trên chrome và nó được cập nhật. Lớp học này có nên làm việc không có vấn đề gì không?Lỗi tham chiếu không bắt buộc BufferLoader không được xác định
<html>
<head>
<script type=text/javascript>
window.onload = init;
var context;
var bufferLoader;
function init(){
context = new webkitAudioContext();
bufferLoader = new BufferLoader(
context,
[
' https://dl.dropboxusercontent.com/u/1957768/kdFFO3.wav',
' https://dl.dropboxusercontent.com/u/1957768/geniuse%20meodies.wav',
],
finishedLoading
);
bufferLoader.load();
}
function finishedLoading(bufferList){
//make two sources and play them
var source1 = context.createBufferSource();
var source2 = context.createBufferSource();
source1.buffer = bufferList[0];
source2.buffer = bufferList[1];
source1.connect(context.destination);
source2.connect(context.destination);
source1.start(0);
source2.start(0);
}
</script>
</head>
<body>
</body>
</html>
đâu là tài liệu cho này 'BufferLoader'? Bạn đang nói về 'Bộ đệm tải 'từ đây http://chromium.googlecode.com/svn/trunk/samples/audio/doc/loading-sounds.html hoặc tại đây https://code.google.com/p/chromium /source/browse/trunk/samples/audio/doc/resources/buffer-loader.js?r=2681? – Ian
API âm thanh web của nó. nó sẽ hoạt động ngay trên hộp trong chrome. – oxxi
Tôi không nghĩ vậy. Như bạn có thể thấy trong các liên kết được cung cấp (và một số khác mà tôi đã tìm thấy), nó là một hàm tùy chỉnh mà bạn phải khai báo và sử dụng. – Ian