How to convert JS Audio Blob to Binary Data

I have been using the below components from the forge:

https://www.outsystems.com/forge/component-overview/7350/pwa-core
https://www.outsystems.com/forge/component-overview/7997/pwa-camera-microphone
In attempts to create a reactive web app that will allow the user to record audio from their microphone. I would then like to express this recorded audio as Binary Data within outsystems so that I can use this component:
https://www.outsystems.com/forge/component-overview/2929/aws-s3-extension
To upload that recorded audio to an S3 Bucket.

At the moment, the recorded audio is stored as a blob in JS, and can only be expressed in Outsystems as an Object, which is no good to me. I need it to be a Binary Data variable.
If I try to output the JS blob into a Binary Data variable, the variable seems to contain some data but can't be used by Outsystems actions (i.e. If I try to store the Binary Data in a database, a new record will be created but the data itself is not written to the db).

I've also attempted to implement my own version of the plugin using RecordRTC, and again get to the point where I have a JS blob that contains my recording, and I cant convert it to something useful to me.

Any help would be greatly appreciated, thank you.

Solution

Hi Bryce,

Maybe the following component can help to convert your blob to base64 and from there to binary?

https://www.outsystems.com/forge/component-overview/3242/binarydata-client-side 

Regards,

Daniel

Solution

Hey Daniël,

Thank you for your suggestion! That ended up working perfectly!
I initially had some difficulty getting the Base64 string out of my JS node due to some scoping issues, but after I managed to get it out and removed the preamble from the start of the Base64 string, it all worked perfectly!
Thank you again for your time, I greatly appreciate it!
-Bryce