@bigbinary/neeto-media-recorder 2.4.3 → 2.5.1
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/constants.js +2 -1
- package/constants.js.map +1 -1
- package/core.js +34 -20
- package/core.js.map +1 -1
- package/index.js +149 -75
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/translations/en.json +2 -1
package/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { shallow } from 'zustand/shallow';
|
|
|
2
2
|
import { useState, useEffect, forwardRef, useImperativeHandle, useRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { isNotEmpty, noop } from '@bigbinary/neeto-cist';
|
|
5
|
-
import { SCREEN_RECORDER_STATUS, UPLOAD_STATUS, MIME_TYPE as MIME_TYPE$1, ONE_MINUTE_IN_MILLISECONDS as ONE_MINUTE_IN_MILLISECONDS$1, ONE_SECOND_IN_MILLISECONDS as ONE_SECOND_IN_MILLISECONDS$1, IS_EXTENSION as IS_EXTENSION$1, SCREEN_RECORDER_ERROR, IS_SAFARI_EXTENSION, SCREEN_RECORDER_EVENT, UPLOAD_EVENT } from '@bigbinary/neeto-media-recorder/constants';
|
|
5
|
+
import { SCREEN_RECORDER_STATUS, UPLOAD_STATUS as UPLOAD_STATUS$1, MIME_TYPE as MIME_TYPE$1, ONE_MINUTE_IN_MILLISECONDS as ONE_MINUTE_IN_MILLISECONDS$1, ONE_SECOND_IN_MILLISECONDS as ONE_SECOND_IN_MILLISECONDS$1, IS_EXTENSION as IS_EXTENSION$1, SCREEN_RECORDER_ERROR, IS_SAFARI_EXTENSION, SCREEN_RECORDER_EVENT, UPLOAD_EVENT } from '@bigbinary/neeto-media-recorder/constants';
|
|
6
6
|
import { screenRecorder, multipartS3Uploader } from '@bigbinary/neeto-media-recorder/core';
|
|
7
7
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
8
8
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
@@ -25,13 +25,56 @@ import { copyToClipboard } from '@bigbinary/neeto-commons-frontend/utils/general
|
|
|
25
25
|
import Close from '@bigbinary/neeto-icons/Close';
|
|
26
26
|
import Download from '@bigbinary/neeto-icons/Download';
|
|
27
27
|
import Copy from '@bigbinary/neeto-icons/Copy';
|
|
28
|
+
import Refresh from '@bigbinary/neeto-icons/Refresh';
|
|
28
29
|
import CopyToClipboardButton from '@bigbinary/neeto-molecules/CopyToClipboardButton';
|
|
30
|
+
import ProgressBar from '@bigbinary/neetoui/ProgressBar';
|
|
29
31
|
|
|
30
32
|
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
31
33
|
|
|
32
|
-
var css = ".nrec-done-button{background-color:rgb(var(--neeto-ui-error-100));padding:8px 12px}.nrec-done-button:hover{box-shadow:0 0 0 3px rgba(var(--neeto-ui-error-500),15%)}body .neeto-ui-modal__wrapper .neeto-ui-btn--style-danger{background:rgb(var(--neeto-ui-error-500))}.nrec-media-upload-loader{background:#d9d9d9;border-radius:14px;display:inline-block;height:10px;margin:0 auto;max-width:480px;overflow:hidden;position:relative;width:100%}.nrec-media-upload-loader:after{animation:movementLoader 3s linear infinite,barAnimation 1.5s linear infinite;background-color:#fff;background-image:linear-gradient(45deg,#268e6c 25%,#12805c 0,#12805c 50%,#268e6c 0,#268e6c 75%,#12805c 0,#12805c);background-size:1em 1em;border-radius:14px;box-sizing:border-box;content:\"\";height:10px;left:0;position:absolute;top:0;width:230px}@media only screen and (max-width:767px){.nrec-media-upload-loader:after{width:130px}}@keyframes barAnimation{0%{background-position:1em 0}to{background-position:0 0}}@keyframes movementLoader{0%{left:0;transform:translateX(-100%)}to{left:100%;transform:translateX(0)}}";
|
|
34
|
+
var css = ".nrec-done-button{background-color:rgb(var(--neeto-ui-error-100));padding:8px 12px}.nrec-done-button:hover{box-shadow:0 0 0 3px rgba(var(--neeto-ui-error-500),15%)}body .neeto-ui-modal__wrapper .neeto-ui-btn--style-danger{background:rgb(var(--neeto-ui-error-500))}.nrec-media-upload-progress{margin:0 auto;max-width:480px}.nrec-media-upload-error{color:rgb(var(--neeto-ui-error-500))}.nrec-media-upload-loader{background:#d9d9d9;border-radius:14px;display:inline-block;height:10px;margin:0 auto;max-width:480px;overflow:hidden;position:relative;width:100%}.nrec-media-upload-loader:after{animation:movementLoader 3s linear infinite,barAnimation 1.5s linear infinite;background-color:#fff;background-image:linear-gradient(45deg,#268e6c 25%,#12805c 0,#12805c 50%,#268e6c 0,#268e6c 75%,#12805c 0,#12805c);background-size:1em 1em;border-radius:14px;box-sizing:border-box;content:\"\";height:10px;left:0;position:absolute;top:0;width:230px}@media only screen and (max-width:767px){.nrec-media-upload-loader:after{width:130px}}@keyframes barAnimation{0%{background-position:1em 0}to{background-position:0 0}}@keyframes movementLoader{0%{left:0;transform:translateX(-100%)}to{left:100%;transform:translateX(0)}}";
|
|
33
35
|
n(css,{});
|
|
34
36
|
|
|
37
|
+
function _typeof$1(obj) {
|
|
38
|
+
"@babel/helpers - typeof";
|
|
39
|
+
|
|
40
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
41
|
+
return typeof obj;
|
|
42
|
+
} : function (obj) {
|
|
43
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
44
|
+
}, _typeof$1(obj);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function _toPrimitive(input, hint) {
|
|
48
|
+
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
49
|
+
var prim = input[Symbol.toPrimitive];
|
|
50
|
+
if (prim !== undefined) {
|
|
51
|
+
var res = prim.call(input, hint || "default");
|
|
52
|
+
if (_typeof$1(res) !== "object") return res;
|
|
53
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
54
|
+
}
|
|
55
|
+
return (hint === "string" ? String : Number)(input);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function _toPropertyKey(arg) {
|
|
59
|
+
var key = _toPrimitive(arg, "string");
|
|
60
|
+
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function _defineProperty(obj, key, value) {
|
|
64
|
+
key = _toPropertyKey(key);
|
|
65
|
+
if (key in obj) {
|
|
66
|
+
Object.defineProperty(obj, key, {
|
|
67
|
+
value: value,
|
|
68
|
+
enumerable: true,
|
|
69
|
+
configurable: true,
|
|
70
|
+
writable: true
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
obj[key] = value;
|
|
74
|
+
}
|
|
75
|
+
return obj;
|
|
76
|
+
}
|
|
77
|
+
|
|
35
78
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
36
79
|
try {
|
|
37
80
|
var info = gen[key](arg);
|
|
@@ -124,9 +167,9 @@ function getDefaultExportFromCjs (x) {
|
|
|
124
167
|
|
|
125
168
|
var regeneratorRuntime$1 = {exports: {}};
|
|
126
169
|
|
|
127
|
-
var _typeof
|
|
170
|
+
var _typeof = {exports: {}};
|
|
128
171
|
|
|
129
|
-
_typeof
|
|
172
|
+
_typeof.exports;
|
|
130
173
|
|
|
131
174
|
(function (module) {
|
|
132
175
|
function _typeof(obj) {
|
|
@@ -139,9 +182,9 @@ _typeof$1.exports;
|
|
|
139
182
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
140
183
|
}
|
|
141
184
|
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
142
|
-
} (_typeof
|
|
185
|
+
} (_typeof));
|
|
143
186
|
|
|
144
|
-
var _typeofExports = _typeof
|
|
187
|
+
var _typeofExports = _typeof.exports;
|
|
145
188
|
|
|
146
189
|
regeneratorRuntime$1.exports;
|
|
147
190
|
|
|
@@ -471,51 +514,17 @@ try {
|
|
|
471
514
|
|
|
472
515
|
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
|
|
473
516
|
|
|
474
|
-
function _typeof(obj) {
|
|
475
|
-
"@babel/helpers - typeof";
|
|
476
|
-
|
|
477
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
478
|
-
return typeof obj;
|
|
479
|
-
} : function (obj) {
|
|
480
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
481
|
-
}, _typeof(obj);
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
function _toPrimitive(input, hint) {
|
|
485
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
486
|
-
var prim = input[Symbol.toPrimitive];
|
|
487
|
-
if (prim !== undefined) {
|
|
488
|
-
var res = prim.call(input, hint || "default");
|
|
489
|
-
if (_typeof(res) !== "object") return res;
|
|
490
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
491
|
-
}
|
|
492
|
-
return (hint === "string" ? String : Number)(input);
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
function _toPropertyKey(arg) {
|
|
496
|
-
var key = _toPrimitive(arg, "string");
|
|
497
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
function _defineProperty(obj, key, value) {
|
|
501
|
-
key = _toPropertyKey(key);
|
|
502
|
-
if (key in obj) {
|
|
503
|
-
Object.defineProperty(obj, key, {
|
|
504
|
-
value: value,
|
|
505
|
-
enumerable: true,
|
|
506
|
-
configurable: true,
|
|
507
|
-
writable: true
|
|
508
|
-
});
|
|
509
|
-
} else {
|
|
510
|
-
obj[key] = value;
|
|
511
|
-
}
|
|
512
|
-
return obj;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
517
|
var ONE_SECOND_IN_MILLISECONDS = 1000;
|
|
516
518
|
var ONE_MINUTE_IN_MILLISECONDS = 60 * ONE_SECOND_IN_MILLISECONDS;
|
|
517
519
|
var ONE_HOUR_IN_MILLISECONDS = 60 * ONE_MINUTE_IN_MILLISECONDS;
|
|
518
|
-
var
|
|
520
|
+
var UPLOAD_STATUS = {
|
|
521
|
+
uploading: "uploading",
|
|
522
|
+
completed: "completed",
|
|
523
|
+
aborting: "aborting",
|
|
524
|
+
insufficient_data: "insufficient_data",
|
|
525
|
+
error: "error"
|
|
526
|
+
};
|
|
527
|
+
var HAS_CHROME_NAMESPACE = (typeof chrome === "undefined" ? "undefined" : _typeof$1(chrome)) === "object";
|
|
519
528
|
var IS_EXTENSION = HAS_CHROME_NAMESPACE && isNotNil(chrome.extension);
|
|
520
529
|
platform.name === "Safari";
|
|
521
530
|
var MIME_TYPE = {
|
|
@@ -535,9 +544,17 @@ function getChromiumVersion() {
|
|
|
535
544
|
}
|
|
536
545
|
return null;
|
|
537
546
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
547
|
+
function compareChromiumVersions(version1, version2) {
|
|
548
|
+
var v1Parts = version1.split(".").map(Number);
|
|
549
|
+
var v2Parts = version2.split(".").map(Number);
|
|
550
|
+
for (var i = 0; i < Math.max(v1Parts.length, v2Parts.length); i++) {
|
|
551
|
+
var v1Part = v1Parts[i] || 0;
|
|
552
|
+
var v2Part = v2Parts[i] || 0;
|
|
553
|
+
if (v1Part > v2Part) return 1;
|
|
554
|
+
if (v1Part < v2Part) return -1;
|
|
555
|
+
}
|
|
556
|
+
return 0;
|
|
557
|
+
}
|
|
541
558
|
var getSupportedMimeType = function getSupportedMimeType(fallback) {
|
|
542
559
|
if (MediaRecorder.isTypeSupported(MIME_TYPE.mp4)) {
|
|
543
560
|
if (platform.name === "Safari") {
|
|
@@ -547,7 +564,7 @@ var getSupportedMimeType = function getSupportedMimeType(fallback) {
|
|
|
547
564
|
if (isNil(chromiumVersion)) {
|
|
548
565
|
return MIME_TYPE.webmH264;
|
|
549
566
|
}
|
|
550
|
-
var isChromiumVersionSupported =
|
|
567
|
+
var isChromiumVersionSupported = compareChromiumVersions(chromiumVersion, MINIMUM_CHROMIUM_VERSION_FOR_MP4) >= 0;
|
|
551
568
|
if (isChromiumVersionSupported) {
|
|
552
569
|
return MIME_TYPE.mp4;
|
|
553
570
|
}
|
|
@@ -590,7 +607,7 @@ var downloadRecordingBlob = function downloadRecordingBlob(blob, name) {
|
|
|
590
607
|
var hasRecordingDiscarded = function hasRecordingDiscarded(_ref) {
|
|
591
608
|
var recorderStatus = _ref.recorderStatus,
|
|
592
609
|
uploadStatus = _ref.uploadStatus;
|
|
593
|
-
return recorderStatus === SCREEN_RECORDER_STATUS.stopped && uploadStatus === UPLOAD_STATUS.aborting;
|
|
610
|
+
return recorderStatus === SCREEN_RECORDER_STATUS.stopped && uploadStatus === UPLOAD_STATUS$1.aborting;
|
|
594
611
|
};
|
|
595
612
|
var getRecorderTimeLimitInHumanFormat = function getRecorderTimeLimitInHumanFormat(timeInMs) {
|
|
596
613
|
var minutes = Math.floor(timeInMs / (1000 * 60));
|
|
@@ -1040,7 +1057,10 @@ var generatePublicUrl = function generatePublicUrl(recordingId) {
|
|
|
1040
1057
|
|
|
1041
1058
|
var UploadingInProgress = function UploadingInProgress(_ref) {
|
|
1042
1059
|
var recording = _ref.recording,
|
|
1043
|
-
|
|
1060
|
+
uploadProgress = _ref.uploadProgress,
|
|
1061
|
+
uploadStatus = _ref.uploadStatus,
|
|
1062
|
+
onDiscard = _ref.onDiscard,
|
|
1063
|
+
onRetryUpload = _ref.onRetryUpload;
|
|
1044
1064
|
var _useState = useState(""),
|
|
1045
1065
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1046
1066
|
baseURL = _useState2[0],
|
|
@@ -1090,9 +1110,12 @@ var UploadingInProgress = function UploadingInProgress(_ref) {
|
|
|
1090
1110
|
weight: "normal",
|
|
1091
1111
|
children: t("neetoMediaRecorder.record.uploadingRecording")
|
|
1092
1112
|
}), /*#__PURE__*/jsx("div", {
|
|
1093
|
-
className: "pb-3",
|
|
1094
|
-
children: /*#__PURE__*/jsx("
|
|
1095
|
-
className: "nrec-media-upload-
|
|
1113
|
+
className: "nrec-media-upload-progress pb-3",
|
|
1114
|
+
children: uploadStatus === UPLOAD_STATUS.error ? /*#__PURE__*/jsx("div", {
|
|
1115
|
+
className: "nrec-media-upload-error",
|
|
1116
|
+
children: t("neetoMediaRecorder.common.uploadError")
|
|
1117
|
+
}) : /*#__PURE__*/jsx(ProgressBar, {
|
|
1118
|
+
progressPercentage: uploadProgress
|
|
1096
1119
|
})
|
|
1097
1120
|
}), /*#__PURE__*/jsx(Typography, {
|
|
1098
1121
|
className: "select-none",
|
|
@@ -1114,6 +1137,12 @@ var UploadingInProgress = function UploadingInProgress(_ref) {
|
|
|
1114
1137
|
style: "tertiary",
|
|
1115
1138
|
label: isMp4Supported() ? t("neetoMediaRecorder.record.downloadMp4") : t("neetoMediaRecorder.record.downloadWebm"),
|
|
1116
1139
|
onClick: handleRecordingBlobDownload
|
|
1140
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
1141
|
+
"data-cy": "recorder-retry-upload-button",
|
|
1142
|
+
icon: Refresh,
|
|
1143
|
+
label: "Retry",
|
|
1144
|
+
style: "tertiary",
|
|
1145
|
+
onClick: onRetryUpload
|
|
1117
1146
|
}), /*#__PURE__*/jsx(Button, {
|
|
1118
1147
|
"data-cy": "recorder-discard-recording-button",
|
|
1119
1148
|
icon: Close,
|
|
@@ -1267,6 +1296,14 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
|
|
|
1267
1296
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
1268
1297
|
isRestartAlertOpen = _useState4[0],
|
|
1269
1298
|
setIsRestartAlertOpen = _useState4[1];
|
|
1299
|
+
var _useState5 = useState(0),
|
|
1300
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
1301
|
+
uploadProgress = _useState6[0],
|
|
1302
|
+
setUploadProgress = _useState6[1];
|
|
1303
|
+
var _useState7 = useState(false),
|
|
1304
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
1305
|
+
isRetryUpload = _useState8[0],
|
|
1306
|
+
setIsRetryUpload = _useState8[1];
|
|
1270
1307
|
var _useRecorderStore = useRecorderStore(function (store) {
|
|
1271
1308
|
return {
|
|
1272
1309
|
status: store["status"],
|
|
@@ -1297,10 +1334,10 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
|
|
|
1297
1334
|
multipartS3Uploader.initialize(recording.id, uploadId);
|
|
1298
1335
|
var uploadStatus = useMultipartS3UploadStore.getState().status;
|
|
1299
1336
|
var recorderStatus = useRecorderStore.getState().status;
|
|
1300
|
-
if (uploadStatus === UPLOAD_STATUS.uploading) {
|
|
1337
|
+
if (uploadStatus === UPLOAD_STATUS$1.uploading || isRetryUpload) {
|
|
1338
|
+
setIsRetryUpload(false);
|
|
1301
1339
|
multipartS3Uploader.completeUpload();
|
|
1302
|
-
}
|
|
1303
|
-
if (hasRecordingDiscarded({
|
|
1340
|
+
} else if (hasRecordingDiscarded({
|
|
1304
1341
|
recorderStatus: recorderStatus,
|
|
1305
1342
|
uploadStatus: uploadStatus
|
|
1306
1343
|
})) {
|
|
@@ -1347,7 +1384,7 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
|
|
|
1347
1384
|
return multipartS3Uploader.abortUpload();
|
|
1348
1385
|
case 2:
|
|
1349
1386
|
uploadStatus = useMultipartS3UploadStore.getState().status;
|
|
1350
|
-
if (!(uploadStatus === UPLOAD_STATUS.aborting)) {
|
|
1387
|
+
if (!(uploadStatus === UPLOAD_STATUS$1.aborting)) {
|
|
1351
1388
|
_context2.next = 5;
|
|
1352
1389
|
break;
|
|
1353
1390
|
}
|
|
@@ -1391,6 +1428,35 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
|
|
|
1391
1428
|
restartRecording();
|
|
1392
1429
|
setIsRestartAlertOpen(false);
|
|
1393
1430
|
};
|
|
1431
|
+
var handleUploadError = function handleUploadError() {
|
|
1432
|
+
setUploadProgress(0);
|
|
1433
|
+
};
|
|
1434
|
+
var handleUploadProgress = function handleUploadProgress(progress) {
|
|
1435
|
+
setUploadProgress(progress);
|
|
1436
|
+
};
|
|
1437
|
+
var handleReUpload = /*#__PURE__*/function () {
|
|
1438
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
1439
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
1440
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1441
|
+
case 0:
|
|
1442
|
+
setIsRetryUpload(true);
|
|
1443
|
+
setUploadProgress(0);
|
|
1444
|
+
_context4.next = 4;
|
|
1445
|
+
return multipartS3Uploader.abortUpload();
|
|
1446
|
+
case 4:
|
|
1447
|
+
multipartS3Uploader.resetState();
|
|
1448
|
+
multipartS3Uploader.push(screenRecorder.getWebmMediaBlob());
|
|
1449
|
+
handleCreateRecording();
|
|
1450
|
+
case 7:
|
|
1451
|
+
case "end":
|
|
1452
|
+
return _context4.stop();
|
|
1453
|
+
}
|
|
1454
|
+
}, _callee4);
|
|
1455
|
+
}));
|
|
1456
|
+
return function handleReUpload() {
|
|
1457
|
+
return _ref6.apply(this, arguments);
|
|
1458
|
+
};
|
|
1459
|
+
}();
|
|
1394
1460
|
useImperativeHandle(ref, function () {
|
|
1395
1461
|
return {
|
|
1396
1462
|
handleDiscardRecording: function handleDiscardRecording() {
|
|
@@ -1433,17 +1499,22 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
|
|
|
1433
1499
|
return noop;
|
|
1434
1500
|
}, [recorderStatus, error]);
|
|
1435
1501
|
useEffect(function () {
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1502
|
+
var _recorderCallbacks, _uploaderCallbacks;
|
|
1503
|
+
var recorderCallbacks = (_recorderCallbacks = {}, _defineProperty(_recorderCallbacks, SCREEN_RECORDER_EVENT.onDataAvailable, multipartS3Uploader.push), _defineProperty(_recorderCallbacks, SCREEN_RECORDER_EVENT.onStop, multipartS3Uploader.completeUpload), _defineProperty(_recorderCallbacks, SCREEN_RECORDER_EVENT.onDiscard, handleDiscardRecording), _defineProperty(_recorderCallbacks, SCREEN_RECORDER_EVENT.onRestart, handleRestartRecording), _recorderCallbacks);
|
|
1504
|
+
var uploaderCallbacks = (_uploaderCallbacks = {}, _defineProperty(_uploaderCallbacks, UPLOAD_EVENT.onComplete, handleUploadComplete), _defineProperty(_uploaderCallbacks, UPLOAD_EVENT.onError, handleUploadError), _defineProperty(_uploaderCallbacks, UPLOAD_EVENT.onProgress, handleUploadProgress), _uploaderCallbacks);
|
|
1505
|
+
Object.keys(recorderCallbacks).forEach(function (key) {
|
|
1506
|
+
screenRecorder.addCallback(key, recorderCallbacks[key]);
|
|
1507
|
+
});
|
|
1508
|
+
Object.keys(uploaderCallbacks).forEach(function (key) {
|
|
1509
|
+
multipartS3Uploader.addCallback(key, uploaderCallbacks[key]);
|
|
1510
|
+
});
|
|
1441
1511
|
return function () {
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1512
|
+
Object.keys(recorderCallbacks).forEach(function (key) {
|
|
1513
|
+
screenRecorder.removeCallback(key, recorderCallbacks[key]);
|
|
1514
|
+
});
|
|
1515
|
+
Object.keys(uploaderCallbacks).forEach(function (key) {
|
|
1516
|
+
multipartS3Uploader.removeCallback(key, uploaderCallbacks[key]);
|
|
1517
|
+
});
|
|
1447
1518
|
};
|
|
1448
1519
|
}, [recording.id]);
|
|
1449
1520
|
useEffect(function () {
|
|
@@ -1456,7 +1527,7 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
|
|
|
1456
1527
|
};
|
|
1457
1528
|
}, []);
|
|
1458
1529
|
useEffect(function () {
|
|
1459
|
-
if (!isUploadStatus(UPLOAD_STATUS.insufficient_data)) return;
|
|
1530
|
+
if (!isUploadStatus(UPLOAD_STATUS$1.insufficient_data)) return;
|
|
1460
1531
|
handleDiscardRecording();
|
|
1461
1532
|
}, [uploadStatus]);
|
|
1462
1533
|
var shouldShowSafariExtensionCalloutToStartRecording = isRecorderStatus(SCREEN_RECORDER_STATUS.idle) && IS_SAFARI_EXTENSION && error === SCREEN_RECORDER_ERROR.None;
|
|
@@ -1480,13 +1551,16 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
|
|
|
1480
1551
|
})]
|
|
1481
1552
|
});
|
|
1482
1553
|
}
|
|
1483
|
-
if (isRecorderStatus(SCREEN_RECORDER_STATUS.stopped) && isUploadStatus(UPLOAD_STATUS.uploading)) {
|
|
1554
|
+
if (isRetryUpload || isRecorderStatus(SCREEN_RECORDER_STATUS.stopped) && isUploadStatus(UPLOAD_STATUS$1.uploading, UPLOAD_STATUS$1.error)) {
|
|
1484
1555
|
return /*#__PURE__*/jsx(UploadingInProgress, {
|
|
1485
1556
|
recording: recording,
|
|
1486
|
-
|
|
1557
|
+
uploadProgress: uploadProgress,
|
|
1558
|
+
uploadStatus: uploadStatus,
|
|
1559
|
+
onDiscard: handleDiscardRecording,
|
|
1560
|
+
onRetryUpload: handleReUpload
|
|
1487
1561
|
});
|
|
1488
1562
|
}
|
|
1489
|
-
if (isRecorderStatus(SCREEN_RECORDER_STATUS.stopped) && isUploadStatus(UPLOAD_STATUS.completed)) {
|
|
1563
|
+
if (isRecorderStatus(SCREEN_RECORDER_STATUS.stopped) && isUploadStatus(UPLOAD_STATUS$1.completed)) {
|
|
1490
1564
|
return /*#__PURE__*/jsx("div", {
|
|
1491
1565
|
className: "h-screen w-full",
|
|
1492
1566
|
children: /*#__PURE__*/jsx(PageLoader, {})
|