Supervisor SDK

The Supervisor SDK is the JavaScript library for using proctoring features in a browser. It can be used for integration with an e-learning system. It has an instance constructor new Supervisor() and two simple functions start() and stop(). The constructor takes the url parameter as your proctoring server URL. The start() function with parameters is used to initialize and start the session. The stop() function is used to end the session and log out. You can also add a handler for the stop event that is emitted when the session is ended.

NOTE: Do not forget to change "your-proctoring-server" to your dedicated instance of the proctoring server in the examples below.

Use with self-registration

You can use self-registration or sign-up for test-takers. It is an easy way to integrate your exam with the proctoring system without having to send data between systems. In this way, all proctoring parameters are set in the session template from the administrator interface. And a test-taker needs to fill out the username, password, and session template identifier in advance to register and start the session.

Below is an example of how to use this approach:

<script src="https://your-proctoring-server/sdk/supervisor.js"></script>
<script>
  // create Supervisor instance
  var supervisor = new Supervisor({
    // URL of your proctoring server
    url: 'https://your-proctoring-server'
  });
  // add a handler for the "stop" and "fail" events
  supervisor.on(['stop', 'fail'], function () {
    // log out of the session with redirection to referrer page
    supervisor.logout({ redirect: true });
  });
  // start the session in self-registration mode
  supervisor.start();
</script>

Instead of the code above, you can use data-attributes with the script to start a self-registered proctoring session. See the code below for this scenario:

<script src="https://your-proctoring-server/sdk/supervisor.js" data-supervisor="init"></script>

Apart from data-supervisor="init", you can use data-supervisor="sync" to initialize and start the session from a session token, which must be passed as the token query parameter.

By the way, you can open your test in IFRAME after the proctoring session has started. You should specify the url field in the session template for this. If your test can be password protected, you can specify it in the code field in the same place.

Use with JWT payload

You can create JWT string with payload on backend of your server with access through API. Get the token from the frontend and pass it to the start() function with initialization parameters: the provider is an integration provider (jwt by default) and the token is a JWT string with payload. The payload must contain two mandatory parameters: the username is unique user login and the identifier is unique session identifier.

Below is an example of using with JWT authorization:

<script src="https://your-proctoring-server/sdk/supervisor.js"></script>
<script>
  // create Supervisor instance
  var supervisor = new Supervisor({
    url: 'https://your-proctoring-server',
  });
  // add a handler for the "start" event
  supervisor.on('start', function () {
    // start testing in the e-learning system here
  });
  // add a handler for the "stop" and "fail" events
  supervisor.on(['stop', 'fail'], function () {
    // log out of the session with redirection to home page
    supervisor.logout({ redirect: '/' });
  });
  // initialize the session and start it
  supervisor.start({
    // set your provider name
    provider: 'jwt',
    // get JWT string from your server
    token: fetch('/api/token').then(function (response) {
      if (response.ok) return response.text();
      else throw Error('Failed to get JWT');
    })
  });
  // stop the session after testing in the e-learning system is over,
  // the timeout function is used here as an example
  setTimeout(function () {
    // stop the session
    supervisor.stop();
  }, 5 * 60 * 1000); // 5 minutes
</script>

On your backend, you can implement an API to receive results for each proctoring session. If you pass the api field in the JWT payload, then the proctoring server will send an HTTP webhook with the session result after the session ends.

Requirements and limitations

The minimum system requirements listed below must be satisfied for the system to function properly.

Parameter Minimum requirement
OS Windows 7, macOS 10.12 "Sierra", Linux
Browsers Chrome 72, Opera 59, Firefox 66, Edge 79, Safari 12
Mobiles Android 4.4 (Chrome), iOS 13 (Safari)
Required protocols HTTPS, WebSockets, WebRTC
CPU 2 cores
RAM (free) 1 GB
Network bandwidth 256 kbps
Camera 640x480, 15 fps
Microphone required

You should also be aware of the following limitations:

  1. Your e-learning system must be hosted on a server with valid SSL certificate (via HTTPS protocol). Otherwise the video and audio capture will not work.
  2. Your web page with the SDK should not reload completely while the library is running. For example, when switching between test questions. If the reload occurs in less than a minute, the proctoring results will not be saved.

supervisor.js

Description:
  • Supervisor SDK Library.
Author:
Supervisor SDK Library.