WKWebView
is not asking permission for camera and microphone in the app. When I load the same url in safari browser it asks the permission for camera and microphone, and video call works perfectly. But when I embed this in WKWebView
permission is not asked even I have given both camera and microphone permission in plist file. The same thing is not working even in UIWebView
and safari view controller. I have referred below links but still its not working.
Enable Camera and Mic access in wkwebview ,
How do I prevent a WKWebView from presenting the Camera modal if a user has denied access to the camera?
Can anybody provide any solution?
Asked
Active
Viewed 3,673 times
9

Pooja Gupta
- 785
- 10
- 22

Sona
- 394
- 3
- 15
-
1have you found any solution? – iosdev Nov 29 '18 at 10:50
-
1please reply if you have found any solution.I am also stuck in same situation. – shruti garg Jun 07 '19 at 13:46
-
This answer may be a solution. [Enable camera and mic access in webview](https://stackoverflow.com/questions/43916436/enable-camera-and-mic-access-in-wkwebview) – Sesen Sep 23 '19 at 11:52
1 Answers
0
Why not do the asking permission for camera and microphone in the app yourself?
You have the full control over your app.
//Camera
AVCaptureDevice.requestAccess(for: AVMediaType.video) { response in
if response {
//access granted
} else {
}
}
//Photos
let photos = PHPhotoLibrary.authorizationStatus()
if photos == .notDetermined {
PHPhotoLibrary.requestAuthorization({status in
if status == .authorized{
...
} else {}
})
}
If all granted, then do the js
video call.
If not, show tips for the use to grant it.
- And, it's easy to do that
js
callnative
,native
calljs

dengST30
- 3,643
- 24
- 25