| 2678 | readAsArrayBuffer(); |
| 2679 | |
| 2680 | function concatenateBuffers() { |
| 2681 | var byteLength = 0; |
| 2682 | buffers.forEach(function(buffer) { |
| 2683 | byteLength += buffer.byteLength; |
| 2684 | }); |
| 2685 | |
| 2686 | var tmp = new Uint16Array(byteLength); |
| 2687 | var lastOffset = 0; |
| 2688 | buffers.forEach(function(buffer) { |
| 2689 | // BYTES_PER_ELEMENT == 2 for Uint16Array |
| 2690 | var reusableByteLength = buffer.byteLength; |
| 2691 | if (reusableByteLength % 2 != 0) { |
| 2692 | buffer = buffer.slice(0, reusableByteLength - 1) |
| 2693 | } |
| 2694 | tmp.set(new Uint16Array(buffer), lastOffset); |
| 2695 | lastOffset += reusableByteLength; |
| 2696 | }); |
| 2697 | |
| 2698 | var blob = new Blob([tmp.buffer], { |
| 2699 | type: type |
| 2700 | }); |
| 2701 | |
| 2702 | callback(blob); |
| 2703 | } |
| 2704 | }; |
| 2705 | })(); |
| 2706 | |