New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use camera through Webview? #508
Comments
I can't find any proper answer for this question. |
#231 is maybe related? |
i'm also having the same issue... "react-native-webview": "^5.7.0" what i'm trying to do:
you can check the webview source url (its a fully tested url for the camera that works well on desktops and mobile as well.. however in the webview it seems not to work AndroidManifest.xml
|
@hartatovich did you find any solution yet? |
@mharis161 not yet... cc - @Titozzz |
@hartatovich i commited @Javascript-ninja's file 'RNCWebViewManager.java' to my code but got this error:
FAILURE: Build failed with an exception.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. |
My current RN Version is : 0.59.6 and i am getting Permission Denied error for camera and mic too. Did you guys find any workaround yet? |
You need to prompt the user to give you the camera permission. I believe that should be done by this library, must have been missed |
I was able to confirm a workaround. I have two screens that use the camera: one is a React Native screen that uses
I'm going to look into a work around where I just ask people for permission to use the camera when they open the webview |
I confirmed that you can use a library like |
I'd recommend to use patch package to patch the file selection intent
creation and call the native permission API.
…On Wed, Jun 12, 2019, 7:52 PM Garrett McCullough ***@***.***> wrote:
I confirmed that you can use a library like react-native-permissions to
grant the necessary permissions when the webview is loaded. I'm just asking
when the webview is mounted but I guess you could get tricky and watch the
webview's URL to pop the permission dialog when the url is set to the page
where you access the camera
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#508>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAS6SHH2AC4JA5FEGKSNM2TP2GK4JANCNFSM4HGQGB2A>
.
|
My CAMERA and RECORD_AUDIO are both granted. But I am still unable to use my Camera over web view. Any thoughts on this?
I am using the web view URI given above to test. The error I receive is
|
did you find any solution yet |
#719 This PR is included in version 6.6.0 |
I am still seeing the same issue as above, using the latest version of the webview. as commented on this issue, I'd be happy to bring in changes from this library to address permissions issues, as well as to avoid assuming 'accept' headers |
Did you manage to get the solution? |
I was trying to solve a similar problem to this. In order to see my camera on my website through my webview I had to request permission for CAMERA, and RECORD_AUDIO. Enabling these through my react-native app allowed me to see my camera, but I also had an incoming camera feed (third party camera) that wasn't showing up. In order to fix it, I add the |
I also experienced an issue where Android would only launch a file browser and did not let the user choose the camera. For anyone who is trying to do a simple upload from a html input, remember to add accept="image/*" attribute.
|
any solutions? |
I am also facing the same problem in |
Hi @gwmccull ! I'm running into this issue with Android. Do you remember if this was a workaround for the Android build? Or was it for both? |
hi @kchens! We're doing the same thing for iOS & Android but the names of the permissions appear to be different. It looks like there's been work on this since I first found that solution but I haven't tried to reevaluating it. It's still working for us though |
@gwmccull what Android version and React-Native versions is your company's app on right now? |
@kchens we're using RN 0.61.5 and we're supporting Android 9+. We're looking into expanding back to Android 8+ (we supported it up until a few months ago) and I'm not expecting this to be an issue |
I have the same issue. Camera does not work in webview when standalone Android app is built with expo. But it works through the expo client with the same configuration. Any solution? |
actually i was getting the same issue for both camera and gallery
I hope this helps you as well. |
@Gjoshi3107 Thanks for your tips! Did you only try Android? Just wondering if iOS works? |
any fix, update on this espacially on iOS ? |
Hello , I tried using below code and working properly on Android phones and displaying live video.
Please guide me . Thanks. |
Tried everything but still failing for android, iOS works fine. Snack URL https://snack.expo.io/@shahidcodes/webview-get-user-media-test-android |
Its working fine on Android but not on iOS |
@Zain228 not sure how you tested it, did you use the snack or cloned locally? |
I use my own iPhone for testing but its not working however on my Samsung phone its working fine |
On Android add the prop
|
What iOS version are you running? |
That Is already set in the props still no luck. https://snack.expo.io/@shahidcodes/webview-get-user-media-test-android |
Try adding
These two props fixed the issue for me. |
iOS 12! |
Yeah, works on iOS 14. |
@wahaj-47 is it possible for you to share code or steps. I have added both props , still not working. |
This works on both Android 10+ and iOS 14+ |
web-view version 11.4.4: it does not work on IOS, why close this issue ? |
this issue is still active on Android. https://snack.expo.dev/UY4OhRSm5 (same on real devices) |
I was able to solve this by adding |
Applied both of these and it worked. the MODIFY_AUDIO_SETTINGS was not intuitive. Anyways, my permissions in AndroidManifest.xml and webview looked like this after
|
I'm facing a slightly different problem (in iOS). When running the app for the first time the modal for asking permission pops up fine, showing the message in But I'd like to check that message in different languages. Unfortunately, going to the app settings and revoking access to the camera ends up with the app opening the camera app but with a blank background (no image from the camera and a non-working trigger button). So there's no way after the first modal to show it again (you give access and everything is fine; or you don't and get the blank camera; but not a new modal request nor a permission error). |
Did Any one find the solution please help? |
Hey guys Slightly different problem here but I was hoping someone might have an answer. I've been searching the topic for 2 days and didn't get my answer. I'm picking a video file from the library with the lib Would anybody have a tip on the correct way to handle this ? It would be so so so much appreciated ! Thank you very much in advance 😌 |
Hey,
Before you call your web view component, conditionally render it with permission like below with
|
Thank you @anirudh711. This aproach worked overhere! |
use expo all worked few weeks ago, now have problem with mic and camera |
the whereby site has some relevant information regarding this topic: https://docs.whereby.com/embedding-rooms/in-a-mobile-app/in-react-native
<WebView
startInLoadingState
source={{ uri }}
mediaPlaybackRequiresUserAction={false}
// iOS specific:
allowsInlineMediaPlayback
// Android specific:
javaScriptEnabled
domStorageEnabled
/>
On the iOS instructions, it recommends the following for iOS 14.2 and earlier:
|
thank you very much, you saved my life |
Hi.
I am a new React Native developer.
Now, I am implementing some function using React Native.
I want to use Camera and Mic through Webview.
My site works well on Mobile Browser, but when I call that url in Webview, I can't use Camera and Mic.
Please help me.
Thanks.
The text was updated successfully, but these errors were encountered: