Good, I am using these lines of code to send videos in base64 to a server, but from a time here they began to fail the sending of videos of more than 50 mb. I have read it to divide the file and other things, but when I do that the base 64 generates it incomplete.
InputStream is = activity.getContentResolver().openInputStream(uriFileVideo);
ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();
// this is storage overwritten on each iteration with bytes
int bufferSize = 1024;
byte[] buffer = new byte[bufferSize];
// we need to know how may bytes were read to write them to the byteBuffer
int len = 0;
while ((len = is.read(buffer)) != -1) {
byteBuffer.write(buffer, 0, len);
}
String tempData = Base64.encodeToString(byteBuffer.toByteArray(), Base64.DEFAULT);
In Base64.encodeToString the error of java.lang.OutOfMemoryError is presented: Failed to allocate to 156050688 byte allocation with 16777216 free bytes and 121MB until OOM