Android how to play video using VLC Player?

More like,

Intent i = new Intent(Intent.ACTION_MAIN);
i.setComponent(new ComponentName("com.vlcdirect.vlcdirect", "com.vlcdirect.vlcdirect.URLStreamerActivity"));
i.putExtra("url", url);
startActivity(i);

Which supposes that the component, activity, and payload are as shown, and also that the activity is explicitly or implicitly exported -- I don't know the actual values, or if the activity is exported. vlcdirect doesn't document this, but you can

  1. ask the developer, or

  2. view the log as you stream from a URL within that app, to identify the component and activity; dedex and decompile the .apk, to confirm the payload; duplicate payload classes, if necessary; give up and fume after the developer ignores you, if the activity is not exported.

Ideally you would broadcast a "view the stream from this URL" intent, and vlcdirect or any other suitable app would pick it up, but I don't know if vlcdirect or any other app respond to such.


VLC needs to be explicitly told the type:

Intent i = new Intent(Intent.ACTION_VIEW);
i.setPackage("org.videolan.vlc.betav7neon");
i.setDataAndType(Uri.parse("http://ip:8080"), "video/h264");
startActivity(i);

i.e. just "video/*" wouldn't work for me


Previous answers didn't work me. After a bit of searching I found the official docs here.

Basically, here it is:

int vlcRequestCode = 42; //request code used when finished playing, not necessary if you only use startActivity(vlcIntent)
 Uri uri = Uri.parse("file:///storage/emulated/0/Movies/KUNG FURY Official Movie.mp4"); //your file URI
 Intent vlcIntent = new Intent(Intent.ACTION_VIEW);
 vlcIntent.setPackage("org.videolan.vlc");
 vlcIntent.setDataAndTypeAndNormalize(uri, "video/*");
 vlcIntent.putExtra("title", "Kung Fury");
 vlcIntent.putExtra("from_start", false);
 vlcIntent.putExtra("subtitles_location", "/sdcard/Movies/Fifty-Fifty.srt"); //subtitles file
 startActivityForResult(vlcIntent, vlcRequestCode);

You can remove unnecessary parts for you.