Hello guys, So I am using rememberLauncherForActiv...
# android
s
Hello guys, So I am using rememberLauncherForActivityResult to start a camera activity(to take a video). I've been able to successfully retrieve the uri of the video. Now I want to be able send this video over a server, but I have to send it as a ByteArray, so my question is what is the best way to convert a video uri to a ByteArray in kotlin? There seems to lack a lot of guides on video, but only for images, string etc and they are also mostly done on java too
m
Hi, this link form stackoverflow could give you an idea about it. https://stackoverflow.com/questions/10296734/image-uri-to-bytesarray
s
Thanks, I'll look into that
I am actually making use of the first answer but then I encountered a memory error, but I'll have a look at the others as well
lol actually just noticed the owner made some changes to the answer on this new post. Thanks again
m
@shock 11 👏
s
@marlonlom it seems this method isn't recommended for large videos. So I will have to find some other way
m
🤔 ... @shock 11 try this: https://stackoverflow.com/questions/7913384/how-to-convert-video-from-uri-to-byte in large videos, try to do this using coroutines and/or workmanager, as this could be a background operation
👍 1
s
yeah that's also a nice suggestion. I will consider that thank you