I'm making a video with Google Glass and want to encode it into a Base64 String. When I'm trying to do this I always get an "OutOfMemoryException". The coding looks like the following:
File mFile = new File(this.mNotification.getVideo());
if (mFile.exists()) {
try {
InputStream is = new FileInputStream(mFile);
try {
byte[] bytes = org.apache.commons.io.IOUtils.toByteArray(is);
byte[] value = org.apache.commons.codec.binary.Base64.encodeBase64(bytes);
this.mNotification.setVideo(new String(value));
} catch (IOException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
I only have the opportunity to send the video as a Base64 String...