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

Allow to get high quality pictures. #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

firvida
Copy link

@firvida firvida commented Aug 4, 2021

Prior to this commit the quality of the picture was taken from the video
html component, which in general will lead to pretty low resolution.

Instead of that, we add a video constraint, so if possible the video will
project a stream with height of at least 1080p. We store global height
and width from the selected stream and set the canvas to those when snap
is taken.

Prior to this commit the quality of the picture was taken from the video
html component, which in general will lead to pretty low resolution.

Instead of that, we add a video constraint, so if possible the video will
project a stream with height of at least 1080p. We store global height
and width from the selected stream and set the canvas to those when snap
is taken.
The function of the webcam isn't modified in this commit we just use
screen measurements to give video component better defaults which will
maybe be closer to the use case in which it is used.

Also if the screen resizes we should take care of the video resizing.
MV-GH added a commit to MV-GH/webcam-easy that referenced this pull request Dec 23, 2021
Allow to get high quality pictures
bensonruan#29

This was easier than actually building upon the pr
@MV-GH MV-GH mentioned this pull request Dec 23, 2021
@@ -53,14 +59,16 @@ class Webcam {
} else {
videoConstraints.deviceId = { exact: this._selectedDeviceId};
}
/* Try to get a media stream that takes at least 1080p pictures */
videoConstraints.height = { min: 1080 }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

min means minimum supported resolution. So if you have smaller resolution camera you will not see it. I think here could be used ideal .

To require a capability, use the keywords min, max, or exact
https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia

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

Successfully merging this pull request may close these issues.

None yet

2 participants