AutoProctor Events
Most of AutoProctor’s functionality is internally driven by JavaScript’s Events. As you integrate the SDK with your website, you will use events to manage the user flow as well. On this page, we look at two types of events
- Regular events: The most important events are emitted directly to the
Window
target - Custom events: The less important events are emitted as a Custom Event. The specific event (for example, ML Model is loaded) is added to the
detail
property of the event.
Regular events
Let's say you want to show a quiz's <div>
once AutoProctor's monitoring has begun. For that, you'd write code like this
Let's say you want to enable a button when AutoProctor is ready. For that, you'd write code like this
window.addEventListener('apMonitoringStarted', () => {
div.style.visibility = 'visible'
})
Following are the events AutoProctor emits:
Event | Emitted When |
---|---|
apSetupComplete | .setup() completes successfully. You can now call the .start() method |
apMonitoringStarted | .start() executes successfully, and events are being tracked. We set the test start time now. If you want to hide a test's questions until the proctoring is ready, you can load the questions after this event |
apMonitoringStopped | .stop() executes successfully. The last set of violations are sent to the server, the test finish time is set and Trust Score calculated. If you want to redirect the user to a different page after the test, etc you should do it after this event |
Custom Events
An AutoProctor custom event can be one of: apSuccessEvent
, apErrorEvent
or apEvidenceEvent
. Let's say you want to enable a button when ML models are loaded. You would then write something like
window.addEventListener('apSuccessEvent', (e) => {
const { successCode } = e.detail
if (successCode === 2001) {
btn.disabled = false
}
})
Following the convention HTTP_STATUS_CODE
's use, an event starting with 2
corresponds to success, starting with 4 corresponds to a browser error and
starting with 5 corresponds to a violation.
apSuccessEvent
- Success Events
Code | Emitted When |
---|---|
2001 | Browser and Permission check completed and Permission granted |
2002 | HTML Elements created. Ready to async load video and ML model |
2003 | Video and ML model loaded. Ready to start face detection |
apErrorEvent
- Error Events
Code | Emitted When |
---|---|
4001 | Incompatible Browser. Doesn't pass checkBrowserCompatiblity(). |
4002 | From permissions API, user has already blocked access to camera. |
4003 | From permissions API, user has already blocked access to microphone. |
4004 | User has proactively declined access to camera/microphone. Or, the page is being loaded within an insecure context. |
4005 | Hardware error, insecure context, or some other error. |
4006 | From permissions API, user has already blocked access to camera and mic. |
4007 | Audio Not Readable Error in getUserMedia. |
4008 | Video Not Readable Error in getUserMedia. |
4007 | Mic Not Found in getUserMedia. |
4008 | Camera Not Found in getUserMedia. |
4009 | We weren't able to find a microphone on your device. You need to enable your microphone, or use another device that has a microphone to take this test. |
4010 | We weren't able to find a camera (or webcam) on your device. You need to enable your camera, or use another device that has a camera to take this test. |
4011 | Permission to access a screen area was denied by the user, or the current browsing instance is not permitted access to screen sharing. Please reload the page to provide the access. |
4012 | The user selected a screen, window, tab, or other source of screen data, but a hardware or operating system level error or lockout occurred, preventing the sharing of the selected source. |
4013 | No sources of screen video are available for capture. |
4014 | You must share your entire screen in order to proceed with the test. Please reload the page to select again. |
4015 | We have detected multiple monitors. Please disconnect the extra monitor (or displays like Chromecast). If you continue without disconnecting, your teacher will be informed of multiple monitors. |
4016 | Use latest version of Safari on iPhone or iPad. Else, use Chrome. |
4017 | Please use Chrome or Firefox, if you want to proceed with the test. (if forceCaptureSwitchedTab is true) |
4018 | There was some error while loading the libraries. |
apEvidenceEvent
- Evidence Events
Code | Emitted When |
---|---|
5001 | No one looking at camera |
5002 | More than 1 Person in Video |
5003 | Random photo taken |
5004 | Audio above background levels |
5005 | Document page hidden or focus lost |
5006 | Document page became visible or focus was gained |
5007 | Multiple monitors detected |
5008 | Multiple monitors suspected (not a violation) |