What's different between SambaFileInputStream

2020-05-06 03:24发布

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..

1条回答
闹够了就滚
2楼-- · 2020-05-06 03:32

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);
查看更多
登录 后发表回答