0

I am trying to compress a video that is captured from the camera, but the compressed video cannot be saved in Android version 8.1. The same code is working fine for lower versions.

All the permissions that require READ and WRITE external storage are there.

 File videoFile = new File(pathToStoredVideo);
    String origin;
    origin = videoFile.getAbsolutePath();
    compressVideo(origin, origin);

I am trying to save a new file at the same location. This code is working fine with lower version but it is not working in Android version 8.1 and above.

Origin looks like this /storage/emulated/0/DCIM/Camera/VID_20190415_143927.mp4

Error in console- E/tmessages: /storage/emulated/0/DCIM/Camera/VID_20190408_173343395.mp4 (Permission denied) time = 18

1 Answers1

1

For 8.0 and above only those permissions that are explicitly requested will be granted.

Did you add Read and Write request permission explicitly at runtime?

Unable to save image file in android oreo update. How to do it?

Meet Patel
  • 71
  • 4
  • yes i have already added Read and Write request Permission explicitly at runtime. I have edited the question again that tells the error I am getting. – sakshi Agrawal Apr 15 '19 at 11:48
  • WRITE_EXTERNAL_STORAGE , READ_EXTERNAL_STORAGE these two permission need to be added on Manifest file "outside the application tag" and also must be asked to allow at run-time if these are already added in your manifest and also added at run-time then there should be not right video formation or file corrupted.! – Meet Patel Apr 15 '19 at 11:59