Merge pull request #21262 from edx/waheed/PROD-499-fix-verify-image-aspect-ratio

Fix photo ID verify images aspect ratio.
This commit is contained in:
Waheed Ahmed
2019-07-31 17:15:18 +05:00
committed by GitHub

View File

@@ -50,11 +50,15 @@
},
snapshot: function() {
var video, canvas;
var video, canvas, aspectRatio;
if (this.stream) {
video = this.getVideo();
canvas = this.getCanvas();
// keep canvas aspect ratio same as video while drawing image.
aspectRatio = canvas.width / video.videoWidth;
canvas.width = video.videoWidth * aspectRatio;
canvas.height = video.videoHeight * aspectRatio;
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
video.pause();
return true;