I need to use RN's WebView module in my Android app for WebRTC. But according to here, there is a class named PermissionRequest, stands for allowing to use device resources:
This class defines a permission request and is used when web content requests access to protected resources
And looks like RN's WebView does not handle this. So we cannot use device camera or microphone for WebRTC apps. Local camera and mic do not work in the webview.
However, I created a native webview module extending SimpleViewManager and just put these 3 lines:
webview.setWebChromeClient(new WebChromeClient(){
// Need to accept permissions to use the camera
@Override
public void onPermissionRequest(final PermissionRequest request) {
request.grant(request.getResources());
}
});
With this, WebView just worked as expected. Device camera and microphone works flawlessly.
I tried to extend RN's WebView and put these 3 lines but didn't go well.
Did you solve your problem? I'm exactly with the same problem...
@LucasSouzaa No. i rewrote my own Android Webview App with my custom bridges and configuration. And moved from react native to react for now. No one interested this issue so far :/
@alioguzhan do you have your extended component in a repo ?
Any update on this?
@alioguzhan It would be great if you could share the solution that you did manage to get working.
Same Problem in RN 0.46.
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.
can you please share your code?
My application have this issue.
I could not get any solution.
can you please share it.
Hi, it's been long time. The project belongs to my previous company. I don't have access to the code anymore :/
Are you have any idea about it?
Not now. But i will check my previous projects when i am home, today. If i ll find any sample code related to this issue, i will put it here.
OK Thanks
Hi, my way ended also here, any help ?
I couldn't find my custom webview's source code. If i have enough time, i can re-write it. It is not that complicated. But there is another issue i believe.
I created this issue more than one year ago and people having this issue ended up here many times. @hramos labeled this issue as icebox which means they consider this is not priority.
It would be great and helpful if someone from maintainers give us an explanation about this issue.
+1, solution for this is welcome, I have the same issue
Please open an issue on react-native-community/react-native-webview as this won't get fixed here @diegolaciar
Most helpful comment
@LucasSouzaa No. i rewrote my own Android Webview App with my custom bridges and configuration. And moved from react native to react for now. No one interested this issue so far :/