Open panyiyiyi opened 1 year ago
我也遇到这个问题,运行demo的时候,选择视频,然后点击预览播放,就会报这个错,是必现的,是权限问题吧?
https://github.com/HuanTanSheng/EasyPhotos/issues/219#issuecomment-1042662608
private void toPlayVideo(View v, Uri uri, String type) { Context context = v.getContext(); Intent intent = new Intent(Intent.ACTION_VIEW); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.putExtra(Intent.EXTRA_STREAM, uri); } intent.setDataAndType(uri, type); context.startActivity(intent); }
java.lang.SecurityException: UID 10274 does not have permission to content://media/external/video/media/293361 [user 0] at android.os.Parcel.createExceptionOrNull(Parcel.java:2425) at android.os.Parcel.createException(Parcel.java:2409) at android.os.Parcel.readException(Parcel.java:2392) at android.os.Parcel.readException(Parcel.java:2334) at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:2670) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1743) at android.app.Activity.startActivityForResult(Activity.java:5533) at androidx.activity.ComponentActivity.startActivityForResult(Unknown Source:0) at android.app.Activity.startActivityForResult(Activity.java:5486) at androidx.activity.ComponentActivity.startActivityForResult(Unknown Source:0) at android.app.Activity.startActivity(Activity.java:5892) at android.app.Activity.startActivity(Activity.java:5845) at com.huantansheng.easyphotos.ui.adapter.PreviewPhotosAdapter$1.onClick(Unknown Source:55) at android.view.View.performClick(View.java:7753) at android.view.View.performClickInternal(View.java:7730) at android.view.View.access$3700(View.java:861) at android.view.View$PerformClick.run(View.java:29146) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:210) at android.os.Looper.loop(Looper.java:299) at android.app.ActivityThread.main(ActivityThread.java:8293) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)