未验证 提交 55d516a4 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #13710 from meatwallace/fix-detached-audio-buffer

AudioLoader: Clone buffer prior to decoding to allow reuse
......@@ -20,9 +20,12 @@ Object.assign( AudioLoader.prototype, {
loader.setResponseType( 'arraybuffer' );
loader.load( url, function ( buffer ) {
var context = AudioContext.getContext();
// Create a copy of the buffer. The `decodeAudioData` method
// detaches the buffer when complete, preventing reuse.
var bufferCopy = buffer.slice( 0 );
context.decodeAudioData( buffer, function ( audioBuffer ) {
var context = AudioContext.getContext();
context.decodeAudioData( bufferCopy, function ( audioBuffer ) {
onLoad( audioBuffer );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册