@bigbinary/neeto-media-recorder 2.6.10 → 2.6.12
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/README.md +10 -0
- package/core.js +43 -19
- package/core.js.map +1 -1
- package/index.js +46 -50
- package/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,6 +41,8 @@ This package exports four different sets of functions and components.
|
|
|
41
41
|
- `appName`: This prop is used to set the application name which will be used
|
|
42
42
|
in the permission denied messages. By default it will be set to
|
|
43
43
|
`globalProps.appName`
|
|
44
|
+
- `mimeType`: This prop is used to set the mime type of the recording. By default
|
|
45
|
+
it will be set to `video/webm;codecs=h264`.
|
|
44
46
|
|
|
45
47
|
### Utilities
|
|
46
48
|
|
|
@@ -273,6 +275,14 @@ import {
|
|
|
273
275
|
A property which returns the current status of the `MultipartS3Uploader`
|
|
274
276
|
instance.
|
|
275
277
|
|
|
278
|
+
- `mimeType`
|
|
279
|
+
|
|
280
|
+
A property which returns the mime type of the recording.
|
|
281
|
+
|
|
282
|
+
- `setMimeType(mimeType)`
|
|
283
|
+
|
|
284
|
+
Used to set the mime type of the recording.
|
|
285
|
+
|
|
276
286
|
- #### useMultipartS3UploadStatus
|
|
277
287
|
|
|
278
288
|
A react hook which can be used to know the current status of the
|
package/core.js
CHANGED
|
@@ -914,7 +914,8 @@ var s3Api = {
|
|
|
914
914
|
};
|
|
915
915
|
|
|
916
916
|
var isMp4Supported = function isMp4Supported() {
|
|
917
|
-
|
|
917
|
+
var mimeType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getSupportedMimeType();
|
|
918
|
+
return mimeType === MIME_TYPE$1.mp4;
|
|
918
919
|
};
|
|
919
920
|
|
|
920
921
|
var createPrefixedLogger = function createPrefixedLogger(prefix) {
|
|
@@ -985,6 +986,7 @@ var _uploadProgress = /*#__PURE__*/new WeakMap();
|
|
|
985
986
|
var _status = /*#__PURE__*/new WeakMap();
|
|
986
987
|
var _id = /*#__PURE__*/new WeakMap();
|
|
987
988
|
var _logger$1 = /*#__PURE__*/new WeakMap();
|
|
989
|
+
var _mimeType$1 = /*#__PURE__*/new WeakMap();
|
|
988
990
|
var _status2 = /*#__PURE__*/new WeakMap();
|
|
989
991
|
var _fireCallbacks$1 = /*#__PURE__*/new WeakMap();
|
|
990
992
|
var _handleChunkUploadError = /*#__PURE__*/new WeakMap();
|
|
@@ -1060,6 +1062,13 @@ var MultipartS3Uploader = /*#__PURE__*/function () {
|
|
|
1060
1062
|
writable: true,
|
|
1061
1063
|
value: createPrefixedLogger("[".concat(_classPrivateFieldGet(this, _id), "]"))
|
|
1062
1064
|
});
|
|
1065
|
+
_classPrivateFieldInitSpec$1(this, _mimeType$1, {
|
|
1066
|
+
writable: true,
|
|
1067
|
+
value: getSupportedMimeType()
|
|
1068
|
+
});
|
|
1069
|
+
_defineProperty(this, "setMimeType", function (mimeType) {
|
|
1070
|
+
return _classPrivateFieldSet(_this, _mimeType$1, mimeType);
|
|
1071
|
+
});
|
|
1063
1072
|
_defineProperty(this, "setRecording", function (recordingId, uploadId) {
|
|
1064
1073
|
_classPrivateFieldSet(_this, _recordingId, recordingId);
|
|
1065
1074
|
_classPrivateFieldSet(_this, _uploadId, uploadId);
|
|
@@ -1147,7 +1156,7 @@ var MultipartS3Uploader = /*#__PURE__*/function () {
|
|
|
1147
1156
|
payload: {
|
|
1148
1157
|
parts: parts,
|
|
1149
1158
|
uploadId: _classPrivateFieldGet(_this, _uploadId),
|
|
1150
|
-
isMp4: isMp4Supported(),
|
|
1159
|
+
isMp4: isMp4Supported(_classPrivateFieldGet(_this, _mimeType$1)),
|
|
1151
1160
|
logs: sessionLogs
|
|
1152
1161
|
},
|
|
1153
1162
|
config: {
|
|
@@ -1231,7 +1240,7 @@ var MultipartS3Uploader = /*#__PURE__*/function () {
|
|
|
1231
1240
|
recordingId: recordingId,
|
|
1232
1241
|
payload: {
|
|
1233
1242
|
uploadId: uploadId,
|
|
1234
|
-
isMp4: isMp4Supported(),
|
|
1243
|
+
isMp4: isMp4Supported(_classPrivateFieldGet(_this, _mimeType$1)),
|
|
1235
1244
|
logs: sessionLogs
|
|
1236
1245
|
}
|
|
1237
1246
|
});
|
|
@@ -1307,43 +1316,45 @@ var MultipartS3Uploader = /*#__PURE__*/function () {
|
|
|
1307
1316
|
value: function () {
|
|
1308
1317
|
var _value = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(chunks) {
|
|
1309
1318
|
var _this$partNumber;
|
|
1310
|
-
var partNumber,
|
|
1319
|
+
var partNumber, _yield$partPresignedU, presignedUrl, s3PartUploadPromise;
|
|
1311
1320
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
1312
1321
|
while (1) switch (_context3.prev = _context3.next) {
|
|
1313
1322
|
case 0:
|
|
1314
1323
|
_classPrivateFieldGet(_this, _logger$1).info("Part ready to be uploaded: ", _classPrivateFieldGet(_this, _partNumber));
|
|
1315
1324
|
partNumber = _classPrivateFieldGet(_this, _partNumber);
|
|
1316
|
-
mimeType = getSupportedMimeType();
|
|
1317
1325
|
_classPrivateFieldSet(_this, _partNumber, (_this$partNumber = _classPrivateFieldGet(_this, _partNumber), _this$partNumber++, _this$partNumber));
|
|
1318
1326
|
_classPrivateFieldGet(_this, _uploadProgress)[partNumber] = {
|
|
1319
1327
|
uploaded: 0,
|
|
1320
1328
|
total: new Blob(chunks, {
|
|
1321
|
-
type:
|
|
1329
|
+
type: _classPrivateFieldGet(_this, _mimeType$1)
|
|
1322
1330
|
}).size
|
|
1323
1331
|
};
|
|
1324
|
-
_context3.prev =
|
|
1325
|
-
_context3.next =
|
|
1332
|
+
_context3.prev = 4;
|
|
1333
|
+
_context3.next = 7;
|
|
1326
1334
|
return partPresignedUrlApi.create({
|
|
1327
1335
|
recordingId: _classPrivateFieldGet(_this, _recordingId),
|
|
1328
1336
|
payload: {
|
|
1329
1337
|
partNumber: partNumber,
|
|
1330
1338
|
uploadId: _classPrivateFieldGet(_this, _uploadId),
|
|
1331
|
-
isMp4:
|
|
1339
|
+
isMp4: _classPrivateFieldGet(_this, _mimeType$1) === MIME_TYPE.mp4
|
|
1332
1340
|
},
|
|
1333
1341
|
config: {
|
|
1334
1342
|
signal: _classPrivateFieldGet(_this, _abortController).signal
|
|
1335
1343
|
}
|
|
1336
1344
|
});
|
|
1337
|
-
case
|
|
1345
|
+
case 7:
|
|
1338
1346
|
_yield$partPresignedU = _context3.sent;
|
|
1339
1347
|
presignedUrl = _yield$partPresignedU.presignedUrl;
|
|
1340
1348
|
_classPrivateFieldGet(_this, _logger$1).info("Presigned url created for partNumber:", partNumber);
|
|
1341
1349
|
s3PartUploadPromise = s3Api.presignedUpload({
|
|
1342
1350
|
presignedUrl: presignedUrl,
|
|
1343
1351
|
blob: new Blob(chunks, {
|
|
1344
|
-
type:
|
|
1352
|
+
type: _classPrivateFieldGet(_this, _mimeType$1)
|
|
1345
1353
|
}),
|
|
1346
1354
|
config: {
|
|
1355
|
+
headers: {
|
|
1356
|
+
"Content-Type": _classPrivateFieldGet(_this, _mimeType$1)
|
|
1357
|
+
},
|
|
1347
1358
|
includeMetadataInResponse: true,
|
|
1348
1359
|
signal: _classPrivateFieldGet(_this, _abortController).signal,
|
|
1349
1360
|
onUploadProgress: function onUploadProgress(e) {
|
|
@@ -1362,17 +1373,17 @@ var MultipartS3Uploader = /*#__PURE__*/function () {
|
|
|
1362
1373
|
_classPrivateFieldGet(_this, _handleChunkUploadError).call(_this, error, partNumber);
|
|
1363
1374
|
});
|
|
1364
1375
|
_classPrivateFieldGet(_this, _s3PartUploadPromises).push(s3PartUploadPromise);
|
|
1365
|
-
_context3.next =
|
|
1376
|
+
_context3.next = 17;
|
|
1366
1377
|
break;
|
|
1367
|
-
case
|
|
1368
|
-
_context3.prev =
|
|
1369
|
-
_context3.t0 = _context3["catch"](
|
|
1378
|
+
case 14:
|
|
1379
|
+
_context3.prev = 14;
|
|
1380
|
+
_context3.t0 = _context3["catch"](4);
|
|
1370
1381
|
_classPrivateFieldGet(_this, _handleChunkUploadError).call(_this, _context3.t0, partNumber);
|
|
1371
|
-
case
|
|
1382
|
+
case 17:
|
|
1372
1383
|
case "end":
|
|
1373
1384
|
return _context3.stop();
|
|
1374
1385
|
}
|
|
1375
|
-
}, _callee3, null, [[
|
|
1386
|
+
}, _callee3, null, [[4, 14]]);
|
|
1376
1387
|
}));
|
|
1377
1388
|
function value(_x2) {
|
|
1378
1389
|
return _value.apply(this, arguments);
|
|
@@ -1384,7 +1395,7 @@ var MultipartS3Uploader = /*#__PURE__*/function () {
|
|
|
1384
1395
|
writable: true,
|
|
1385
1396
|
value: function value() {
|
|
1386
1397
|
return new Blob(_classPrivateFieldGet(_this, _unUploadedChunks), {
|
|
1387
|
-
type:
|
|
1398
|
+
type: _classPrivateFieldGet(_this, _mimeType$1)
|
|
1388
1399
|
});
|
|
1389
1400
|
}
|
|
1390
1401
|
});
|
|
@@ -1395,6 +1406,11 @@ var MultipartS3Uploader = /*#__PURE__*/function () {
|
|
|
1395
1406
|
get: function get() {
|
|
1396
1407
|
return _classPrivateFieldGet(this, _status);
|
|
1397
1408
|
}
|
|
1409
|
+
}, {
|
|
1410
|
+
key: "mimeType",
|
|
1411
|
+
get: function get() {
|
|
1412
|
+
return _classPrivateFieldGet(this, _mimeType$1);
|
|
1413
|
+
}
|
|
1398
1414
|
}, {
|
|
1399
1415
|
key: "hasSufficientData",
|
|
1400
1416
|
get: function get() {
|
|
@@ -1508,6 +1524,7 @@ var _audioStream = /*#__PURE__*/new WeakMap();
|
|
|
1508
1524
|
var _timeLimit = /*#__PURE__*/new WeakMap();
|
|
1509
1525
|
var _startRecordingTimeoutID = /*#__PURE__*/new WeakMap();
|
|
1510
1526
|
var _enableNoiseCancellation = /*#__PURE__*/new WeakMap();
|
|
1527
|
+
var _mimeType = /*#__PURE__*/new WeakMap();
|
|
1511
1528
|
var _checkCompatibility = /*#__PURE__*/new WeakMap();
|
|
1512
1529
|
var _acquireMediaStream = /*#__PURE__*/new WeakMap();
|
|
1513
1530
|
var _fireCallbacks = /*#__PURE__*/new WeakMap();
|
|
@@ -1598,9 +1615,16 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
1598
1615
|
writable: true,
|
|
1599
1616
|
value: false
|
|
1600
1617
|
});
|
|
1618
|
+
_classPrivateFieldInitSpec(this, _mimeType, {
|
|
1619
|
+
writable: true,
|
|
1620
|
+
value: getSupportedMimeType()
|
|
1621
|
+
});
|
|
1601
1622
|
_defineProperty(this, "setEnableNoiseCancellation", function (value) {
|
|
1602
1623
|
return _classPrivateFieldSet(_this, _enableNoiseCancellation, value);
|
|
1603
1624
|
});
|
|
1625
|
+
_defineProperty(this, "setMimeType", function (mimeType) {
|
|
1626
|
+
return _classPrivateFieldSet(_this, _mimeType, mimeType);
|
|
1627
|
+
});
|
|
1604
1628
|
_defineProperty(this, "setAudioConfiguration", function (audio) {
|
|
1605
1629
|
return _classPrivateFieldSet(_this, _audio, audio);
|
|
1606
1630
|
});
|
|
@@ -1610,7 +1634,7 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
1610
1634
|
});
|
|
1611
1635
|
_defineProperty(this, "getWebmMediaBlob", function () {
|
|
1612
1636
|
return new Blob(_classPrivateFieldGet(_this, _mediaChunks), {
|
|
1613
|
-
type:
|
|
1637
|
+
type: _classPrivateFieldGet(_this, _mimeType)
|
|
1614
1638
|
});
|
|
1615
1639
|
});
|
|
1616
1640
|
_defineProperty(this, "addCallback", function (event, callback) {
|