How to download video from url with pieces both on the server and on the client side.
HttpURLConnection connection =
(HttpURLConnection) url.openConnection();
connection.setRequestProperty("Range",
"bytes=" + downloaded + "-");
connection.connect();
if (connection.getResponseCode() / 100 != 2) {
error();
}
int contentLength = connection.getContentLength();
if (contentLength < 1) {
error();
}
if (size == -1) {
size = contentLength;
stateChanged();
}
File f = new File("/sdcard/Sample");
if(f.exists())
{
}else
{
f.mkdir();
}
file = new RandomAccessFile(f.getAbsolutePath()+"/"+getFileName(url), "rw");
file.seek(downloaded);
stream = connection.getInputStream();
here i want to upload the file as pieces ... if the pieces coming from the server and my client, I need to download and merge this full video file
source
share