OvidijusParsiunas / deep-chat

Fully customizable AI chatbot component for your website
https://deepchat.dev
MIT License
1.26k stars 170 forks source link

Using input capture method for camera #172

Closed anup-singh closed 1 month ago

anup-singh commented 2 months ago

Is there any option to directly use camera on mobile devices instead of using getUserMedia. HTML allows us to directly use mobile camera instead of getUsetMedia

For example - <input type="file" name="image" accept="image/*" capture="user">

reference - https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/capture

OvidijusParsiunas commented 2 months ago

Hi @anup-singh.

The images button is using the input element, however it doesn't use the capture attribute. Nevertheless I have tested this button on my phone and upon clicking it I do get the camera option and I can switch between different modes (front/back), hence this does not seem to be problematic on that end.

The camera button on the other hand as you described does use the getUserMedia method. The reason why we use it over the input button is because it gives us more control over the captured image when used on the browser to allow it to fit the modal and preview the captured image. Additionally it still does capture the camera on the phone (though it does not automatically use the back camera), so its a win-win.

If you want your users to have full control of the camera in mobile devices I would suggest that you would try the images button instead.

Thankyou!

OvidijusParsiunas commented 1 month ago

I will be closing this issue as there has been no further activity.