Open iliasmal opened 3 weeks ago
Just a few minutes ago, I added a function to catch download url and function to request file download from the C#.
If you want to download a file with a pure C# implementation, you may find UnityWebRequest useful.
Thank you for your quick answer.Everything works fine! I have one problem, though, and I don't know how to tackle it. When I get the download url, it points to a blob (blob:https://dddd.com/hgdjhsd-asdasdasd- and so on). How can I read the bytes of this? I know this hasn't anything to do with your work, but I hope if you could point me to the right direction...
Thank you again!
To read file data from the blob url, you need to get a base64 string from the blob url. you can get file byte data from base64 string. Here is a sample code.
Thank you again!!! I have tried the code and it closes (crashes) the app when it sends the unitySendMessge. If I replace base64data with a string, everything works ok (I mean the callback works.). I have tried many things in the js call, but nothing seems to work. I have even tried to override the mime type and change the responseType, but nothing happened... Do you have any ideas?
Sorry for late reply, this problem because Java cause stack overflow when pass the too large string (like image file), I'm currently implementing map string buffer to memory and send pointer to C# ...
That will be great! Thank you for your time and effort!
In the latest update I added a sample to get base64 string from blob url and map base64 string to java's ByteBuffer. It can also be accessed from the C# side, but at the moment it can't be accessed with a pointer, but it can avoid an app crash (stack overflow) with a 3000KB file. Note that the mapped buffers contain the data url scheme in the head (like "data:
My files are well over 5mbs, but I will try.
Thank you!
Hello. Thank you very much for this asset. I have only one question. Is it possible to handle any file download inside Unity and not through the native plugin? Or, can I have in Unity the download link that I click on inside WebView?
Thank you in advance.