Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
  <link rel="stylesheet" href="https://ap-statics.s3.ap-south-1.amazonaws.com/autoproctor.2.5.min.css" />
</head>

<body>
  <div id="ap-section">
  <button id="testStart">Start Proctoring</button>
  <button id="testEnd" disabled>End Proctoring</button>
  <button id="testReload">Reload</button>
  <div id="ap-test-report"></div>
  <div id="proctor-feedback"></div>
    <div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" ></script>
  <script src="https://ap-statics.s3.ap-south-1.amazonaws.com/autoproctor.2.5.min.js?v=5"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>

</body>
              
            
!

CSS

              
                #ap-section button {
  background: lightgrey !important ;
  padding: 5px;
  border-radius: 7px;
}

#ap-section {
    background: white;
    height: 100vh;
}
              
            
!

JS

              
                window.addEventListener("load", function () {

      /*
       * You will get clientId & clientSecret Once you get registered here
       * https://www.autoproctor.co/developers/register/ 
       */
      const clientID = "8b88Yarr";
      const clientSecret = "4vaNDdgPX3JuHkh";
  
      /*
       * testAttemptId identifies each test attempt. This is a unique ID that your own platform generates
       */
      const testAttemptId = CryptoJS.lib.WordArray.random(5).toString();

      /*
       * The SHA-256 HMAC of the testAttemptId with your SECRET_KEY
       * For more info: https://www.autoproctor.co/developers/docs#authentication
       */
      const hashedTestAttemptId = CryptoJS.SHA256(testAttemptId + clientSecret).toString();

      //Configurations which you have to pass in SDK
      const apSettings = {
        clientId: clientID,
        testAttemptId: testAttemptId,
        hashedTestAttemptId: hashedTestAttemptId,
        trackingOptions: {
          audio: true,
          numHumans: true,
          tabSwitch: true,
          photosAtRandom: true,
          numPhotosAtRandom: 5,
          captureSwitchedTab: true,
          preventMultipleScreens: true,
          testTakerPhoto: false,
          forceFullScreen: true,
          forceCaptureSwitchedTab: false,
          forcePreventMultipleScreens: false,
        },
        testContainerId: "ap-section",
        restrictConsole: false,
        evidencePushInterval: 5,
        showHowToVideo: false
      }

      async function init() {
        try {
          autoProctorTest = await initAutoProctor(apSettings); //initiating the instance
          
          document.getElementById("testStart").addEventListener("click", () => {
            autoProctorTest.start(); //Start Monitoring
          });
          
          //"apStartTest" event tells you whether test has been started or not
          window.addEventListener("apStartTest", () => {
             $("#testEnd").prop("disabled", false);
             $("#testStart").prop("disabled", true);
             $("#ap-test-report").html("Proctoring...");
          });
          
          document.getElementById("testEnd").addEventListener("click", () => {
            autoProctorTest.stop(); //Stop Monitoring
          });
          
          //"apStopMonitoring" event tells you whether test has been ended or not
          window.addEventListener("apStopMonitoring", async () => {
            //Call this function to get the reports of each test attempt, You can change UI accordingly
                        const response = await autoProctorTest.getEvidenceReport(
                            apSettings.clientId,
                            apSettings.testAttemptId,
                            apSettings.hashedTestAttemptId
                        );
                        let html = `<section class="py-20">
                                        <div class="container mx-auto px-4">
                                            <div class="flex flex-wrap text-center">
                                            <div class="mb-8 w-full md:w-1/2 lg:w-1/4">
                                                <h4 class="mb-2 text-gray-500">Device</h4>
                                                <span class="text-3xl lg:text-2xl font-bold">${
                                                    response.attemptDetails.device
                                                }</span>
                                            </div>
                                            <div class="mb-8 w-full md:w-1/2 lg:w-1/4">
                                                <h4 class="mb-2 text-gray-500">Started</h4>
                                                <span class="text-3xl lg:text-2xl font-bold">${
                                                    response.attemptDetails.startedAt
                                                }</span>
                                            </div>
                                            <div class="mb-8 w-full md:w-1/2 lg:w-1/4">
                                                <h4 class="mb-2 text-gray-500">Finished</h4>
                                                <span class="text-3xl lg:text-2xl font-bold">${
                                                    response.attemptDetails.finishedAt
                                                }</span>
                                            </div>
                                            <div class="mb-8 w-full md:w-1/2 lg:w-1/4">
                                                <h4 class="mb-2 text-gray-500">Trust Score</h4>
                                                <span class="text-3xl lg:text-2xl font-bold">${
                                                    response.attemptDetails.trustScore * 100
                                                } %</span>
                                            </div>
                                            </div>
                                        </div>
                                        </section><div
                                            class="
                                                md:ml-auto
                                                border-t border-gray-200
                                                inset-x-0
                                                transform
                                                rh-assg-result-candidate__scores
                                            "
                                        >
                                    <div class="flex flex-col">
                                        <div class="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
                                            <div class="py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8">
                                                <div class="shadow overflow-hidden border-b border-gray-200 sm:rounded-lg">
                                                    <table class="min-w-full divide-y divide-gray-200" id="rh-ap-section-table">
                                                        <thead class="bg-gray-50">
                                                            <tr>
                                                                <th
                                                                    scope="col"
                                                                    class="
                                                                        px-6
                                                                        py-3
                                                                        text-left text-xs
                                                                        font-medium
                                                                        text-gray-500
                                                                        uppercase
                                                                    "
                                                                >
                                                                    Number
                                                                </th>
                                                                <th
                                                                    scope="col"
                                                                    class="
                                                                        px-6
                                                                        py-3
                                                                        text-left text-xs
                                                                        font-medium
                                                                        text-gray-500
                                                                        uppercase
                                                                    "
                                                                >
                                                                    Type
                                                                </th>
                                                                <th
                                                                    scope="col"
                                                                    class="
                                                                        px-6
                                                                        py-3
                                                                        text-left text-xs
                                                                        font-medium
                                                                        text-gray-500
                                                                        uppercase
                                                                    "
                                                                >
                                                                    Time
                                                                </th>
                                                                <th
                                                                    scope="col"
                                                                    class="
                                                                        px-6
                                                                        py-3
                                                                        text-left text-xs
                                                                        font-medium
                                                                        text-gray-500
                                                                        uppercase
                                                                    "
                                                                >
                                                                    Capture
                                                                </th>
                                                            </tr>
                                                        </thead>
                                                        <tbody class="bg-white divide-y divide-gray-200">`;

                        response.reportData.forEach((report, index) => {
                            html += `<tr>
                                                                <td
                                                                    class="
                                                                        px-6
                                                                        py-4
                                                                        whitespace-nowrap
                                                                        text-sm
                                                                        font-medium
                                                                        text-gray-900
                                                                    "
                                                                >
                                                                    ${index + 1}
                                                                </td>
                                                                <td
                                                                    class="
                                                                        px-6
                                                                        py-4
                                                                        whitespace-nowrap
                                                                        text-sm
                                                                        font-medium
                                                                        text-gray-900
                                                                    "
                                                                >
                                                                    ${report.message}
                                                                </td>
                                                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                                                    ${report.occurredAt}
                                                                </td>
                                                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                                                    ${
                                                                        report?.evidenceUrl
                                                                            ? report?.miscData
                                                                                ? report?.miscData?.dataType === "audio"
                                                                                    ? `<a href="${report.evidenceUrl}"><audio controls class="media-audio">
                                                                            <source src="${report.evidenceUrl}">
                                                                        </audio></a>`
                                                                                    : `<a href="${report.evidenceUrl}"><img class="media-image" src="${report.evidenceUrl}" /></a>`
                                                                                : `-`
                                                                            : `-`
                                                                    }


                                                                </td>
                                                            </tr>`;
                        });

                        html += `</tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>`;
                        document.getElementById("ap-test-report").innerHTML = html;
                    });
             
          document.getElementById("testReload").addEventListener("click", () => {
            window.location.reload();
          });
        } catch (err) {
        }
      }

      init();

    })
              
            
!
999px

Console