@newtonschool/react_proctoring_library 0.0.30 → 0.0.32
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.
- package/package.json +1 -1
- package/dist/assets/images/newton-school-logo.png +0 -0
- package/dist/assets/images/url-video-permission-highlight.png +0 -0
- package/dist/assets/videos/ask-permission.mp4 +0 -0
- package/dist/components/ProctorApp.js +0 -181
- package/dist/components/ProctoredContextApp.js +0 -109
- package/dist/components/activity-tracker/index.js +0 -150
- package/dist/components/activity-tracker/index.scss +0 -7
- package/dist/components/index.js +0 -47
- package/dist/components/index.scss +0 -8
- package/dist/components/permissions/index.js +0 -77
- package/dist/components/permissions/index.scss +0 -6
- package/dist/components/permissions/permission-body.js +0 -60
- package/dist/components/proctor-app/Loadable.js +0 -26
- package/dist/components/proctor-app/index.js +0 -181
- package/dist/components/proctor-app/index.scss +0 -12
- package/dist/components/proctor-context-app/Loadable.js +0 -26
- package/dist/components/proctor-context-app/index.js +0 -108
- package/dist/components/screenshare/index.js +0 -40
- package/dist/components/screenshare/index.scss +0 -4
- package/dist/constants/defaults.js +0 -54
- package/dist/constants/text.js +0 -60
- package/dist/hooks/index.js +0 -23
- package/dist/hooks/useFullScreenData.js +0 -43
- package/dist/hooks/usePageVisibility.js +0 -31
- package/dist/hooks/useTabSwitchCount.js +0 -25
- package/dist/hooks/useWebcamData.js +0 -82
- package/dist/index.js +0 -19
- package/dist/proctoringTracker/tracker.js +0 -17
- package/dist/proctoringTracker/trackerWrapper.js +0 -1
- package/dist/utils/arrayUtils.js +0 -16
- package/dist/utils/breachUtils.js +0 -135
- package/dist/utils/browserUtils.js +0 -72
- package/dist/utils/gpuUtils.js +0 -29
- package/dist/utils/index.js +0 -79
- package/dist/utils/loadable.js +0 -29
- package/dist/utils/webcamMicrophoneUtils.js +0 -223
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = usePageVisibility;
|
|
7
|
-
|
|
8
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
-
|
|
10
|
-
var _react = require("react");
|
|
11
|
-
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
|
|
14
|
-
const visibilityChangeEvent = (0, _utils.getVisibilityChangeEventName)();
|
|
15
|
-
|
|
16
|
-
function usePageVisibility(isProctorParam) {
|
|
17
|
-
const [isVisible, setIsVisible] = (0, _react.useState)((0, _utils.getIsDocumentVisible)());
|
|
18
|
-
|
|
19
|
-
const updateVisibility = () => {
|
|
20
|
-
setIsVisible((0, _utils.getIsDocumentVisible)());
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
(0, _react.useEffect)(() => {
|
|
24
|
-
updateVisibility();
|
|
25
|
-
document.addEventListener(visibilityChangeEvent, updateVisibility, false);
|
|
26
|
-
return () => {
|
|
27
|
-
document.removeEventListener(visibilityChangeEvent, updateVisibility);
|
|
28
|
-
};
|
|
29
|
-
}, []);
|
|
30
|
-
return isVisible && isProctorParam;
|
|
31
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useTabSwitchCount;
|
|
7
|
-
|
|
8
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
-
|
|
10
|
-
var _react = require("react");
|
|
11
|
-
|
|
12
|
-
var _defaults = require("../constants/defaults");
|
|
13
|
-
|
|
14
|
-
var _ = require(".");
|
|
15
|
-
|
|
16
|
-
function useTabSwitchCount(firstFullScreenDone) {
|
|
17
|
-
const isTabVisible = (0, _.usePageVisibility)();
|
|
18
|
-
const [tabSwitchCount, setTabSwitchCount] = (0, _react.useState)(_defaults.initialValues.tabSwitchCount);
|
|
19
|
-
(0, _react.useEffect)(() => {
|
|
20
|
-
if (!isTabVisible && firstFullScreenDone.current) {
|
|
21
|
-
setTabSwitchCount(tabSwitchCount => tabSwitchCount + 1);
|
|
22
|
-
}
|
|
23
|
-
}, [isTabVisible, firstFullScreenDone]);
|
|
24
|
-
return tabSwitchCount;
|
|
25
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useWebcamData;
|
|
7
|
-
|
|
8
|
-
require("core-js/modules/es.promise.js");
|
|
9
|
-
|
|
10
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
-
|
|
12
|
-
var _react = require("react");
|
|
13
|
-
|
|
14
|
-
var cocoSsd = _interopRequireWildcard(require("@tensorflow-models/coco-ssd"));
|
|
15
|
-
|
|
16
|
-
var tf = _interopRequireWildcard(require("@tensorflow/tfjs"));
|
|
17
|
-
|
|
18
|
-
var _utils = require("../utils");
|
|
19
|
-
|
|
20
|
-
var _defaults = require("../constants/defaults");
|
|
21
|
-
|
|
22
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
|
-
const getUserCount = async (model, image) => {
|
|
27
|
-
try {
|
|
28
|
-
let predictions = await model.detect(image);
|
|
29
|
-
let numOfUsers = 0;
|
|
30
|
-
predictions.forEach(prediction => {
|
|
31
|
-
if (prediction.class === "person") {
|
|
32
|
-
numOfUsers += 1;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
return numOfUsers;
|
|
36
|
-
} catch (err) {}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
function useWebcamData(webcamReference, canvasReference, proctorParams) {
|
|
40
|
-
const [userCount, setUserCount] = (0, _react.useState)(_defaults.initialValues.userCount);
|
|
41
|
-
const isWatching = (0, _react.useState)(_defaults.initialValues.isWatching);
|
|
42
|
-
const [lookedAwayCount, setLookedAwayCount] = (0, _react.useState)(_defaults.initialValues.lookedAwayCount);
|
|
43
|
-
(0, _react.useEffect)(() => {
|
|
44
|
-
if ((0, _utils.isGPUAvailable)() && proctorParams.people && proctorParams.lookedAwayCount) {
|
|
45
|
-
const loadCocoSSDModel = async () => {
|
|
46
|
-
try {
|
|
47
|
-
const model = await cocoSsd.load();
|
|
48
|
-
setInterval(async () => {
|
|
49
|
-
if ((0, _utils.isWebcamVideoValid)(webcamReference)) {
|
|
50
|
-
const video = webcamReference.current.video;
|
|
51
|
-
const {
|
|
52
|
-
videoWidth,
|
|
53
|
-
videoHeight
|
|
54
|
-
} = video;
|
|
55
|
-
const b64Snapshot = webcamReference.current.getScreenshot();
|
|
56
|
-
const webcamSnapShot = new Image(videoWidth, videoHeight);
|
|
57
|
-
webcamSnapShot.src = b64Snapshot;
|
|
58
|
-
|
|
59
|
-
webcamSnapShot.onload = async () => {
|
|
60
|
-
const count = await getUserCount(model, webcamSnapShot);
|
|
61
|
-
setUserCount(count);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
canvasReference.current.width = videoWidth;
|
|
65
|
-
canvasReference.current.height = videoHeight;
|
|
66
|
-
}
|
|
67
|
-
}, _defaults.evaluateVideoIntervalInSeconds * 1000);
|
|
68
|
-
} catch (err) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
loadCocoSSDModel();
|
|
74
|
-
}
|
|
75
|
-
}, [webcamReference, canvasReference, proctorParams.people, proctorParams.lookedAwayCount]);
|
|
76
|
-
(0, _react.useEffect)(() => {
|
|
77
|
-
if (!isWatching) {
|
|
78
|
-
setLookedAwayCount(lookedAwayCount => lookedAwayCount + 1);
|
|
79
|
-
}
|
|
80
|
-
}, [isWatching]);
|
|
81
|
-
return [userCount, lookedAwayCount];
|
|
82
|
-
}
|
package/dist/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "ProctorApp", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _components.ProctorApp;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "ProctoredContextApp", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _components.ProctoredContextApp;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
var _components = require("./components");
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
class ProctoringTracker {
|
|
9
|
-
constructor() {}
|
|
10
|
-
|
|
11
|
-
askProctoredPermission() {}
|
|
12
|
-
|
|
13
|
-
hasProctoredPermission() {}
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.default = ProctoringTracker;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/utils/arrayUtils.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isArrayValid = void 0;
|
|
7
|
-
|
|
8
|
-
const isArrayValid = array => {
|
|
9
|
-
if (!array || !(array instanceof Array) || array.length <= 0) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return true;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
exports.isArrayValid = isArrayValid;
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.showProctoredComponent = exports.isWebcamRequired = exports.getRequiredPermissionsFromProctorParams = exports.getInitialStats = exports.getDataOnBreach = void 0;
|
|
7
|
-
|
|
8
|
-
var _defaults = require("../constants/defaults");
|
|
9
|
-
|
|
10
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
-
|
|
12
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
-
|
|
14
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
-
|
|
16
|
-
const getInitialStats = proctorParams => {
|
|
17
|
-
const initialStats = {};
|
|
18
|
-
|
|
19
|
-
if (proctorParams.people) {
|
|
20
|
-
initialStats[_defaults.STATS_PARAMS.userCountMax] = _defaults.initialValues.userCount;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (proctorParams.tabSwitch) {
|
|
24
|
-
initialStats[_defaults.STATS_PARAMS.isTabSwitched] = _defaults.initialValues.isTabSwitched;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (proctorParams.fullscreenExit) {
|
|
28
|
-
initialStats[_defaults.STATS_PARAMS.isFullscreen] = _defaults.initialValues.isFullscreen;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (proctorParams.lookedAway) {
|
|
32
|
-
initialStats[_defaults.STATS_PARAMS.lookedAwayCount] = _defaults.initialValues.lookedAwayCount;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return initialStats;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
exports.getInitialStats = getInitialStats;
|
|
39
|
-
|
|
40
|
-
const getRequiredPermissionsFromProctorParams = proctorParams => {
|
|
41
|
-
const requiredPermissions = [];
|
|
42
|
-
|
|
43
|
-
for (const key in proctorParams) {
|
|
44
|
-
if (proctorParams[key] && _defaults.proctorParamsToPermission[key]) {
|
|
45
|
-
requiredPermissions.push(_defaults.proctorParamsToPermission[key]);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return requiredPermissions;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
exports.getRequiredPermissionsFromProctorParams = getRequiredPermissionsFromProctorParams;
|
|
53
|
-
|
|
54
|
-
const isWebcamRequired = proctorParams => proctorParams.people || proctorParams.lookedAway || proctorParams.webcamSnapshots;
|
|
55
|
-
|
|
56
|
-
exports.isWebcamRequired = isWebcamRequired;
|
|
57
|
-
|
|
58
|
-
const showProctoredComponent = (proctorParams, hasAllPermission) => {
|
|
59
|
-
return hasAllPermission(getRequiredPermissionsFromProctorParams(proctorParams));
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
exports.showProctoredComponent = showProctoredComponent;
|
|
63
|
-
|
|
64
|
-
const getDataOnBreach = (statistics, currentData, proctorParams) => {
|
|
65
|
-
const {
|
|
66
|
-
userCount,
|
|
67
|
-
isTabSwitched,
|
|
68
|
-
isFullscreen,
|
|
69
|
-
lookedAwayCount,
|
|
70
|
-
isWebcamDataNotReliable
|
|
71
|
-
} = currentData;
|
|
72
|
-
const timestamp = Date.now();
|
|
73
|
-
const data = statistics.current;
|
|
74
|
-
const isWebCamNotReliableParam = _defaults.STATS_PARAMS.isWebcamNotReliable;
|
|
75
|
-
|
|
76
|
-
if (isWebcamRequired(proctorParams) && data[isWebCamNotReliableParam]) {
|
|
77
|
-
return {
|
|
78
|
-
breachedParam: isWebCamNotReliableParam,
|
|
79
|
-
timestamp,
|
|
80
|
-
data: _objectSpread(_objectSpread({}, data), {}, {
|
|
81
|
-
[isWebCamNotReliableParam]: isWebcamDataNotReliable
|
|
82
|
-
})
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const userCountMaxParam = _defaults.STATS_PARAMS.userCountMax;
|
|
87
|
-
|
|
88
|
-
if (proctorParams.people && data[userCountMaxParam] < userCount) {
|
|
89
|
-
return {
|
|
90
|
-
breachedParam: userCountMaxParam,
|
|
91
|
-
timestamp,
|
|
92
|
-
data: _objectSpread(_objectSpread({}, data), {}, {
|
|
93
|
-
[userCountMaxParam]: userCount
|
|
94
|
-
})
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const isTabSwitchedParam = _defaults.STATS_PARAMS.isTabSwitched;
|
|
99
|
-
|
|
100
|
-
if (proctorParams.tabSwitch && isTabSwitched && !data[isTabSwitchedParam]) {
|
|
101
|
-
return {
|
|
102
|
-
breachedParam: isTabSwitchedParam,
|
|
103
|
-
timestamp,
|
|
104
|
-
data: _objectSpread(_objectSpread({}, data), {}, {
|
|
105
|
-
[isTabSwitchedParam]: isTabSwitched
|
|
106
|
-
})
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const fullscreenExitParam = _defaults.STATS_PARAMS.isFullscreen;
|
|
111
|
-
|
|
112
|
-
if (proctorParams.fullscreenExit && !isFullscreen && data[fullscreenExitParam]) {
|
|
113
|
-
return {
|
|
114
|
-
breachedParam: fullscreenExitParam,
|
|
115
|
-
timestamp,
|
|
116
|
-
data: _objectSpread(_objectSpread({}, data), {}, {
|
|
117
|
-
[fullscreenExitParam]: isFullscreen
|
|
118
|
-
})
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const lookedAwayParam = _defaults.STATS_PARAMS.lookedAwayCount;
|
|
123
|
-
|
|
124
|
-
if (proctorParams.lookedAway && data[lookedAwayParam] !== lookedAwayCount) {
|
|
125
|
-
return {
|
|
126
|
-
breachedParam: lookedAwayParam,
|
|
127
|
-
timestamp,
|
|
128
|
-
data: _objectSpread(_objectSpread({}, data), {}, {
|
|
129
|
-
[lookedAwayParam]: lookedAwayCount
|
|
130
|
-
})
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
exports.getDataOnBreach = getDataOnBreach;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isChrome = exports.getVisibilityChangeEventName = exports.getIsDocumentVisible = exports.getBrowserFullscreenElementProp = void 0;
|
|
7
|
-
|
|
8
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
9
|
-
|
|
10
|
-
require("core-js/modules/es.string.match.js");
|
|
11
|
-
|
|
12
|
-
const PROPERTY_TYPES = {
|
|
13
|
-
HIDDEN: "hidden",
|
|
14
|
-
VISIBILITY_CHANGE: "visibilitychange"
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const getBrowserPropPrefix = () => {
|
|
18
|
-
if (typeof document.msHidden !== "undefined") {
|
|
19
|
-
return "ms";
|
|
20
|
-
} else if (typeof document.webkitHidden !== "undefined") {
|
|
21
|
-
return "webkit";
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return "";
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const getBrowserPropForHidden = () => {
|
|
28
|
-
if (typeof document.hidden !== "undefined") {
|
|
29
|
-
return "hidden";
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return "".concat(getBrowserPropPrefix(), "Hidden");
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const getBrowserDocumentProp = type => {
|
|
36
|
-
switch (type) {
|
|
37
|
-
case PROPERTY_TYPES.HIDDEN:
|
|
38
|
-
return getBrowserPropForHidden();
|
|
39
|
-
|
|
40
|
-
case PROPERTY_TYPES.VISIBILITY_CHANGE:
|
|
41
|
-
return "".concat(getBrowserPropPrefix(), "visibilitychange");
|
|
42
|
-
|
|
43
|
-
default:
|
|
44
|
-
return "";
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const getIsDocumentVisible = () => !document[getBrowserDocumentProp(PROPERTY_TYPES.HIDDEN)];
|
|
49
|
-
|
|
50
|
-
exports.getIsDocumentVisible = getIsDocumentVisible;
|
|
51
|
-
|
|
52
|
-
const getVisibilityChangeEventName = () => getBrowserDocumentProp(PROPERTY_TYPES.VISIBILITY_CHANGE);
|
|
53
|
-
|
|
54
|
-
exports.getVisibilityChangeEventName = getVisibilityChangeEventName;
|
|
55
|
-
|
|
56
|
-
const getBrowserFullscreenElementProp = () => {
|
|
57
|
-
if (typeof document.fullscreenElement !== "undefined") {
|
|
58
|
-
return "fullscreenElement";
|
|
59
|
-
} else if (typeof document.mozFullScreenElement !== "undefined") {
|
|
60
|
-
return "mozFullScreenElement";
|
|
61
|
-
} else if (typeof document.msFullscreenElement !== "undefined") {
|
|
62
|
-
return "msFullscreenElement";
|
|
63
|
-
} else if (typeof document.webkitFullscreenElement !== "undefined") {
|
|
64
|
-
return "webkitFullscreenElement";
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
exports.getBrowserFullscreenElementProp = getBrowserFullscreenElementProp;
|
|
69
|
-
|
|
70
|
-
const isChrome = () => !!navigator.userAgent.match(/chrome|chromium/i);
|
|
71
|
-
|
|
72
|
-
exports.isChrome = isChrome;
|
package/dist/utils/gpuUtils.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isGPUAvailable = void 0;
|
|
7
|
-
|
|
8
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
-
|
|
10
|
-
require("core-js/modules/es.array.includes.js");
|
|
11
|
-
|
|
12
|
-
require("core-js/modules/es.string.includes.js");
|
|
13
|
-
|
|
14
|
-
var _defaults = require("../constants/defaults");
|
|
15
|
-
|
|
16
|
-
const isGPUAvailable = () => {
|
|
17
|
-
const canvas = document.createElement("canvas");
|
|
18
|
-
const webgl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
|
|
19
|
-
const debugInfo = webgl.getExtension("webgl_debug_renderer_info");
|
|
20
|
-
const gpu = webgl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL).toLowerCase();
|
|
21
|
-
|
|
22
|
-
for (const gpuType of _defaults.gpuTypes) {
|
|
23
|
-
if (gpu.includes(gpuType)) return true;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return false;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
exports.isGPUAvailable = isGPUAvailable;
|
package/dist/utils/index.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "captureWebcamSnapshot", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _webcamMicrophoneUtils.captureWebcamSnapshot;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "getAudioPermission", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _webcamMicrophoneUtils.getAudioPermission;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "getAudioVideoPermission", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _webcamMicrophoneUtils.getAudioVideoPermission;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "getBrowserFullscreenElementProp", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _browserUtils.getBrowserFullscreenElementProp;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "getIsDocumentVisible", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _browserUtils.getIsDocumentVisible;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "getVideoPermission", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function get() {
|
|
39
|
-
return _webcamMicrophoneUtils.getVideoPermission;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "getVisibilityChangeEventName", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function get() {
|
|
45
|
-
return _browserUtils.getVisibilityChangeEventName;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "isArrayValid", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function get() {
|
|
51
|
-
return _arrayUtils.isArrayValid;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "isGPUAvailable", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function get() {
|
|
57
|
-
return _gpuUtils.isGPUAvailable;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(exports, "isWebcamVideoValid", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function get() {
|
|
63
|
-
return _webcamMicrophoneUtils.isWebcamVideoValid;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
Object.defineProperty(exports, "updateStatistics", {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function get() {
|
|
69
|
-
return _webcamMicrophoneUtils.updateStatistics;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
var _webcamMicrophoneUtils = require("./webcamMicrophoneUtils");
|
|
74
|
-
|
|
75
|
-
var _browserUtils = require("./browserUtils");
|
|
76
|
-
|
|
77
|
-
var _arrayUtils = require("./arrayUtils");
|
|
78
|
-
|
|
79
|
-
var _gpuUtils = require("./gpuUtils");
|
package/dist/utils/loadable.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
|
|
16
|
-
const loadable = function loadable(importFunc) {
|
|
17
|
-
let {
|
|
18
|
-
fallback = null
|
|
19
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
20
|
-
fallback: null
|
|
21
|
-
};
|
|
22
|
-
const LazyComponent = /*#__PURE__*/(0, _react.lazy)(importFunc);
|
|
23
|
-
return props => /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
24
|
-
fallback: fallback
|
|
25
|
-
}, /*#__PURE__*/_react.default.createElement(LazyComponent, props));
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
var _default = loadable;
|
|
29
|
-
exports.default = _default;
|