easyproctor 0.0.41 → 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.
- package/esm/index.js +16 -6
- package/index.d.ts +1 -1
- package/index.js +16 -6
- package/interfaces/ProctoringRecord.d.ts +1 -0
- package/package.json +1 -1
- package/unpkg/easyproctor.min.js +13 -13
package/esm/index.js
CHANGED
|
@@ -8424,8 +8424,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8424
8424
|
}
|
|
8425
8425
|
return { cameraFile, screenFile };
|
|
8426
8426
|
};
|
|
8427
|
-
async function
|
|
8428
|
-
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
|
|
8427
|
+
async function initConfig() {
|
|
8429
8428
|
if (proctoringConfig != void 0) {
|
|
8430
8429
|
setConfiguration(proctoringConfig.account, proctoringConfig.containerName, proctoringConfig.sas);
|
|
8431
8430
|
azureBlobUrl = proctoringConfig.azureBlobUrl;
|
|
@@ -8442,6 +8441,10 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8442
8441
|
setBaseUrl(config.baseUrl);
|
|
8443
8442
|
init(config.insights);
|
|
8444
8443
|
}
|
|
8444
|
+
}
|
|
8445
|
+
async function start(options = defaultProctoringOptions) {
|
|
8446
|
+
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
|
|
8447
|
+
await initConfig();
|
|
8445
8448
|
if (!allowMultipleMonitors) {
|
|
8446
8449
|
const hasMultipleMonitors = await checkIfhasMultipleMonitors();
|
|
8447
8450
|
if (hasMultipleMonitors) {
|
|
@@ -8451,6 +8454,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8451
8454
|
const hasExam = await getRecord("exams");
|
|
8452
8455
|
if (hasExam != null) {
|
|
8453
8456
|
await clearBuffers("exams");
|
|
8457
|
+
cancelCallback = null;
|
|
8454
8458
|
}
|
|
8455
8459
|
try {
|
|
8456
8460
|
const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType });
|
|
@@ -8471,6 +8475,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8471
8475
|
resp.screenStream = _screenStream;
|
|
8472
8476
|
await insertRecord("exams", {
|
|
8473
8477
|
id: resp.id,
|
|
8478
|
+
examId: proctoringOptions.examId,
|
|
8474
8479
|
sessions: []
|
|
8475
8480
|
});
|
|
8476
8481
|
proctoringId = resp.id;
|
|
@@ -8507,9 +8512,10 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8507
8512
|
await insertRecord("exams", record);
|
|
8508
8513
|
_clear();
|
|
8509
8514
|
}
|
|
8510
|
-
async function resume(options = defaultProctoringOptions) {
|
|
8515
|
+
async function resume(options = defaultProctoringOptions, examId) {
|
|
8511
8516
|
_clear();
|
|
8512
8517
|
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
|
|
8518
|
+
await initConfig();
|
|
8513
8519
|
if (!allowMultipleMonitors) {
|
|
8514
8520
|
const hasMultipleMonitors = await checkIfhasMultipleMonitors();
|
|
8515
8521
|
if (hasMultipleMonitors) {
|
|
@@ -8522,6 +8528,10 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8522
8528
|
const record = await getRecord("exams");
|
|
8523
8529
|
if (!record) {
|
|
8524
8530
|
throw PROCTORING_NOT_STARTED;
|
|
8531
|
+
} else if (record) {
|
|
8532
|
+
console.log(examId);
|
|
8533
|
+
if (record.examId != examId)
|
|
8534
|
+
throw PROCTORING_NOT_STARTED;
|
|
8525
8535
|
}
|
|
8526
8536
|
const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType });
|
|
8527
8537
|
const serverTime = await makeRequest({
|
|
@@ -8612,7 +8622,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8612
8622
|
jwt: proctoringOptions.token,
|
|
8613
8623
|
body: {
|
|
8614
8624
|
proctoringId,
|
|
8615
|
-
alerts: [...sessionsDto[
|
|
8625
|
+
alerts: [...sessionsDto[sessionsDto.length - 1].alerts]
|
|
8616
8626
|
}
|
|
8617
8627
|
});
|
|
8618
8628
|
} catch (error) {
|
|
@@ -8624,9 +8634,9 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8624
8634
|
method: "POST",
|
|
8625
8635
|
body: {
|
|
8626
8636
|
endDate: time,
|
|
8627
|
-
videoCameraUrl: `${azureBlobUrl}/` + sessionsDto[
|
|
8637
|
+
videoCameraUrl: `${azureBlobUrl}/` + sessionsDto[sessionsDto.length - 1].videoCameraUrl,
|
|
8628
8638
|
audioCameraUrl: "",
|
|
8629
|
-
videoScreenUrl: _captureScreen ? `${azureBlobUrl}/` + sessionsDto[
|
|
8639
|
+
videoScreenUrl: _captureScreen ? `${azureBlobUrl}/` + sessionsDto[sessionsDto.length - 1].videoScreenUrl : ""
|
|
8630
8640
|
},
|
|
8631
8641
|
jwt: proctoringOptions.token
|
|
8632
8642
|
});
|
package/index.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare function useProctoring(proctoringOptions: {
|
|
|
30
30
|
}) => Promise<void>;
|
|
31
31
|
finishAudio: () => Promise<void>;
|
|
32
32
|
pause: () => Promise<void>;
|
|
33
|
-
resume: (options
|
|
33
|
+
resume: (options: ProctoringOptions | undefined, examId: string) => Promise<{
|
|
34
34
|
cameraStream: MediaStream;
|
|
35
35
|
_screenStream: MediaStream | undefined;
|
|
36
36
|
}>;
|
package/index.js
CHANGED
|
@@ -8764,8 +8764,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8764
8764
|
}
|
|
8765
8765
|
return { cameraFile, screenFile };
|
|
8766
8766
|
};
|
|
8767
|
-
async function
|
|
8768
|
-
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
|
|
8767
|
+
async function initConfig() {
|
|
8769
8768
|
if (proctoringConfig != void 0) {
|
|
8770
8769
|
setConfiguration(proctoringConfig.account, proctoringConfig.containerName, proctoringConfig.sas);
|
|
8771
8770
|
azureBlobUrl = proctoringConfig.azureBlobUrl;
|
|
@@ -8782,6 +8781,10 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8782
8781
|
setBaseUrl(config.baseUrl);
|
|
8783
8782
|
init(config.insights);
|
|
8784
8783
|
}
|
|
8784
|
+
}
|
|
8785
|
+
async function start(options = defaultProctoringOptions) {
|
|
8786
|
+
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
|
|
8787
|
+
await initConfig();
|
|
8785
8788
|
if (!allowMultipleMonitors) {
|
|
8786
8789
|
const hasMultipleMonitors = await checkIfhasMultipleMonitors();
|
|
8787
8790
|
if (hasMultipleMonitors) {
|
|
@@ -8791,6 +8794,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8791
8794
|
const hasExam = await getRecord("exams");
|
|
8792
8795
|
if (hasExam != null) {
|
|
8793
8796
|
await clearBuffers("exams");
|
|
8797
|
+
cancelCallback = null;
|
|
8794
8798
|
}
|
|
8795
8799
|
try {
|
|
8796
8800
|
const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType });
|
|
@@ -8811,6 +8815,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8811
8815
|
resp.screenStream = _screenStream;
|
|
8812
8816
|
await insertRecord("exams", {
|
|
8813
8817
|
id: resp.id,
|
|
8818
|
+
examId: proctoringOptions.examId,
|
|
8814
8819
|
sessions: []
|
|
8815
8820
|
});
|
|
8816
8821
|
proctoringId = resp.id;
|
|
@@ -8847,9 +8852,10 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8847
8852
|
await insertRecord("exams", record);
|
|
8848
8853
|
_clear();
|
|
8849
8854
|
}
|
|
8850
|
-
async function resume(options = defaultProctoringOptions) {
|
|
8855
|
+
async function resume(options = defaultProctoringOptions, examId) {
|
|
8851
8856
|
_clear();
|
|
8852
8857
|
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
|
|
8858
|
+
await initConfig();
|
|
8853
8859
|
if (!allowMultipleMonitors) {
|
|
8854
8860
|
const hasMultipleMonitors = await checkIfhasMultipleMonitors();
|
|
8855
8861
|
if (hasMultipleMonitors) {
|
|
@@ -8862,6 +8868,10 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8862
8868
|
const record = await getRecord("exams");
|
|
8863
8869
|
if (!record) {
|
|
8864
8870
|
throw PROCTORING_NOT_STARTED;
|
|
8871
|
+
} else if (record) {
|
|
8872
|
+
console.log(examId);
|
|
8873
|
+
if (record.examId != examId)
|
|
8874
|
+
throw PROCTORING_NOT_STARTED;
|
|
8865
8875
|
}
|
|
8866
8876
|
const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType });
|
|
8867
8877
|
const serverTime = await makeRequest({
|
|
@@ -8952,7 +8962,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8952
8962
|
jwt: proctoringOptions.token,
|
|
8953
8963
|
body: {
|
|
8954
8964
|
proctoringId,
|
|
8955
|
-
alerts: [...sessionsDto[
|
|
8965
|
+
alerts: [...sessionsDto[sessionsDto.length - 1].alerts]
|
|
8956
8966
|
}
|
|
8957
8967
|
});
|
|
8958
8968
|
} catch (error) {
|
|
@@ -8964,9 +8974,9 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8964
8974
|
method: "POST",
|
|
8965
8975
|
body: {
|
|
8966
8976
|
endDate: time,
|
|
8967
|
-
videoCameraUrl: `${azureBlobUrl}/` + sessionsDto[
|
|
8977
|
+
videoCameraUrl: `${azureBlobUrl}/` + sessionsDto[sessionsDto.length - 1].videoCameraUrl,
|
|
8968
8978
|
audioCameraUrl: "",
|
|
8969
|
-
videoScreenUrl: _captureScreen ? `${azureBlobUrl}/` + sessionsDto[
|
|
8979
|
+
videoScreenUrl: _captureScreen ? `${azureBlobUrl}/` + sessionsDto[sessionsDto.length - 1].videoScreenUrl : ""
|
|
8970
8980
|
},
|
|
8971
8981
|
jwt: proctoringOptions.token
|
|
8972
8982
|
});
|