I need to send the video to the webservice in .net, im send the base64 encode string if the video is about 2 MB or 6 seconds 7 seconds everything is fine, but when the more serious reasons are outofmemoryerror when I do Bas.encode [byte []);
This is my code:
videoPath = getRealPathFromURI(fileUri); File tmpFile = new File(videoPath); in = null; in = new BufferedInputStream(new FileInputStream(tmpFile)); bos = new ByteArrayOutputStream(); long tamano = tmpFile.length(); int iTamano = (int) tamano; byte[] b = new byte[iTamano]; int bytesRead; while ((bytesRead = in.read(b)) != -1) { bos.write(b, 0, bytesRead); } ficheroAEnviar = bos.toByteArray(); try { strBase64 = Base64.encode(ficheroAEnviar); } catch (Exception e) { correcto = false; e.printStackTrace(); }
Failure in this line: strBase64 = Base64.encode (ficheroAEnviar);
rbrlnx
source share