javascript – Error: Uncaught (Promised) DOMException: Unable to Decode Audio Data – Decode Audio Context

I create an audio player using an audio context. This audio context receives small packets of audio file table buffer (.wav) from the API for each API call. When encoding this buffer, an extraction error, such as audio data, is impossible to decode. Code snippet shown below. This error is generated for both browsers (chrome and firefox).

context = new AudioContext ();
getAudioBuffer () {

                                this.service.getBufferPackets (). subscribe (data => {
var arrayBuffer = new ArrayBuffer (data.byteLength);
var bufferView = new Uint8Array (arrayBuffer);
for (i = 0; i < data.byteLength; i++) {
                bufferView[i] = data[i];

              this.context.decodeAudioData(arrayBuffer, (buffer)=> {
this.buf = buffer; ();
this.getAudioBuffer ();
}, error => {


to play() {
// Create a source node from the buffer
var source = this.context.createBufferSource ();
source.buffer = this.buf;
// Connect to the last output node (the speakers)
source.connect (this.context.destination);
// Play immediately
source.start (0);

Here, the service call is asynchronous.

Service call:

public getBufferPackets (): observable {
return this.http.get ("api / controller / GetParallelAudioBytePackets", {responseType: "arraybuffer"});

Error: Uncaught (Promised) DOMException: Unable to Decode Audio Data


         public byte[] ReplaceOldAudioPackts () {
MemoryStream outStream = new MemoryStream ();

NAudio.Wave.WaveFormat waveFormat = new NAudio.Wave.WaveFormat (8000, 16, 1);
using (WaveFileWriter writer = new WaveFileWriter (outStream, waveFormat))
writer.Write (combinesBytes, 0, combinesBytes.Length);
return outStream.ToArray ();

Here byte[] combinesBytes is the bytearray wav files. This varies for each call.

Please tell me any solution to resolve this error.

Trump's speech in prime time on the government's closure

President Donald Trump will hold court in court tonight as he delivers the speech of the Oval Office of

hope to convince the American public and skeptical lawmakers that there is a crisis on the southern border. latest avant-garde news

His goal: to get billions of dollars of funds to build the "big, beautiful" wall he promised in a context of partial closure of the government that has no end.
Read more


Java – Future Objects / Promised in Controllers – Best Practice – MVC

Today, I was reviewing articles related to Futures and Callables and thinking about best practices for working in a VMC-based environment.

I was wondering if it was necessary to create Future objects in the controllers and force the service classes to return a Future object.
I have a case where a particular API needs to get data from two different services and doing with Futures in Controllers will not block the second (or third …) call to another third party service. This seems like the right idea and a wise choice.

But it seems complicated. In thinking a little more, I thought that creating a common service and hiding all future third-party API objects and calls seemed fine. As this makes everything non-blocking and that controllers do not feel like services.

What path should we follow?