Page 1 of 2

Starting VLC Beta by Intent...

Posted: 31 Jul 2012 15:49
by mkl24
Mod edit and stickied, as this is a very common request.

To start VLC for Android with an intent, you should use Intent.ACTION_VIEW and call VLC with a valid multimedia URI and/or type, like so:

Code: Select all

Intent intent = new Intent(Intent.ACTION_VIEW); intent.setPackage("org.videolan.vlc.betav7neon"); // Use org.videolan.vlc for nightly builds intent.setDataAndType(Uri.parse("http://example.com/media/test.mp4"), "application/mp4"); startActivity(intent);
There is an optional extra called position (type 'long') that tells VLC when to start playback, in milliseconds. Please note that not all streams support seeking, and this extra will only work on seekable streams.

For example, you can use it like this to start a stream at 1:00.

Code: Select all

Intent intent = new Intent(Intent.ACTION_VIEW); intent.setPackage("org.videolan.vlc.betav7neon"); // Use org.videolan.vlc for nightly builds intent.setDataAndType(Uri.parse("http://127.0.0.1/temp/stream"), "application/mp4"); intent.putExtra("position", (long)60000); startActivity(intent);
Or, if you just want to start _any_ video player without discrimination, you can use an indirect intent like so:

Code: Select all

Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse("udp://@10.11.11.11:1111")); startActivity(in);
The original posting is preserved below.
-----------------------------------------------------------------------------------------------------------------





Hi i just like to start VLC Beta with an intent. First i tried an indirect intent:

Code: Select all

Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse("udp://@111.11.11.11:1111")); startActivity(in);
But this one just show me MXPlayer :( After that i tried to decompile VLC to address the intent explicit:

Code: Select all

Intent intent = new Intent("org.videolan.vlc.betav7neon"); Uri uri = Uri.parse("udp://@111.11.11.11:1111"); intent.setDataAndType(uri, "video/*"); intent.putExtra("udp", uri); intent.setClassName("org.videolan.vlc.betav7neon", "org.videolan.vlc.betav7neon.gui.video.VideoPlayerActivity"); startActivity(intent);
This one will open the PlayerActivity but i´m not able to start it with the udp-uri...

Any idea how to solve this? I just need a temporary solution till you implement all features!

Re: Starting VLC Beta by Intent...

Posted: 01 Aug 2012 01:50
by edwardw
Thanks for the bug report, fixed in latest VLC-Android git. Please try a nightly build!

Re: Starting VLC Beta by Intent...

Posted: 01 Aug 2012 10:51
by mkl24
Perfectly! Work like a charm :)

Re: Starting VLC Beta by Intent...

Posted: 25 Jan 2013 18:07
by jomateix
Hi,

I am trying to call vlc by intent with no luck, my tablet runs a BOXCHIP A10 1.5GHz (cortex A8), GPU: Mali-400, so I installed VLC-debug-20130125-0604.apk 25-Jan-2013 06:05 7.6M fom http://nightlies.videolan.org/build/armv7-android/, is this the version i should use ?,

I tried this code but nothing, happens, no crashes no messages, no vlc player poping up

Code: Select all

Intent intent = new Intent("org.videolan.vlc.armv7-android"); Uri uri = Uri.parse("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"); intent.setDataAndType(uri, "video/*"); intent.putExtra("url", uri); intent.setClassName("org.videolan.vlc.armv7-android", "org.videolan.vlc.armv7-android.gui.video.VideoPlayerActivity"); startActivity(intent);
what would be the package name i should invoke ? betav7neon isn't my platform so i tried .armv7-android also also tried .armv7


Thanks you very much for your help, and forgive my lack of knowledge

Re: Starting VLC Beta by Intent...

Posted: 26 Jan 2013 20:33
by edwardw
If you use a nightly build you should use org.videolan.vlc

Re: Starting VLC Beta by Intent...

Posted: 28 Jan 2013 18:24
by jomateix
Hi thank you very much again, you are right on "org.videolan.vlc"

I am looking at VLC source code "/vlc-android/AndroidManifest.xml" to figure out how to configure this intent call

Code: Select all

Intent intent = new Intent("org.videolan.vlc"); //Uri uri = Uri.parse("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"); intent.setDataAndType(uri, "video/*"); //comenting one of the next 2 sentences intent.putExtra("httplive", uri); intent.putExtra("mms", uri); //comenting one of the next 2 sentences intent.setClassName("org.videolan.vlc", "org.videolan.vlc.gui.video.VideoPlayerActivity");/*opens videoplayer that ignore the url i set, fullscreen blackscreen not playing the url i set*/ intent.setClassName("org.videolan.vlc", "org.videolan.vlc.gui.MainActivity"); /*opens standard VLC App not playing any file/url ?*/ startActivity(intent);
what I intent to do is open a media stream programatically by intent from an android app.

forgive me again for my lack off success, maybe it will serve as a simple tutorial someday...

Re: Starting VLC Beta by Intent...

Posted: 03 Mar 2013 23:51
by edwardw
Look at the posts above.

Open network stream with VLC from my app

Posted: 22 Apr 2013 22:59
by kalu06
Hi guys,

How can I read a network stream with VLC from my app?
I already know how to launch VLC. The only problem is how to send the network stream (url).

Thanks
Lucas

Re: Starting VLC Beta by Intent...

Posted: 25 Apr 2013 03:18
by edwardw
Read above postings...

Re: Starting VLC Beta by Intent...

Posted: 01 May 2013 10:28
by kalu06
Thanks! :)

Re: Starting VLC Beta by Intent...

Posted: 01 May 2013 11:17
by kalu06
I tried to use "udp" as extra (like mkl24) to read my network stream but, obviously, it didn't work. What extra do I have to use? "url"? "http"?
Thank guys.

Re: Starting VLC Beta by Intent...

Posted: 01 May 2013 11:40
by edwardw
I tried to use "udp" as extra (like mkl24) to read my network stream but, obviously, it didn't work. What extra do I have to use? "url"? "http"?
Thank guys.
I think that the extra is not necessary. Get your setDataAndType() call correct.

Re: Starting VLC Beta by Intent...

Posted: 26 May 2013 11:43
by stargate
I have tried the above code but VLC doesn't play my file... it just says "Title" on the window caption and does nothing when I press play. My targate is a MP4 file (H264/AAC) hosted on an IIS server. The URL works if I launch VLC from Browser. Should I set a different DataAndType? Thanks.

Re: Starting VLC Beta by Intent...

Posted: 26 May 2013 21:39
by edwardw
I have tried the above code but VLC doesn't play my file... it just says "Title" on the window caption and does nothing when I press play. My targate is a MP4 file (H264/AAC) hosted on an IIS server. The URL works if I launch VLC from Browser. Should I set a different DataAndType? Thanks.

Code: Select all

Intent intent = new Intent(Intent.ACTION_VIEW); intent.setPackage("org.videolan.vlc.betav7neon"); // Use org.videolan.vlc for nightly builds intent.setDataAndType(Uri.parse("http://example.com/media/test.mp4"), "application/mp4"); startActivity(intent);

Re: Starting VLC Beta by Intent...

Posted: 14 Jun 2013 02:29
by subloader
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!

Re: Starting VLC Beta by Intent...

Posted: 14 Jun 2013 04:53
by edwardw
But in the case of a Samba file, the uri is something like "smb://192.168.1.70/Movies/movie.mp4"
Hello,

There are two separate issues here.

The first is that VLC for Android does not have the SMB plugin compiled, which is a bit difficult. That is being tracked at https://trac.videolan.org/vlc/ticket/7069

The second is that ES File Explorer has its own internal smb-to-http proxy that it uses to proxy smb connections, so in effect fooling apps into thinking they're browsing a HTTP stream.

Hope that clarified something.

Re: Starting VLC Beta by Intent...

Posted: 14 Jun 2013 06:02
by subloader
Hi Edward,

Thanks for the quick response.
That makes so much sense now.

Now I need to find a way to implement this smb-to-http proxy thing...

Re: Starting VLC Beta by Intent...

Posted: 14 Jun 2013 13:53
by edwardw
Now I need to find a way to implement this smb-to-http proxy thing...
Honestly speaking, I would not recommend such an endeavour, since it is likely to be hard, slow, buggy, and insecure :) It is better to just wait for VLC to port over the SMB plugin.

Re: Starting VLC Beta by Intent...

Posted: 14 Jun 2013 19:25
by subloader
Now I need to find a way to implement this smb-to-http proxy thing...
Honestly speaking, I would not recommend such an endeavour, since it is likely to be hard, slow, buggy, and insecure :) It is better to just wait for VLC to port over the SMB plugin.
Fair enough. I'll advise the users to use ES File Explorer for the time being.

Re: Starting VLC Beta by Intent...

Posted: 14 Jun 2013 21:55
by edwardw
Now I need to find a way to implement this smb-to-http proxy thing...
Honestly speaking, I would not recommend such an endeavour, since it is likely to be hard, slow, buggy, and insecure :) It is better to just wait for VLC to port over the SMB plugin.
Fair enough. I'll advise the users to use ES File Explorer for the time being.
Subscribe to that ticket above to know when SMB will be done.

Re: Starting VLC Beta by Intent...

Posted: 25 Jun 2013 17:41
by RobNCD
Hi All

I was wondering if anyone had any experience with MIT App Inventor? I am trying to create an app using APP Inventor that opens VLC and then starts an audio stream automatically. Using the example I can open VLC but cant seem to feed the audio file to the program.

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setPackage("org.videolan.vlc.betav7neon"); // Use org.videolan.vlc for nightly builds
intent.setDataAndType(Uri.parse("http://example.com/media/test.mp3"), "application/mp3");
startActivity(intent);

Notice I changed the example to MP3, and am using the ActivityStarter in App Inventor to set the intents, but am having troubles with the setDataAndType.

I have in APP Inventor the following:

ActivityStarter.Action----------------> android.intent.VIEW
ActivityStarter.ActivityPackage-----> org.videolan.vlc
ActivityStarter.ActivityClass--------> org.videolan.vlc.gui.MainActivity
ActivityStarter.DataType------------> application/mp3
ActivityStarter.DataUri--------------> http://example.com/media/test.mp3
ActivityStarter.StartActivity

Any help would be appreciated....

Re: Starting VLC Beta by Intent...

Posted: 25 Jun 2013 18:14
by edwardw
Data type of MP3 is audio/mpeg, as defined in RFC3003.

Re: Starting VLC Beta by Intent...

Posted: 25 Jun 2013 18:38
by RobNCD
Still no luck
My example:

ActivityStarter.Action----------------> android.intent.VIEW
ActivityStarter.ActivityPackage-----> org.videolan.vlc
ActivityStarter.ActivityClass--------> org.videolan.vlc.gui.MainActivity
ActivityStarter.DataType------------> audio/mpeg
ActivityStarter.DataUri--------------> http://android.mcics.com/LightsOut.mp3
ActivityStarter.StartActivity

Any help would be appreciated....

Re: Starting VLC Beta by Intent...

Posted: 25 Jun 2013 18:40
by edwardw
Which VLC beta are you using? App Store version or VLC nightly builds?

Also, remove the ActivityClass parameter.

Re: Starting VLC Beta by Intent...

Posted: 25 Jun 2013 19:00
by RobNCD
Thanks for the suggestions so far...
I am using the newest nightly build
If I remove the ActivityClass parameter then it says no corresponding activity found and cant start VLC.

ActivityStarter.Action----------------> android.intent.action.VIEW
ActivityStarter.ActivityPackage-----> org.videolan.vlc
ActivityStarter.ActivityClass--------> org.videolan.vlc.gui.MainActivity
ActivityStarter.DataType------------> audio/mpeg
ActivityStarter.DataUri--------------> http://android.mcics.com/LightsOut.mp3
ActivityStarter.StartActivity

Any help would be appreciated....