easyproctor 0.0.49 → 0.0.52

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/README.md CHANGED
@@ -28,7 +28,7 @@ Ao inicializar a sessão de proctoring através do método start do componente v
28
28
 
29
29
  Após finalizar a sessão de proctoring através do método finish você poderá consultar os dados de proctoring através da nossa API.
30
30
 
31
- https://iaris.easyproctor.tech/index.html
31
+ https://proctoring-api.easyproctor.tech/index.html
32
32
 
33
33
  Em um bundler
34
34
 
package/esm/index.js CHANGED
@@ -14334,14 +14334,14 @@ function recorder(stream, buffer) {
14334
14334
  }
14335
14335
 
14336
14336
  // src/modules/startCameraCapture.ts
14337
- async function startCameraCapture(buffer, options = { cameraId: void 0, microphoneId: void 0 }) {
14337
+ async function startCameraCapture(buffer, options = { cameraId: void 0, microphoneId: void 0 }, videoOptions = { width: 640, height: 480 }) {
14338
14338
  const { cameraId, microphoneId } = options;
14339
14339
  const constraints = {
14340
14340
  audio: { deviceId: microphoneId },
14341
14341
  video: {
14342
14342
  deviceId: cameraId,
14343
- width: { max: 1280, ideal: 1280 },
14344
- height: { max: 720, ideal: 720 },
14343
+ width: videoOptions.width,
14344
+ height: videoOptions.height,
14345
14345
  frameRate: 15
14346
14346
  }
14347
14347
  };
@@ -14444,7 +14444,7 @@ async function upload(data) {
14444
14444
  var upload_default = upload;
14445
14445
 
14446
14446
  // src/modules/http.ts
14447
- var baseUrl = "https://iaris.easyproctor.tech/api";
14447
+ var baseUrl = "https://proctoring-api.easyproctor.tech/api";
14448
14448
  async function setBaseUrl(_baseUrl) {
14449
14449
  baseUrl = _baseUrl;
14450
14450
  }
@@ -14454,7 +14454,7 @@ async function makeRequest(data) {
14454
14454
  method,
14455
14455
  body: body != null ? JSON.stringify(body) : void 0,
14456
14456
  headers: {
14457
- "Authorization": `Bearer ${jwt}`,
14457
+ Authorization: `Bearer ${jwt}`,
14458
14458
  "Content-Type": "application/json"
14459
14459
  }
14460
14460
  });
@@ -22650,6 +22650,8 @@ function useProctoring(proctoringOptions, proctoringConfig) {
22650
22650
  let onFocusCallback;
22651
22651
  let onStopSharingScreenCallback = void 0;
22652
22652
  let cancelCallback = null;
22653
+ let lastClick = 0;
22654
+ const delay = 20;
22653
22655
  function _clear() {
22654
22656
  cameraBuffer = [];
22655
22657
  screenBuffer = [];
@@ -22658,8 +22660,9 @@ function useProctoring(proctoringOptions, proctoringConfig) {
22658
22660
  startDate = void 0;
22659
22661
  alerts = [];
22660
22662
  }
22661
- async function _startCapture(options) {
22663
+ async function _startCapture(options, videoOptions = { width: 640, height: 480 }) {
22662
22664
  if (!document.body) {
22665
+ trackers.registerError(proctoringId, "Script n\xE3o chamado dentro do body!");
22663
22666
  throw SCRIPT_NOT_CALLED_INSIDE_BODY;
22664
22667
  }
22665
22668
  if (cancelCallback != null) {
@@ -22680,7 +22683,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
22680
22683
  cancelScreenCapture = stopScreenRecorder;
22681
22684
  _screenStream = screenStream;
22682
22685
  }
22683
- const { cameraStream, stopCameraRecording } = await startCameraCapture(cameraBuffer, { cameraId, microphoneId });
22686
+ const { cameraStream, stopCameraRecording } = await startCameraCapture(cameraBuffer, { cameraId, microphoneId }, videoOptions);
22684
22687
  startAudio();
22685
22688
  cancelCameraCapture = stopCameraRecording;
22686
22689
  if (captureScreen) {
@@ -22735,6 +22738,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
22735
22738
  const finalAudioBuffer = buffer;
22736
22739
  const finalScreenBuffer = screenBuffer;
22737
22740
  if (finalCameraBuffer.length == 0) {
22741
+ trackers.registerError(proctoringId, PROCTORING_NOT_STARTED);
22738
22742
  throw PROCTORING_NOT_STARTED;
22739
22743
  }
22740
22744
  const cameraFileName = `EP_${proctoringId}_camera_${index}.webm`;
@@ -22769,12 +22773,16 @@ function useProctoring(proctoringOptions, proctoringConfig) {
22769
22773
  init(config.insights);
22770
22774
  }
22771
22775
  }
22772
- async function start(options = defaultProctoringOptions) {
22776
+ async function start(options = defaultProctoringOptions, videoOptions = { width: 640, height: 480 }) {
22777
+ if (lastClick >= Date.now() - delay)
22778
+ throw PROCTORING_ALREADY_STARTED;
22779
+ lastClick = Date.now();
22773
22780
  const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
22774
22781
  await initConfig();
22775
22782
  if (!allowMultipleMonitors) {
22776
22783
  const hasMultipleMonitors = await checkIfhasMultipleMonitors();
22777
22784
  if (hasMultipleMonitors) {
22785
+ trackers.registerError(proctoringId, "Multiplas telas detectadas!");
22778
22786
  throw MULTIPLE_MONITORS_DETECTED;
22779
22787
  }
22780
22788
  }
@@ -22784,7 +22792,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
22784
22792
  cancelCallback = null;
22785
22793
  }
22786
22794
  try {
22787
- const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType });
22795
+ const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType }, videoOptions);
22788
22796
  const serverTime = await makeRequest({
22789
22797
  url: `/Proctoring/server-hour`,
22790
22798
  method: "GET",
@@ -22826,10 +22834,21 @@ function useProctoring(proctoringOptions, proctoringConfig) {
22826
22834
  async function pause() {
22827
22835
  const record = await getRecord("exams");
22828
22836
  if (!cancelCallback || !record) {
22837
+ trackers.registerError(proctoringId, "Proctoring n\xE3o iniciado!");
22829
22838
  throw PROCTORING_NOT_STARTED;
22830
22839
  }
22831
22840
  onStopSharingScreenCallback = void 0;
22832
22841
  await cancelCallback();
22842
+ let serverTime;
22843
+ try {
22844
+ serverTime = await makeRequest({
22845
+ url: `/Proctoring/server-hour`,
22846
+ method: "GET",
22847
+ jwt: proctoringOptions.token
22848
+ });
22849
+ } catch (e) {
22850
+ trackers.registerError(proctoringId, "N\xE3o foi poss\xEDvel requisitar a data do servidor!");
22851
+ }
22833
22852
  const { cameraFile, audioFile, screenFile } = await _closeSession(record.sessions.length);
22834
22853
  record.sessions.push({
22835
22854
  alerts,
@@ -22837,39 +22856,48 @@ function useProctoring(proctoringOptions, proctoringConfig) {
22837
22856
  audioFile,
22838
22857
  screenFile,
22839
22858
  id: "" + record.sessions.length + 1,
22840
- start: startDate ? startDate.toISOString() : new Date().toISOString(),
22841
- end: new Date().toISOString()
22859
+ start: startDate ? startDate.toISOString() : new Date(serverTime.toString()).toISOString(),
22860
+ end: new Date(serverTime.toString()).toISOString()
22842
22861
  });
22843
22862
  await insertRecord("exams", record);
22844
22863
  _clear();
22845
22864
  }
22846
- async function resume(options = defaultProctoringOptions, examId) {
22865
+ async function resume(options = defaultProctoringOptions, examId, videoOptions = { width: 640, height: 480 }) {
22847
22866
  _clear();
22848
22867
  const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
22849
22868
  await initConfig();
22850
22869
  if (!allowMultipleMonitors) {
22851
22870
  const hasMultipleMonitors = await checkIfhasMultipleMonitors();
22852
22871
  if (hasMultipleMonitors) {
22872
+ trackers.registerError(proctoringId, "Multiplas telas detectadas!");
22853
22873
  throw MULTIPLE_MONITORS_DETECTED;
22854
22874
  }
22855
22875
  }
22856
22876
  if (cancelCallback) {
22877
+ trackers.registerError(proctoringId, "Proctoring j\xE1 est\xE1 rodando!");
22857
22878
  throw PROCTORING_RUNNING;
22858
22879
  }
22859
22880
  const record = await getRecord("exams");
22860
22881
  if (!record) {
22882
+ trackers.registerError(proctoringId, "Proctoring n\xE3o iniciado!");
22861
22883
  throw PROCTORING_NOT_STARTED;
22862
22884
  } else if (record) {
22863
- console.log(examId);
22864
- if (record.examId != examId)
22885
+ if (record.examId != examId) {
22886
+ trackers.registerError(proctoringId, "Proctoring n\xE3o iniciado!");
22865
22887
  throw PROCTORING_NOT_STARTED;
22888
+ }
22889
+ }
22890
+ const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType }, videoOptions);
22891
+ let serverTime;
22892
+ try {
22893
+ serverTime = await makeRequest({
22894
+ url: `/Proctoring/server-hour`,
22895
+ method: "GET",
22896
+ jwt: proctoringOptions.token
22897
+ });
22898
+ } catch (e) {
22899
+ trackers.registerError(proctoringId, "N\xE3o foi poss\xEDvel requisitar a data do servidor!");
22866
22900
  }
22867
- const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType });
22868
- const serverTime = await makeRequest({
22869
- url: `/Proctoring/server-hour`,
22870
- method: "GET",
22871
- jwt: proctoringOptions.token
22872
- });
22873
22901
  proctoringId = record.id;
22874
22902
  startDate = new Date(serverTime.toString());
22875
22903
  startTime = startDate.getTime();
@@ -22879,6 +22907,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
22879
22907
  const { onProgress } = options;
22880
22908
  const record = await getRecord("exams");
22881
22909
  if (!record) {
22910
+ trackers.registerError(proctoringId, "Proctoring n\xE3o iniciado!");
22882
22911
  throw PROCTORING_NOT_STARTED;
22883
22912
  }
22884
22913
  try {
@@ -22899,6 +22928,16 @@ function useProctoring(proctoringOptions, proctoringConfig) {
22899
22928
  onStopSharingScreenCallback = void 0;
22900
22929
  if (cancelCallback) {
22901
22930
  await cancelCallback();
22931
+ let serverTime2;
22932
+ try {
22933
+ serverTime2 = await makeRequest({
22934
+ url: `/Proctoring/server-hour`,
22935
+ method: "GET",
22936
+ jwt: proctoringOptions.token
22937
+ });
22938
+ } catch (e) {
22939
+ trackers.registerError(proctoringId, "N\xE3o foi poss\xEDvel requisitar a data do servidor!");
22940
+ }
22902
22941
  const { cameraFile, audioFile, screenFile } = await _closeSession(record.sessions.length);
22903
22942
  record.sessions.push({
22904
22943
  alerts,
@@ -22906,18 +22945,24 @@ function useProctoring(proctoringOptions, proctoringConfig) {
22906
22945
  audioFile,
22907
22946
  screenFile,
22908
22947
  id: "" + record.sessions.length + 1,
22909
- start: startDate ? startDate.toISOString() : new Date().toISOString(),
22910
- end: new Date().toISOString()
22948
+ start: startDate ? startDate.toISOString() : new Date(serverTime2.toString()).toISOString(),
22949
+ end: new Date(serverTime2.toString()).toISOString()
22911
22950
  });
22912
22951
  }
22913
22952
  if (record.sessions.length == 0) {
22953
+ trackers.registerError(proctoringId, "Nenhum v\xEDdeo gravado!");
22914
22954
  throw NO_VIDEOS_RECORDED;
22915
22955
  }
22916
- const serverTime = await makeRequest({
22917
- url: `/Proctoring/server-hour`,
22918
- method: "GET",
22919
- jwt: proctoringOptions.token
22920
- });
22956
+ let serverTime;
22957
+ try {
22958
+ serverTime = await makeRequest({
22959
+ url: `/Proctoring/server-hour`,
22960
+ method: "GET",
22961
+ jwt: proctoringOptions.token
22962
+ });
22963
+ } catch (e) {
22964
+ trackers.registerError(proctoringId, "N\xE3o foi poss\xEDvel requisitar a data do servidor!");
22965
+ }
22921
22966
  const time = new Date(serverTime.toString()).toISOString();
22922
22967
  const allFiles = [];
22923
22968
  record.sessions.forEach((session) => {
package/index.d.ts CHANGED
@@ -23,7 +23,10 @@ export declare function useProctoring(proctoringOptions: {
23
23
  clientId: string;
24
24
  token: string;
25
25
  }, proctoringConfig?: ProctoringConfig): {
26
- start: (options?: ProctoringOptions) => Promise<StartProctoringResponse>;
26
+ start: (options?: ProctoringOptions, videoOptions?: {
27
+ width?: number;
28
+ height?: number;
29
+ }) => Promise<StartProctoringResponse>;
27
30
  startAudio: () => Promise<void>;
28
31
  finish: (options?: {
29
32
  onProgress?: ((percentage: number) => void) | undefined;
@@ -33,7 +36,10 @@ export declare function useProctoring(proctoringOptions: {
33
36
  blob: any;
34
37
  }>;
35
38
  pause: () => Promise<void>;
36
- resume: (options: ProctoringOptions | undefined, examId: string) => Promise<{
39
+ resume: (options: ProctoringOptions | undefined, examId: string, videoOptions?: {
40
+ width?: number;
41
+ height?: number;
42
+ }) => Promise<{
37
43
  cameraStream: MediaStream;
38
44
  _screenStream: MediaStream | undefined;
39
45
  }>;
package/index.js CHANGED
@@ -22677,14 +22677,14 @@ function recorder(stream, buffer) {
22677
22677
  }
22678
22678
 
22679
22679
  // src/modules/startCameraCapture.ts
22680
- async function startCameraCapture(buffer, options = { cameraId: void 0, microphoneId: void 0 }) {
22680
+ async function startCameraCapture(buffer, options = { cameraId: void 0, microphoneId: void 0 }, videoOptions = { width: 640, height: 480 }) {
22681
22681
  const { cameraId, microphoneId } = options;
22682
22682
  const constraints = {
22683
22683
  audio: { deviceId: microphoneId },
22684
22684
  video: {
22685
22685
  deviceId: cameraId,
22686
- width: { max: 1280, ideal: 1280 },
22687
- height: { max: 720, ideal: 720 },
22686
+ width: videoOptions.width,
22687
+ height: videoOptions.height,
22688
22688
  frameRate: 15
22689
22689
  }
22690
22690
  };
@@ -22787,7 +22787,7 @@ async function upload(data) {
22787
22787
  var upload_default = upload;
22788
22788
 
22789
22789
  // src/modules/http.ts
22790
- var baseUrl = "https://iaris.easyproctor.tech/api";
22790
+ var baseUrl = "https://proctoring-api.easyproctor.tech/api";
22791
22791
  async function setBaseUrl(_baseUrl) {
22792
22792
  baseUrl = _baseUrl;
22793
22793
  }
@@ -22797,7 +22797,7 @@ async function makeRequest(data) {
22797
22797
  method,
22798
22798
  body: body != null ? JSON.stringify(body) : void 0,
22799
22799
  headers: {
22800
- "Authorization": `Bearer ${jwt}`,
22800
+ Authorization: `Bearer ${jwt}`,
22801
22801
  "Content-Type": "application/json"
22802
22802
  }
22803
22803
  });
@@ -22979,6 +22979,8 @@ function useProctoring(proctoringOptions, proctoringConfig) {
22979
22979
  let onFocusCallback;
22980
22980
  let onStopSharingScreenCallback = void 0;
22981
22981
  let cancelCallback = null;
22982
+ let lastClick = 0;
22983
+ const delay = 20;
22982
22984
  function _clear() {
22983
22985
  cameraBuffer = [];
22984
22986
  screenBuffer = [];
@@ -22987,8 +22989,9 @@ function useProctoring(proctoringOptions, proctoringConfig) {
22987
22989
  startDate = void 0;
22988
22990
  alerts = [];
22989
22991
  }
22990
- async function _startCapture(options) {
22992
+ async function _startCapture(options, videoOptions = { width: 640, height: 480 }) {
22991
22993
  if (!document.body) {
22994
+ trackers.registerError(proctoringId, "Script n\xE3o chamado dentro do body!");
22992
22995
  throw SCRIPT_NOT_CALLED_INSIDE_BODY;
22993
22996
  }
22994
22997
  if (cancelCallback != null) {
@@ -23009,7 +23012,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
23009
23012
  cancelScreenCapture = stopScreenRecorder;
23010
23013
  _screenStream = screenStream;
23011
23014
  }
23012
- const { cameraStream, stopCameraRecording } = await startCameraCapture(cameraBuffer, { cameraId, microphoneId });
23015
+ const { cameraStream, stopCameraRecording } = await startCameraCapture(cameraBuffer, { cameraId, microphoneId }, videoOptions);
23013
23016
  startAudio();
23014
23017
  cancelCameraCapture = stopCameraRecording;
23015
23018
  if (captureScreen) {
@@ -23064,6 +23067,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
23064
23067
  const finalAudioBuffer = buffer;
23065
23068
  const finalScreenBuffer = screenBuffer;
23066
23069
  if (finalCameraBuffer.length == 0) {
23070
+ trackers.registerError(proctoringId, PROCTORING_NOT_STARTED);
23067
23071
  throw PROCTORING_NOT_STARTED;
23068
23072
  }
23069
23073
  const cameraFileName = `EP_${proctoringId}_camera_${index}.webm`;
@@ -23098,12 +23102,16 @@ function useProctoring(proctoringOptions, proctoringConfig) {
23098
23102
  init(config.insights);
23099
23103
  }
23100
23104
  }
23101
- async function start(options = defaultProctoringOptions) {
23105
+ async function start(options = defaultProctoringOptions, videoOptions = { width: 640, height: 480 }) {
23106
+ if (lastClick >= Date.now() - delay)
23107
+ throw PROCTORING_ALREADY_STARTED;
23108
+ lastClick = Date.now();
23102
23109
  const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
23103
23110
  await initConfig();
23104
23111
  if (!allowMultipleMonitors) {
23105
23112
  const hasMultipleMonitors = await checkIfhasMultipleMonitors();
23106
23113
  if (hasMultipleMonitors) {
23114
+ trackers.registerError(proctoringId, "Multiplas telas detectadas!");
23107
23115
  throw MULTIPLE_MONITORS_DETECTED;
23108
23116
  }
23109
23117
  }
@@ -23113,7 +23121,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
23113
23121
  cancelCallback = null;
23114
23122
  }
23115
23123
  try {
23116
- const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType });
23124
+ const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType }, videoOptions);
23117
23125
  const serverTime = await makeRequest({
23118
23126
  url: `/Proctoring/server-hour`,
23119
23127
  method: "GET",
@@ -23155,10 +23163,21 @@ function useProctoring(proctoringOptions, proctoringConfig) {
23155
23163
  async function pause() {
23156
23164
  const record = await getRecord("exams");
23157
23165
  if (!cancelCallback || !record) {
23166
+ trackers.registerError(proctoringId, "Proctoring n\xE3o iniciado!");
23158
23167
  throw PROCTORING_NOT_STARTED;
23159
23168
  }
23160
23169
  onStopSharingScreenCallback = void 0;
23161
23170
  await cancelCallback();
23171
+ let serverTime;
23172
+ try {
23173
+ serverTime = await makeRequest({
23174
+ url: `/Proctoring/server-hour`,
23175
+ method: "GET",
23176
+ jwt: proctoringOptions.token
23177
+ });
23178
+ } catch (e) {
23179
+ trackers.registerError(proctoringId, "N\xE3o foi poss\xEDvel requisitar a data do servidor!");
23180
+ }
23162
23181
  const { cameraFile, audioFile, screenFile } = await _closeSession(record.sessions.length);
23163
23182
  record.sessions.push({
23164
23183
  alerts,
@@ -23166,39 +23185,48 @@ function useProctoring(proctoringOptions, proctoringConfig) {
23166
23185
  audioFile,
23167
23186
  screenFile,
23168
23187
  id: "" + record.sessions.length + 1,
23169
- start: startDate ? startDate.toISOString() : new Date().toISOString(),
23170
- end: new Date().toISOString()
23188
+ start: startDate ? startDate.toISOString() : new Date(serverTime.toString()).toISOString(),
23189
+ end: new Date(serverTime.toString()).toISOString()
23171
23190
  });
23172
23191
  await insertRecord("exams", record);
23173
23192
  _clear();
23174
23193
  }
23175
- async function resume(options = defaultProctoringOptions, examId) {
23194
+ async function resume(options = defaultProctoringOptions, examId, videoOptions = { width: 640, height: 480 }) {
23176
23195
  _clear();
23177
23196
  const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
23178
23197
  await initConfig();
23179
23198
  if (!allowMultipleMonitors) {
23180
23199
  const hasMultipleMonitors = await checkIfhasMultipleMonitors();
23181
23200
  if (hasMultipleMonitors) {
23201
+ trackers.registerError(proctoringId, "Multiplas telas detectadas!");
23182
23202
  throw MULTIPLE_MONITORS_DETECTED;
23183
23203
  }
23184
23204
  }
23185
23205
  if (cancelCallback) {
23206
+ trackers.registerError(proctoringId, "Proctoring j\xE1 est\xE1 rodando!");
23186
23207
  throw PROCTORING_RUNNING;
23187
23208
  }
23188
23209
  const record = await getRecord("exams");
23189
23210
  if (!record) {
23211
+ trackers.registerError(proctoringId, "Proctoring n\xE3o iniciado!");
23190
23212
  throw PROCTORING_NOT_STARTED;
23191
23213
  } else if (record) {
23192
- console.log(examId);
23193
- if (record.examId != examId)
23214
+ if (record.examId != examId) {
23215
+ trackers.registerError(proctoringId, "Proctoring n\xE3o iniciado!");
23194
23216
  throw PROCTORING_NOT_STARTED;
23217
+ }
23218
+ }
23219
+ const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType }, videoOptions);
23220
+ let serverTime;
23221
+ try {
23222
+ serverTime = await makeRequest({
23223
+ url: `/Proctoring/server-hour`,
23224
+ method: "GET",
23225
+ jwt: proctoringOptions.token
23226
+ });
23227
+ } catch (e) {
23228
+ trackers.registerError(proctoringId, "N\xE3o foi poss\xEDvel requisitar a data do servidor!");
23195
23229
  }
23196
- const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType });
23197
- const serverTime = await makeRequest({
23198
- url: `/Proctoring/server-hour`,
23199
- method: "GET",
23200
- jwt: proctoringOptions.token
23201
- });
23202
23230
  proctoringId = record.id;
23203
23231
  startDate = new Date(serverTime.toString());
23204
23232
  startTime = startDate.getTime();
@@ -23208,6 +23236,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
23208
23236
  const { onProgress } = options;
23209
23237
  const record = await getRecord("exams");
23210
23238
  if (!record) {
23239
+ trackers.registerError(proctoringId, "Proctoring n\xE3o iniciado!");
23211
23240
  throw PROCTORING_NOT_STARTED;
23212
23241
  }
23213
23242
  try {
@@ -23228,6 +23257,16 @@ function useProctoring(proctoringOptions, proctoringConfig) {
23228
23257
  onStopSharingScreenCallback = void 0;
23229
23258
  if (cancelCallback) {
23230
23259
  await cancelCallback();
23260
+ let serverTime2;
23261
+ try {
23262
+ serverTime2 = await makeRequest({
23263
+ url: `/Proctoring/server-hour`,
23264
+ method: "GET",
23265
+ jwt: proctoringOptions.token
23266
+ });
23267
+ } catch (e) {
23268
+ trackers.registerError(proctoringId, "N\xE3o foi poss\xEDvel requisitar a data do servidor!");
23269
+ }
23231
23270
  const { cameraFile, audioFile, screenFile } = await _closeSession(record.sessions.length);
23232
23271
  record.sessions.push({
23233
23272
  alerts,
@@ -23235,18 +23274,24 @@ function useProctoring(proctoringOptions, proctoringConfig) {
23235
23274
  audioFile,
23236
23275
  screenFile,
23237
23276
  id: "" + record.sessions.length + 1,
23238
- start: startDate ? startDate.toISOString() : new Date().toISOString(),
23239
- end: new Date().toISOString()
23277
+ start: startDate ? startDate.toISOString() : new Date(serverTime2.toString()).toISOString(),
23278
+ end: new Date(serverTime2.toString()).toISOString()
23240
23279
  });
23241
23280
  }
23242
23281
  if (record.sessions.length == 0) {
23282
+ trackers.registerError(proctoringId, "Nenhum v\xEDdeo gravado!");
23243
23283
  throw NO_VIDEOS_RECORDED;
23244
23284
  }
23245
- const serverTime = await makeRequest({
23246
- url: `/Proctoring/server-hour`,
23247
- method: "GET",
23248
- jwt: proctoringOptions.token
23249
- });
23285
+ let serverTime;
23286
+ try {
23287
+ serverTime = await makeRequest({
23288
+ url: `/Proctoring/server-hour`,
23289
+ method: "GET",
23290
+ jwt: proctoringOptions.token
23291
+ });
23292
+ } catch (e) {
23293
+ trackers.registerError(proctoringId, "N\xE3o foi poss\xEDvel requisitar a data do servidor!");
23294
+ }
23250
23295
  const time = new Date(serverTime.toString()).toISOString();
23251
23296
  const allFiles = [];
23252
23297
  record.sessions.forEach((session) => {
@@ -1,6 +1,9 @@
1
1
  export default function startCameraCapture(buffer: Blob[], options?: {
2
2
  cameraId?: string;
3
3
  microphoneId?: string;
4
+ }, videoOptions?: {
5
+ width?: number;
6
+ height?: number;
4
7
  }): Promise<{
5
8
  cameraStream: MediaStream;
6
9
  stopCameraRecording: () => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor",
3
- "version": "0.0.49",
3
+ "version": "0.0.52",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",