My webapp should be hosted on a website and it should receive an MP3 audio in runtime to then reproduce through the AudioSource.
Due to webgl limitation I cannot pass directly the mp3 audio to the unity app so the backend of the webstite converts the generated audio first into an array of bytes and then into a string to be able to be attached to a SendMessage call.
The problem is when I get this data and reverse the process, string to array of byte is fine but I haven’t found any way to convert that [ ]byte back to an mp3/audioclip.
Keep in mind that WebGL has significanrt limitation especially in the area of saving/writing files locally so most of the solutions I found online are not working.
These are all the methods I use to get the MP3 from the website backend, first I get a string (which in this case is the same so I can test it locally on editor), then I turn it into an array of bytes and then I should get an AudioClip.
This system works like a charm on editor but it fails on WebGL probably where I do insert the path for UnityWebRequestMultimedia but I’m not sure since documentation about this topic seems pretty rare.
Hmmm how big is that MP3? You are extremely limited in how much you can save with the File API in WebGL. 10 MB is the maximum (all files, not single file).
File size shouldn’t be an issue since I’ve tried to save the generated MP3 on editor and its weight its 82,4 KB.
Consider that everytime a new audio gets generated I can dispose or overwrite the old one to save storage.
I don’t know any of the APIs you mentioned tho, can you explain how they works or link to a documentation?