What's different between SambaFileInputStream and FileInputStream?
Asked Answered
P

1

0

I need to streaming video from samba server, and I use nanohttpd to create simple server in my project. When I use fileinputstream from my local file, the videoview is work to play video by set "http://localhost:8080"

public class Server extends NanoHTTPD {
    public Server() {
    super(8080);
    }

    @Override
    public Response serve(String uri, Method method,
            Map<String, String> header, Map<String, String> parameters,
            Map<String, String> files) {

        fis = new FileInputStream(filePath);
    return new NanoHTTPD.Response(Status.OK,"video/mp4", fis);
    }
}

JCIFS don't have fileinputstream, so I only get smbfileinputstream, when I change

fis = new SmbFile(filePath,auth).getInputStream();

it doesn't work, I need to know what's different between fileinputstream and smbfileinputsteam so that I can streaming video from samba ...

If you hava others solution to streaming video from samba on android, please help me...
Thanks a lot..

Priapus answered 6/1, 2014 at 7:58 Comment(1)
Try not wrapping it in a FileInputStream, do something like: InputStream is = smbFile.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); return new Response( HTTP_OK, mime, bis);Middle
C
0

You can write the smbfileinputstream directly by getting the input stream from sbmFile

SmbFileInputStream inputStream = new SmbFileInputStream(smbFile);

//My write logic with inputStream
writeStream(inputStream);
Churchill answered 28/10, 2014 at 1:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.