apache / apache/cordova-plugin-inappbrowser
Unable to access camera for record video online from inappbrowser
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
# Bug Report
## Unable to access the camera while accessing the https://webcamtests.com/ URL for android and iOS ionic application
### It must allow access to the Camera for record the video
### It is not accessing the camera for any of the website like https://webcamtests.com/
## Information
I am working on one of the Ionic project and need to access client's website which access the camera and record the video. If we run the Website on browser, it ask for permission to access the camera and if we grant the permission, it will record the video and if we denied the permission we are facing same issue what we are facing for In-App-Browser Lib.
### Command or Code
```
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
constructor(private iab: InAppBrowser) { }
openBrowser(){
const browser = this.iab.create('https://webcamtests.com/','_blank','location=no');
}
```
It is opening the browser in the application however when we visit the websites which are using the camera, it shows Steam is not available error or not able to access your camera.
For only android it is working by adding following code in src/android/InAppChromeClient.java file(However don't know is it really only way to do this or not)
```
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void onPermissionRequest(PermissionRequest request) {
request.grant(request.getResources());
}
```
###Some error logs
Android(If we not modify src/android/InAppChromeClient.java)
```
[ERROR:web_contents_delegate.cc(175)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
```
IOS
```
- <_UIKBCompatInputView: 0x105455200; frame = (0 0; 0 0); layer = > returned 0 width, assuming UIViewNoIntrinsicMetric
- Unbalanced calls to begin/end appearance transitions for
- Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
```
### Environment, Platform, Device
All the android, iOS mobile devices
### Version information
In-App-Browser
Cordova v9.0.0 (cordova-lib@9.0.1)
Ionic v4
Node v12.12.0
NPM v6.14.1
Development using MAC OS
Andorid Studio 3.5.2
XCode 11.3.1
## Checklist
- [X] I searched for existing GitHub issues
- [X] I updated all Cordova tooling to most recent version
- [X] I included all the necessary information above
Contributor guide
Research direction
Start with the reported InAppBrowser.create('_blank') reproduction and inspect src/android/InAppChromeClient.java alongside the Android CheckMediaAccessPermission error. Compare that behavior with the reported iOS WebKit logs; done means webcamtests.com can request camera access and record video in the Android and iOS in-app browser.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, ios, java, javascript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100