Right now i am streaming local files using nanoHTTPd server it working fine.
public Response serve(String uri, Method method,
Map<String, String> header,
Map<String, String> parameters,
Map<String, String> files) {
String answer = "";
FileInputStream fis = null;
try {
fis = new FileInputStream(Environment.getExternalStorageDirectory()
+ "/3886_654.mp4");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
return Response.newFixedLengthResponse(Status.OK, "video/mp4", fis, fis.available());
} catch (IOException e) {
e.printStackTrace();
}
return Response.newFixedLengthResponse("");
}
But if i want server online files how can i do that. based on url some times i will decrypt the response and serve it.
public Response serve(String uri, Method method,
Map<String, String> header,
Map<String, String> parameters,
Map<String, String> files) {
String answer = "";
FileInputStream fis = null;
try {
fis = new FileInputStream(Environment.getExternalStorageDirectory()
+ "/3886_654.mp4");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
return Response.newFixedLengthResponse(Status.OK, "video/mp4", fis, fis.available());
} catch (IOException e) {
e.printStackTrace();
}
return Response.newFixedLengthResponse("");
}
But if i want server online files how can i do that. based on url some times i will decrypt the response and serve it.