Reputation: 1079
I am passing a RTMP video URL to the MX Player app. But I need to force start MX Player when the intent is started instead the user chooses the MX Player manually. I tried this:
i=getPackageManager().
getLaunchIntentForPackage("com.mxtech.videoplayer.ad");
i.setData(Uri.parse("MY_URL"));
startActivity(i);
When I run this MX Player force closes. Any help will be appreciated.
Upvotes: 2
Views: 2412
Reputation: 22945
you can use this MX player API
here is sample
Intent intent = new Intent(Intent.ACTION_VIEW);
intent .setPackage("com.mxtech.videoplayer.ad");
Uri videoUri = Uri.parse("http://host:port/playlist.m3u8");
intent.setDataAndType( videoUri, "application/x-mpegURL" );
intent.setPackage( "com.mxtech.videoplayer.pro" );
startActivity( intent );
Upvotes: 2
Reputation: 182
You can try this. This will work for sure:
i.setPackage("com.mxtech.videoplayer.ad");
i.setData(URI);
startActivity(i);
Upvotes: 2