Hi there,
I'm currently building a new version of Subloader for Android, adding the ability to download subtitles for video located on Samba network shares.
I use jcifs to list video files and write srt files next to them. Everything works great.
But I can't find a way to play the samba video file in VLC.
Here's the code where I build the Intent object:
Code: Select all
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "video/*");
For a local file (on the sdcard) the uri is something like "file:///sdcard/Movies/movie.mp4" and everything works fine.
But in the case of a Samba file, the uri is something like "smb://192.168.1.70/Movies/movie.mp4" and I get an ActivityNotFoundException:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=smb://192.168.1.70/Movies/movie.mp4 typ=video/* }
I know the app ES File Explorer managed somehow to make this work. So I tried "sniffing" the logcat and found this when I play a samba video file from ES:
Code: Select all
06-13 17:19:16.489 389-5143/? I/ActivityManager: START u0 {act=android.intent.action.VIEW dat=http://127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4 typ=video/mp4 flg=0x4000000 cmp=org.videolan.vlc.betav7neon/.gui.video.VideoPlayerActivity (has extras)} from pid 28402
06-13 17:19:16.817 23170-23170/org.videolan.vlc.betav7neon V/VLC/LibVLC: Reading http://127.0.0.1:59777/smb%2F192.168.1.70%2FMovies%2Fmovie.mp4
And the video is played perfectly.
So I tried modifying the uri of the Samba video file replacing "smb://" with "
http://127.0.0.1:59777/smb/" so the uri is something like this "
http://127.0.0.1:59777/smb/192.168.1.70 ... /movie.mp4", I have this in the logcat:
Code: Select all
06-13 17:22:56.637 389-604/? I/ActivityManager: START u0 {act=android.intent.action.VIEW dat=http://127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4 typ=video/* flg=0x40000000 cmp=android/com.android.internal.app.ResolverActivity} from pid 27839
06-13 17:23:03.419 389-623/? I/ActivityManager: START u0 {act=android.intent.action.VIEW dat=http://127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4 typ=video/* flg=0x43000000 cmp=org.videolan.vlc.betav7neon/.gui.video.VideoPlayerActivity} from pid 28612
06-13 17:23:04.395 28650-28650/org.videolan.vlc.betav7neon V/VLC/LibVLC: Reading http://127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4
And the video is played.
But sometimes it doesn't (seems to be due to the fact that I previously launched a video from ES, setting a history or something), and I get this in the logcat:
Code: Select all
06-13 17:25:10.583 389-623/? I/ActivityManager: START u0 {act=android.intent.action.VIEW dat=http://127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4 typ=video/* flg=0x40000000 cmp=android/com.android.internal.app.ResolverActivity} from pid 28729
06-13 17:25:13.606 389-7639/? I/ActivityManager: START u0 {act=android.intent.action.VIEW dat=http://127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4 typ=video/* flg=0x43000000 cmp=org.videolan.vlc.betav7neon/.gui.video.VideoPlayerActivity} from pid 28684
06-13 17:25:14.122 28715-28715/org.videolan.vlc.betav7neon V/VLC/LibVLC: Reading http://127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4
06-13 17:25:14.122 28715-28715/org.videolan.vlc.betav7neon D/VLC: Creating an input for 'http://127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4'
06-13 17:25:14.122 28715-28882/org.videolan.vlc.betav7neon D/VLC: `http://127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4' gives access `http' demux `' path `127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4'
06-13 17:25:14.122 28715-28882/org.videolan.vlc.betav7neon D/VLC: creating demux: access='http' demux='' location='127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4' file='(null)'
06-13 17:25:14.130 28715-28882/org.videolan.vlc.betav7neon D/VLC: creating access 'http' location='127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4', path='(null)'
06-13 17:25:14.130 28715-28882/org.videolan.vlc.betav7neon D/VLC: querying proxy for http://127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4
06-13 17:25:14.130 28715-28882/org.videolan.vlc.betav7neon D/VLC: http: server='127.0.0.1' port=59777 file='/smb/192.168.1.70/Movies/movie.mp4'
06-13 17:25:14.130 28715-28882/org.videolan.vlc.betav7neon E/VLC: open of `http://127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4' failed
06-13 17:25:14.130 28715-28882/org.videolan.vlc.betav7neon E/VLC: VLC is unable to open the MRL 'http://127.0.0.1:59777/smb/192.168.1.70/Movies/movie.mp4'. Check the log for details.
Could you explain to me what is this "59777" that ES File Explorer use in the uri "
http://127.0.0.1:59777/smb/192.168.1.70 ... /movie.mp4" ?
Does ES send extra parameters or flags in the Intent's Bundle?
Is there a better way to launch an Intent to VLC with a Samba video file?
Thanks a lot for your help!