Skip to content
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

Unable To Access Rear Camera on iPad iOS 11.4.1 #172

Open
bm2112 opened this issue Aug 1, 2018 · 6 comments
Open

Unable To Access Rear Camera on iPad iOS 11.4.1 #172

bm2112 opened this issue Aug 1, 2018 · 6 comments

Comments

@bm2112
Copy link

bm2112 commented Aug 1, 2018

When I launch the website it will show that is displaying the rear camera, but it is actually displaying the front. When I switch over to the front camera, it also displays the front. I've tried everything I could find on the internet to fix this issue and I've had no luck. I've tried making the facingMode "environment", using the code from a couple of forks of this project which supposedly allow the iOS rear camera to work, and changing large portions of the app.js and camera.js myself. I've manually selected camera[1] instead of camera[0] and that will cause it to launch with the other camera selected, but it still displays the front camera.

Has anyone else had an issue with the rear camera on iOS that was unable to solve it using one of the above methods I mentioned? I would greatly appreciate some help. The website works fine for Android and Windows for many browsers, but iOS Safari is giving me nothing but trouble. Thanks

@augustosamame
Copy link

As indicated in the Readme, this library only works for mobile browsers that implement WebRTC. IOS browsers currently do not.

Instascan works on non-iOS platforms in any browser that supports the WebRTC/getUserMedia API, which currently includes Chome, Firefox, Opera, and Edge. IE and Safari are not supported.

@bm2112
Copy link
Author

bm2112 commented Aug 15, 2018

That is not true. Safari in the newest version of iOS supports WebRTC API. As I said above, it works for the front camera, but not the rear camera.

@jvanalst
Copy link

jvanalst commented Aug 16, 2018

@bm2112 is correct. Much of WebRTC was made available in iOS and Safari 11. Certain things like MediaRecorder are still missing, but it looks like everything used in this library (MediaStreams) should be available.

Maybe the issue should be updated to say "add iOS 11 support" since it's most of the way there anyway.

@kibagami-jubei
Copy link

Has anyone resolved this? I

@kibagami-jubei
Copy link

Yeah, been working on this, I can't get this to work. Trying to go back and re-read threads. I got the front-facing camera to work by adding the latest web RTC adapter and adding the playsinline attribute to the video tag. It can read the cameras but does nothing when swapping to the back camera.

@guidomgs
Copy link

guidomgs commented May 8, 2020

I m not sure how to change this, but when you start the camera is posible to change the camera

var constraints = {
video: {
facingMode: "environment" //"user" for selfie mode
},
audio: false
};

function cameraStart() {
navigator.mediaDevices
.getUserMedia(constraints)
.then(function(stream) {
track = stream.getTracks()[0];
cameraView.srcObject = stream;
})
.catch(function(error) {
console.error("Oops. Something is broken.", error);
});
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants