easyproctor 1.1.2 → 1.1.4
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 +70 -85
- package/index.js +70 -85
- package/new-flow/recorders/CameraRecorder.d.ts +0 -1
- package/package.json +1 -1
- package/unpkg/easyproctor.min.js +14 -13
package/esm/index.js
CHANGED
|
@@ -24385,7 +24385,6 @@ var CameraRecorder = class {
|
|
|
24385
24385
|
this.recordingPause = pauseRecording;
|
|
24386
24386
|
this.recordingResume = resumeRecording;
|
|
24387
24387
|
this.recordingStart();
|
|
24388
|
-
this.photoShotsCycle();
|
|
24389
24388
|
}
|
|
24390
24389
|
async stopRecording() {
|
|
24391
24390
|
this.recordingStop && await this.recordingStop();
|
|
@@ -24397,30 +24396,6 @@ var CameraRecorder = class {
|
|
|
24397
24396
|
async resumeRecording() {
|
|
24398
24397
|
await this.recordingResume();
|
|
24399
24398
|
}
|
|
24400
|
-
photoShotsCycle() {
|
|
24401
|
-
const track = this.cameraStream.getVideoTracks()[0];
|
|
24402
|
-
this.imageCapture = new ImageCapture(track);
|
|
24403
|
-
this.imageInterval = setInterval(() => {
|
|
24404
|
-
this.imageCapture.takePhoto().then((blob) => {
|
|
24405
|
-
return createImageBitmap(blob);
|
|
24406
|
-
}).then(async (imageBitmap) => {
|
|
24407
|
-
const canvas = document.createElement("canvas");
|
|
24408
|
-
canvas.width = 1280;
|
|
24409
|
-
canvas.height = 720;
|
|
24410
|
-
const ctx = canvas.getContext("bitmaprenderer");
|
|
24411
|
-
ctx.transferFromImageBitmap(imageBitmap);
|
|
24412
|
-
const blob = await new Promise((res) => canvas.toBlob(res));
|
|
24413
|
-
if (blob instanceof Blob && this.azureUpload && this.backendToken) {
|
|
24414
|
-
this.azureUpload.upload({
|
|
24415
|
-
file: new File([blob], `EP_${this.proctoringId}_image_${this.imageCount}.jpg`, {
|
|
24416
|
-
type: "image/jpeg"
|
|
24417
|
-
})
|
|
24418
|
-
}, this.backendToken);
|
|
24419
|
-
this.imageCount++;
|
|
24420
|
-
}
|
|
24421
|
-
}).catch((error) => console.log(error));
|
|
24422
|
-
}, 15e3);
|
|
24423
|
-
}
|
|
24424
24399
|
async saveOnSession(session) {
|
|
24425
24400
|
const settings = this.cameraStream.getVideoTracks()[0].getSettings();
|
|
24426
24401
|
const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
|
|
@@ -25640,7 +25615,9 @@ var ScreenRecorder = class {
|
|
|
25640
25615
|
const { allowOnlyFirstMonitor, onStopSharingScreenCallback } = this.options;
|
|
25641
25616
|
const displayMediaStreamConstraints = {
|
|
25642
25617
|
video: {
|
|
25643
|
-
cursor: "always"
|
|
25618
|
+
cursor: "always",
|
|
25619
|
+
width: 640,
|
|
25620
|
+
height: 480
|
|
25644
25621
|
},
|
|
25645
25622
|
audio: false
|
|
25646
25623
|
};
|
|
@@ -25673,7 +25650,7 @@ var ScreenRecorder = class {
|
|
|
25673
25650
|
async resumeRecording() {
|
|
25674
25651
|
}
|
|
25675
25652
|
async stopRecording() {
|
|
25676
|
-
await this.recordingStop();
|
|
25653
|
+
this.recordingStop && await this.recordingStop();
|
|
25677
25654
|
}
|
|
25678
25655
|
async saveOnSession(session) {
|
|
25679
25656
|
session.addRecording({
|
|
@@ -25934,72 +25911,80 @@ Error: ` + error);
|
|
|
25934
25911
|
this.state = "Stop" /* Stop */;
|
|
25935
25912
|
}
|
|
25936
25913
|
async finish(options = {}) {
|
|
25937
|
-
|
|
25938
|
-
|
|
25939
|
-
|
|
25940
|
-
|
|
25941
|
-
|
|
25942
|
-
|
|
25943
|
-
|
|
25944
|
-
|
|
25945
|
-
|
|
25946
|
-
|
|
25947
|
-
|
|
25948
|
-
new
|
|
25949
|
-
|
|
25950
|
-
|
|
25951
|
-
|
|
25952
|
-
|
|
25953
|
-
|
|
25954
|
-
new
|
|
25955
|
-
|
|
25956
|
-
|
|
25957
|
-
|
|
25958
|
-
|
|
25959
|
-
|
|
25960
|
-
|
|
25961
|
-
|
|
25962
|
-
|
|
25963
|
-
|
|
25964
|
-
|
|
25965
|
-
|
|
25966
|
-
|
|
25967
|
-
|
|
25968
|
-
|
|
25969
|
-
|
|
25970
|
-
|
|
25971
|
-
|
|
25914
|
+
try {
|
|
25915
|
+
this.extension.options = options;
|
|
25916
|
+
if (this.state !== "Recording" /* Recording */) {
|
|
25917
|
+
throw PROCTORING_NOT_STARTED;
|
|
25918
|
+
}
|
|
25919
|
+
await this.recorder.stopAll();
|
|
25920
|
+
await this.recorder.saveAllOnSession();
|
|
25921
|
+
await this.repository.save(this.proctoringSession);
|
|
25922
|
+
let uploader;
|
|
25923
|
+
let uploaderServices;
|
|
25924
|
+
if (versionVerify() !== "1.0.0.0") {
|
|
25925
|
+
uploader = new ProctoringUploader(this.proctoringSession, this.proctoringId, [
|
|
25926
|
+
new DownloadService(this.proctoringId)
|
|
25927
|
+
]);
|
|
25928
|
+
uploaderServices = "Download";
|
|
25929
|
+
this.serviceType = "Download" /* Download */;
|
|
25930
|
+
} else {
|
|
25931
|
+
uploader = new ProctoringUploader(this.proctoringSession, this.proctoringId, [
|
|
25932
|
+
new AzureUploadService(this.proctoringId, this.backend),
|
|
25933
|
+
new AwsUploadService(this.proctoringId, this.backend),
|
|
25934
|
+
new DownloadService(this.proctoringId)
|
|
25935
|
+
]);
|
|
25936
|
+
uploaderServices = "Azure, AWS, Download";
|
|
25937
|
+
this.serviceType = "Upload" /* Upload */;
|
|
25938
|
+
}
|
|
25939
|
+
let extensionSuccess = false;
|
|
25940
|
+
if (this.extension.hasExtension) {
|
|
25941
|
+
await this.extension.start().then((response) => {
|
|
25942
|
+
extensionSuccess = response;
|
|
25943
|
+
}).catch((error) => {
|
|
25944
|
+
extensionSuccess = false;
|
|
25945
|
+
});
|
|
25946
|
+
}
|
|
25947
|
+
if (!extensionSuccess || !this.extension.hasExtension) {
|
|
25948
|
+
await uploader.upload(this.context.token, options.onProgress).catch(async (error) => {
|
|
25949
|
+
trackers.registerUpload(this.proctoringSession.id, false, `upload error: ${error}
|
|
25972
25950
|
|
|
25973
25951
|
Upload Services: ${uploaderServices}`, this.serviceType);
|
|
25974
|
-
|
|
25975
|
-
|
|
25976
|
-
|
|
25977
|
-
|
|
25978
|
-
|
|
25979
|
-
|
|
25980
|
-
|
|
25981
|
-
|
|
25982
|
-
|
|
25983
|
-
|
|
25952
|
+
if (versionVerify() !== "1.0.0.0") {
|
|
25953
|
+
uploader = new ProctoringUploader(this.proctoringSession, this.proctoringId, [
|
|
25954
|
+
new AzureUploadService(this.proctoringId, this.backend),
|
|
25955
|
+
new AwsUploadService(this.proctoringId, this.backend),
|
|
25956
|
+
new DownloadService(this.proctoringId)
|
|
25957
|
+
]);
|
|
25958
|
+
uploaderServices = "Azure, AWS, Download";
|
|
25959
|
+
this.serviceType = "Upload" /* Upload */;
|
|
25960
|
+
await uploader.upload(this.context.token, options.onProgress).catch((error2) => {
|
|
25961
|
+
trackers.registerUpload(this.proctoringSession.id, false, `upload backup error: ${error2}
|
|
25984
25962
|
|
|
25985
25963
|
Upload Services: ${uploaderServices}
|
|
25986
25964
|
Upload backup for Safe Browser`, this.serviceType);
|
|
25987
|
-
|
|
25988
|
-
|
|
25989
|
-
|
|
25990
|
-
|
|
25965
|
+
});
|
|
25966
|
+
}
|
|
25967
|
+
});
|
|
25968
|
+
trackers.registerUpload(this.proctoringSession.id, true, `upload success
|
|
25991
25969
|
|
|
25992
25970
|
Upload Services: ${uploaderServices}`, this.serviceType);
|
|
25971
|
+
}
|
|
25972
|
+
await this.backend.saveScreenAlerts(this.context, this.proctoringSession).catch((err) => {
|
|
25973
|
+
trackers.registerFinish(this.proctoringSession.id, false, "save-screen error: " + err);
|
|
25974
|
+
});
|
|
25975
|
+
await this.backend.finishAndSendUrls(this.context, this.proctoringSession).then(() => {
|
|
25976
|
+
trackers.registerFinish(this.proctoringSession.id, true, "");
|
|
25977
|
+
}).catch((error) => {
|
|
25978
|
+
trackers.registerFinish(this.proctoringSession.id, false, "finish error: " + error);
|
|
25979
|
+
});
|
|
25980
|
+
this.state = "Stop" /* Stop */;
|
|
25981
|
+
} catch (error) {
|
|
25982
|
+
await this.cancel();
|
|
25983
|
+
trackers.registerFinish(this.proctoringId, false, `Token: ${this.context.token}
|
|
25984
|
+
Error: ` + error);
|
|
25985
|
+
this.state = "Stop" /* Stop */;
|
|
25986
|
+
throw error;
|
|
25993
25987
|
}
|
|
25994
|
-
await this.backend.saveScreenAlerts(this.context, this.proctoringSession).catch((err) => {
|
|
25995
|
-
trackers.registerFinish(this.proctoringSession.id, false, "save-screen error: " + err);
|
|
25996
|
-
});
|
|
25997
|
-
await this.backend.finishAndSendUrls(this.context, this.proctoringSession).then(() => {
|
|
25998
|
-
trackers.registerFinish(this.proctoringSession.id, true, "");
|
|
25999
|
-
}).catch((error) => {
|
|
26000
|
-
trackers.registerFinish(this.proctoringSession.id, false, "finish error: " + error);
|
|
26001
|
-
});
|
|
26002
|
-
this.state = "Stop" /* Stop */;
|
|
26003
25988
|
}
|
|
26004
25989
|
async verifyMultipleMonitors(sessionOptions) {
|
|
26005
25990
|
if (!sessionOptions.allowMultipleMonitors) {
|
package/index.js
CHANGED
|
@@ -35919,7 +35919,6 @@ var CameraRecorder = class {
|
|
|
35919
35919
|
this.recordingPause = pauseRecording;
|
|
35920
35920
|
this.recordingResume = resumeRecording;
|
|
35921
35921
|
this.recordingStart();
|
|
35922
|
-
this.photoShotsCycle();
|
|
35923
35922
|
}
|
|
35924
35923
|
async stopRecording() {
|
|
35925
35924
|
this.recordingStop && await this.recordingStop();
|
|
@@ -35931,30 +35930,6 @@ var CameraRecorder = class {
|
|
|
35931
35930
|
async resumeRecording() {
|
|
35932
35931
|
await this.recordingResume();
|
|
35933
35932
|
}
|
|
35934
|
-
photoShotsCycle() {
|
|
35935
|
-
const track = this.cameraStream.getVideoTracks()[0];
|
|
35936
|
-
this.imageCapture = new ImageCapture(track);
|
|
35937
|
-
this.imageInterval = setInterval(() => {
|
|
35938
|
-
this.imageCapture.takePhoto().then((blob) => {
|
|
35939
|
-
return createImageBitmap(blob);
|
|
35940
|
-
}).then(async (imageBitmap) => {
|
|
35941
|
-
const canvas = document.createElement("canvas");
|
|
35942
|
-
canvas.width = 1280;
|
|
35943
|
-
canvas.height = 720;
|
|
35944
|
-
const ctx = canvas.getContext("bitmaprenderer");
|
|
35945
|
-
ctx.transferFromImageBitmap(imageBitmap);
|
|
35946
|
-
const blob = await new Promise((res) => canvas.toBlob(res));
|
|
35947
|
-
if (blob instanceof Blob && this.azureUpload && this.backendToken) {
|
|
35948
|
-
this.azureUpload.upload({
|
|
35949
|
-
file: new File([blob], `EP_${this.proctoringId}_image_${this.imageCount}.jpg`, {
|
|
35950
|
-
type: "image/jpeg"
|
|
35951
|
-
})
|
|
35952
|
-
}, this.backendToken);
|
|
35953
|
-
this.imageCount++;
|
|
35954
|
-
}
|
|
35955
|
-
}).catch((error) => console.log(error));
|
|
35956
|
-
}, 15e3);
|
|
35957
|
-
}
|
|
35958
35933
|
async saveOnSession(session) {
|
|
35959
35934
|
const settings = this.cameraStream.getVideoTracks()[0].getSettings();
|
|
35960
35935
|
const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
|
|
@@ -37174,7 +37149,9 @@ var ScreenRecorder = class {
|
|
|
37174
37149
|
const { allowOnlyFirstMonitor, onStopSharingScreenCallback } = this.options;
|
|
37175
37150
|
const displayMediaStreamConstraints = {
|
|
37176
37151
|
video: {
|
|
37177
|
-
cursor: "always"
|
|
37152
|
+
cursor: "always",
|
|
37153
|
+
width: 640,
|
|
37154
|
+
height: 480
|
|
37178
37155
|
},
|
|
37179
37156
|
audio: false
|
|
37180
37157
|
};
|
|
@@ -37207,7 +37184,7 @@ var ScreenRecorder = class {
|
|
|
37207
37184
|
async resumeRecording() {
|
|
37208
37185
|
}
|
|
37209
37186
|
async stopRecording() {
|
|
37210
|
-
await this.recordingStop();
|
|
37187
|
+
this.recordingStop && await this.recordingStop();
|
|
37211
37188
|
}
|
|
37212
37189
|
async saveOnSession(session) {
|
|
37213
37190
|
session.addRecording({
|
|
@@ -37468,72 +37445,80 @@ Error: ` + error);
|
|
|
37468
37445
|
this.state = "Stop" /* Stop */;
|
|
37469
37446
|
}
|
|
37470
37447
|
async finish(options = {}) {
|
|
37471
|
-
|
|
37472
|
-
|
|
37473
|
-
|
|
37474
|
-
|
|
37475
|
-
|
|
37476
|
-
|
|
37477
|
-
|
|
37478
|
-
|
|
37479
|
-
|
|
37480
|
-
|
|
37481
|
-
|
|
37482
|
-
new
|
|
37483
|
-
|
|
37484
|
-
|
|
37485
|
-
|
|
37486
|
-
|
|
37487
|
-
|
|
37488
|
-
new
|
|
37489
|
-
|
|
37490
|
-
|
|
37491
|
-
|
|
37492
|
-
|
|
37493
|
-
|
|
37494
|
-
|
|
37495
|
-
|
|
37496
|
-
|
|
37497
|
-
|
|
37498
|
-
|
|
37499
|
-
|
|
37500
|
-
|
|
37501
|
-
|
|
37502
|
-
|
|
37503
|
-
|
|
37504
|
-
|
|
37505
|
-
|
|
37448
|
+
try {
|
|
37449
|
+
this.extension.options = options;
|
|
37450
|
+
if (this.state !== "Recording" /* Recording */) {
|
|
37451
|
+
throw PROCTORING_NOT_STARTED;
|
|
37452
|
+
}
|
|
37453
|
+
await this.recorder.stopAll();
|
|
37454
|
+
await this.recorder.saveAllOnSession();
|
|
37455
|
+
await this.repository.save(this.proctoringSession);
|
|
37456
|
+
let uploader;
|
|
37457
|
+
let uploaderServices;
|
|
37458
|
+
if (versionVerify() !== "1.0.0.0") {
|
|
37459
|
+
uploader = new ProctoringUploader(this.proctoringSession, this.proctoringId, [
|
|
37460
|
+
new DownloadService(this.proctoringId)
|
|
37461
|
+
]);
|
|
37462
|
+
uploaderServices = "Download";
|
|
37463
|
+
this.serviceType = "Download" /* Download */;
|
|
37464
|
+
} else {
|
|
37465
|
+
uploader = new ProctoringUploader(this.proctoringSession, this.proctoringId, [
|
|
37466
|
+
new AzureUploadService(this.proctoringId, this.backend),
|
|
37467
|
+
new AwsUploadService(this.proctoringId, this.backend),
|
|
37468
|
+
new DownloadService(this.proctoringId)
|
|
37469
|
+
]);
|
|
37470
|
+
uploaderServices = "Azure, AWS, Download";
|
|
37471
|
+
this.serviceType = "Upload" /* Upload */;
|
|
37472
|
+
}
|
|
37473
|
+
let extensionSuccess = false;
|
|
37474
|
+
if (this.extension.hasExtension) {
|
|
37475
|
+
await this.extension.start().then((response) => {
|
|
37476
|
+
extensionSuccess = response;
|
|
37477
|
+
}).catch((error) => {
|
|
37478
|
+
extensionSuccess = false;
|
|
37479
|
+
});
|
|
37480
|
+
}
|
|
37481
|
+
if (!extensionSuccess || !this.extension.hasExtension) {
|
|
37482
|
+
await uploader.upload(this.context.token, options.onProgress).catch(async (error) => {
|
|
37483
|
+
trackers.registerUpload(this.proctoringSession.id, false, `upload error: ${error}
|
|
37506
37484
|
|
|
37507
37485
|
Upload Services: ${uploaderServices}`, this.serviceType);
|
|
37508
|
-
|
|
37509
|
-
|
|
37510
|
-
|
|
37511
|
-
|
|
37512
|
-
|
|
37513
|
-
|
|
37514
|
-
|
|
37515
|
-
|
|
37516
|
-
|
|
37517
|
-
|
|
37486
|
+
if (versionVerify() !== "1.0.0.0") {
|
|
37487
|
+
uploader = new ProctoringUploader(this.proctoringSession, this.proctoringId, [
|
|
37488
|
+
new AzureUploadService(this.proctoringId, this.backend),
|
|
37489
|
+
new AwsUploadService(this.proctoringId, this.backend),
|
|
37490
|
+
new DownloadService(this.proctoringId)
|
|
37491
|
+
]);
|
|
37492
|
+
uploaderServices = "Azure, AWS, Download";
|
|
37493
|
+
this.serviceType = "Upload" /* Upload */;
|
|
37494
|
+
await uploader.upload(this.context.token, options.onProgress).catch((error2) => {
|
|
37495
|
+
trackers.registerUpload(this.proctoringSession.id, false, `upload backup error: ${error2}
|
|
37518
37496
|
|
|
37519
37497
|
Upload Services: ${uploaderServices}
|
|
37520
37498
|
Upload backup for Safe Browser`, this.serviceType);
|
|
37521
|
-
|
|
37522
|
-
|
|
37523
|
-
|
|
37524
|
-
|
|
37499
|
+
});
|
|
37500
|
+
}
|
|
37501
|
+
});
|
|
37502
|
+
trackers.registerUpload(this.proctoringSession.id, true, `upload success
|
|
37525
37503
|
|
|
37526
37504
|
Upload Services: ${uploaderServices}`, this.serviceType);
|
|
37505
|
+
}
|
|
37506
|
+
await this.backend.saveScreenAlerts(this.context, this.proctoringSession).catch((err) => {
|
|
37507
|
+
trackers.registerFinish(this.proctoringSession.id, false, "save-screen error: " + err);
|
|
37508
|
+
});
|
|
37509
|
+
await this.backend.finishAndSendUrls(this.context, this.proctoringSession).then(() => {
|
|
37510
|
+
trackers.registerFinish(this.proctoringSession.id, true, "");
|
|
37511
|
+
}).catch((error) => {
|
|
37512
|
+
trackers.registerFinish(this.proctoringSession.id, false, "finish error: " + error);
|
|
37513
|
+
});
|
|
37514
|
+
this.state = "Stop" /* Stop */;
|
|
37515
|
+
} catch (error) {
|
|
37516
|
+
await this.cancel();
|
|
37517
|
+
trackers.registerFinish(this.proctoringId, false, `Token: ${this.context.token}
|
|
37518
|
+
Error: ` + error);
|
|
37519
|
+
this.state = "Stop" /* Stop */;
|
|
37520
|
+
throw error;
|
|
37527
37521
|
}
|
|
37528
|
-
await this.backend.saveScreenAlerts(this.context, this.proctoringSession).catch((err) => {
|
|
37529
|
-
trackers.registerFinish(this.proctoringSession.id, false, "save-screen error: " + err);
|
|
37530
|
-
});
|
|
37531
|
-
await this.backend.finishAndSendUrls(this.context, this.proctoringSession).then(() => {
|
|
37532
|
-
trackers.registerFinish(this.proctoringSession.id, true, "");
|
|
37533
|
-
}).catch((error) => {
|
|
37534
|
-
trackers.registerFinish(this.proctoringSession.id, false, "finish error: " + error);
|
|
37535
|
-
});
|
|
37536
|
-
this.state = "Stop" /* Stop */;
|
|
37537
37522
|
}
|
|
37538
37523
|
async verifyMultipleMonitors(sessionOptions) {
|
|
37539
37524
|
if (!sessionOptions.allowMultipleMonitors) {
|