easyproctor 0.0.20 → 0.0.21

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 CHANGED
@@ -406,9 +406,9 @@ function useProctoring(proctoringOptions) {
406
406
  onStopSharingScreenCallback = void 0;
407
407
  if (cancelCallback) {
408
408
  await cancelCallback();
409
- const { cameraFile, screenFile } = _generateFiles(record.cameraBuffers.length);
410
- record.cameraBuffers.push(cameraFile);
411
- record.screenBuffers.push(screenFile);
409
+ const { cameraFile: cameraFile2, screenFile: screenFile2 } = _generateFiles(record.cameraBuffers.length);
410
+ record.cameraBuffers.push(cameraFile2);
411
+ record.screenBuffers.push(screenFile2);
412
412
  }
413
413
  if (record.cameraBuffers.length == 0 || record.screenBuffers.length == 0) {
414
414
  throw NO_VIDEOS_RECORDED;
@@ -420,7 +420,14 @@ function useProctoring(proctoringOptions) {
420
420
  onProgress && onProgress(uploadProgress.reduce((acc, el) => acc += el, 0) / totalFiles);
421
421
  };
422
422
  const allFiles = [...record.cameraBuffers, ...record.screenBuffers];
423
- const uploadPromises = allFiles.map((c, i) => {
423
+ const finalCameraBuffer = cameraBuffer;
424
+ const finalScreenBuffer = screenBuffer;
425
+ const cameraFileName = `EP_${proctoringId}_camera_0.webm`;
426
+ const screenFIleName = `EP_${proctoringId}_screen_0.webm`;
427
+ const cameraFile = new File(finalCameraBuffer, cameraFileName, { type: "video/webm" });
428
+ const screenFile = new File(finalScreenBuffer, screenFIleName, { type: "video/webm" });
429
+ const old_files = [cameraFile, screenFile];
430
+ const uploadPromises = old_files.map((c, i) => {
424
431
  return upload_default({
425
432
  file: c,
426
433
  onProgress: (progress) => {
@@ -441,12 +448,12 @@ function useProctoring(proctoringOptions) {
441
448
  }
442
449
  });
443
450
  await makeRequest({
444
- url: `/proctoring/finish/${record.id}`,
451
+ url: `/proctoring/finish/${proctoringOptions.examId}`,
445
452
  method: "POST",
446
453
  body: {
447
454
  endDate: time,
448
- videoCameraUrl: `${azureBlobUrl}/${proctoringId}/cameraFiles`,
449
- videoScreenUrl: `${azureBlobUrl}/${proctoringId}/screenFiles`
455
+ videoCameraUrl: `${azureBlobUrl}/${cameraFileName}`,
456
+ videoScreenUrl: `${azureBlobUrl}/${screenFIleName}`
450
457
  },
451
458
  jwt: proctoringOptions.token
452
459
  });
package/index.js CHANGED
@@ -435,9 +435,9 @@ function useProctoring(proctoringOptions) {
435
435
  onStopSharingScreenCallback = void 0;
436
436
  if (cancelCallback) {
437
437
  await cancelCallback();
438
- const { cameraFile, screenFile } = _generateFiles(record.cameraBuffers.length);
439
- record.cameraBuffers.push(cameraFile);
440
- record.screenBuffers.push(screenFile);
438
+ const { cameraFile: cameraFile2, screenFile: screenFile2 } = _generateFiles(record.cameraBuffers.length);
439
+ record.cameraBuffers.push(cameraFile2);
440
+ record.screenBuffers.push(screenFile2);
441
441
  }
442
442
  if (record.cameraBuffers.length == 0 || record.screenBuffers.length == 0) {
443
443
  throw NO_VIDEOS_RECORDED;
@@ -449,7 +449,14 @@ function useProctoring(proctoringOptions) {
449
449
  onProgress && onProgress(uploadProgress.reduce((acc, el) => acc += el, 0) / totalFiles);
450
450
  };
451
451
  const allFiles = [...record.cameraBuffers, ...record.screenBuffers];
452
- const uploadPromises = allFiles.map((c, i) => {
452
+ const finalCameraBuffer = cameraBuffer;
453
+ const finalScreenBuffer = screenBuffer;
454
+ const cameraFileName = `EP_${proctoringId}_camera_0.webm`;
455
+ const screenFIleName = `EP_${proctoringId}_screen_0.webm`;
456
+ const cameraFile = new File(finalCameraBuffer, cameraFileName, { type: "video/webm" });
457
+ const screenFile = new File(finalScreenBuffer, screenFIleName, { type: "video/webm" });
458
+ const old_files = [cameraFile, screenFile];
459
+ const uploadPromises = old_files.map((c, i) => {
453
460
  return upload_default({
454
461
  file: c,
455
462
  onProgress: (progress) => {
@@ -470,12 +477,12 @@ function useProctoring(proctoringOptions) {
470
477
  }
471
478
  });
472
479
  await makeRequest({
473
- url: `/proctoring/finish/${record.id}`,
480
+ url: `/proctoring/finish/${proctoringOptions.examId}`,
474
481
  method: "POST",
475
482
  body: {
476
483
  endDate: time,
477
- videoCameraUrl: `${azureBlobUrl}/${proctoringId}/cameraFiles`,
478
- videoScreenUrl: `${azureBlobUrl}/${proctoringId}/screenFiles`
484
+ videoCameraUrl: `${azureBlobUrl}/${cameraFileName}`,
485
+ videoScreenUrl: `${azureBlobUrl}/${screenFIleName}`
479
486
  },
480
487
  jwt: proctoringOptions.token
481
488
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",