Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android how to play video using VLC Player?

I have app for play video in android like as

https://play.google.com/store/apps/details?id=com.vlcforandroid.vlcdirectprofree&hl=en

I want to integrate this app in my app. I have Url for video Streaming and i want to open this video in this app(Vlc Direct), Any idea?

I open this app using:

Intent i = new Intent(Intent.ACTION_MAIN);
            PackageManager manager = getPackageManager();
            i = manager.getLaunchIntentForPackage("com.vlcdirect.vlcdirect");
            i.addCategory(Intent.CATEGORY_LAUNCHER);
            startActivity(i);

But how it start with video streaming, Or any other Player for video Streaming?

like image 555
Samir Mangroliya Avatar asked Feb 13 '12 10:02

Samir Mangroliya


2 Answers

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.

like image 142
Julian Fondren Avatar answered Sep 20 '22 01:09

Julian Fondren


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

like image 34
Mike Redrobe Avatar answered Sep 24 '22 01:09

Mike Redrobe