Open pooriaPoorsarvi opened 4 years ago
I believe this would be possible if there was full implementation of MediaDevices
. Works on Android and Electron, however does not work on iOS Capacitor apps. See this page for info.
You can use MediaDevices.enumerateDevices()
to get info about the user's microphones and cameras. It allows you to get permission and info for the devices, without using them immediately. Then, you can later use MediaDevices.getUserMedia()
to actually start a recording or take a picture. Check out this page for info. Though again this is not supported on iOS Capacitor apps.
I think as a proposal, this could fall under the Media Capture proposal.
@joshstovall is this only available in enterprise mode?
To be honest, I do not know what you mean by enterprise mode.
I agree, @joshstovall.
@pooriaPoorsarvi If you mean Ionic Enterprise, then no. All plugins in capacitor-community
are community-maintained OSS.
iOS 15 made it possible. https://github.com/ionic-team/capacitor/pull/5196
You can try it using my demo case -> https://github.com/samydoesit/capacitor-getusermedia-test
You will get just one Permission Prompt and the decision will be remembered.
Camera use with one-time user permission.
There might be lots of scenarios in which a service might be done using the image captured automatically to do automatic computations. This is common in computer vision projects. So can there be a feature where we ask the user permission for taking pictures once and then use the camera as a webcam at specific times?
I know that some platforms have specific solutions for this such as android: https://stackoverflow.com/questions/9752730/take-a-photo-automatically-without-user-interaction/11771325, but can there be a universal solution to this in ionic?