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
[TIMOB-25854] Android: grant permissions for Audio/Video WebRTC #9928
Conversation
Generated by 🚫 dangerJS |
@m1ga Is it possible to add a unit-test for this? Otherwise, we'll add the |
@Override | ||
public void onPermissionRequest(final PermissionRequest request) | ||
{ | ||
TiViewProxy proxy = tiWebView.getProxy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, tried a different approach before and that survived the code change. Gone now
{ | ||
TiViewProxy proxy = tiWebView.getProxy(); | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | ||
request.grant(request.getResources()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jquick-axway Should we always grant this? I feel this might cause side-effects for other components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You still have to show the popup in your app to access camera (camera permission)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what do we do if a customer wants to explicitly disallow it? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The he clicks no
when you ask for Ti.Android.requestPermissions()
in your app. But you are right: you can't allow the camera in other parts of your app and disallow it for the webview.
So a property/method would be better to allow it and then the developer has to reload the page when it is set to true!
About the test: Not sure if that is test-able |
@hansemannn how about: TiViewProxy proxy = tiWebView.getProxy();
if (proxy.getProperty(TiC.PROPERTY_ALLOW_WEB_PERMISSION)) {
request.grant(request.getResources());
} and a property called |
Requesting @jquick-axway for the review. |
I'm not sure how I feel about having a boolean that grants permission to all resources and all URLs like this. Especially since it includes resources such as audio/video recording. I don't want this code to get red-flagged as a security concern. I believe Google's main intention was for the app to display a dialog asking the end-user to grant permission as can be seen in their example app below (see its screenshots). @hansemannn, do you know how Apple expects this to be handled by a Edit: I think there is a design issue here. Audio/Video recording via a WebView won't simply work with this boolean anyways. You have to use Google's Java |
@jquick-axway I agree. For iOS, permission handling is necessary in two places:
<ios>
<plist>
<dict>
<!-- Permissions: Microphone -->
<key>NSMicrophoneUsageDescription</key>
<string>We need permission to access the microphone on your device for audio input or recording.</string>
<!-- Permissions: Camera -->
<key>NSCameraUsageDescription</key>
<string>We need permission to access your device camera.</string>
</dict>
</plist>
</ios>
So @m1ga, @jquick-axway: I would agree we should re-design this on Android and come back with a more generic solution. |
Okay. Since iOS permission handling is automatic after adding the plist settings mentioned by @hansemannn, then we should make it automatic on Android as well. This means we don't need a new property or event. What I recommend is to modify
Example on how to request permission: @m1ga, I appreciate the effort you've made here and I hope you don't feel discouraged. |
@jquick-axway no problem at all! I think there are two request you need to do:
right? The first is the to access the camera at all and the second is to allow the webview to access it. I'm checking some more examples and see how it can be done. If someone else is working on that I'm fine, too 😄 It will take a bit for me to get back to that PR |
Thanks @m1ga, keep your great contributions! Maybe a look over the edge how other frameworks / native apps do this would help as well. |
@m1ga, the good news here is that you don't need to display a custom alert dialog. Google's Google's source code below shows how to do this for RESOURCE_VIDEO_CAPTURE. We just got to figure out how to handle the other 3 resource constants next. Particularly |
JIRA: https://jira.appcelerator.org/browse/TIMOB-25854
Create a custom conference room at: https://palava.tv/
For more details see the JIRA ticket
tiapp.xml