0

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.

Abhishek Dhotre
  • 481
  • 4
  • 17

1 Answers1

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