|
@@ -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 );
|
|
|
|