easyproctor 2.5.6 → 2.5.8

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;
@@ -25995,6 +26484,7 @@ var BaseDetection = class {
25995
26484
  }
25996
26485
  `;
25997
26486
  document.getElementsByTagName("head")[0].appendChild(style);
26487
+ console.log("BaseDetection enableCam OK");
25998
26488
  }
25999
26489
  async predictWebcam() {
26000
26490
  if (this.lastVideoTime === -1) {
@@ -26123,11 +26613,13 @@ var FaceDetection = class extends BaseDetection {
26123
26613
  );
26124
26614
  this.emmitedPositionAlert = false;
26125
26615
  this.emmitedFaceAlert = false;
26616
+ console.log("FaceDetection constructor");
26617
+ this.numFacesSent = -1;
26126
26618
  }
26127
26619
  stopDetection() {
26128
26620
  super.stopDetection();
26129
26621
  if (this.emmitedFaceAlert) {
26130
- this.handleOk("face_ok", "face_detection_on_stream");
26622
+ this.handleOk("face_stop", "face_detection_on_stream");
26131
26623
  }
26132
26624
  }
26133
26625
  // displayVideoDetections(result: { detections: any; }) {
@@ -30355,6 +30847,7 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30355
30847
  buffer.push(e3.data);
30356
30848
  }
30357
30849
  if (stopped) {
30850
+ console.log("buildMediaRecorder ondataavailable stopped");
30358
30851
  resolvePromise && resolvePromise();
30359
30852
  }
30360
30853
  };
@@ -30424,6 +30917,9 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30424
30917
  if (mediaRecorder.state == "recording") {
30425
30918
  console.log("stopRecording Recorder est\xE1 em estado recording, iniciando stop");
30426
30919
  resolvePromise = resolve;
30920
+ mediaRecorder.onstop = () => {
30921
+ console.log("recorder onstop");
30922
+ };
30427
30923
  stopped = true;
30428
30924
  mediaRecorder.stop();
30429
30925
  } else {
@@ -30839,6 +31335,7 @@ var VolumeMeter = class {
30839
31335
 
30840
31336
  // src/new-flow/recorders/CameraRecorder.ts
30841
31337
  var import_jszip_min = __toESM(require_jszip_min());
31338
+ var import_fix_webm_duration = __toESM(require_fix_webm_duration());
30842
31339
  var CameraRecorder = class {
30843
31340
  constructor(options, videoOptions, paramsConfig, backend, backendToken) {
30844
31341
  this.blobs = [];
@@ -30889,6 +31386,7 @@ var CameraRecorder = class {
30889
31386
  this.hardwareStream = null;
30890
31387
  this.internalClonedStream = null;
30891
31388
  this.videoElement = null;
31389
+ this.duration = 0;
30892
31390
  this.currentRetries = 0;
30893
31391
  this.packageCount = 0;
30894
31392
  this.noiseWait = 20;
@@ -31113,10 +31611,17 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31113
31611
  console.log("Camera Recorder started OK");
31114
31612
  }
31115
31613
  async stopRecording() {
31116
- var _a2, _b, _c2;
31614
+ var _a2, _b, _c2, _d;
31117
31615
  console.log("Camera Recorder stopRecording");
31118
31616
  this.isCanvasLoopActive = false;
31617
+ this.faceDetection && this.faceDetection.detecting && this.faceDetection.stopDetection();
31618
+ this.objectDetection && this.objectDetection.detecting && this.objectDetection.stopDetection();
31619
+ clearInterval(this.imageInterval);
31620
+ clearInterval(this.sendFrameInterval);
31621
+ this.volumeMeter && this.volumeMeter.stop();
31622
+ this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
31119
31623
  this.recordingStop && await this.recordingStop();
31624
+ this.duration = Date.now() - ((_a2 = this.getStartTime()) == null ? void 0 : _a2.getTime()) || 0;
31120
31625
  try {
31121
31626
  if (this.animationFrameId) {
31122
31627
  cancelAnimationFrame(this.animationFrameId);
@@ -31134,28 +31639,22 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31134
31639
  this.hardwareStream = null;
31135
31640
  }
31136
31641
  if (this.videoElement) {
31137
- (_a2 = this.videoElement) == null ? void 0 : _a2.remove();
31642
+ (_b = this.videoElement) == null ? void 0 : _b.remove();
31138
31643
  this.videoElement = null;
31139
31644
  }
31140
31645
  if (this.video) {
31141
- (_b = this.video) == null ? void 0 : _b.remove();
31646
+ (_c2 = this.video) == null ? void 0 : _c2.remove();
31142
31647
  }
31143
31648
  if (this.canvas) {
31144
- (_c2 = this.canvas) == null ? void 0 : _c2.remove();
31649
+ (_d = this.canvas) == null ? void 0 : _d.remove();
31145
31650
  }
31146
31651
  } catch {
31147
31652
  console.error("Erro ao parar os streams de m\xEDdia.");
31148
31653
  }
31149
- this.faceDetection && this.faceDetection.detecting && this.faceDetection.stopDetection();
31150
- this.objectDetection && this.objectDetection.detecting && this.objectDetection.stopDetection();
31151
- clearInterval(this.imageInterval);
31152
- clearInterval(this.sendFrameInterval);
31153
31654
  if (this.options.proctoringType == "REALTIME" && this.upload && this.backendToken) {
31154
31655
  await this.sendPackage(this.filesToUpload);
31155
31656
  await this.filesToUpload.splice(0, this.filesToUpload.length);
31156
31657
  }
31157
- this.volumeMeter && this.volumeMeter.stop();
31158
- this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
31159
31658
  }
31160
31659
  async pauseRecording() {
31161
31660
  await this.recordingPause();
@@ -31289,6 +31788,15 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31289
31788
  const settings = this.cameraStream.getVideoTracks()[0].getSettings();
31290
31789
  const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
31291
31790
  if (this.options.proctoringType == "VIDEO" || this.options.proctoringType == "REALTIME" || this.options.proctoringType == "IMAGE" && ((_a2 = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _a2.saveVideo)) {
31791
+ const rawBlob = new Blob(this.blobs, {
31792
+ type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
31793
+ });
31794
+ const fixedBlob = await (0, import_fix_webm_duration.default)(rawBlob, this.duration);
31795
+ const file = new File(
31796
+ [rawBlob],
31797
+ `EP_${session.id}_camera_0.webm`,
31798
+ { type: rawBlob.type }
31799
+ );
31292
31800
  session.addRecording({
31293
31801
  device: `Audio
31294
31802
  Sample Rate: ${settingsAudio.sampleRate}
@@ -31296,9 +31804,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31296
31804
 
31297
31805
  Video:
31298
31806
  ${JSON.stringify(this.recorderOptions)}`,
31299
- file: new File(this.blobs, `EP_${session.id}_camera_0.webm`, {
31300
- type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
31301
- }),
31807
+ file,
31302
31808
  origin: "Camera" /* Camera */
31303
31809
  });
31304
31810
  }
@@ -33265,6 +33771,22 @@ var ProctoringUploader = class {
33265
33771
  }
33266
33772
  },
33267
33773
  token
33774
+ ).catch(
33775
+ async (e3) => {
33776
+ console.log("Upload File Error", e3), trackers.registerError(this.proctoringId, `Upload File
33777
+ Name: ${rec.file.name}
33778
+ Error: ${e3.message}
33779
+ Size: ${e3.error}`);
33780
+ await uploadService.upload(
33781
+ {
33782
+ file: rec.file,
33783
+ onProgress: (progress) => {
33784
+ if (onProgress) onProgress(progress);
33785
+ }
33786
+ },
33787
+ token
33788
+ );
33789
+ }
33268
33790
  );
33269
33791
  if (result) {
33270
33792
  let fileType = "";
@@ -35973,10 +36495,12 @@ registerProcessor("audio-processor", AudioProcessor);
35973
36495
  `;
35974
36496
 
35975
36497
  // src/new-flow/recorders/ScreenRecorder.ts
36498
+ var import_fix_webm_duration2 = __toESM(require_fix_webm_duration());
35976
36499
  var ScreenRecorder = class {
35977
36500
  constructor(options) {
35978
36501
  this.blobs = [];
35979
36502
  this.blobsFinal = [];
36503
+ this.duration = 0;
35980
36504
  this.options = options;
35981
36505
  }
35982
36506
  setProctoringId(proctoringId2) {
@@ -36058,15 +36582,24 @@ var ScreenRecorder = class {
36058
36582
  async resumeRecording() {
36059
36583
  }
36060
36584
  async stopRecording() {
36585
+ var _a2;
36061
36586
  this.recordingStop && await this.recordingStop();
36587
+ this.duration = Date.now() - ((_a2 = this.startTime) == null ? void 0 : _a2.getTime()) || 0;
36062
36588
  }
36063
36589
  async saveOnSession(session) {
36064
36590
  if (isMobileDevice()) return;
36591
+ const rawBlob = new Blob(this.blobs, {
36592
+ type: "video/webm"
36593
+ });
36594
+ const fixedBlob = await (0, import_fix_webm_duration2.default)(rawBlob, this.duration);
36595
+ const file = new File(
36596
+ [fixedBlob],
36597
+ `EP_${session.id}_screen_0.webm`,
36598
+ { type: rawBlob.type }
36599
+ );
36065
36600
  session.addRecording({
36066
36601
  device: "",
36067
- file: new File(this.blobs, `EP_${session.id}_screen_0.webm`, {
36068
- type: "video/webm"
36069
- }),
36602
+ file,
36070
36603
  origin: "Screen" /* Screen */
36071
36604
  });
36072
36605
  }
@@ -37017,7 +37550,8 @@ var Proctoring = class {
37017
37550
  this.onChangeDevicesCallback = (devices) => {
37018
37551
  return;
37019
37552
  };
37020
- this.onRealtimeAlertsCallback = (response) => {
37553
+ this.onRealtimeAlertsCallback = async (response) => {
37554
+ await this.internalOnRealtimeAlerts(response);
37021
37555
  return;
37022
37556
  };
37023
37557
  this.onBufferSizeErrorCallback = (cameraStream) => {
@@ -37144,7 +37678,7 @@ var Proctoring = class {
37144
37678
  begin: alert.begin,
37145
37679
  end: alert.end,
37146
37680
  warningCategoryEnum: this.convertRealtimeTypeToWarningType(alert.type),
37147
- alertImageBase64: await this.allRecorders.cameraRecorder.getCurrentImageBase64(),
37681
+ alertImageBase64: alert.description !== "face_stop" ? await this.allRecorders.cameraRecorder.getCurrentImageBase64() : "",
37148
37682
  retry: verifyCount < verifyMaxRetries - 1 ? true : false
37149
37683
  });
37150
37684
  return response;
@@ -37155,23 +37689,26 @@ var Proctoring = class {
37155
37689
  };
37156
37690
  await verifyFace(1);
37157
37691
  }
37692
+ async internalOnRealtimeAlerts(response) {
37693
+ if (this.sessionOptions.proctoringType === "REALTIME" && (response.type === "face_detection_on_stream" || response.type === "person_detection_on_stream" || response.type === "lost_focus" || response.type === "focus")) {
37694
+ if (response.status === "ALERT") {
37695
+ await this.backend.startRealtimeAlert({
37696
+ proctoringId: this.proctoringId,
37697
+ begin: response.begin,
37698
+ end: response.end,
37699
+ alert: this.convertRealtimeCategoryToAlertCategory(response.category)
37700
+ });
37701
+ } else if (response.status === "OK") {
37702
+ await this.stopRealtimeAlert(response);
37703
+ }
37704
+ }
37705
+ }
37158
37706
  async onRealtimeAlerts(options = {}) {
37159
37707
  this.setOnLostFocusAlertRecorderCallback();
37160
37708
  this.setOnFocusAlertRecorderCallback();
37161
37709
  this.onRealtimeAlertsCallback = async (response) => {
37710
+ await this.internalOnRealtimeAlerts(response);
37162
37711
  options.data && options.data(response);
37163
- if (this.sessionOptions.proctoringType === "REALTIME" && (response.type === "face_detection_on_stream" || response.type === "person_detection_on_stream" || response.type === "lost_focus" || response.type === "focus")) {
37164
- if (response.status === "ALERT") {
37165
- await this.backend.startRealtimeAlert({
37166
- proctoringId: this.proctoringId,
37167
- begin: response.begin,
37168
- end: response.end,
37169
- alert: this.convertRealtimeCategoryToAlertCategory(response.category)
37170
- });
37171
- } else if (response.status === "OK") {
37172
- await this.stopRealtimeAlert(response);
37173
- }
37174
- }
37175
37712
  };
37176
37713
  }
37177
37714
  setOnBufferSizeErrorCallback(cb) {
@@ -37346,7 +37883,7 @@ Navigator: ${JSON.stringify(_navigator2)}`
37346
37883
  verifyingFace = true;
37347
37884
  verifyFirstFaceIntervalCount++;
37348
37885
  try {
37349
- var response = await this.backend.verifyFace(this.proctoringId, await this.allRecorders.cameraRecorder.getCurrentImageBase64(), verifyFirstFaceIntervalCount > 5 ? false : true);
37886
+ var response = await this.backend.verifyFace(this.proctoringId, await this.allRecorders.cameraRecorder.getCurrentImageBase64(), verifyFirstFaceIntervalCount > 2 ? false : true);
37350
37887
  verifyingFace = false;
37351
37888
  clearInterval(this.verifyFirstFaceInterval);
37352
37889
  } catch (error) {
@@ -37354,7 +37891,7 @@ Navigator: ${JSON.stringify(_navigator2)}`
37354
37891
  return;
37355
37892
  }
37356
37893
  }
37357
- }, 1500);
37894
+ }, 5e3);
37358
37895
  return startResponse;
37359
37896
  } catch (error) {
37360
37897
  console.log(error);