这个用于打开玩家的弹出窗口。但如何播放视频文件与特定的播放器,如 MX播放器等..
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.setDataAndType(Uri.parse(url), "video/*");
答案 0 :(得分:4)
请参阅MX播放器API链接。
https://sites.google.com/site/mxvpen/api
/** Open another app.
* @param context current Context, like Activity, App, or Service
* @param packageName the full package name of the app to open
* @return true if likely successful, false if unsuccessful
*/
public static boolean openApp(Context context, String packageName) {
PackageManager manager = context.getPackageManager();
try {
Intent i = manager.getLaunchIntentForPackage(packageName);
if (i == null) {
return false;
//throw new PackageManager.NameNotFoundException();
}
i.addCategory(Intent.CATEGORY_LAUNCHER);
context.startActivity(i);
return true;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
openApp(this, "com.mxtech.videoplayer.pro"); // Pro version of MX player
openApp(this, "com.mxtech.videoplayer.ad"); // free version of MX player