easyproctor 2.5.5 → 2.5.7

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/index.js CHANGED
@@ -14011,6 +14011,493 @@ var require_jszip_min = __commonJS({
14011
14011
  }
14012
14012
  });
14013
14013
 
14014
+ // node_modules/fix-webm-duration/fix-webm-duration.js
14015
+ var require_fix_webm_duration = __commonJS({
14016
+ "node_modules/fix-webm-duration/fix-webm-duration.js"(exports2, module2) {
14017
+ (function(name, definition) {
14018
+ if (typeof define === "function" && define.amd) {
14019
+ define(definition);
14020
+ } else if (typeof module2 !== "undefined" && module2.exports) {
14021
+ module2.exports = definition();
14022
+ } else {
14023
+ window.ysFixWebmDuration = definition();
14024
+ }
14025
+ })("fix-webm-duration", function() {
14026
+ var sections = {
14027
+ 172351395: { name: "EBML", type: "Container" },
14028
+ 646: { name: "EBMLVersion", type: "Uint" },
14029
+ 759: { name: "EBMLReadVersion", type: "Uint" },
14030
+ 754: { name: "EBMLMaxIDLength", type: "Uint" },
14031
+ 755: { name: "EBMLMaxSizeLength", type: "Uint" },
14032
+ 642: { name: "DocType", type: "String" },
14033
+ 647: { name: "DocTypeVersion", type: "Uint" },
14034
+ 645: { name: "DocTypeReadVersion", type: "Uint" },
14035
+ 108: { name: "Void", type: "Binary" },
14036
+ 63: { name: "CRC-32", type: "Binary" },
14037
+ 190023271: { name: "SignatureSlot", type: "Container" },
14038
+ 16010: { name: "SignatureAlgo", type: "Uint" },
14039
+ 16026: { name: "SignatureHash", type: "Uint" },
14040
+ 16037: { name: "SignaturePublicKey", type: "Binary" },
14041
+ 16053: { name: "Signature", type: "Binary" },
14042
+ 15963: { name: "SignatureElements", type: "Container" },
14043
+ 15995: { name: "SignatureElementList", type: "Container" },
14044
+ 9522: { name: "SignedElement", type: "Binary" },
14045
+ 139690087: { name: "Segment", type: "Container" },
14046
+ 21863284: { name: "SeekHead", type: "Container" },
14047
+ 3515: { name: "Seek", type: "Container" },
14048
+ 5035: { name: "SeekID", type: "Binary" },
14049
+ 5036: { name: "SeekPosition", type: "Uint" },
14050
+ 88713574: { name: "Info", type: "Container" },
14051
+ 13220: { name: "SegmentUID", type: "Binary" },
14052
+ 13188: { name: "SegmentFilename", type: "String" },
14053
+ 1882403: { name: "PrevUID", type: "Binary" },
14054
+ 1868715: { name: "PrevFilename", type: "String" },
14055
+ 2013475: { name: "NextUID", type: "Binary" },
14056
+ 1999803: { name: "NextFilename", type: "String" },
14057
+ 1092: { name: "SegmentFamily", type: "Binary" },
14058
+ 10532: { name: "ChapterTranslate", type: "Container" },
14059
+ 10748: { name: "ChapterTranslateEditionUID", type: "Uint" },
14060
+ 10687: { name: "ChapterTranslateCodec", type: "Uint" },
14061
+ 10661: { name: "ChapterTranslateID", type: "Binary" },
14062
+ 710577: { name: "TimecodeScale", type: "Uint" },
14063
+ 1161: { name: "Duration", type: "Float" },
14064
+ 1121: { name: "DateUTC", type: "Date" },
14065
+ 15273: { name: "Title", type: "String" },
14066
+ 3456: { name: "MuxingApp", type: "String" },
14067
+ 5953: { name: "WritingApp", type: "String" },
14068
+ // 0xf43b675: { name: 'Cluster', type: 'Container' },
14069
+ 103: { name: "Timecode", type: "Uint" },
14070
+ 6228: { name: "SilentTracks", type: "Container" },
14071
+ 6359: { name: "SilentTrackNumber", type: "Uint" },
14072
+ 39: { name: "Position", type: "Uint" },
14073
+ 43: { name: "PrevSize", type: "Uint" },
14074
+ 35: { name: "SimpleBlock", type: "Binary" },
14075
+ 32: { name: "BlockGroup", type: "Container" },
14076
+ 33: { name: "Block", type: "Binary" },
14077
+ 34: { name: "BlockVirtual", type: "Binary" },
14078
+ 13729: { name: "BlockAdditions", type: "Container" },
14079
+ 38: { name: "BlockMore", type: "Container" },
14080
+ 110: { name: "BlockAddID", type: "Uint" },
14081
+ 37: { name: "BlockAdditional", type: "Binary" },
14082
+ 27: { name: "BlockDuration", type: "Uint" },
14083
+ 122: { name: "ReferencePriority", type: "Uint" },
14084
+ 123: { name: "ReferenceBlock", type: "Int" },
14085
+ 125: { name: "ReferenceVirtual", type: "Int" },
14086
+ 36: { name: "CodecState", type: "Binary" },
14087
+ 13730: { name: "DiscardPadding", type: "Int" },
14088
+ 14: { name: "Slices", type: "Container" },
14089
+ 104: { name: "TimeSlice", type: "Container" },
14090
+ 76: { name: "LaceNumber", type: "Uint" },
14091
+ 77: { name: "FrameNumber", type: "Uint" },
14092
+ 75: { name: "BlockAdditionID", type: "Uint" },
14093
+ 78: { name: "Delay", type: "Uint" },
14094
+ 79: { name: "SliceDuration", type: "Uint" },
14095
+ 72: { name: "ReferenceFrame", type: "Container" },
14096
+ 73: { name: "ReferenceOffset", type: "Uint" },
14097
+ 74: { name: "ReferenceTimeCode", type: "Uint" },
14098
+ 47: { name: "EncryptedBlock", type: "Binary" },
14099
+ 106212971: { name: "Tracks", type: "Container" },
14100
+ 46: { name: "TrackEntry", type: "Container" },
14101
+ 87: { name: "TrackNumber", type: "Uint" },
14102
+ 13253: { name: "TrackUID", type: "Uint" },
14103
+ 3: { name: "TrackType", type: "Uint" },
14104
+ 57: { name: "FlagEnabled", type: "Uint" },
14105
+ 8: { name: "FlagDefault", type: "Uint" },
14106
+ 5546: { name: "FlagForced", type: "Uint" },
14107
+ 28: { name: "FlagLacing", type: "Uint" },
14108
+ 11751: { name: "MinCache", type: "Uint" },
14109
+ 11768: { name: "MaxCache", type: "Uint" },
14110
+ 254851: { name: "DefaultDuration", type: "Uint" },
14111
+ 216698: { name: "DefaultDecodedFieldDuration", type: "Uint" },
14112
+ 209231: { name: "TrackTimecodeScale", type: "Float" },
14113
+ 4991: { name: "TrackOffset", type: "Int" },
14114
+ 5614: { name: "MaxBlockAdditionID", type: "Uint" },
14115
+ 4974: { name: "Name", type: "String" },
14116
+ 177564: { name: "Language", type: "String" },
14117
+ 6: { name: "CodecID", type: "String" },
14118
+ 9122: { name: "CodecPrivate", type: "Binary" },
14119
+ 362120: { name: "CodecName", type: "String" },
14120
+ 13382: { name: "AttachmentLink", type: "Uint" },
14121
+ 1742487: { name: "CodecSettings", type: "String" },
14122
+ 1785920: { name: "CodecInfoURL", type: "String" },
14123
+ 438848: { name: "CodecDownloadURL", type: "String" },
14124
+ 42: { name: "CodecDecodeAll", type: "Uint" },
14125
+ 12203: { name: "TrackOverlay", type: "Uint" },
14126
+ 5802: { name: "CodecDelay", type: "Uint" },
14127
+ 5819: { name: "SeekPreRoll", type: "Uint" },
14128
+ 9764: { name: "TrackTranslate", type: "Container" },
14129
+ 9980: { name: "TrackTranslateEditionUID", type: "Uint" },
14130
+ 9919: { name: "TrackTranslateCodec", type: "Uint" },
14131
+ 9893: { name: "TrackTranslateTrackID", type: "Binary" },
14132
+ 96: { name: "Video", type: "Container" },
14133
+ 26: { name: "FlagInterlaced", type: "Uint" },
14134
+ 5048: { name: "StereoMode", type: "Uint" },
14135
+ 5056: { name: "AlphaMode", type: "Uint" },
14136
+ 5049: { name: "OldStereoMode", type: "Uint" },
14137
+ 48: { name: "PixelWidth", type: "Uint" },
14138
+ 58: { name: "PixelHeight", type: "Uint" },
14139
+ 5290: { name: "PixelCropBottom", type: "Uint" },
14140
+ 5307: { name: "PixelCropTop", type: "Uint" },
14141
+ 5324: { name: "PixelCropLeft", type: "Uint" },
14142
+ 5341: { name: "PixelCropRight", type: "Uint" },
14143
+ 5296: { name: "DisplayWidth", type: "Uint" },
14144
+ 5306: { name: "DisplayHeight", type: "Uint" },
14145
+ 5298: { name: "DisplayUnit", type: "Uint" },
14146
+ 5299: { name: "AspectRatioType", type: "Uint" },
14147
+ 963876: { name: "ColourSpace", type: "Binary" },
14148
+ 1029411: { name: "GammaValue", type: "Float" },
14149
+ 230371: { name: "FrameRate", type: "Float" },
14150
+ 97: { name: "Audio", type: "Container" },
14151
+ 53: { name: "SamplingFrequency", type: "Float" },
14152
+ 14517: { name: "OutputSamplingFrequency", type: "Float" },
14153
+ 31: { name: "Channels", type: "Uint" },
14154
+ 15739: { name: "ChannelPositions", type: "Binary" },
14155
+ 8804: { name: "BitDepth", type: "Uint" },
14156
+ 98: { name: "TrackOperation", type: "Container" },
14157
+ 99: { name: "TrackCombinePlanes", type: "Container" },
14158
+ 100: { name: "TrackPlane", type: "Container" },
14159
+ 101: { name: "TrackPlaneUID", type: "Uint" },
14160
+ 102: { name: "TrackPlaneType", type: "Uint" },
14161
+ 105: { name: "TrackJoinBlocks", type: "Container" },
14162
+ 109: { name: "TrackJoinUID", type: "Uint" },
14163
+ 64: { name: "TrickTrackUID", type: "Uint" },
14164
+ 65: { name: "TrickTrackSegmentUID", type: "Binary" },
14165
+ 70: { name: "TrickTrackFlag", type: "Uint" },
14166
+ 71: { name: "TrickMasterTrackUID", type: "Uint" },
14167
+ 68: { name: "TrickMasterTrackSegmentUID", type: "Binary" },
14168
+ 11648: { name: "ContentEncodings", type: "Container" },
14169
+ 8768: { name: "ContentEncoding", type: "Container" },
14170
+ 4145: { name: "ContentEncodingOrder", type: "Uint" },
14171
+ 4146: { name: "ContentEncodingScope", type: "Uint" },
14172
+ 4147: { name: "ContentEncodingType", type: "Uint" },
14173
+ 4148: { name: "ContentCompression", type: "Container" },
14174
+ 596: { name: "ContentCompAlgo", type: "Uint" },
14175
+ 597: { name: "ContentCompSettings", type: "Binary" },
14176
+ 4149: { name: "ContentEncryption", type: "Container" },
14177
+ 2017: { name: "ContentEncAlgo", type: "Uint" },
14178
+ 2018: { name: "ContentEncKeyID", type: "Binary" },
14179
+ 2019: { name: "ContentSignature", type: "Binary" },
14180
+ 2020: { name: "ContentSigKeyID", type: "Binary" },
14181
+ 2021: { name: "ContentSigAlgo", type: "Uint" },
14182
+ 2022: { name: "ContentSigHashAlgo", type: "Uint" },
14183
+ 206814059: { name: "Cues", type: "Container" },
14184
+ 59: { name: "CuePoint", type: "Container" },
14185
+ 51: { name: "CueTime", type: "Uint" },
14186
+ 55: { name: "CueTrackPositions", type: "Container" },
14187
+ 119: { name: "CueTrack", type: "Uint" },
14188
+ 113: { name: "CueClusterPosition", type: "Uint" },
14189
+ 112: { name: "CueRelativePosition", type: "Uint" },
14190
+ 50: { name: "CueDuration", type: "Uint" },
14191
+ 4984: { name: "CueBlockNumber", type: "Uint" },
14192
+ 106: { name: "CueCodecState", type: "Uint" },
14193
+ 91: { name: "CueReference", type: "Container" },
14194
+ 22: { name: "CueRefTime", type: "Uint" },
14195
+ 23: { name: "CueRefCluster", type: "Uint" },
14196
+ 4959: { name: "CueRefNumber", type: "Uint" },
14197
+ 107: { name: "CueRefCodecState", type: "Uint" },
14198
+ 155296873: { name: "Attachments", type: "Container" },
14199
+ 8615: { name: "AttachedFile", type: "Container" },
14200
+ 1662: { name: "FileDescription", type: "String" },
14201
+ 1646: { name: "FileName", type: "String" },
14202
+ 1632: { name: "FileMimeType", type: "String" },
14203
+ 1628: { name: "FileData", type: "Binary" },
14204
+ 1710: { name: "FileUID", type: "Uint" },
14205
+ 1653: { name: "FileReferral", type: "Binary" },
14206
+ 1633: { name: "FileUsedStartTime", type: "Uint" },
14207
+ 1634: { name: "FileUsedEndTime", type: "Uint" },
14208
+ 4433776: { name: "Chapters", type: "Container" },
14209
+ 1465: { name: "EditionEntry", type: "Container" },
14210
+ 1468: { name: "EditionUID", type: "Uint" },
14211
+ 1469: { name: "EditionFlagHidden", type: "Uint" },
14212
+ 1499: { name: "EditionFlagDefault", type: "Uint" },
14213
+ 1501: { name: "EditionFlagOrdered", type: "Uint" },
14214
+ 54: { name: "ChapterAtom", type: "Container" },
14215
+ 13252: { name: "ChapterUID", type: "Uint" },
14216
+ 5716: { name: "ChapterStringUID", type: "String" },
14217
+ 17: { name: "ChapterTimeStart", type: "Uint" },
14218
+ 18: { name: "ChapterTimeEnd", type: "Uint" },
14219
+ 24: { name: "ChapterFlagHidden", type: "Uint" },
14220
+ 1432: { name: "ChapterFlagEnabled", type: "Uint" },
14221
+ 11879: { name: "ChapterSegmentUID", type: "Binary" },
14222
+ 11964: { name: "ChapterSegmentEditionUID", type: "Uint" },
14223
+ 9155: { name: "ChapterPhysicalEquiv", type: "Uint" },
14224
+ 15: { name: "ChapterTrack", type: "Container" },
14225
+ 9: { name: "ChapterTrackNumber", type: "Uint" },
14226
+ 0: { name: "ChapterDisplay", type: "Container" },
14227
+ 5: { name: "ChapString", type: "String" },
14228
+ 892: { name: "ChapLanguage", type: "String" },
14229
+ 894: { name: "ChapCountry", type: "String" },
14230
+ 10564: { name: "ChapProcess", type: "Container" },
14231
+ 10581: { name: "ChapProcessCodecID", type: "Uint" },
14232
+ 1293: { name: "ChapProcessPrivate", type: "Binary" },
14233
+ 10513: { name: "ChapProcessCommand", type: "Container" },
14234
+ 10530: { name: "ChapProcessTime", type: "Uint" },
14235
+ 10547: { name: "ChapProcessData", type: "Binary" },
14236
+ 39109479: { name: "Tags", type: "Container" },
14237
+ 13171: { name: "Tag", type: "Container" },
14238
+ 9152: { name: "Targets", type: "Container" },
14239
+ 10442: { name: "TargetTypeValue", type: "Uint" },
14240
+ 9162: { name: "TargetType", type: "String" },
14241
+ 9157: { name: "TagTrackUID", type: "Uint" },
14242
+ 9161: { name: "TagEditionUID", type: "Uint" },
14243
+ 9156: { name: "TagChapterUID", type: "Uint" },
14244
+ 9158: { name: "TagAttachmentUID", type: "Uint" },
14245
+ 10184: { name: "SimpleTag", type: "Container" },
14246
+ 1443: { name: "TagName", type: "String" },
14247
+ 1146: { name: "TagLanguage", type: "String" },
14248
+ 1156: { name: "TagDefault", type: "Uint" },
14249
+ 1159: { name: "TagString", type: "String" },
14250
+ 1157: { name: "TagBinary", type: "Binary" }
14251
+ };
14252
+ function doInherit(newClass, baseClass) {
14253
+ newClass.prototype = Object.create(baseClass.prototype);
14254
+ newClass.prototype.constructor = newClass;
14255
+ }
14256
+ function WebmBase(name, type) {
14257
+ this.name = name || "Unknown";
14258
+ this.type = type || "Unknown";
14259
+ }
14260
+ WebmBase.prototype.updateBySource = function() {
14261
+ };
14262
+ WebmBase.prototype.setSource = function(source) {
14263
+ this.source = source;
14264
+ this.updateBySource();
14265
+ };
14266
+ WebmBase.prototype.updateByData = function() {
14267
+ };
14268
+ WebmBase.prototype.setData = function(data) {
14269
+ this.data = data;
14270
+ this.updateByData();
14271
+ };
14272
+ function WebmUint(name, type) {
14273
+ WebmBase.call(this, name, type || "Uint");
14274
+ }
14275
+ doInherit(WebmUint, WebmBase);
14276
+ function padHex(hex) {
14277
+ return hex.length % 2 === 1 ? "0" + hex : hex;
14278
+ }
14279
+ WebmUint.prototype.updateBySource = function() {
14280
+ this.data = "";
14281
+ for (var i3 = 0; i3 < this.source.length; i3++) {
14282
+ var hex = this.source[i3].toString(16);
14283
+ this.data += padHex(hex);
14284
+ }
14285
+ };
14286
+ WebmUint.prototype.updateByData = function() {
14287
+ var length = this.data.length / 2;
14288
+ this.source = new Uint8Array(length);
14289
+ for (var i3 = 0; i3 < length; i3++) {
14290
+ var hex = this.data.substr(i3 * 2, 2);
14291
+ this.source[i3] = parseInt(hex, 16);
14292
+ }
14293
+ };
14294
+ WebmUint.prototype.getValue = function() {
14295
+ return parseInt(this.data, 16);
14296
+ };
14297
+ WebmUint.prototype.setValue = function(value) {
14298
+ this.setData(padHex(value.toString(16)));
14299
+ };
14300
+ function WebmFloat(name, type) {
14301
+ WebmBase.call(this, name, type || "Float");
14302
+ }
14303
+ doInherit(WebmFloat, WebmBase);
14304
+ WebmFloat.prototype.getFloatArrayType = function() {
14305
+ return this.source && this.source.length === 4 ? Float32Array : Float64Array;
14306
+ };
14307
+ WebmFloat.prototype.updateBySource = function() {
14308
+ var byteArray = this.source.reverse();
14309
+ var floatArrayType = this.getFloatArrayType();
14310
+ var floatArray = new floatArrayType(byteArray.buffer);
14311
+ this.data = floatArray[0];
14312
+ };
14313
+ WebmFloat.prototype.updateByData = function() {
14314
+ var floatArrayType = this.getFloatArrayType();
14315
+ var floatArray = new floatArrayType([this.data]);
14316
+ var byteArray = new Uint8Array(floatArray.buffer);
14317
+ this.source = byteArray.reverse();
14318
+ };
14319
+ WebmFloat.prototype.getValue = function() {
14320
+ return this.data;
14321
+ };
14322
+ WebmFloat.prototype.setValue = function(value) {
14323
+ this.setData(value);
14324
+ };
14325
+ function WebmContainer(name, type) {
14326
+ WebmBase.call(this, name, type || "Container");
14327
+ }
14328
+ doInherit(WebmContainer, WebmBase);
14329
+ WebmContainer.prototype.readByte = function() {
14330
+ return this.source[this.offset++];
14331
+ };
14332
+ WebmContainer.prototype.readUint = function() {
14333
+ var firstByte = this.readByte();
14334
+ var bytes = 8 - firstByte.toString(2).length;
14335
+ var value = firstByte - (1 << 7 - bytes);
14336
+ for (var i3 = 0; i3 < bytes; i3++) {
14337
+ value *= 256;
14338
+ value += this.readByte();
14339
+ }
14340
+ return value;
14341
+ };
14342
+ WebmContainer.prototype.updateBySource = function() {
14343
+ this.data = [];
14344
+ for (this.offset = 0; this.offset < this.source.length; this.offset = end) {
14345
+ var id = this.readUint();
14346
+ var len = this.readUint();
14347
+ var end = Math.min(this.offset + len, this.source.length);
14348
+ var data = this.source.slice(this.offset, end);
14349
+ var info = sections[id] || { name: "Unknown", type: "Unknown" };
14350
+ var ctr = WebmBase;
14351
+ switch (info.type) {
14352
+ case "Container":
14353
+ ctr = WebmContainer;
14354
+ break;
14355
+ case "Uint":
14356
+ ctr = WebmUint;
14357
+ break;
14358
+ case "Float":
14359
+ ctr = WebmFloat;
14360
+ break;
14361
+ }
14362
+ var section = new ctr(info.name, info.type);
14363
+ section.setSource(data);
14364
+ this.data.push({
14365
+ id,
14366
+ idHex: id.toString(16),
14367
+ data: section
14368
+ });
14369
+ }
14370
+ };
14371
+ WebmContainer.prototype.writeUint = function(x3, draft) {
14372
+ for (var bytes = 1, flag = 128; x3 >= flag && bytes < 8; bytes++, flag *= 128) {
14373
+ }
14374
+ if (!draft) {
14375
+ var value = flag + x3;
14376
+ for (var i3 = bytes - 1; i3 >= 0; i3--) {
14377
+ var c3 = value % 256;
14378
+ this.source[this.offset + i3] = c3;
14379
+ value = (value - c3) / 256;
14380
+ }
14381
+ }
14382
+ this.offset += bytes;
14383
+ };
14384
+ WebmContainer.prototype.writeSections = function(draft) {
14385
+ this.offset = 0;
14386
+ for (var i3 = 0; i3 < this.data.length; i3++) {
14387
+ var section = this.data[i3], content = section.data.source, contentLength = content.length;
14388
+ this.writeUint(section.id, draft);
14389
+ this.writeUint(contentLength, draft);
14390
+ if (!draft) {
14391
+ this.source.set(content, this.offset);
14392
+ }
14393
+ this.offset += contentLength;
14394
+ }
14395
+ return this.offset;
14396
+ };
14397
+ WebmContainer.prototype.updateByData = function() {
14398
+ var length = this.writeSections("draft");
14399
+ this.source = new Uint8Array(length);
14400
+ this.writeSections();
14401
+ };
14402
+ WebmContainer.prototype.getSectionById = function(id) {
14403
+ for (var i3 = 0; i3 < this.data.length; i3++) {
14404
+ var section = this.data[i3];
14405
+ if (section.id === id) {
14406
+ return section.data;
14407
+ }
14408
+ }
14409
+ return null;
14410
+ };
14411
+ function WebmFile(source) {
14412
+ WebmContainer.call(this, "File", "File");
14413
+ this.setSource(source);
14414
+ }
14415
+ doInherit(WebmFile, WebmContainer);
14416
+ WebmFile.prototype.fixDuration = function(duration, options) {
14417
+ var logger = options && options.logger;
14418
+ if (logger === void 0) {
14419
+ logger = function(message) {
14420
+ console.log(message);
14421
+ };
14422
+ } else if (!logger) {
14423
+ logger = function() {
14424
+ };
14425
+ }
14426
+ var segmentSection = this.getSectionById(139690087);
14427
+ if (!segmentSection) {
14428
+ logger("[fix-webm-duration] Segment section is missing");
14429
+ return false;
14430
+ }
14431
+ var infoSection = segmentSection.getSectionById(88713574);
14432
+ if (!infoSection) {
14433
+ logger("[fix-webm-duration] Info section is missing");
14434
+ return false;
14435
+ }
14436
+ var timeScaleSection = infoSection.getSectionById(710577);
14437
+ if (!timeScaleSection) {
14438
+ logger("[fix-webm-duration] TimecodeScale section is missing");
14439
+ return false;
14440
+ }
14441
+ var durationSection = infoSection.getSectionById(1161);
14442
+ if (durationSection) {
14443
+ if (durationSection.getValue() <= 0) {
14444
+ logger(`[fix-webm-duration] Duration section is present, but the value is ${durationSection.getValue()}`);
14445
+ durationSection.setValue(duration);
14446
+ } else {
14447
+ logger(`[fix-webm-duration] Duration section is present, and the value is ${durationSection.getValue()}`);
14448
+ return false;
14449
+ }
14450
+ } else {
14451
+ logger("[fix-webm-duration] Duration section is missing");
14452
+ durationSection = new WebmFloat("Duration", "Float");
14453
+ durationSection.setValue(duration);
14454
+ infoSection.data.push({
14455
+ id: 1161,
14456
+ data: durationSection
14457
+ });
14458
+ }
14459
+ timeScaleSection.setValue(1e6);
14460
+ infoSection.updateByData();
14461
+ segmentSection.updateByData();
14462
+ this.updateByData();
14463
+ return true;
14464
+ };
14465
+ WebmFile.prototype.toBlob = function(mimeType) {
14466
+ return new Blob([this.source.buffer], { type: mimeType || "video/webm" });
14467
+ };
14468
+ function fixWebmDuration3(blob, duration, callback, options) {
14469
+ if (typeof callback === "object") {
14470
+ options = callback;
14471
+ callback = void 0;
14472
+ }
14473
+ if (!callback) {
14474
+ return new Promise(function(resolve) {
14475
+ fixWebmDuration3(blob, duration, resolve, options);
14476
+ });
14477
+ }
14478
+ try {
14479
+ var reader = new FileReader();
14480
+ reader.onloadend = function() {
14481
+ try {
14482
+ var file = new WebmFile(new Uint8Array(reader.result));
14483
+ if (file.fixDuration(duration, options)) {
14484
+ blob = file.toBlob(blob.type);
14485
+ }
14486
+ } catch (ex) {
14487
+ }
14488
+ callback(blob);
14489
+ };
14490
+ reader.readAsArrayBuffer(blob);
14491
+ } catch (ex) {
14492
+ callback(blob);
14493
+ }
14494
+ }
14495
+ fixWebmDuration3.default = fixWebmDuration3;
14496
+ return fixWebmDuration3;
14497
+ });
14498
+ }
14499
+ });
14500
+
14014
14501
  // node_modules/file-saver/dist/FileSaver.min.js
14015
14502
  var require_FileSaver_min = __commonJS({
14016
14503
  "node_modules/file-saver/dist/FileSaver.min.js"(exports2, module2) {
@@ -25943,6 +26430,7 @@ var BaseDetection = class {
25943
26430
  // objectDetection
25944
26431
  runningMode: this.runningMode
25945
26432
  });
26433
+ console.log("BaseDetection initializeDetector", this.detectorType);
25946
26434
  }
25947
26435
  stopDetection() {
25948
26436
  this.animationFrameId && clearTimeout(this.animationFrameId);
@@ -25954,6 +26442,7 @@ var BaseDetection = class {
25954
26442
  }
25955
26443
  enableCam(cameraStream) {
25956
26444
  var _a2;
26445
+ console.log("BaseDetection enableCam");
25957
26446
  if (!this.detector) {
25958
26447
  console.log("Wait! Detector not loaded yet.");
25959
26448
  return;
@@ -25978,7 +26467,6 @@ var BaseDetection = class {
25978
26467
  }
25979
26468
  cameraStream && !this.video.srcObject && (this.video.srcObject = cameraStream);
25980
26469
  this.video.play();
25981
- this.startTime = new Date(Date.now());
25982
26470
  const that = this;
25983
26471
  (_a2 = this.video) == null ? void 0 : _a2.addEventListener("loadeddata", () => that.predictWebcam());
25984
26472
  const style = document.createElement("style");
@@ -25996,6 +26484,7 @@ var BaseDetection = class {
25996
26484
  }
25997
26485
  `;
25998
26486
  document.getElementsByTagName("head")[0].appendChild(style);
26487
+ console.log("BaseDetection enableCam OK");
25999
26488
  }
26000
26489
  async predictWebcam() {
26001
26490
  if (this.lastVideoTime === -1) {
@@ -26021,8 +26510,8 @@ var BaseDetection = class {
26021
26510
  description: this.alertTranslate(description),
26022
26511
  type,
26023
26512
  category: description,
26024
- begin: Date.now() - this.startTime.getTime(),
26025
- end: Date.now() - this.startTime.getTime()
26513
+ begin: 0,
26514
+ end: 0
26026
26515
  });
26027
26516
  if (this.options.onRealtimeAlertsCallback == null)
26028
26517
  this.error && (this.error.innerText = description);
@@ -26033,8 +26522,8 @@ var BaseDetection = class {
26033
26522
  description: this.alertTranslate(description),
26034
26523
  type,
26035
26524
  category: description,
26036
- begin: Date.now() - this.startTime.getTime(),
26037
- end: Date.now() - this.startTime.getTime()
26525
+ begin: 0,
26526
+ end: 0
26038
26527
  });
26039
26528
  this.error && (this.error.innerText = "");
26040
26529
  }
@@ -26124,11 +26613,13 @@ var FaceDetection = class extends BaseDetection {
26124
26613
  );
26125
26614
  this.emmitedPositionAlert = false;
26126
26615
  this.emmitedFaceAlert = false;
26616
+ console.log("FaceDetection constructor");
26617
+ this.numFacesSent = -1;
26127
26618
  }
26128
26619
  stopDetection() {
26129
26620
  super.stopDetection();
26130
26621
  if (this.emmitedFaceAlert) {
26131
- this.handleOk("face_ok", "face_detection_on_stream");
26622
+ this.handleOk("face_stop", "face_detection_on_stream");
26132
26623
  }
26133
26624
  }
26134
26625
  // displayVideoDetections(result: { detections: any; }) {
@@ -26291,6 +26782,8 @@ var FaceDetection = class extends BaseDetection {
26291
26782
  }
26292
26783
  verify(result) {
26293
26784
  var _a2;
26785
+ console.log("this.numFacesSent", this.numFacesSent);
26786
+ console.log("result.detections.length", result.detections.length);
26294
26787
  if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectFace) && result.detections.length !== this.numFacesSent) {
26295
26788
  this.numFacesSent = result.detections.length;
26296
26789
  if (result.detections.length === 0) {
@@ -30306,46 +30799,6 @@ function isMobileDevice() {
30306
30799
  return /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
30307
30800
  }
30308
30801
 
30309
- // src/plugins/insights.ts
30310
- var backendService;
30311
- var init = (backend) => {
30312
- backendService = backend;
30313
- return backendService;
30314
- };
30315
- var eventNames = {
30316
- DEVICES_CHECKED: "devices_checked",
30317
- START: "start",
30318
- FINISH: "finish",
30319
- ERROR: "error",
30320
- UPLOAD: "upload",
30321
- UPLOAD_FILE: "upload_file",
30322
- DOWNLOAD_VIDEO: "download_video",
30323
- BUFFER_SIZE: "buffer_size",
30324
- ANOTHER_STREAM: "another_stream",
30325
- CHANGE_DEVICE: "change_device",
30326
- STOP_SHARING_SCREEN: "stop_sharing_screen",
30327
- ERROR_RECORDER_RTC: "error_recorder_rtc",
30328
- BROWSER_NOT_SUPPORTED: "browser_not_supported",
30329
- SAVE_ON_SESSION: "save_on_session"
30330
- };
30331
- var log = (eventName, properties) => backendService && backendService.log(eventName, properties);
30332
- var trackers = {
30333
- registerDevicesChecked: (proctoringId2, success, description) => log(eventNames.DEVICES_CHECKED, { proctoringId: proctoringId2, success, description }),
30334
- registerStart: (proctoringId2, success, description) => log(eventNames.START, { proctoringId: proctoringId2, success, description }),
30335
- registerFinish: (proctoringId2, success, description) => log(eventNames.FINISH, { proctoringId: proctoringId2, success, description }),
30336
- registerError: (proctoringId2, description) => log(eventNames.ERROR, { proctoringId: proctoringId2, description }),
30337
- registerBrowserNotSupported: (proctoringId2, description) => log(eventNames.BROWSER_NOT_SUPPORTED, { proctoringId: proctoringId2, description }),
30338
- registerUpload: (proctoringId2, success, description, serviceType, uploadTime) => log(eventNames.UPLOAD, { proctoringId: proctoringId2, success, description, serviceType, uploadTime }),
30339
- registerUploadFile: (proctoringId2, description, fileType) => log(eventNames.UPLOAD_FILE, { proctoringId: proctoringId2, description, fileType }),
30340
- registerChangeDevice: (proctoringId2, inOrOut, description) => log(eventNames.CHANGE_DEVICE, { proctoringId: proctoringId2, inOrOut, description }),
30341
- registerStopSharingScreen: (proctoringId2, description) => log(eventNames.STOP_SHARING_SCREEN, { proctoringId: proctoringId2, description }),
30342
- registerErrorRecorderRTC: (proctoringId2, description) => log(eventNames.ERROR_RECORDER_RTC, { proctoringId: proctoringId2, description }),
30343
- registerDownloadFile: (proctoringId2, description) => log(eventNames.DOWNLOAD_VIDEO, { proctoringId: proctoringId2, description }),
30344
- registerOnBufferSizeError: (proctoringId2, description) => log(eventNames.BUFFER_SIZE, { proctoringId: proctoringId2, description }),
30345
- registerAnotherStream: (proctoringId2, description) => log(eventNames.ANOTHER_STREAM, { proctoringId: proctoringId2, description }),
30346
- registerSaveOnSession: (proctoringId2, description) => log(eventNames.SAVE_ON_SESSION, { proctoringId: proctoringId2, description })
30347
- };
30348
-
30349
30802
  // src/plugins/recorder.ts
30350
30803
  var proctoringId;
30351
30804
  function setRecorderProctoringId(id) {
@@ -30358,6 +30811,7 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30358
30811
  let lastEvent;
30359
30812
  let bufferSize;
30360
30813
  bufferSize = 0;
30814
+ let startTime;
30361
30815
  let recorderOptions = {
30362
30816
  // eslint-disable-next-line no-useless-escape
30363
30817
  mimeType: "video/webm",
@@ -30377,59 +30831,106 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30377
30831
  audioBitsPerSecond: 64 * 1e3
30378
30832
  };
30379
30833
  }
30380
- const mediaRecorder = new MediaRecorder(stream4, recorderOptions);
30381
- mediaRecorder.ondataavailable = (e3) => {
30382
- bufferSize = bufferSize + e3.data.size;
30383
- if (e3.data.size > 0) {
30384
- buffer.push(e3.data);
30834
+ function buildMediaRecorder(stream5, recorderOptions2) {
30835
+ const tracks = stream5.getTracks();
30836
+ if (tracks.length == 0) {
30837
+ throw new Error("No tracks found");
30385
30838
  }
30386
- if (!stopped) {
30387
- if (lastEvent && e3.data.size === lastEvent.data.size || e3.data.size === 0) {
30388
- proctoringId && lastEvent && e3.data.size === lastEvent.data.size && trackers.registerOnBufferSizeError(
30389
- proctoringId,
30390
- `onBufferSizeError: Recorder size freezed: ${e3.data.size} Mb`
30391
- );
30392
- proctoringId && e3.data.size === 0 && trackers.registerOnBufferSizeError(
30393
- proctoringId,
30394
- `onBufferSizeError: Recorder size equal 0 Mb`
30395
- );
30396
- onBufferSizeErrorCallback && onBufferSizeErrorCallback();
30839
+ const invalidTracks = tracks.find((t3) => t3.readyState != "live");
30840
+ if (invalidTracks) {
30841
+ throw new Error("Track not live: " + invalidTracks.label);
30842
+ }
30843
+ console.log("buildMediaRecorder tracks OK");
30844
+ let mediaRecorder2 = new MediaRecorder(stream5, recorderOptions2);
30845
+ console.log("buildMediaRecorder mediaRecorder OK");
30846
+ mediaRecorder2.ondataavailable = (e3) => {
30847
+ bufferSize = bufferSize + e3.data.size;
30848
+ if (e3.data.size > 0) {
30849
+ buffer.push(e3.data);
30397
30850
  }
30398
- lastEvent = e3;
30399
- } else {
30400
- if (audio && mediaRecorder.state == "inactive") {
30401
- const blob = new Blob(buffer, { type: "audio/webm" });
30402
- buffer = [blob];
30851
+ if (stopped) {
30852
+ console.log("buildMediaRecorder ondataavailable stopped");
30853
+ resolvePromise && resolvePromise();
30403
30854
  }
30404
- resolvePromise && resolvePromise();
30405
- }
30406
- };
30407
- function startRecording() {
30408
- return new Promise((resolve) => {
30409
- resolvePromise = resolve;
30410
- mediaRecorder.start();
30411
- bufferSize = 0;
30412
- stopped = false;
30413
- if (onBufferSizeError) {
30414
- onBufferSizeInterval = setInterval(async () => {
30415
- await mediaRecorder.requestData();
30416
- }, 3e4);
30855
+ };
30856
+ return mediaRecorder2;
30857
+ }
30858
+ let mediaRecorder = buildMediaRecorder(stream4, recorderOptions);
30859
+ async function startRecorder(recorder2) {
30860
+ return new Promise((resolve, reject) => {
30861
+ var _a2, _b;
30862
+ let started = false;
30863
+ recorder2.onstart = () => {
30864
+ started = true;
30865
+ console.log("recorder onstart");
30866
+ resolve();
30867
+ };
30868
+ recorder2.onerror = (ev) => {
30869
+ console.error("Recorder error event:", ev);
30870
+ stream4.getTracks().forEach((t3) => console.log(t3.readyState));
30871
+ if ("error" in ev) {
30872
+ const err = ev.error;
30873
+ console.error("Error name:", err == null ? void 0 : err.name);
30874
+ console.error("Error message:", err == null ? void 0 : err.message);
30875
+ reject(err || ev);
30876
+ } else {
30877
+ console.warn("Evento sem propriedade error");
30878
+ reject(ev);
30879
+ }
30880
+ };
30881
+ try {
30882
+ console.log("State antes do start:", recorder2.state);
30883
+ recorder2.start(1e4);
30884
+ startTime = new Date(Date.now());
30885
+ } catch (e3) {
30886
+ console.error("Recorder erro ao chamar start event:", e3);
30887
+ console.error("Erro real:", e3, e3 == null ? void 0 : e3.error, (_a2 = e3 == null ? void 0 : e3.error) == null ? void 0 : _a2.name, (_b = e3 == null ? void 0 : e3.error) == null ? void 0 : _b.message);
30888
+ console.error("Erro real 2:", e3, e3 == null ? void 0 : e3.message, e3 == null ? void 0 : e3.name);
30889
+ stream4.getTracks().forEach((t3) => console.log(t3.readyState));
30890
+ return reject(e3);
30417
30891
  }
30892
+ setTimeout(() => {
30893
+ if (!started) {
30894
+ console.error("Timeout ao iniciar o recorder");
30895
+ reject(new Error("Timeout ao iniciar o recorder"));
30896
+ }
30897
+ }, 2e3);
30418
30898
  });
30419
30899
  }
30900
+ async function startRecording() {
30901
+ try {
30902
+ await startRecorder(mediaRecorder);
30903
+ if (mediaRecorder.state === "recording") {
30904
+ bufferSize = 0;
30905
+ stopped = false;
30906
+ return;
30907
+ } else {
30908
+ console.log("Recorder n\xE3o est\xE1 em estado recording ap\xF3s start");
30909
+ }
30910
+ } catch (e3) {
30911
+ console.error("Erro ao iniciar o recorder:", e3);
30912
+ await new Promise((r3) => setTimeout(r3, 300));
30913
+ throw e3;
30914
+ }
30915
+ return;
30916
+ }
30420
30917
  function stopRecording() {
30421
30918
  return new Promise((resolve) => {
30422
30919
  if (mediaRecorder.state == "recording") {
30920
+ console.log("stopRecording Recorder est\xE1 em estado recording, iniciando stop");
30423
30921
  resolvePromise = resolve;
30424
- mediaRecorder.stop();
30922
+ mediaRecorder.onstop = () => {
30923
+ console.log("recorder onstop");
30924
+ };
30425
30925
  stopped = true;
30426
- clearInterval(onBufferSizeInterval);
30427
- stream4.getTracks().forEach((el) => {
30428
- el.stop();
30429
- });
30926
+ mediaRecorder.stop();
30430
30927
  } else {
30928
+ console.log("stopRecording Recorder n\xE3o est\xE1 em estado recording");
30431
30929
  resolve();
30432
30930
  }
30931
+ stream4.getTracks().forEach((el) => {
30932
+ el.stop();
30933
+ });
30433
30934
  });
30434
30935
  }
30435
30936
  function pauseRecording() {
@@ -30455,16 +30956,60 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30455
30956
  function getBufferSize() {
30456
30957
  return bufferSize;
30457
30958
  }
30959
+ function getStartTime() {
30960
+ return startTime;
30961
+ }
30458
30962
  return {
30459
30963
  startRecording,
30460
30964
  stopRecording,
30461
30965
  pauseRecording,
30462
30966
  resumeRecording,
30463
30967
  recorderOptions,
30464
- getBufferSize
30968
+ getBufferSize,
30969
+ getStartTime
30465
30970
  };
30466
30971
  }
30467
30972
 
30973
+ // src/plugins/insights.ts
30974
+ var backendService;
30975
+ var init = (backend) => {
30976
+ backendService = backend;
30977
+ return backendService;
30978
+ };
30979
+ var eventNames = {
30980
+ DEVICES_CHECKED: "devices_checked",
30981
+ START: "start",
30982
+ FINISH: "finish",
30983
+ ERROR: "error",
30984
+ UPLOAD: "upload",
30985
+ UPLOAD_FILE: "upload_file",
30986
+ DOWNLOAD_VIDEO: "download_video",
30987
+ BUFFER_SIZE: "buffer_size",
30988
+ ANOTHER_STREAM: "another_stream",
30989
+ CHANGE_DEVICE: "change_device",
30990
+ STOP_SHARING_SCREEN: "stop_sharing_screen",
30991
+ ERROR_RECORDER_RTC: "error_recorder_rtc",
30992
+ BROWSER_NOT_SUPPORTED: "browser_not_supported",
30993
+ SAVE_ON_SESSION: "save_on_session"
30994
+ };
30995
+ var log = (eventName, properties) => backendService && backendService.log(eventName, properties);
30996
+ var trackers = {
30997
+ registerDevicesChecked: (proctoringId2, success, description) => log(eventNames.DEVICES_CHECKED, { proctoringId: proctoringId2, success, description }),
30998
+ registerStart: (proctoringId2, success, description) => log(eventNames.START, { proctoringId: proctoringId2, success, description }),
30999
+ registerFinish: (proctoringId2, success, description) => log(eventNames.FINISH, { proctoringId: proctoringId2, success, description }),
31000
+ registerError: (proctoringId2, description) => log(eventNames.ERROR, { proctoringId: proctoringId2, description }),
31001
+ registerBrowserNotSupported: (proctoringId2, description) => log(eventNames.BROWSER_NOT_SUPPORTED, { proctoringId: proctoringId2, description }),
31002
+ registerUpload: (proctoringId2, success, description, serviceType, uploadTime) => log(eventNames.UPLOAD, { proctoringId: proctoringId2, success, description, serviceType, uploadTime }),
31003
+ registerUploadFile: (proctoringId2, description, fileType) => log(eventNames.UPLOAD_FILE, { proctoringId: proctoringId2, description, fileType }),
31004
+ registerChangeDevice: (proctoringId2, inOrOut, description) => log(eventNames.CHANGE_DEVICE, { proctoringId: proctoringId2, inOrOut, description }),
31005
+ registerStopSharingScreen: (proctoringId2, description) => log(eventNames.STOP_SHARING_SCREEN, { proctoringId: proctoringId2, description }),
31006
+ registerErrorRecorderRTC: (proctoringId2, description) => log(eventNames.ERROR_RECORDER_RTC, { proctoringId: proctoringId2, description }),
31007
+ registerDownloadFile: (proctoringId2, description) => log(eventNames.DOWNLOAD_VIDEO, { proctoringId: proctoringId2, description }),
31008
+ registerOnBufferSizeError: (proctoringId2, description) => log(eventNames.BUFFER_SIZE, { proctoringId: proctoringId2, description }),
31009
+ registerAnotherStream: (proctoringId2, description) => log(eventNames.ANOTHER_STREAM, { proctoringId: proctoringId2, description }),
31010
+ registerSaveOnSession: (proctoringId2, description) => log(eventNames.SAVE_ON_SESSION, { proctoringId: proctoringId2, description })
31011
+ };
31012
+
30468
31013
  // src/new-flow/upload/UploadService.ts
30469
31014
  var UploadService = class {
30470
31015
  constructor(proctoringId2, backend) {
@@ -30750,12 +31295,12 @@ var VolumeMeter = class {
30750
31295
  async start(options = {}) {
30751
31296
  return new Promise((resolve, reject) => {
30752
31297
  try {
30753
- const audioContext = new AudioContext();
30754
- this.analyser = audioContext.createAnalyser();
30755
- const microphone = audioContext.createMediaStreamSource(this.stream);
31298
+ this.audioContext = new AudioContext();
31299
+ this.analyser = this.audioContext.createAnalyser();
31300
+ this.microphone = this.audioContext.createMediaStreamSource(this.stream);
30756
31301
  this.analyser.smoothingTimeConstant = 0.8;
30757
31302
  this.analyser.fftSize = 1024;
30758
- microphone.connect(this.analyser);
31303
+ this.microphone.connect(this.analyser);
30759
31304
  const processAudio = () => {
30760
31305
  const array = new Uint8Array(this.analyser.frequencyBinCount);
30761
31306
  this.analyser.getByteFrequencyData(array);
@@ -30774,9 +31319,13 @@ var VolumeMeter = class {
30774
31319
  });
30775
31320
  }
30776
31321
  stop() {
31322
+ var _a2, _b, _c2;
30777
31323
  if (this.animationFrameId !== null) {
30778
31324
  cancelAnimationFrame(this.animationFrameId);
30779
31325
  }
31326
+ (_a2 = this.audioContext) == null ? void 0 : _a2.close();
31327
+ (_b = this.microphone) == null ? void 0 : _b.disconnect();
31328
+ (_c2 = this.analyser) == null ? void 0 : _c2.disconnect();
30780
31329
  }
30781
31330
  getVolume() {
30782
31331
  return this.volume;
@@ -30788,6 +31337,7 @@ var VolumeMeter = class {
30788
31337
 
30789
31338
  // src/new-flow/recorders/CameraRecorder.ts
30790
31339
  var import_jszip_min = __toESM(require_jszip_min());
31340
+ var import_fix_webm_duration = __toESM(require_fix_webm_duration());
30791
31341
  var CameraRecorder = class {
30792
31342
  constructor(options, videoOptions, paramsConfig, backend, backendToken) {
30793
31343
  this.blobs = [];
@@ -30837,6 +31387,8 @@ var CameraRecorder = class {
30837
31387
  this.isCanvasLoopActive = false;
30838
31388
  this.hardwareStream = null;
30839
31389
  this.internalClonedStream = null;
31390
+ this.videoElement = null;
31391
+ this.duration = 0;
30840
31392
  this.currentRetries = 0;
30841
31393
  this.packageCount = 0;
30842
31394
  this.noiseWait = 20;
@@ -30857,7 +31409,12 @@ var CameraRecorder = class {
30857
31409
  if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectPerson) || ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectCellPhone)) {
30858
31410
  this.objectDetection = new ObjectDetection(
30859
31411
  {
30860
- onRealtimeAlertsCallback: (response) => this.options.onRealtimeAlertsCallback(response)
31412
+ onRealtimeAlertsCallback: (response) => {
31413
+ var _a3, _b2;
31414
+ response.begin = Date.now() - (((_a3 = this.getStartTime()) == null ? void 0 : _a3.getTime()) || 0);
31415
+ response.end = Date.now() - (((_b2 = this.getStartTime()) == null ? void 0 : _b2.getTime()) || 0);
31416
+ this.options.onRealtimeAlertsCallback(response);
31417
+ }
30861
31418
  },
30862
31419
  this.paramsConfig
30863
31420
  );
@@ -30866,7 +31423,12 @@ var CameraRecorder = class {
30866
31423
  if ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectFace) {
30867
31424
  this.faceDetection = new FaceDetection(
30868
31425
  {
30869
- onRealtimeAlertsCallback: (response) => this.options.onRealtimeAlertsCallback(response)
31426
+ onRealtimeAlertsCallback: (response) => {
31427
+ var _a3, _b2;
31428
+ response.begin = Date.now() - (((_a3 = this.getStartTime()) == null ? void 0 : _a3.getTime()) || 0);
31429
+ response.end = Date.now() - (((_b2 = this.getStartTime()) == null ? void 0 : _b2.getTime()) || 0);
31430
+ this.options.onRealtimeAlertsCallback(response);
31431
+ }
30870
31432
  },
30871
31433
  this.paramsConfig
30872
31434
  );
@@ -30892,25 +31454,20 @@ var CameraRecorder = class {
30892
31454
  }
30893
31455
  async bufferError(e3) {
30894
31456
  var _a2, _b;
30895
- console.log("buffer error Camera Recorder params " + this.paramsConfig.videoBehaviourParameters);
31457
+ console.log("buffer error Camera Recorder params ");
30896
31458
  const retryEnabled = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.retryEnabled) || false;
30897
31459
  const maxRetries = ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.maxRetries) || 3;
30898
31460
  if (retryEnabled && this.currentRetries < maxRetries) {
30899
31461
  await this.recordingStop();
30900
- await this.startRecording({
30901
- retry: true
30902
- });
31462
+ await this.startRecording();
30903
31463
  this.currentRetries++;
30904
31464
  this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback(this.cameraStream);
30905
31465
  } else {
30906
31466
  this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback();
30907
31467
  }
30908
31468
  }
30909
- async startRecording(options) {
30910
- var _a2, _b, _c2, _d, _e3, _f, _g, _h;
30911
- if ((((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectPerson) || ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectCellPhone) || ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectFace)) && !(options == null ? void 0 : options.retry)) {
30912
- await this.initializeDetectors();
30913
- }
31469
+ async startStream() {
31470
+ var _a2;
30914
31471
  const { cameraId, microphoneId, onBufferSizeErrorCallback } = this.options;
30915
31472
  const constraints = {
30916
31473
  audio: { deviceId: microphoneId },
@@ -30934,13 +31491,81 @@ var CameraRecorder = class {
30934
31491
  const track = this.cameraStream.getVideoTracks()[0];
30935
31492
  const settings = track.getSettings();
30936
31493
  let { width = 0, height = 0 } = settings;
31494
+ const isPortrait = (_a2 = screen.orientation) == null ? void 0 : _a2.type.includes("portrait");
31495
+ if (isPortrait && isMobileDevice()) {
31496
+ if (this.videoOptions.width == height && this.videoOptions.height == width) {
31497
+ [width, height] = [height, width];
31498
+ }
31499
+ }
31500
+ if (this.videoOptions.minWidth > width || this.videoOptions.minHeight > height) {
31501
+ throw STREAM_UNDER_MINIMUM_PERMITTED;
31502
+ } else if (this.videoOptions.width !== width || this.videoOptions.height !== height) {
31503
+ trackers.registerAnotherStream(
31504
+ this.proctoringId,
31505
+ `Maybe have another stream active
31506
+ Video Options: ${JSON.stringify(
31507
+ this.videoOptions,
31508
+ null,
31509
+ 2
31510
+ )}
31511
+ Setting: ${JSON.stringify(settings, null, 2)}`
31512
+ );
31513
+ throw ANOTHER_STREAM_ACTIVE;
31514
+ }
31515
+ }
31516
+ async stopStream() {
31517
+ if (this.cameraStream) {
31518
+ this.cameraStream.getTracks().forEach((track) => track.stop());
31519
+ }
31520
+ if (this.internalClonedStream) {
31521
+ this.internalClonedStream.getTracks().forEach((track) => track.stop());
31522
+ this.internalClonedStream = null;
31523
+ }
31524
+ if (this.hardwareStream) {
31525
+ this.hardwareStream.getTracks().forEach((track) => track.stop());
31526
+ this.hardwareStream = null;
31527
+ }
31528
+ }
31529
+ async waitForVideoFlow() {
31530
+ return new Promise((resolve) => {
31531
+ const check = () => {
31532
+ var _a2;
31533
+ if (this.videoElement && ((_a2 = this.videoElement) == null ? void 0 : _a2.readyState) >= 3) return resolve();
31534
+ else requestAnimationFrame(check);
31535
+ };
31536
+ check();
31537
+ });
31538
+ }
31539
+ async attachAndWarmup(stream4) {
31540
+ this.videoElement = document.createElement("video");
31541
+ this.videoElement.srcObject = stream4;
31542
+ this.videoElement.muted = true;
31543
+ await this.videoElement.play().catch((e3) => {
31544
+ });
31545
+ await new Promise((resolve) => {
31546
+ var _a2;
31547
+ if (this.videoElement && ((_a2 = this.videoElement) == null ? void 0 : _a2.readyState) >= 1) return resolve();
31548
+ if (this.videoElement)
31549
+ this.videoElement.onloadedmetadata = () => resolve();
31550
+ });
31551
+ console.log("CameraRecorder checking metadata ok");
31552
+ await this.waitForVideoFlow();
31553
+ console.log("CameraRecorder waiting for video flow ok");
31554
+ await new Promise((r3) => setTimeout(r3, 300));
31555
+ }
31556
+ async startRecording() {
31557
+ var _a2, _b, _c2, _d, _e3, _f, _g;
31558
+ console.log("CameraRecorder startRecording");
31559
+ await this.startStream();
31560
+ await this.attachAndWarmup(this.cameraStream);
30937
31561
  const {
30938
31562
  startRecording,
30939
31563
  stopRecording,
30940
31564
  pauseRecording,
30941
31565
  resumeRecording,
30942
31566
  recorderOptions,
30943
- getBufferSize
31567
+ getBufferSize,
31568
+ getStartTime
30944
31569
  } = recorder(
30945
31570
  this.cameraStream,
30946
31571
  // streamToRecord,
@@ -30955,44 +31580,50 @@ var CameraRecorder = class {
30955
31580
  this.recordingResume = resumeRecording;
30956
31581
  this.recorderOptions = recorderOptions;
30957
31582
  this.getBufferSize = getBufferSize;
30958
- this.recordingStart();
30959
- const isPortrait = (_d = screen.orientation) == null ? void 0 : _d.type.includes("portrait");
30960
- if (isPortrait && isMobileDevice()) {
30961
- if (this.videoOptions.width == height && this.videoOptions.height == width) {
30962
- [width, height] = [height, width];
31583
+ this.getStartTime = getStartTime;
31584
+ try {
31585
+ await new Promise((r3) => setTimeout(r3, 500));
31586
+ await this.recordingStart();
31587
+ } catch (error) {
31588
+ console.log("Camera Recorder error", error);
31589
+ this.stopRecording();
31590
+ const maxRetries = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.maxRetries) || 3;
31591
+ if (this.currentRetries < maxRetries) {
31592
+ console.log("Camera Recorder retry", this.currentRetries);
31593
+ this.currentRetries++;
31594
+ await this.startRecording();
31595
+ } else {
31596
+ throw error;
30963
31597
  }
30964
31598
  }
30965
- if (this.videoOptions.minWidth > width || this.videoOptions.minHeight > height) {
30966
- throw STREAM_UNDER_MINIMUM_PERMITTED;
30967
- } else if (this.videoOptions.width !== width || this.videoOptions.height !== height) {
30968
- trackers.registerAnotherStream(
30969
- this.proctoringId,
30970
- `Maybe have another stream active
30971
- Video Options: ${JSON.stringify(
30972
- this.videoOptions,
30973
- null,
30974
- 2
30975
- )}
30976
- Setting: ${JSON.stringify(settings, null, 2)}`
30977
- );
30978
- throw ANOTHER_STREAM_ACTIVE;
31599
+ if (((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectPerson) || ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectCellPhone) || ((_d = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _d.detectFace)) {
31600
+ await this.initializeDetectors();
30979
31601
  }
30980
- ((_e3 = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _e3.useUploadImage) && this.options.proctoringType == "IMAGE" && this.photoShotsCycle();
30981
- if ((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectFace) {
31602
+ if ((_e3 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _e3.detectFace) {
30982
31603
  await this.faceDetection.enableCam(this.cameraStream);
30983
31604
  }
30984
- if (((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectPerson) || ((_h = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _h.detectCellPhone)) {
31605
+ if (((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectPerson) || ((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectCellPhone)) {
30985
31606
  await this.objectDetection.enableCam(this.cameraStream);
30986
31607
  }
30987
31608
  this.filesToUpload = [];
30988
31609
  if (this.options.proctoringType == "REALTIME") {
30989
- this.captureFrame();
31610
+ await this.startRealtimeCapture();
30990
31611
  }
30991
31612
  this.packageCount = 0;
31613
+ console.log("Camera Recorder started OK");
30992
31614
  }
30993
31615
  async stopRecording() {
31616
+ var _a2, _b, _c2, _d;
31617
+ console.log("Camera Recorder stopRecording");
30994
31618
  this.isCanvasLoopActive = false;
31619
+ this.faceDetection && this.faceDetection.detecting && this.faceDetection.stopDetection();
31620
+ this.objectDetection && this.objectDetection.detecting && this.objectDetection.stopDetection();
31621
+ clearInterval(this.imageInterval);
31622
+ clearInterval(this.sendFrameInterval);
31623
+ this.volumeMeter && this.volumeMeter.stop();
31624
+ this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
30995
31625
  this.recordingStop && await this.recordingStop();
31626
+ this.duration = Date.now() - ((_a2 = this.getStartTime()) == null ? void 0 : _a2.getTime()) || 0;
30996
31627
  try {
30997
31628
  if (this.animationFrameId) {
30998
31629
  cancelAnimationFrame(this.animationFrameId);
@@ -31009,19 +31640,23 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31009
31640
  this.hardwareStream.getTracks().forEach((track) => track.stop());
31010
31641
  this.hardwareStream = null;
31011
31642
  }
31643
+ if (this.videoElement) {
31644
+ (_b = this.videoElement) == null ? void 0 : _b.remove();
31645
+ this.videoElement = null;
31646
+ }
31647
+ if (this.video) {
31648
+ (_c2 = this.video) == null ? void 0 : _c2.remove();
31649
+ }
31650
+ if (this.canvas) {
31651
+ (_d = this.canvas) == null ? void 0 : _d.remove();
31652
+ }
31012
31653
  } catch {
31013
31654
  console.error("Erro ao parar os streams de m\xEDdia.");
31014
31655
  }
31015
- this.faceDetection && this.faceDetection.detecting && this.faceDetection.stopDetection();
31016
- this.objectDetection && this.objectDetection.detecting && this.objectDetection.stopDetection();
31017
- clearInterval(this.imageInterval);
31018
- clearInterval(this.sendFrameInterval);
31019
31656
  if (this.options.proctoringType == "REALTIME" && this.upload && this.backendToken) {
31020
31657
  await this.sendPackage(this.filesToUpload);
31021
31658
  await this.filesToUpload.splice(0, this.filesToUpload.length);
31022
31659
  }
31023
- this.volumeMeter && this.volumeMeter.stop();
31024
- this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
31025
31660
  }
31026
31661
  async pauseRecording() {
31027
31662
  await this.recordingPause();
@@ -31029,35 +31664,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31029
31664
  async resumeRecording() {
31030
31665
  await this.recordingResume();
31031
31666
  }
31032
- photoShotsCycle() {
31033
- let imageFile;
31034
- this.configImageCapture();
31035
- this.imageInterval = setInterval(async () => {
31036
- this.canvas.getContext("2d").drawImage(
31037
- this.video,
31038
- 0,
31039
- 0,
31040
- this.videoOptions.width,
31041
- this.videoOptions.height
31042
- );
31043
- const image_data_url = this.canvas.toDataURL("image/jpeg");
31044
- imageFile = await this.getFile(
31045
- image_data_url,
31046
- `${this.proctoringId}_${this.imageCount + 1}.jpg`,
31047
- "image/jpeg"
31048
- );
31049
- if (imageFile && this.upload && this.backendToken) {
31050
- this.upload.upload(
31051
- {
31052
- file: imageFile
31053
- },
31054
- this.backendToken,
31055
- true
31056
- );
31057
- this.imageCount++;
31058
- }
31059
- }, this.paramsConfig.imageBehaviourParameters.uploadInterval * 1e3);
31060
- }
31061
31667
  async getCurrentImageBase64() {
31062
31668
  if (!this.video || !this.canvas) {
31063
31669
  this.configImageCapture();
@@ -31088,30 +31694,35 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31088
31694
  this.canvas.getContext("2d").drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
31089
31695
  return this.canvas.toDataURL("image/jpeg");
31090
31696
  }
31091
- // captura um frame a cada intervalo de tempo definido no paramsConfig.videoBehaviourParameters?.realtimeCaptureInterval!
31092
- captureFrame() {
31093
- var _a2, _b;
31697
+ async captureFrame() {
31698
+ var _a2;
31094
31699
  let imageFile;
31095
- this.configImageCapture();
31096
31700
  const packSize = (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.realtimePackageSize;
31701
+ this.canvas.getContext("2d").drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
31702
+ const image_data_url = this.canvas.toDataURL("image/jpeg");
31703
+ if (this.proctoringId == void 0) return;
31704
+ if (packSize == this.imageCount) {
31705
+ this.imageCount = 0;
31706
+ const framesToSend = [...this.filesToUpload];
31707
+ this.sendPackage(framesToSend);
31708
+ await this.filesToUpload.splice(0, this.filesToUpload.length);
31709
+ }
31710
+ let imageName = `${this.proctoringId}_${this.imageCount + 1}.jpg`;
31711
+ imageFile = await this.getFile(image_data_url, imageName, "image/jpeg");
31712
+ if (imageFile && imageFile.size > 10 && packSize > 0) {
31713
+ this.filesToUpload.push(imageFile);
31714
+ this.imageCount++;
31715
+ }
31716
+ }
31717
+ // inicia a captura de um frame a cada intervalo de tempo definido no paramsConfig.videoBehaviourParameters?.realtimeCaptureInterval!
31718
+ async startRealtimeCapture() {
31719
+ var _a2;
31720
+ this.configImageCapture();
31097
31721
  this.imageCount = 0;
31722
+ await this.captureFrame();
31098
31723
  this.imageInterval = setInterval(async () => {
31099
- this.canvas.getContext("2d").drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
31100
- const image_data_url = this.canvas.toDataURL("image/jpeg");
31101
- if (this.proctoringId == void 0) return;
31102
- if (packSize == this.imageCount) {
31103
- this.imageCount = 0;
31104
- const framesToSend = [...this.filesToUpload];
31105
- this.sendPackage(framesToSend);
31106
- await this.filesToUpload.splice(0, this.filesToUpload.length);
31107
- }
31108
- let imageName = `${this.proctoringId}_${this.imageCount + 1}.jpg`;
31109
- imageFile = await this.getFile(image_data_url, imageName, "image/jpeg");
31110
- if (imageFile && imageFile.size > 10 && packSize > 0) {
31111
- this.filesToUpload.push(imageFile);
31112
- this.imageCount++;
31113
- }
31114
- }, ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.realtimeCaptureInterval) * 1e3);
31724
+ await this.captureFrame();
31725
+ }, ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.realtimeCaptureInterval) * 1e3);
31115
31726
  }
31116
31727
  // envia pacote de imagens
31117
31728
  async sendPackage(framesToSend) {
@@ -31119,7 +31730,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31119
31730
  let pending = false;
31120
31731
  let undeliveredPackagesCount = 0;
31121
31732
  const packSize = (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.realtimePackageSize;
31122
- const packCaptureInterval = ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.realtimeCaptureInterval) + 1;
31733
+ const packCaptureInterval = (_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.realtimeCaptureInterval;
31123
31734
  if (this.upload && this.backendToken && !pending && this.filesToUpload.length > 0) {
31124
31735
  undeliveredPackagesCount = 0;
31125
31736
  pending = true;
@@ -31179,6 +31790,15 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31179
31790
  const settings = this.cameraStream.getVideoTracks()[0].getSettings();
31180
31791
  const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
31181
31792
  if (this.options.proctoringType == "VIDEO" || this.options.proctoringType == "REALTIME" || this.options.proctoringType == "IMAGE" && ((_a2 = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _a2.saveVideo)) {
31793
+ const rawBlob = new Blob(this.blobs, {
31794
+ type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
31795
+ });
31796
+ const fixedBlob = await (0, import_fix_webm_duration.default)(rawBlob, this.duration);
31797
+ const file = new File(
31798
+ [fixedBlob],
31799
+ `EP_${session.id}_camera_0.webm`,
31800
+ { type: rawBlob.type }
31801
+ );
31182
31802
  session.addRecording({
31183
31803
  device: `Audio
31184
31804
  Sample Rate: ${settingsAudio.sampleRate}
@@ -31186,9 +31806,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31186
31806
 
31187
31807
  Video:
31188
31808
  ${JSON.stringify(this.recorderOptions)}`,
31189
- file: new File(this.blobs, `EP_${session.id}_camera_0.webm`, {
31190
- type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
31191
- }),
31809
+ file,
31192
31810
  origin: "Camera" /* Camera */
31193
31811
  });
31194
31812
  }
@@ -32307,6 +32925,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
32307
32925
  return this.deviceCheckResult;
32308
32926
  }
32309
32927
  async runCheckDevicesFlow(options, _videoOptions, onModalConfirm, onModalCancel, onUpdate) {
32928
+ var _a2;
32310
32929
  if (_DeviceCheckerService.isModalOpen) {
32311
32930
  return Promise.reject("Modal j\xE1 est\xE1 aberto");
32312
32931
  }
@@ -32324,7 +32943,9 @@ var _DeviceCheckerService = class _DeviceCheckerService {
32324
32943
  options,
32325
32944
  _videoOptions
32326
32945
  );
32327
- this.checkSpyScan();
32946
+ if ((_a2 = this.options) == null ? void 0 : _a2.useSpyScan) {
32947
+ await this.checkSpyScan();
32948
+ }
32328
32949
  const returnData = { cameraStream: this.cameraRecorder.cameraStream };
32329
32950
  this.onUpdateCb = (e3) => onUpdate(e3);
32330
32951
  const resultPromise = new Promise(
@@ -32379,6 +33000,10 @@ var _DeviceCheckerService = class _DeviceCheckerService {
32379
33000
  if (_DeviceCheckerService.isModalOpen) {
32380
33001
  return Promise.reject();
32381
33002
  }
33003
+ this.allowedAmbient = false;
33004
+ this.allowedMicrophone = false;
33005
+ this.allowedAmbient = false;
33006
+ this.allowedPositionFace = false;
32382
33007
  _DeviceCheckerService.isModalOpen = true;
32383
33008
  this.DeviceCheckerUI = new DeviceCheckerUI(options, _videoOptions);
32384
33009
  try {
@@ -32416,8 +33041,8 @@ var _DeviceCheckerService = class _DeviceCheckerService {
32416
33041
  resolve(response);
32417
33042
  });
32418
33043
  } catch (error) {
33044
+ this.DeviceCheckerUI && this.DeviceCheckerUI.closeModal();
32419
33045
  this.closeCheckDevices();
32420
- this.DeviceCheckerUI.closeModal();
32421
33046
  return Promise.reject(error);
32422
33047
  }
32423
33048
  }
@@ -32488,7 +33113,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
32488
33113
  }
32489
33114
  async changeSelectedDevice({ cameraId, microphoneId }) {
32490
33115
  var _a2;
32491
- this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
33116
+ this.cameraRecorder.stopStream && await this.cameraRecorder.stopStream();
32492
33117
  (_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
32493
33118
  this.faceDetection.stopDetection();
32494
33119
  this.cameraRecorder = new CameraRecorder(
@@ -32504,7 +33129,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
32504
33129
  height: this.videoOptions.height
32505
33130
  }
32506
33131
  );
32507
- await this.cameraRecorder.startRecording();
33132
+ await this.cameraRecorder.startStream();
32508
33133
  this.videoDeviceInterface(this.cameraRecorder.cameraStream);
32509
33134
  this.audioDeviceInterface(this.cameraRecorder.cameraStream);
32510
33135
  return {
@@ -32512,6 +33137,10 @@ var _DeviceCheckerService = class _DeviceCheckerService {
32512
33137
  };
32513
33138
  }
32514
33139
  async startCheckDevices(options = getDefaultProctoringOptions, _videoOptions) {
33140
+ this.allowedAmbient = false;
33141
+ this.allowedMicrophone = false;
33142
+ this.allowedAmbient = false;
33143
+ this.allowedPositionFace = false;
32515
33144
  this.DeviceCheckerUI && this.DeviceCheckerUI.setSelectOption(
32516
33145
  options,
32517
33146
  (e3) => this.changeSelectedDevice(e3)
@@ -32531,7 +33160,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
32531
33160
  height: this.videoOptions.height
32532
33161
  }
32533
33162
  );
32534
- await this.cameraRecorder.startRecording();
33163
+ await this.cameraRecorder.startStream();
32535
33164
  this.videoDeviceInterface(this.cameraRecorder.cameraStream);
32536
33165
  this.audioDeviceInterface(this.cameraRecorder.cameraStream);
32537
33166
  if (this.DeviceCheckerUI) {
@@ -32548,7 +33177,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
32548
33177
  this.faceDetection.stopDetection();
32549
33178
  (_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
32550
33179
  this.volumeMedia = Math.ceil(this.volumeSum / this.volumeCounter);
32551
- this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
33180
+ this.cameraRecorder.stopStream && await this.cameraRecorder.stopStream();
32552
33181
  this.DeviceCheckerUI = void 0;
32553
33182
  this.onUpdateCb = void 0;
32554
33183
  }
@@ -32621,7 +33250,7 @@ var CapturePhoto = class {
32621
33250
  // height: 480,
32622
33251
  // }
32623
33252
  );
32624
- await this.cameraRecorder.startRecording();
33253
+ await this.cameraRecorder.startStream();
32625
33254
  cameraContainer.srcObject = this.cameraRecorder.cameraStream;
32626
33255
  cameraContainer.play();
32627
33256
  }
@@ -32861,7 +33490,7 @@ var CapturePhoto = class {
32861
33490
  });
32862
33491
  }
32863
33492
  async closeInterface() {
32864
- await this.cameraRecorder.stopRecording();
33493
+ await this.cameraRecorder.stopStream();
32865
33494
  const authPhoto = document.querySelector("#authPhoto");
32866
33495
  authPhoto == null ? void 0 : authPhoto.remove();
32867
33496
  }
@@ -33144,6 +33773,22 @@ var ProctoringUploader = class {
33144
33773
  }
33145
33774
  },
33146
33775
  token
33776
+ ).catch(
33777
+ async (e3) => {
33778
+ console.log("Upload File Error", e3), trackers.registerError(this.proctoringId, `Upload File
33779
+ Name: ${rec.file.name}
33780
+ Error: ${e3.message}
33781
+ Size: ${e3.error}`);
33782
+ await uploadService.upload(
33783
+ {
33784
+ file: rec.file,
33785
+ onProgress: (progress) => {
33786
+ if (onProgress) onProgress(progress);
33787
+ }
33788
+ },
33789
+ token
33790
+ );
33791
+ }
33147
33792
  );
33148
33793
  if (result) {
33149
33794
  let fileType = "";
@@ -33365,54 +34010,6 @@ var AlertRecorder = class {
33365
34010
  }
33366
34011
  };
33367
34012
 
33368
- // src/new-flow/recorders/AudioRecorder.ts
33369
- var AudioRecorder = class {
33370
- constructor(options, audioParams) {
33371
- this.blobs = [];
33372
- this.options = {
33373
- cameraId: void 0,
33374
- microphoneId: void 0
33375
- };
33376
- this.audioParams = {
33377
- recordingBitrate: 128
33378
- };
33379
- audioParams && (this.audioParams = audioParams);
33380
- options && (this.options = options);
33381
- }
33382
- async startRecording() {
33383
- const constraints = {
33384
- audio: { deviceId: this.options.microphoneId || "default" }
33385
- };
33386
- this.audioStream = await navigator.mediaDevices.getUserMedia(constraints);
33387
- const { startRecording, stopRecording, pauseRecording, resumeRecording } = recorder(this.audioStream, this.blobs, void 0, void 0, true);
33388
- this.recordingStart = startRecording;
33389
- this.recordingStop = stopRecording;
33390
- this.recordingPause = pauseRecording;
33391
- this.recordingResume = resumeRecording;
33392
- this.recordingStart();
33393
- }
33394
- async pauseRecording() {
33395
- }
33396
- async resumeRecording() {
33397
- }
33398
- async stopRecording() {
33399
- this.recordingStop && await this.recordingStop();
33400
- }
33401
- async saveOnSession(session, start, end) {
33402
- session.addRecording({
33403
- device: "",
33404
- file: new File(
33405
- this.blobs,
33406
- `EP_${session.id}_audio_${start && end && `${start}_${end}` || "0"}.webm`,
33407
- {
33408
- type: "audio/webm"
33409
- }
33410
- ),
33411
- origin: "Mic" /* Mic */
33412
- });
33413
- }
33414
- };
33415
-
33416
34013
  // node_modules/@mediapipe/tasks-audio/audio_bundle.mjs
33417
34014
  var t2 = "undefined" != typeof self ? self : {};
33418
34015
  function e2() {
@@ -35652,7 +36249,6 @@ var NoiseRecorder = class {
35652
36249
  this.recordingInProgress = false;
35653
36250
  this.recordIndex = 1;
35654
36251
  this.countLoopTimes = 0;
35655
- this.examStartTime = 0;
35656
36252
  this.recordingStartTime = 0;
35657
36253
  this.recordingEndTime = 0;
35658
36254
  this.isSpeech = false;
@@ -35679,12 +36275,7 @@ var NoiseRecorder = class {
35679
36275
  this.proctoringId && this.backend && (this.upload = new UploadService(this.proctoringId, this.backend));
35680
36276
  }
35681
36277
  async startRecording() {
35682
- this.examStartTime = Date.now();
35683
36278
  await this.createAudioClassifier();
35684
- this.audioRecorder = new AudioRecorder(
35685
- void 0,
35686
- this.paramsConfig.audioBehaviourParameters
35687
- );
35688
36279
  this.intervalNoiseDetection = setInterval(
35689
36280
  () => this.onNoiseDetectedRecord(),
35690
36281
  200
@@ -35696,6 +36287,7 @@ var NoiseRecorder = class {
35696
36287
  await this.stopSoundRecord();
35697
36288
  await this.volumeMeter && this.volumeMeter.stop();
35698
36289
  this.audioWorkletNode && this.audioWorkletNode.disconnect();
36290
+ this.context && this.context.close();
35699
36291
  }
35700
36292
  async pauseRecording() {
35701
36293
  }
@@ -35704,7 +36296,7 @@ var NoiseRecorder = class {
35704
36296
  async saveOnSession(session) {
35705
36297
  }
35706
36298
  async onNoiseDetectedRecord() {
35707
- var _a2, _b, _c2, _d;
36299
+ var _a2, _b, _c2, _d, _e3, _f, _g, _h, _i3;
35708
36300
  if (!this.volumeMeter && this.cameraRecorder.cameraStream) {
35709
36301
  this.volumeMeter = new VolumeMeter(this.cameraRecorder.cameraStream);
35710
36302
  this.volumeMeter.start().catch((e3) => {
@@ -35726,7 +36318,7 @@ var NoiseRecorder = class {
35726
36318
  this.recordingChunks = [...this.preRollBuffer];
35727
36319
  const totalSamplesInBuffer = this.preRollBuffer.reduce((acc, chunk) => acc + chunk.length, 0);
35728
36320
  const bufferDurationMs = totalSamplesInBuffer / this.SAMPLE_RATE * 1e3;
35729
- const triggerTime = Date.now() - this.examStartTime;
36321
+ const triggerTime = Date.now() - (((_c2 = this.cameraRecorder.getStartTime()) == null ? void 0 : _c2.getTime()) || 0);
35730
36322
  this.recordingStartTime = triggerTime - bufferDurationMs;
35731
36323
  if (this.recordingStartTime < 0) this.recordingStartTime = 0;
35732
36324
  } else if (this.recordingInProgress) {
@@ -35734,15 +36326,19 @@ var NoiseRecorder = class {
35734
36326
  const currentRecordDuration = Date.now() - this.recordingStartTime;
35735
36327
  if (silenceDuration >= this.SILENCE_THRESHOLD && currentRecordDuration >= 3e3 && this.countLoopTimes > 4) {
35736
36328
  await this.stopSoundRecord();
35737
- if (((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectNoise) && !this.isSpeech) {
36329
+ if (((_d = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _d.detectNoise) && !this.isSpeech) {
35738
36330
  this.onRealtimeAlertsCallback({
36331
+ begin: Date.now() - (((_e3 = this.cameraRecorder.getStartTime()) == null ? void 0 : _e3.getTime()) || 0),
36332
+ end: Date.now() - (((_f = this.cameraRecorder.getStartTime()) == null ? void 0 : _f.getTime()) || 0),
35739
36333
  status: "ALERT",
35740
36334
  description: "Barulho detectado",
35741
36335
  type: "audio_detection_on_stream"
35742
36336
  });
35743
36337
  }
35744
- if (((_d = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _d.detectSpeech) && this.isSpeech) {
36338
+ if (((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectSpeech) && this.isSpeech) {
35745
36339
  this.onRealtimeAlertsCallback({
36340
+ begin: Date.now() - (((_h = this.cameraRecorder.getStartTime()) == null ? void 0 : _h.getTime()) || 0),
36341
+ end: Date.now() - (((_i3 = this.cameraRecorder.getStartTime()) == null ? void 0 : _i3.getTime()) || 0),
35746
36342
  status: "ALERT",
35747
36343
  description: "Fala detectada",
35748
36344
  type: "audio_detection_on_stream"
@@ -35757,8 +36353,9 @@ var NoiseRecorder = class {
35757
36353
  }
35758
36354
  }
35759
36355
  async stopSoundRecord() {
36356
+ var _a2;
35760
36357
  if (!this.recordingInProgress && this.recordingChunks.length === 0) return;
35761
- this.recordingEndTime = Date.now() - this.examStartTime;
36358
+ this.recordingEndTime = Date.now() - (((_a2 = this.cameraRecorder.getStartTime()) == null ? void 0 : _a2.getTime()) || 0);
35762
36359
  if (this.optionsProctoring.proctoringType !== "REALTIME") return;
35763
36360
  const wavBlob = encodeToWav(this.recordingChunks, this.SAMPLE_RATE);
35764
36361
  const file = new File(
@@ -35900,10 +36497,12 @@ registerProcessor("audio-processor", AudioProcessor);
35900
36497
  `;
35901
36498
 
35902
36499
  // src/new-flow/recorders/ScreenRecorder.ts
36500
+ var import_fix_webm_duration2 = __toESM(require_fix_webm_duration());
35903
36501
  var ScreenRecorder = class {
35904
36502
  constructor(options) {
35905
36503
  this.blobs = [];
35906
36504
  this.blobsFinal = [];
36505
+ this.duration = 0;
35907
36506
  this.options = options;
35908
36507
  }
35909
36508
  setProctoringId(proctoringId2) {
@@ -35985,14 +36584,24 @@ var ScreenRecorder = class {
35985
36584
  async resumeRecording() {
35986
36585
  }
35987
36586
  async stopRecording() {
36587
+ var _a2;
35988
36588
  this.recordingStop && await this.recordingStop();
36589
+ this.duration = Date.now() - ((_a2 = this.startTime) == null ? void 0 : _a2.getTime()) || 0;
35989
36590
  }
35990
36591
  async saveOnSession(session) {
36592
+ if (isMobileDevice()) return;
36593
+ const rawBlob = new Blob(this.blobs, {
36594
+ type: "video/webm"
36595
+ });
36596
+ const fixedBlob = await (0, import_fix_webm_duration2.default)(rawBlob, this.duration);
36597
+ const file = new File(
36598
+ [fixedBlob],
36599
+ `EP_${session.id}_screen_0.webm`,
36600
+ { type: rawBlob.type }
36601
+ );
35991
36602
  session.addRecording({
35992
36603
  device: "",
35993
- file: new File(this.blobs, `EP_${session.id}_screen_0.webm`, {
35994
- type: "video/webm"
35995
- }),
36604
+ file,
35996
36605
  origin: "Screen" /* Screen */
35997
36606
  });
35998
36607
  }
@@ -36197,7 +36806,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
36197
36806
  this.connection = null;
36198
36807
  this.context = context;
36199
36808
  this.onRealtimeAlertsCallback = onRealtimeAlertsCallback;
36200
- console.log("context -> ", context);
36201
36809
  this.backend = new BackendService({
36202
36810
  type: (context == null ? void 0 : context.type) || "prod",
36203
36811
  token: context.token
@@ -36211,7 +36819,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
36211
36819
  try {
36212
36820
  this.transmissionOk = false;
36213
36821
  const response = await this.backend.externalCameraCheckTransmission("" + this.externalSessionId);
36214
- console.log(response);
36215
36822
  let attempts = 0;
36216
36823
  while (!this.transmissionOk && attempts <= 5) {
36217
36824
  await new Promise((resolve) => setTimeout(resolve, 2e3));
@@ -36228,16 +36835,13 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
36228
36835
  try {
36229
36836
  this.proctoringId = proctoringId2;
36230
36837
  const response = await this.backend.externalCameraStartTransmission("" + this.externalSessionId, proctoringId2);
36231
- console.log(response);
36232
36838
  } catch (error) {
36233
- console.error("Erro ao iniciar transmiss\xE3o:", error);
36234
36839
  throw new Error("N\xE3o foi poss\xEDvel iniciar a transmiss\xE3o.");
36235
36840
  }
36236
36841
  }
36237
36842
  async goToPositionGuide() {
36238
36843
  try {
36239
36844
  const response = await this.backend.goToExternalCameraPositionStep("" + this.externalSessionId);
36240
- console.log(response);
36241
36845
  } catch (error) {
36242
36846
  console.error("Erro ao enviar comando de Position:", error);
36243
36847
  throw new Error("N\xE3o foi poss\xEDvel enviar comando de Position Guide.");
@@ -36247,7 +36851,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
36247
36851
  if (this.connection) {
36248
36852
  const actionMessage = new ActionMessage();
36249
36853
  actionMessage.command = "Reset";
36250
- console.log("Enviando comando 'Reset' para o aplicativo...");
36251
36854
  this.connection.invoke(
36252
36855
  "SendAction",
36253
36856
  this.externalSessionId,
@@ -36261,7 +36864,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
36261
36864
  this.onTakePictureCallback = onTakePictureCallback;
36262
36865
  const actionMessage = new ActionMessage();
36263
36866
  actionMessage.command = "Capture";
36264
- console.log("Enviando comando 'Capture' para o aplicativo...");
36265
36867
  this.connection.invoke(
36266
36868
  "SendAction",
36267
36869
  this.externalSessionId,
@@ -36280,7 +36882,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
36280
36882
  await this.reset();
36281
36883
  const response = await this.backend.externalCameraStartSession();
36282
36884
  this.externalSessionId = response.externalSessionId;
36283
- console.log(this.externalSessionId);
36284
36885
  this.currentStep = 0 /* STARTED */;
36285
36886
  const pairingObject = {
36286
36887
  externalSessionId: this.externalSessionId,
@@ -36289,7 +36890,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
36289
36890
  };
36290
36891
  const pairingDataString = JSON.stringify(pairingObject);
36291
36892
  this.qrCodeBase64Image = await import_qrcode.default.toDataURL(pairingDataString);
36292
- console.log(this.qrCodeBase64Image);
36293
36893
  return this.qrCodeBase64Image;
36294
36894
  } catch (error) {
36295
36895
  this.disconnectWebSocket();
@@ -36388,7 +36988,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
36388
36988
  var _a2;
36389
36989
  const actionMessage = new ActionMessage();
36390
36990
  actionMessage.command = "Cancel";
36391
- console.log("Enviando comando 'Cancel' para o aplicativo...");
36392
36991
  (_a2 = this.connection) == null ? void 0 : _a2.invoke(
36393
36992
  "SendAction",
36394
36993
  this.externalSessionId,
@@ -36728,8 +37327,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
36728
37327
  this.connection.on(
36729
37328
  "ReceiveMessage",
36730
37329
  (sessionId, messageStr) => {
36731
- console.log("sessionId: ", sessionId);
36732
- console.log("Message: ", messageStr);
36733
37330
  if (sessionId !== this.externalSessionId) {
36734
37331
  console.warn("Sess\xE3o diferente!");
36735
37332
  return;
@@ -36737,7 +37334,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
36737
37334
  try {
36738
37335
  const messageKey = messageStr;
36739
37336
  const message = ExternalCameraStatusEnum[messageKey];
36740
- console.log("Mensagem -> ", message);
36741
37337
  this.handleWebSocketMessage(message);
36742
37338
  } catch (e3) {
36743
37339
  console.error("Erro ao processar mensagem do WebSocket:", e3);
@@ -36747,8 +37343,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
36747
37343
  this.connection.on(
36748
37344
  "ReceiveAction",
36749
37345
  (sessionId, actionMessage) => {
36750
- console.log("sessionId: ", sessionId);
36751
- console.log("Message: ", actionMessage);
36752
37346
  if (sessionId !== this.externalSessionId) {
36753
37347
  console.warn("Sess\xE3o diferente!");
36754
37348
  return;
@@ -36762,7 +37356,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
36762
37356
  );
36763
37357
  try {
36764
37358
  await this.connection.start();
36765
- console.log("Conectado ao Hub SignalR com sucesso!");
36766
37359
  } catch (err) {
36767
37360
  console.error("Falha ao conectar ou entrar no grupo do SignalR: ", err);
36768
37361
  throw new Error("N\xE3o foi poss\xEDvel conectar ao servi\xE7o em tempo real.");
@@ -36889,7 +37482,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
36889
37482
  if (this.connection) {
36890
37483
  try {
36891
37484
  await this.connection.stop();
36892
- console.log("Desconectado do SignalR.");
36893
37485
  } catch (err) {
36894
37486
  console.error("Erro ao desconectar do SignalR:", err);
36895
37487
  } finally {
@@ -36960,7 +37552,8 @@ var Proctoring = class {
36960
37552
  this.onChangeDevicesCallback = (devices) => {
36961
37553
  return;
36962
37554
  };
36963
- this.onRealtimeAlertsCallback = (response) => {
37555
+ this.onRealtimeAlertsCallback = async (response) => {
37556
+ await this.internalOnRealtimeAlerts(response);
36964
37557
  return;
36965
37558
  };
36966
37559
  this.onBufferSizeErrorCallback = (cameraStream) => {
@@ -37087,10 +37680,9 @@ var Proctoring = class {
37087
37680
  begin: alert.begin,
37088
37681
  end: alert.end,
37089
37682
  warningCategoryEnum: this.convertRealtimeTypeToWarningType(alert.type),
37090
- alertImageBase64: await this.allRecorders.cameraRecorder.getCurrentImageBase64(),
37683
+ alertImageBase64: alert.description !== "face_stop" ? await this.allRecorders.cameraRecorder.getCurrentImageBase64() : "",
37091
37684
  retry: verifyCount < verifyMaxRetries - 1 ? true : false
37092
37685
  });
37093
- console.log("response stopRealtimeAlert", response);
37094
37686
  return response;
37095
37687
  } catch (error) {
37096
37688
  console.log("error stopRealtimeAlert", error);
@@ -37099,23 +37691,26 @@ var Proctoring = class {
37099
37691
  };
37100
37692
  await verifyFace(1);
37101
37693
  }
37694
+ async internalOnRealtimeAlerts(response) {
37695
+ if (this.sessionOptions.proctoringType === "REALTIME" && (response.type === "face_detection_on_stream" || response.type === "person_detection_on_stream" || response.type === "lost_focus" || response.type === "focus")) {
37696
+ if (response.status === "ALERT") {
37697
+ await this.backend.startRealtimeAlert({
37698
+ proctoringId: this.proctoringId,
37699
+ begin: response.begin,
37700
+ end: response.end,
37701
+ alert: this.convertRealtimeCategoryToAlertCategory(response.category)
37702
+ });
37703
+ } else if (response.status === "OK") {
37704
+ await this.stopRealtimeAlert(response);
37705
+ }
37706
+ }
37707
+ }
37102
37708
  async onRealtimeAlerts(options = {}) {
37103
37709
  this.setOnLostFocusAlertRecorderCallback();
37104
37710
  this.setOnFocusAlertRecorderCallback();
37105
37711
  this.onRealtimeAlertsCallback = async (response) => {
37712
+ await this.internalOnRealtimeAlerts(response);
37106
37713
  options.data && options.data(response);
37107
- if (this.sessionOptions.proctoringType === "REALTIME" && (response.type === "face_detection_on_stream" || response.type === "person_detection_on_stream" || response.type === "lost_focus" || response.type === "focus")) {
37108
- if (response.status === "ALERT") {
37109
- await this.backend.startRealtimeAlert({
37110
- proctoringId: this.proctoringId,
37111
- begin: response.begin,
37112
- end: response.end,
37113
- alert: this.convertRealtimeCategoryToAlertCategory(response.category)
37114
- });
37115
- } else if (response.status === "OK") {
37116
- await this.stopRealtimeAlert(response);
37117
- }
37118
- }
37119
37714
  };
37120
37715
  }
37121
37716
  setOnBufferSizeErrorCallback(cb) {
@@ -37129,9 +37724,11 @@ var Proctoring = class {
37129
37724
  setDeviceCheckData(data) {
37130
37725
  this.deviceData = data;
37131
37726
  }
37132
- createRecorders(options = getDefaultProctoringOptions) {
37133
- var _a2, _b;
37727
+ async createRecorders(options = getDefaultProctoringOptions) {
37728
+ var _a2, _b, _c2;
37134
37729
  this.onChangeDevices();
37730
+ console.log("Creating recorders");
37731
+ await ((_a2 = this.recorder) == null ? void 0 : _a2.stopAll());
37135
37732
  const cameraRecorder = new CameraRecorder(
37136
37733
  {
37137
37734
  cameraId: this.sessionOptions.cameraId,
@@ -37153,8 +37750,8 @@ var Proctoring = class {
37153
37750
  this.context.token
37154
37751
  );
37155
37752
  const screenRecorder = this.sessionOptions.captureScreen ? new ScreenRecorder({
37156
- allowOnlyFirstMonitor: (_a2 = this.sessionOptions.allowOnlyFirstMonitor) != null ? _a2 : true,
37157
- allowMultipleMonitors: (_b = this.sessionOptions.allowMultipleMonitors) != null ? _b : true,
37753
+ allowOnlyFirstMonitor: (_b = this.sessionOptions.allowOnlyFirstMonitor) != null ? _b : true,
37754
+ allowMultipleMonitors: (_c2 = this.sessionOptions.allowMultipleMonitors) != null ? _c2 : true,
37158
37755
  screenRecorderOptions: this.sessionOptions.screenRecorderOptions,
37159
37756
  onStopSharingScreenCallback: () => this.onStopSharingScreenCallback(),
37160
37757
  onBufferSizeError: this.sessionOptions.onBufferSizeError,
@@ -37179,10 +37776,12 @@ var Proctoring = class {
37179
37776
  );
37180
37777
  const recorders = [
37181
37778
  cameraRecorder,
37182
- screenRecorder,
37779
+ noiseRecorder,
37183
37780
  alertRecorder
37184
37781
  ].filter(Boolean);
37185
- recorders.push(noiseRecorder);
37782
+ if (this.sessionOptions.proctoringType != "REALTIME" && screenRecorder) {
37783
+ recorders.push(screenRecorder);
37784
+ }
37186
37785
  this.recorder = new ProctoringRecorder(this.proctoringSession, recorders);
37187
37786
  return { cameraRecorder, screenRecorder, alertRecorder, noiseRecorder };
37188
37787
  }
@@ -37222,7 +37821,7 @@ var Proctoring = class {
37222
37821
  await this.repository.clear();
37223
37822
  }
37224
37823
  this.proctoringSession = new ProctoringSession();
37225
- this.allRecorders = this.createRecorders(this.sessionOptions);
37824
+ this.allRecorders = await this.createRecorders(this.sessionOptions);
37226
37825
  const startResponse = await this.backend.confirmStart(
37227
37826
  {
37228
37827
  clientId: this.context.clientId,
@@ -37249,7 +37848,13 @@ var Proctoring = class {
37249
37848
  this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
37250
37849
  this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
37251
37850
  this.proctoringSession.setProctoringId(this.proctoringId);
37252
- await this.recorder.startAll();
37851
+ try {
37852
+ console.log("Starting recorders");
37853
+ await this.recorder.startAll();
37854
+ } catch (error) {
37855
+ console.log("Starting recorders error:", error);
37856
+ throw error;
37857
+ }
37253
37858
  if (options == null ? void 0 : options.useSpyScan) {
37254
37859
  this.spyCam.setProctoringId(this.proctoringId);
37255
37860
  this.spyCam.startCheckSpyCam((_a2 = this.paramsConfig.spyScanInterval) != null ? _a2 : 5, {
@@ -37280,7 +37885,7 @@ Navigator: ${JSON.stringify(_navigator2)}`
37280
37885
  verifyingFace = true;
37281
37886
  verifyFirstFaceIntervalCount++;
37282
37887
  try {
37283
- var response = await this.backend.verifyFace(this.proctoringId, await this.allRecorders.cameraRecorder.getCurrentImageBase64(), verifyFirstFaceIntervalCount > 5 ? false : true);
37888
+ var response = await this.backend.verifyFace(this.proctoringId, await this.allRecorders.cameraRecorder.getCurrentImageBase64(), verifyFirstFaceIntervalCount > 2 ? false : true);
37284
37889
  verifyingFace = false;
37285
37890
  clearInterval(this.verifyFirstFaceInterval);
37286
37891
  } catch (error) {
@@ -37288,7 +37893,7 @@ Navigator: ${JSON.stringify(_navigator2)}`
37288
37893
  return;
37289
37894
  }
37290
37895
  }
37291
- }, 1500);
37896
+ }, 5e3);
37292
37897
  return startResponse;
37293
37898
  } catch (error) {
37294
37899
  console.log(error);
@@ -37410,7 +38015,6 @@ Upload Services: ${uploaderServices}`,
37410
38015
  await this.backend.finishAndSendUrls(this.context).then((finishResponse) => {
37411
38016
  var _a2, _b, _c2, _d;
37412
38017
  trackers.registerFinish(this.proctoringSession.id, true, "");
37413
- console.log("finishResponse: ", finishResponse);
37414
38018
  options.onResultAvailable && options.onResultAvailable((_a2 = finishResponse == null ? void 0 : finishResponse.score) != null ? _a2 : 100, (_b = finishResponse == null ? void 0 : finishResponse.scoreThreshold) != null ? _b : 70, (_c2 = finishResponse == null ? void 0 : finishResponse.approved) != null ? _c2 : true, (_d = finishResponse == null ? void 0 : finishResponse.justification) != null ? _d : "");
37415
38019
  }).catch((error) => {
37416
38020
  trackers.registerFinish(
@@ -37539,7 +38143,6 @@ Error: ` + error
37539
38143
  return {
37540
38144
  cameraStream: this.allRecorders.cameraRecorder.cameraStream,
37541
38145
  // recorder (pause & resume)
37542
- // audioStream: this.allRecorders.audioRecorder.audioStream,
37543
38146
  _screenStream: (_a2 = this.allRecorders.screenRecorder) == null ? void 0 : _a2.screenStream
37544
38147
  };
37545
38148
  }