Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Permission Denial: reading com.google.android.apps.photos.contentprovider.impl.MediaContentProvider #84

Closed
kyleabens opened this issue Jan 27, 2023 · 7 comments
Labels
platform: android Android platform

Comments

@kyleabens
Copy link

All works well on iOS but I get the following error when trying to display the selected video on Android in a video tag in my html.

java.lang.SecurityException: Permission Denial: reading com.google.android.apps.photos.contentprovider.impl.MediaContentProvider uri content://com.google.android.apps.photos.contentprovider/0/2/content%3A%2F%2Fmedia%2Fexternal%2Fvideo%2Fmedia%2F2523/ORIGINAL/NONE/video%2Fmp4/394201964#t=0.1 from pid=7125, uid=10270 requires the provider be exported, or grantUriPermission()

I have tried searching for an answer for a couple days now and nothing has worked. Wondering if you can provide some insight into this error and if any others have had this issue in the past.

const result = await FilePicker.pickMedia({
  multiple: true
});
result.files.forEach(file => {
  const url = Capacitor.convertFileSrc(file.path);
  // url is used as src in html
});
@KANekT
Copy link

KANekT commented Jan 27, 2023

@robingenz
Copy link
Member

@kyleabens I'm not sure if it's the same bug but unfortunately embedding locale videos in the img tag on Android doesn't work at the moment, see ionic-team/capacitor#6021

@KANekT Can you share your use case where you need to request permission? In my tests on Android (Android 13, Pixel 5) and iOS, request permissions has not been necessary so far. If you really need this, then i have to implement the method in this plugin.

@KANekT
Copy link

KANekT commented Jan 27, 2023

sorry, I did not know that such a bug already exists in the core Capacitor

I thought it was just a file permissions issue.

but - requestpermissions may be fix error in current ...

@kyleabens
Copy link
Author

@KANekT I tried adding requestPermission and that unfortunately didn't resolve my issue.

@robingenz What I'm doing is giving users the ability to select images and videos and then display them in a modal that they can then upload to our server. Images work fine on Android, it's only videos that are not displaying. Also videos are not being placed in an img tag, I'm using the video tag for those (Eg. <video><source src="path"></video>). I don't want to convert the videos to base64 since that's memory intensive and unnecessary for simply displaying them before uploading.

Again this works on browser and iOS no problem. I'm assuming it has something to do with the videos I'm selecting being on Google photos? However images work fine so idk. At the end of the day I'm just trying to display a video in the html based on the path of that video

@kyleabens
Copy link
Author

Might have to use something like this for the time being https://github.com/jepiqueau/capacitor-video-player

@robingenz
Copy link
Member

What I'm doing is giving users the ability to select images and videos and then display them in a modal that they can then upload to our server. Images work fine on Android, it's only videos that are not displaying. Also videos are not being placed in an img tag, I'm using the video tag for those (Eg. ).

Yes, that's the issue i linked: ionic-team/capacitor#6021

One of my clients has the same problem. Therefore, this plugin will probably generate thumbnails for videos in the next version, which can be displayed to the user. Maybe you have another use case and this isn't a solution for you.

@robingenz
Copy link
Member

As this is not a bug in this plugin, i am closing the issue.

@robingenz robingenz closed this as not planned Won't fix, can't repro, duplicate, stale Jan 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: android Android platform
Projects
None yet
Development

No branches or pull requests

3 participants