'Play audio data from java ByteArray

I have a 16-bit PCM audio data from an android app and I want to stream and play it on a webpage from the format as seen on this screenshot.

Is there a way to directly play audio buffers on webpage without having a server to serve an audio file? I'm open to suggestions.

enter image description here



Solution 1:[1]

You can try using a Data Uri to map the data to a file on-the-fly and input that into something that can play an auio file from a uri (such as the HTML audio component). You could also just save this buffer to a file and play that.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ysb