I’d like to have the following code snippet produce a working WebRTC based camera when build with xcode on a physical device. Instead it gives me a
getUserMedia error: Not Allowed Error"
I presume the error happens because the app is being ran in a localhost scheme, and the webrtc specifications for ios require https.
This example works just fine when using
ionic serve in the browser or when compiled with Android Studio and served on an Android device. When using xcode to compile on an iPhone however, it fails with the error above.
Permissions are not the issue in the app itself, since the camera is able to be accessed by a different (non iframed) part of the application.
Any ideas are welcome.
I have same problem, when i work with the iframe in localhost i don’t have any problem with the iframe access to the camera and microphone, but if i run prod mode in xcode even if i gave the camera and microphone permissions in ios app, i still having this error “The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.”.
did you manage to solve the issue??
Nope, I am still facing this issue.
I did however manage to get this working in React Native using their WebView component, so it’s a possibility at least. From what I understand the iframe that capacitor generates is prefixed with ‘capacitor://’ which IOS doesn’t see as secure, and thus disallows the usage of microphone/webcam.
I did come across this repo, but haven’t managed to get this working myself yet.