@newtonschool/react_proctoring_library 0.0.45 → 0.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,9 +12,7 @@ require("core-js/modules/es.typed-array.sort.js");
12
12
  require("core-js/modules/es.typed-array.to-locale-string.js");
13
13
  require("core-js/modules/es.promise.js");
14
14
  var _ = require(".");
15
- var _html2canvas = _interopRequireDefault(require("html2canvas"));
16
15
  var _defaults = require("../constants/defaults");
17
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
16
  const isWebcamVideoValid = webcamReference => webcamReference !== null && webcamReference !== undefined && typeof webcamReference.current !== "undefined" && webcamReference.current !== null && webcamReference.current.video.readyState === 4;
19
17
  exports.isWebcamVideoValid = isWebcamVideoValid;
20
18
  const updateStatistics = (statistics, currentStats, proctorParams) => {
@@ -176,9 +174,13 @@ const captureWebcamSnapshot = webcamReference => {
176
174
  exports.captureWebcamSnapshot = captureWebcamSnapshot;
177
175
  const captureScreenshot = async elementIdSelector => {
178
176
  try {
179
- const canvas = await (0, _html2canvas.default)(document.querySelector(elementIdSelector));
180
- const b64Snapshot = canvas.toDataURL("image/jpeg");
181
- return b64DataURItoBlob(b64Snapshot);
177
+ const canvas = document.createElement("canvas");
178
+ const video = document.querySelector(elementIdSelector);
179
+ canvas.width = video.videoWidth;
180
+ canvas.height = video.videoHeight;
181
+ canvas.getContext("2d").drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
182
+ const blob = await new Promise(resolve => canvas.toBlob(resolve));
183
+ return blob;
182
184
  } catch (e) {
183
185
  // pass
184
186
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newtonschool/react_proctoring_library",
3
- "version": "0.0.45",
3
+ "version": "0.0.46",
4
4
  "description": "Used to proctor online tests",
5
5
  "author": "ayushkagrawal,shreyachandra,weastel",
6
6
  "main": "dist/index.js",
@@ -17,7 +17,6 @@
17
17
  "@tensorflow/tfjs": "^3.9.0",
18
18
  "bootstrap": "^5.1.3",
19
19
  "core-js": "^3.22.7",
20
- "html2canvas": "^1.4.1",
21
20
  "react-bootstrap": "^2.0.4",
22
21
  "react-webcam": "^6.0.0"
23
22
  },