问题
I'm using the free jCIFS library to connect to my NAS device via CIFS, and it's working great. I can connect and get a list of filenames, etc. without any issues.
Now I'd like to open one of the files in the default Android application - i.e. a music file should be opened in the music player, an image in the gallery, video file in a video player and so forth. The issue is not really about getting the MIME type and so on. The issue is that I don't want to download the files first, they should be streamed.
Does anyone know how this can be achieved? I know that CifsManager (another third party application) is capable of doing something similar, but it doesn't use jCIFS and it requires root access to mount drives. It is essential that my application doesn't require root access.
You can find the jCIFS library here: http://jcifs.samba.org/
回答1:
You can use the SmbFileInputStream to read the file.
Please go through the documentation jcifs.smb.SmbFileInputStream
来源:https://stackoverflow.com/questions/8030769/how-to-open-files-in-android-with-default-viewer-using-jcifs