easyproctor-hml 2.5.34 → 2.5.36

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; }) {
@@ -26290,6 +26782,8 @@ var FaceDetection = class extends BaseDetection {
26290
26782
  }
26291
26783
  verify(result) {
26292
26784
  var _a2;
26785
+ console.log("this.numFacesSent", this.numFacesSent);
26786
+ console.log("result.detections.length", result.detections.length);
26293
26787
  if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectFace) && result.detections.length !== this.numFacesSent) {
26294
26788
  this.numFacesSent = result.detections.length;
26295
26789
  if (result.detections.length === 0) {
@@ -30355,6 +30849,7 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30355
30849
  buffer.push(e3.data);
30356
30850
  }
30357
30851
  if (stopped) {
30852
+ console.log("buildMediaRecorder ondataavailable stopped");
30358
30853
  resolvePromise && resolvePromise();
30359
30854
  }
30360
30855
  };
@@ -30424,6 +30919,9 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30424
30919
  if (mediaRecorder.state == "recording") {
30425
30920
  console.log("stopRecording Recorder est\xE1 em estado recording, iniciando stop");
30426
30921
  resolvePromise = resolve;
30922
+ mediaRecorder.onstop = () => {
30923
+ console.log("recorder onstop");
30924
+ };
30427
30925
  stopped = true;
30428
30926
  mediaRecorder.stop();
30429
30927
  } else {
@@ -30839,6 +31337,7 @@ var VolumeMeter = class {
30839
31337
 
30840
31338
  // src/new-flow/recorders/CameraRecorder.ts
30841
31339
  var import_jszip_min = __toESM(require_jszip_min());
31340
+ var import_fix_webm_duration = __toESM(require_fix_webm_duration());
30842
31341
  var CameraRecorder = class {
30843
31342
  constructor(options, videoOptions, paramsConfig, backend, backendToken) {
30844
31343
  this.blobs = [];
@@ -30889,6 +31388,7 @@ var CameraRecorder = class {
30889
31388
  this.hardwareStream = null;
30890
31389
  this.internalClonedStream = null;
30891
31390
  this.videoElement = null;
31391
+ this.duration = 0;
30892
31392
  this.currentRetries = 0;
30893
31393
  this.packageCount = 0;
30894
31394
  this.noiseWait = 20;
@@ -31113,10 +31613,17 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31113
31613
  console.log("Camera Recorder started OK");
31114
31614
  }
31115
31615
  async stopRecording() {
31116
- var _a2, _b, _c2;
31616
+ var _a2, _b, _c2, _d;
31117
31617
  console.log("Camera Recorder stopRecording");
31118
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);
31119
31625
  this.recordingStop && await this.recordingStop();
31626
+ this.duration = Date.now() - ((_a2 = this.getStartTime()) == null ? void 0 : _a2.getTime()) || 0;
31120
31627
  try {
31121
31628
  if (this.animationFrameId) {
31122
31629
  cancelAnimationFrame(this.animationFrameId);
@@ -31134,28 +31641,22 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31134
31641
  this.hardwareStream = null;
31135
31642
  }
31136
31643
  if (this.videoElement) {
31137
- (_a2 = this.videoElement) == null ? void 0 : _a2.remove();
31644
+ (_b = this.videoElement) == null ? void 0 : _b.remove();
31138
31645
  this.videoElement = null;
31139
31646
  }
31140
31647
  if (this.video) {
31141
- (_b = this.video) == null ? void 0 : _b.remove();
31648
+ (_c2 = this.video) == null ? void 0 : _c2.remove();
31142
31649
  }
31143
31650
  if (this.canvas) {
31144
- (_c2 = this.canvas) == null ? void 0 : _c2.remove();
31651
+ (_d = this.canvas) == null ? void 0 : _d.remove();
31145
31652
  }
31146
31653
  } catch {
31147
31654
  console.error("Erro ao parar os streams de m\xEDdia.");
31148
31655
  }
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
31656
  if (this.options.proctoringType == "REALTIME" && this.upload && this.backendToken) {
31154
31657
  await this.sendPackage(this.filesToUpload);
31155
31658
  await this.filesToUpload.splice(0, this.filesToUpload.length);
31156
31659
  }
31157
- this.volumeMeter && this.volumeMeter.stop();
31158
- this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
31159
31660
  }
31160
31661
  async pauseRecording() {
31161
31662
  await this.recordingPause();
@@ -31289,6 +31790,15 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31289
31790
  const settings = this.cameraStream.getVideoTracks()[0].getSettings();
31290
31791
  const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
31291
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
+ );
31292
31802
  session.addRecording({
31293
31803
  device: `Audio
31294
31804
  Sample Rate: ${settingsAudio.sampleRate}
@@ -31296,9 +31806,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31296
31806
 
31297
31807
  Video:
31298
31808
  ${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
- }),
31809
+ file,
31302
31810
  origin: "Camera" /* Camera */
31303
31811
  });
31304
31812
  }
@@ -33348,6 +33856,22 @@ var ProctoringUploader = class {
33348
33856
  }
33349
33857
  },
33350
33858
  token
33859
+ ).catch(
33860
+ async (e3) => {
33861
+ console.log("Upload File Error", e3), trackers.registerError(this.proctoringId, `Upload File
33862
+ Name: ${rec.file.name}
33863
+ Error: ${e3.message}
33864
+ Size: ${e3.error}`);
33865
+ await uploadService.upload(
33866
+ {
33867
+ file: rec.file,
33868
+ onProgress: (progress) => {
33869
+ if (onProgress) onProgress(progress);
33870
+ }
33871
+ },
33872
+ token
33873
+ );
33874
+ }
33351
33875
  );
33352
33876
  if (result) {
33353
33877
  let fileType = "";
@@ -36056,10 +36580,12 @@ registerProcessor("audio-processor", AudioProcessor);
36056
36580
  `;
36057
36581
 
36058
36582
  // src/new-flow/recorders/ScreenRecorder.ts
36583
+ var import_fix_webm_duration2 = __toESM(require_fix_webm_duration());
36059
36584
  var ScreenRecorder = class {
36060
36585
  constructor(options) {
36061
36586
  this.blobs = [];
36062
36587
  this.blobsFinal = [];
36588
+ this.duration = 0;
36063
36589
  this.options = options;
36064
36590
  }
36065
36591
  setProctoringId(proctoringId2) {
@@ -36141,15 +36667,24 @@ var ScreenRecorder = class {
36141
36667
  async resumeRecording() {
36142
36668
  }
36143
36669
  async stopRecording() {
36670
+ var _a2;
36144
36671
  this.recordingStop && await this.recordingStop();
36672
+ this.duration = Date.now() - ((_a2 = this.startTime) == null ? void 0 : _a2.getTime()) || 0;
36145
36673
  }
36146
36674
  async saveOnSession(session) {
36147
36675
  if (isMobileDevice()) return;
36676
+ const rawBlob = new Blob(this.blobs, {
36677
+ type: "video/webm"
36678
+ });
36679
+ const fixedBlob = await (0, import_fix_webm_duration2.default)(rawBlob, this.duration);
36680
+ const file = new File(
36681
+ [fixedBlob],
36682
+ `EP_${session.id}_screen_0.webm`,
36683
+ { type: rawBlob.type }
36684
+ );
36148
36685
  session.addRecording({
36149
36686
  device: "",
36150
- file: new File(this.blobs, `EP_${session.id}_screen_0.webm`, {
36151
- type: "video/webm"
36152
- }),
36687
+ file,
36153
36688
  origin: "Screen" /* Screen */
36154
36689
  });
36155
36690
  }
@@ -37227,7 +37762,7 @@ var Proctoring = class {
37227
37762
  begin: alert.begin,
37228
37763
  end: alert.end,
37229
37764
  warningCategoryEnum: this.convertRealtimeTypeToWarningType(alert.type),
37230
- alertImageBase64: await this.allRecorders.cameraRecorder.getCurrentImageBase64(),
37765
+ alertImageBase64: alert.description !== "face_stop" ? await this.allRecorders.cameraRecorder.getCurrentImageBase64() : "",
37231
37766
  retry: verifyCount < verifyMaxRetries - 1 ? true : false
37232
37767
  });
37233
37768
  return response;
@@ -37432,7 +37967,7 @@ Navigator: ${JSON.stringify(_navigator2)}`
37432
37967
  verifyingFace = true;
37433
37968
  verifyFirstFaceIntervalCount++;
37434
37969
  try {
37435
- var response = await this.backend.verifyFace(this.proctoringId, await this.allRecorders.cameraRecorder.getCurrentImageBase64(), verifyFirstFaceIntervalCount > 5 ? false : true);
37970
+ var response = await this.backend.verifyFace(this.proctoringId, await this.allRecorders.cameraRecorder.getCurrentImageBase64(), verifyFirstFaceIntervalCount > 2 ? false : true);
37436
37971
  verifyingFace = false;
37437
37972
  clearInterval(this.verifyFirstFaceInterval);
37438
37973
  } catch (error) {
@@ -37440,7 +37975,7 @@ Navigator: ${JSON.stringify(_navigator2)}`
37440
37975
  return;
37441
37976
  }
37442
37977
  }
37443
- }, 1500);
37978
+ }, 5e3);
37444
37979
  return startResponse;
37445
37980
  } catch (error) {
37446
37981
  console.log(error);