AckerApple / ack-angular-webcam

MIT License
37 stars 19 forks source link

Switch between Front and Back camera ? #43

Closed mahdifantar closed 6 years ago

mahdifantar commented 6 years ago

Good evening I used your module and it's really cool but i can't switch between front camera and back camera could you help me please :)

AckerApple commented 6 years ago

Look threw this packages reported issues.

In short, and I need to document this: facingMode is ONLY supported by iOS/Safari

For ALL other computers/devices to change cameras you supply deviceId to this package

Let me know if you need more help because this is all short hand. Use the demo page for this package to test what I am telling you. On Apple, change facingMode in demo. All other devices, change the selected device in the demo page.

Good luck. Let me know

mahdifantar commented 6 years ago

screenshot_20180321-082253 good morning this is a screenshot of what i have. i switched between cameras by changing their id but the back cam don't work all the time

AckerApple commented 6 years ago

Don’t work all the time? Some of the time it works?

Hey this library doesn’t do anything magical. I just wrapped HTML5 getUserMedia in an Angular package.

I got an Android and I’ll try it today.

AckerApple commented 6 years ago

Also, i don’t think you can access both cameras at the same time on Android. Not 100% sure. Try accessing just the environment camera and if it works you just can’t do both cameras at same time.

Your screen shot shows you trying to access both cameras at the same time. Don’t work on your hardware. Have to be on a desktop machine to access more than one cam at a time

AckerApple commented 6 years ago

I’ve just confirmed you CANNOT show both cameras at the same time on iOS. You are using this package in a way that your Android browser does NOT support. Try one camera at a time and it should let you access either camera but NOT both

mahdifantar commented 6 years ago

Hello Sorry for disturbing you. I know that i cannot show both of the front and back cameras on the same time but when i select the back camera i have a black screen it doesn't work

AckerApple commented 6 years ago

I’ll go grab an Android and test.

You are not bothering me but when you say “sorry to bother you”, it makes it sound like I’m frazzled that you reported an issue, that bothers me. I’m here to help. I might come off as a tight ass but I’m far from it just being direct

Let me see what this ol Android here does for me.... brb

AckerApple commented 6 years ago

I had to charge and then update my Android and I have arrived at the same issue, finally.

I will get back to you most likely within 3 days

This is a working page that I will use to figure out what they are doing different: https://webrtc.github.io/samples/src/content/devices/input-output/

mahdifantar commented 6 years ago

thank you so much :)

AckerApple commented 6 years ago

Busy as all, this issue is on my mind. I suspect another 1 to 4 days depending on what life gives me to work with.

Thank you........ I believe my fix is simply to assign "deviceId" for Android as "cameraId", that was my educated guess last looking at it. If you would look up how to assign deviceId to an HTML video element, that would help. Again currently this package uses "deviceId" to tell the video elm of its source and that works on desktops to perfection.

mahdifantar commented 6 years ago

hello mr @AckerApple, hope that you find a solution for this issue

AckerApple commented 6 years ago

Well I think today’s the day. I’ve had to clear my plate the last 4 days and I have done just that. I’ll report today

AckerApple commented 6 years ago

This StackOverflow issue report seems promising: https://stackoverflow.com/questions/40891009/switch-camera-using-mediadevices-getusermedia-in-webrtc

Note to self: I believe this package may need to issue the stop() first to the video element before switching devices

AckerApple commented 6 years ago

This StackOverflow suggests using some sort of sourceId instead of deviceId: https://stackoverflow.com/questions/18625007/enable-rear-camera-with-html5/19055195

AckerApple commented 6 years ago

Fixed! Please acquire version 1.9.2

Close this issue when satisfied or report further.

On Android, I had to issue the stop() command before changing cameras as Android considered us to be running two cameras at once. And even though we were NOT trying to run two cameras at once, this fixed the Android changing devices issue you reported

mahdifantar commented 6 years ago

thank you so much it works

AckerApple commented 6 years ago

If you have not already, please follow, star, or perform any social actions that may help naturally boost the popularity of this package.

Thank you for waiting and staying tuned in!

AckerApple commented 6 years ago

OHHHH and special request. I like to remember those I work with. Please consider updating your github icon to a real photo of yourself (or not)

Be well

mahdifantar commented 6 years ago

here i am 👍 :)

AckerApple commented 6 years ago

Good show. Good show indeed.

Make money