简体   繁体   中英

How can i open a network stored file using JCIFS like ES File Explorer Does?

I'm working on an android app, and I can actually get a list of all my files, but can't use the URL to open a file from the list, I also tried to open from InputStream , but this does not work.

What I want to do is something like ES File Explorer does, I know they use JCIFS library, and that when you open a file (an MP3 for example), they make some kind of Tunnel with sockets, that reads the file and pass it to the propper app in an HTTP format.

Example:

If my nas file path is:

smb://My_IP_Address/SharedFolder/Media/MyMusic.mp3

ES File Explorer send an URL like this:

http:// 127.0.0.1:59777/smb%2FMy_IP_Address%2FSharedFolder%2FMedia%2FMyMusic.mp3

It's off course doable but kind of tricky. Your app must act as a server, reading an input stream from the samba share, streaming it to a third party application like a music player if we are talking about a mp3 file.

You'll find details here : Android ServerSocket programming with jCIFS streaming files

Sorry, I want to use comment instead of answer, but I don't have enough reputation...

What I found on ES Explore or other same app, they seemed not only use JCIFS , but also use nanoHTTPD...

They transfer the nas file to samba file, then use nanoHTTPD as a Streaming server to serve the multimedia files...

There got many sample on the web, here a discussion => How to serve a file on sdcard using NanoHTTPD (inside Android)

Hope this can help you...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM