Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
536 views
in Technique[技术] by (71.8m points)

java - Android SDK : Samba server streaming video to Android using VideoView?

I need play video from samba to android device streaming. I've been look for this question and someone say that :

  1. Using JCIFS to scan for and "see" the share: http://jcifs.samba.org/
  2. Implementing a simple HTTP server (NanoHttpd) to stream the content via http: https://github.com/NanoHttpd/nanohttpd
  3. Passing the http://localhost/myvideo link to the VideoView

I'm already use JCIFS to get SmbFile in my project and I also get inputstream( smbfile.getInputStream() ).
Now I import NanoHttpd and I create simple HTTP server that http address ishttp://localhost:8080

private class MyHTTPD extends NanoHTTPD {
    public MyHTTPD() throws IOException {
        super(8080);
    }

    @Override
    public Response serve(String uri, String method, Properties header, Properties parms, Properties files) {
        InputStream is = new SmbFile(filePath,auth).getInputStream();

                  //return index as response
        return new NanoHTTPD.Response(HTTP_OK, "video/mp4", is);
    }
}

server = new MyHTTPD();
server.start();

But my http address is different from http://localhost/myvideo, I don't know how to get right http address and put it in to VideoView.
I don't know how to get path like http://localhost/myvideo .
Thanks for help....

The other question : Can I use VideoView playing video from InputStream ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...