Sound from bytearray when targeting html5?

Is there a way to create sound out of bytearray when targeting html5?
loadCompressedDataFromByteArray is not implemented, AudioBuffer’s fromBytes returns null :confused:

This works okay I guess but it’s platform specific : (

 private function playSound(ba:ByteArray):Void
        context = new AudioContext();
        var arrayBuffer:ArrayBuffer = new ArrayBuffer(ba.length);
        var bufferView:Uint8Array = new Uint8Array(arrayBuffer);
        for(i in
            bufferView[i] = ba.readByte();
        context.decodeAudioData(arrayBuffer, onDecode);
    private function onDecode(audioBuffer:AudioBuffer):Void
        var source:AudioBufferSourceNode = context.createBufferSource();
        source.buffer = audioBuffer;

looks like an interesting solution,
What do you mean platform-specific?

It works only when targeting html5 :slight_smile:


but this looks like a good starting point.
I’ll try to tackle this myself as well next week.