0

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.

Jeggu
  • 569
  • 2
  • 10
  • 26
  • `now i am streaming local files`. I would not call that streaming. NanoHttpD will just serve a local file. Look in the documentation of nano to see if you can open an outputstream where you can write to. Start with using the stream for a local file first. – greenapps Oct 31 '16 at 11:37
  • @greenapps For local files its working fine, i have tested. in online case cant i stream via nanohttpd – Jeggu Oct 31 '16 at 13:01
  • You have not reacted on the suggestion of openening an output stream. Or on anything i said. – greenapps Oct 31 '16 at 13:35

0 Answers0