1

I have implemented a code to select a video from gallery and play it in videoview. It works very well in lollipop version. But today when I checked it on Marshmallow, It is not working. There is no exception in logcat too.

Is it due to some security that is added in Marshmallow that is not allowing me to select the video or are any runtime permission needed? I have this permissions in my manifest file:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Following is my code:

      Intent pickVideoImage= new Intent(Intent.ACTION_GET_CONTENT);
      pickVideoImage.setType("*/*");
      String[] mimetypes = {"image/*", "video/*"};
      pickVideoImage.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
      startActivityForResult(pickVideoImage,SELECT_PICTURE_VIDEO);

And this is the code inside onActivityResult :

      path = data.getData().toString();
      vid.setVideoPath(path);
      vid.start();
rahul
  • 1,095
  • 8
  • 22
  • I hope this [link](http://stackoverflow.com/questions/8854359/exception-open-failed-eacces-permission-denied-on-android/40277322#40277322) will help you – Sumit Kumar May 17 '17 at 08:51

1 Answers1

0

you should allow permissions on Runtime for Android Marshmallow Version 6.0