Android-AdvancedWebView icon indicating copy to clipboard operation
Android-AdvancedWebView copied to clipboard

Camera and audio permission issue

Open VarshaMenon opened this issue 3 years ago • 1 comments

Video calling feature was working perfectly with webview until almost 3 months ago. Recently it's not supporting camera and audio functionality, even browser and application have both of these permissions. Would like to know is it because of any recent update with webview or chromium or with anything else, as it was working properly before.

Manifest permissions:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIDEO_CAPTURE" />
<uses-permission android:name="android.permission.AUDIO_CAPTURE" />
<uses-permission android:name="android.webkit.resource.AUDIO_CAPTURE" />
<uses-permission android:name="android.webkit.resource.VIDEO_CAPTURE" />

Please anyone respond to this issue, and thanks in advance. Attaching the screenshot for more information.

camera_permission_issue

microphone_permission_issue

VarshaMenon avatar Oct 14 '22 05:10 VarshaMenon

I found a great solution. Accidentally on the normal webview, noticed that reloading the page worked (by rotating the device) Force this event order:

  • loadUrl() //has no permissions yet
  • PermissionListener request //requests permissions
  • loadUrl() //loading it again will use the cached page but now it has permissions granted of course. All cameras, all audio devices. Even Bluetooth audio

In my case I reload the page inside the onPermissionRequest function once all permissions have been requested. Also Irequest permissions really early in javascript so that the reload is not perceptable to the user. I don't know if there is a better way but this works

ryza1 avatar Oct 16 '24 16:10 ryza1