in client/src/js/RemoteVerifier.ts [45:73]
uploadFrame() {
const context = this.invisibleCanvas.getContext("2d");
if (context === null) {
throw "Error getting canvas context";
}
context.drawImage(this.videoElement, 0, 0, this.videoElement.width, this.videoElement.height);
if (Utils.getConfigBooleanValue("FLIP_VIDEO")) {
context.scale(-1, 1);
}
const canvas = this.invisibleCanvas;
const self = this;
this.promises.push(
new Promise(function(resolve: () => void, reject: (error: Error) => void) {
canvas.toBlob(
function(blob) {
if (blob === null) {
reject(new Error("Error creating blob from canvas"));
} else {
RemoteVerifier.callFramesApi(self.challengeId, self.token, blob, resolve, reject);
}
},
"image/jpeg",
parseFloat(Utils.getConfig().IMAGE_JPG_QUALITY)
);
})
);
}