I'm using Xamarin.Forms.WebView to display a website in my Xamarin application. The rendered website requires the user to record audio using microphone. The recording works fine when I open the website in safari browser on iPhone and iPad but doesn't work when opened from WebView. I also noticed that when I open the website in browser it asks permission to access microphone but that doesn't happen in WebView.
Asked
Active
Viewed 903 times
0
-
Did you add the microphone usage key in your info.plist file `
NSMicrophoneUsageDescription `? – Adam Rodriguez Sep 27 '19 at 17:49 -
Yes I have added the key in info.plist – Abhishek Dhotre Sep 27 '19 at 18:34
1 Answers
1
Try to Request Authorization for Media Capture on iOS before your start recording:
AVCaptureDevice.RequestAccessForMediaType(AVMediaType.Audio, (bool isAccessGranted) => {
//if has access
if (isAccessGranted)
{
//do something
}
//if has no access
else
{
//show an alert
}
});
Recording audio or video always requires explicit permission from the user
Refer: requestaccessformediatype

nevermore
- 15,432
- 1
- 12
- 30
-
Thanks Jack, I'm able to get permissions to enable microphone, but the audio recording is still not working on the webview. Any idea what thew problem might be. – Abhishek Dhotre Sep 30 '19 at 15:35
-
It seems a limitation in iOS app. See [this thread](https://stackoverflow.com/questions/45055329/does-webkit-in-ios-11-beta-support-webrtc/49467964#49467964) and [here](https://github.com/zxing-js/library/issues/15#issuecomment-381572333). – nevermore Oct 01 '19 at 03:17