用Android开发一个app,纯Android开发,只是通过intent播放本地视频,代码如下
mIntent.putExtra("title",“jingyu.mp4”);
mIntent.putExtra("playTime",0);
mIntent.putExtra("loop",false);
mIntent.putExtra("isControl",true);
mIntent.putExtra("videoSource","1");//
mIntent.putExtra("videoType","video/*");//
mIntent.putExtra("shouldPlayIndex",0);//
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.N){
mIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
uri = FileProvider.getUriForFile(this, getApplicationContext().getPackageName()+".FileProvider",file);
}else {
mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
uri = Uri.parse("file:///sdcard/"+mpUrl);
}
mIntent.setDataAndType(uri,"video/*");
mLauncher.launch(mIntent);
视频一直显示加载中,或 无法播放,请问代码有问题么?