-
Notifications
You must be signed in to change notification settings - Fork 51
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
fix: secondary camera #69
base: master
Are you sure you want to change the base?
fix: secondary camera #69
Conversation
@@ -17,7 +17,7 @@ export class CameraPWA { | |||
|
|||
@Prop({ context: 'isServer' }) private isServer: boolean; | |||
|
|||
@Prop() facingMode: string = 'user'; |
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.
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.
We hope this will fix both issues described above for us. (no camera found (iOS IPhone 12) and default rear camera) |
Why is this PR not accepted yet? |
Same question here. Any updates on this |
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.
Approved the PR to update the camera on PWAs.
Planning to merge it ? I made in the past a custom Camera component for my PWA, but For example "environment" facingMode doesn't work on Microsoft Tablets, it shows the "user" camera 🤯 So we had to do this: const videoDevices = mediaDevices.filter(
(device) => device.kind === "videoinput"
);
console.info("videoDevices: ", videoDevices);
/* We have to check manually which is the right back device camera, because there's not
standard library to manage that, especially for weird devices like Microsoft Surfaces */
const backCameraDevice = videoDevices.find(
(d) =>
d.label.toLowerCase().includes("back") ||
d.label.toLowerCase().includes("rear")
);
const backCameraId = backCameraDevice && backCameraDevice.deviceId;
const frontCameraDevice = videoDevices.find(
(d) => d.deviceId !== backCameraId
);
const frontCameraId = frontCameraDevice && frontCameraDevice.deviceId;
const constraints = {
audio: false,
video: {
deviceId: backCameraId || frontCameraId,
},
}; @mtsmachado8 would you like to implement this corner case ? |
Any update on this PR ? Thanks |
So, any update on when this will be released? |
4 months later and still no news? |
As a workaround I use the html tag instead of the Ionic Camera. Then just read the data from the input element from the DOM. Works like a charm. |
@KnulstBDH above only opens gallery or camera too? |
@abkNiazi It shows the native media selector from the device, so the user can choose to either use the camera, or to select images from their library. On desktop it'll only open the file selector, so you're not able to test it with a camera (like a webcam), but on mobile it is also possible to choose your camera. |
@KnulstBDH As I understand is that it will be to let user choose camera or gallery/storage when natively build and run on android. |
@abkNiazi Yes, it will let the user choose between camera or gallery, but it doesn't have to be deployed on a specific OS, because it is just a website. If I understand you correctly; When website is opened on mobile it will work the same as you described: "let user choose camera or gallery" |
@KnulstBDH thanks for your time. But unfortunately it is opening file storage and does not give option to take photo. |
On some devices(that have multiple cameras) we cant take the default back camera (REAR camera) -> test it on galaxy s20+ or Huawey P30 Lite -> MAR-LX3A.
It looks like its beeing used or the manufacturer didn't implement it like they should.
This PR solves this issue by getting another camera.
It would be better if we could chose wich camera is that tough... (maybe someone can implement in the future)
This PR also solves another issue.
The default camera should be Rear, Not FRONT by the documentation of capacitor.
This code was getting the user view by default, not environment as it should