简体   繁体   中英

convert video files to byte array in android

In my android application i am recording and saving the file in sdcard. Now i would like to convert this saved file to byte array and sent it to the server.

Could anyone please let me know as how can i convert video files to byte array

Please forward your valuable suggestions.

Thanks in advance :)

try this:

String strFile=null;
File file=new File(pathOnSdCard);
try {
byte[] data = FileUtils.readFileToByteArray(file);//Convert any file, image or video into byte array
strFile = Base64.encodeToString(data, Base64.NO_WRAP);//Convert byte array into string
} catch (IOException e) {
e.printStackTrace();
}
return strFile;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM