public static takePhoto()

in source/client/src/liveness/utils/CanvasUtils.ts [36:54]


  public static takePhoto(
    videoElementId: string,
    canvasElementId: string,
    width: number,
    height: number,
    flip: boolean
  ) {
    const videoElement = CanvasUtils.getVideoElement(videoElementId);
    const canvasElement = CanvasUtils.getCanvasElement(canvasElementId);
    const canvasContext = CanvasUtils.getCanvasContext(canvasElement);
    canvasElement.width = width;
    canvasElement.height = height;
    if (flip) {
      canvasContext.scale(-1, 1);
      canvasContext.drawImage(videoElement, 0, 0, width * -1, height);
    } else {
      canvasContext.drawImage(videoElement, 0, 0);
    }
  }