@newtonschool/react_proctoring_library 0.0.42 → 0.0.44
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.
|
@@ -31,7 +31,7 @@ function useWebcamData(webcamReference, canvasReference, proctorParams) {
|
|
|
31
31
|
const isWatching = (0, _react.useState)(_defaults.initialValues.isWatching);
|
|
32
32
|
const [lookedAwayCount, setLookedAwayCount] = (0, _react.useState)(_defaults.initialValues.lookedAwayCount);
|
|
33
33
|
(0, _react.useEffect)(() => {
|
|
34
|
-
if (
|
|
34
|
+
if (proctorParams.people && proctorParams.lookedAwayCount && (0, _utils.isGPUAvailable)()) {
|
|
35
35
|
const loadCocoSSDModel = async () => {
|
|
36
36
|
try {
|
|
37
37
|
const model = await cocoSsd.load();
|
package/dist/utils/gpuUtils.js
CHANGED
|
@@ -11,10 +11,13 @@ var _defaults = require("../constants/defaults");
|
|
|
11
11
|
const isGPUAvailable = () => {
|
|
12
12
|
const canvas = document.createElement("canvas");
|
|
13
13
|
const webgl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
|
|
14
|
-
const debugInfo = webgl.getExtension("webgl_debug_renderer_info");
|
|
15
|
-
|
|
14
|
+
const debugInfo = webgl === null || webgl === void 0 ? void 0 : webgl.getExtension("webgl_debug_renderer_info");
|
|
15
|
+
if (!debugInfo) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const gpu = webgl.getParameter(debugInfo === null || debugInfo === void 0 ? void 0 : debugInfo.UNMASKED_RENDERER_WEBGL).toLowerCase();
|
|
16
19
|
for (const gpuType of _defaults.gpuTypes) {
|
|
17
|
-
if (gpu.includes(gpuType)) return true;
|
|
20
|
+
if (gpu !== null && gpu !== void 0 && gpu.includes(gpuType)) return true;
|
|
18
21
|
}
|
|
19
22
|
return false;
|
|
20
23
|
};
|