easyproctor-hml 2.5.34 → 2.5.35

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) {
@@ -26127,7 +26614,7 @@ var FaceDetection = class extends BaseDetection {
26127
26614
  stopDetection() {
26128
26615
  super.stopDetection();
26129
26616
  if (this.emmitedFaceAlert) {
26130
- this.handleOk("face_ok", "face_detection_on_stream");
26617
+ this.handleOk("face_stop", "face_detection_on_stream");
26131
26618
  }
26132
26619
  }
26133
26620
  // displayVideoDetections(result: { detections: any; }) {
@@ -30355,6 +30842,7 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30355
30842
  buffer.push(e3.data);
30356
30843
  }
30357
30844
  if (stopped) {
30845
+ console.log("buildMediaRecorder ondataavailable stopped");
30358
30846
  resolvePromise && resolvePromise();
30359
30847
  }
30360
30848
  };
@@ -30424,6 +30912,9 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30424
30912
  if (mediaRecorder.state == "recording") {
30425
30913
  console.log("stopRecording Recorder est\xE1 em estado recording, iniciando stop");
30426
30914
  resolvePromise = resolve;
30915
+ mediaRecorder.onstop = () => {
30916
+ console.log("recorder onstop");
30917
+ };
30427
30918
  stopped = true;
30428
30919
  mediaRecorder.stop();
30429
30920
  } else {
@@ -30839,6 +31330,7 @@ var VolumeMeter = class {
30839
31330
 
30840
31331
  // src/new-flow/recorders/CameraRecorder.ts
30841
31332
  var import_jszip_min = __toESM(require_jszip_min());
31333
+ var import_fix_webm_duration = __toESM(require_fix_webm_duration());
30842
31334
  var CameraRecorder = class {
30843
31335
  constructor(options, videoOptions, paramsConfig, backend, backendToken) {
30844
31336
  this.blobs = [];
@@ -30889,6 +31381,7 @@ var CameraRecorder = class {
30889
31381
  this.hardwareStream = null;
30890
31382
  this.internalClonedStream = null;
30891
31383
  this.videoElement = null;
31384
+ this.duration = 0;
30892
31385
  this.currentRetries = 0;
30893
31386
  this.packageCount = 0;
30894
31387
  this.noiseWait = 20;
@@ -31113,10 +31606,17 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31113
31606
  console.log("Camera Recorder started OK");
31114
31607
  }
31115
31608
  async stopRecording() {
31116
- var _a2, _b, _c2;
31609
+ var _a2, _b, _c2, _d;
31117
31610
  console.log("Camera Recorder stopRecording");
31118
31611
  this.isCanvasLoopActive = false;
31612
+ this.faceDetection && this.faceDetection.detecting && this.faceDetection.stopDetection();
31613
+ this.objectDetection && this.objectDetection.detecting && this.objectDetection.stopDetection();
31614
+ clearInterval(this.imageInterval);
31615
+ clearInterval(this.sendFrameInterval);
31616
+ this.volumeMeter && this.volumeMeter.stop();
31617
+ this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
31119
31618
  this.recordingStop && await this.recordingStop();
31619
+ this.duration = Date.now() - ((_a2 = this.getStartTime()) == null ? void 0 : _a2.getTime()) || 0;
31120
31620
  try {
31121
31621
  if (this.animationFrameId) {
31122
31622
  cancelAnimationFrame(this.animationFrameId);
@@ -31134,28 +31634,22 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31134
31634
  this.hardwareStream = null;
31135
31635
  }
31136
31636
  if (this.videoElement) {
31137
- (_a2 = this.videoElement) == null ? void 0 : _a2.remove();
31637
+ (_b = this.videoElement) == null ? void 0 : _b.remove();
31138
31638
  this.videoElement = null;
31139
31639
  }
31140
31640
  if (this.video) {
31141
- (_b = this.video) == null ? void 0 : _b.remove();
31641
+ (_c2 = this.video) == null ? void 0 : _c2.remove();
31142
31642
  }
31143
31643
  if (this.canvas) {
31144
- (_c2 = this.canvas) == null ? void 0 : _c2.remove();
31644
+ (_d = this.canvas) == null ? void 0 : _d.remove();
31145
31645
  }
31146
31646
  } catch {
31147
31647
  console.error("Erro ao parar os streams de m\xEDdia.");
31148
31648
  }
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
31649
  if (this.options.proctoringType == "REALTIME" && this.upload && this.backendToken) {
31154
31650
  await this.sendPackage(this.filesToUpload);
31155
31651
  await this.filesToUpload.splice(0, this.filesToUpload.length);
31156
31652
  }
31157
- this.volumeMeter && this.volumeMeter.stop();
31158
- this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
31159
31653
  }
31160
31654
  async pauseRecording() {
31161
31655
  await this.recordingPause();
@@ -31289,6 +31783,15 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31289
31783
  const settings = this.cameraStream.getVideoTracks()[0].getSettings();
31290
31784
  const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
31291
31785
  if (this.options.proctoringType == "VIDEO" || this.options.proctoringType == "REALTIME" || this.options.proctoringType == "IMAGE" && ((_a2 = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _a2.saveVideo)) {
31786
+ const rawBlob = new Blob(this.blobs, {
31787
+ type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
31788
+ });
31789
+ const fixedBlob = await (0, import_fix_webm_duration.default)(rawBlob, this.duration);
31790
+ const file = new File(
31791
+ [fixedBlob],
31792
+ `EP_${session.id}_camera_0.webm`,
31793
+ { type: rawBlob.type }
31794
+ );
31292
31795
  session.addRecording({
31293
31796
  device: `Audio
31294
31797
  Sample Rate: ${settingsAudio.sampleRate}
@@ -31296,9 +31799,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31296
31799
 
31297
31800
  Video:
31298
31801
  ${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
- }),
31802
+ file,
31302
31803
  origin: "Camera" /* Camera */
31303
31804
  });
31304
31805
  }
@@ -33348,6 +33849,22 @@ var ProctoringUploader = class {
33348
33849
  }
33349
33850
  },
33350
33851
  token
33852
+ ).catch(
33853
+ async (e3) => {
33854
+ console.log("Upload File Error", e3), trackers.registerError(this.proctoringId, `Upload File
33855
+ Name: ${rec.file.name}
33856
+ Error: ${e3.message}
33857
+ Size: ${e3.error}`);
33858
+ await uploadService.upload(
33859
+ {
33860
+ file: rec.file,
33861
+ onProgress: (progress) => {
33862
+ if (onProgress) onProgress(progress);
33863
+ }
33864
+ },
33865
+ token
33866
+ );
33867
+ }
33351
33868
  );
33352
33869
  if (result) {
33353
33870
  let fileType = "";
@@ -36056,10 +36573,12 @@ registerProcessor("audio-processor", AudioProcessor);
36056
36573
  `;
36057
36574
 
36058
36575
  // src/new-flow/recorders/ScreenRecorder.ts
36576
+ var import_fix_webm_duration2 = __toESM(require_fix_webm_duration());
36059
36577
  var ScreenRecorder = class {
36060
36578
  constructor(options) {
36061
36579
  this.blobs = [];
36062
36580
  this.blobsFinal = [];
36581
+ this.duration = 0;
36063
36582
  this.options = options;
36064
36583
  }
36065
36584
  setProctoringId(proctoringId2) {
@@ -36141,15 +36660,24 @@ var ScreenRecorder = class {
36141
36660
  async resumeRecording() {
36142
36661
  }
36143
36662
  async stopRecording() {
36663
+ var _a2;
36144
36664
  this.recordingStop && await this.recordingStop();
36665
+ this.duration = Date.now() - ((_a2 = this.startTime) == null ? void 0 : _a2.getTime()) || 0;
36145
36666
  }
36146
36667
  async saveOnSession(session) {
36147
36668
  if (isMobileDevice()) return;
36669
+ const rawBlob = new Blob(this.blobs, {
36670
+ type: "video/webm"
36671
+ });
36672
+ const fixedBlob = await (0, import_fix_webm_duration2.default)(rawBlob, this.duration);
36673
+ const file = new File(
36674
+ [fixedBlob],
36675
+ `EP_${session.id}_screen_0.webm`,
36676
+ { type: rawBlob.type }
36677
+ );
36148
36678
  session.addRecording({
36149
36679
  device: "",
36150
- file: new File(this.blobs, `EP_${session.id}_screen_0.webm`, {
36151
- type: "video/webm"
36152
- }),
36680
+ file,
36153
36681
  origin: "Screen" /* Screen */
36154
36682
  });
36155
36683
  }
@@ -37227,7 +37755,7 @@ var Proctoring = class {
37227
37755
  begin: alert.begin,
37228
37756
  end: alert.end,
37229
37757
  warningCategoryEnum: this.convertRealtimeTypeToWarningType(alert.type),
37230
- alertImageBase64: await this.allRecorders.cameraRecorder.getCurrentImageBase64(),
37758
+ alertImageBase64: alert.description !== "face_stop" ? await this.allRecorders.cameraRecorder.getCurrentImageBase64() : "",
37231
37759
  retry: verifyCount < verifyMaxRetries - 1 ? true : false
37232
37760
  });
37233
37761
  return response;
@@ -37432,7 +37960,7 @@ Navigator: ${JSON.stringify(_navigator2)}`
37432
37960
  verifyingFace = true;
37433
37961
  verifyFirstFaceIntervalCount++;
37434
37962
  try {
37435
- var response = await this.backend.verifyFace(this.proctoringId, await this.allRecorders.cameraRecorder.getCurrentImageBase64(), verifyFirstFaceIntervalCount > 5 ? false : true);
37963
+ var response = await this.backend.verifyFace(this.proctoringId, await this.allRecorders.cameraRecorder.getCurrentImageBase64(), verifyFirstFaceIntervalCount > 2 ? false : true);
37436
37964
  verifyingFace = false;
37437
37965
  clearInterval(this.verifyFirstFaceInterval);
37438
37966
  } catch (error) {
@@ -37440,7 +37968,7 @@ Navigator: ${JSON.stringify(_navigator2)}`
37440
37968
  return;
37441
37969
  }
37442
37970
  }
37443
- }, 1500);
37971
+ }, 5e3);
37444
37972
  return startResponse;
37445
37973
  } catch (error) {
37446
37974
  console.log(error);