This is my code, but the second split of the video is different, therefore when combining the split parts the video plays the first split but the second part it does not.
int bufferSize = (int) video_size_bytes;
byte[] buffer = new byte[bufferSize];
ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();
int len = 0;
try {
while ((len = inputStream.read(buffer)) != -1)
{
byteBuffer.write(buffer, 0, len);
}
} catch (IOException e) {
e.printStackTrace();
Log.i(PostsActivity.TAG, "IOException: " + e.getMessage());
}
int offset = 0;
int addition = 100000;
int length = 100000;
int limit = (int) video_size_bytes;
boolean stop_loop = false;
boolean loop_mock = true;
do{
//Converting bytes into base64
String video_string_raw = Base64.encodeToString(byteBuffer.toByteArray(), offset, length, Base64.DEFAULT);
String video_string_raw_refined = video_string_raw.trim();
video_string = video_string_raw_refined.replaceAll("\n", "");
video_parts_array_string.add(video_string);
if(stop_loop){
break;
}
offset = offset + addition;
if((offset+addition) > limit){
length = limit-offset;
stop_loop = true;
}else{
offset = offset + addition;
}
}while(loop_mock);