@bigbinary/neeto-media-recorder 2.6.10 → 2.6.12-beta.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/README.md +10 -0
- package/core.js +44 -20
- package/core.js.map +1 -1
- package/index.js +47 -51
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -18,9 +18,9 @@ import withT from '@bigbinary/neeto-commons-frontend/react-utils/withT';
|
|
|
18
18
|
import Spinner from '@bigbinary/neetoui/Spinner';
|
|
19
19
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
20
20
|
import Computer from '@bigbinary/neeto-icons/Computer';
|
|
21
|
-
import Delete from '@bigbinary/neeto-icons/Delete';
|
|
22
21
|
import Pause from '@bigbinary/neeto-icons/Pause';
|
|
23
22
|
import Unlock from '@bigbinary/neeto-icons/Unlock';
|
|
23
|
+
import Delete from '@bigbinary/neeto-icons/Delete';
|
|
24
24
|
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';
|
|
@@ -527,7 +527,7 @@ var MIME_TYPE = {
|
|
|
527
527
|
// 2 hours
|
|
528
528
|
|
|
529
529
|
var getSupportedMimeType = function getSupportedMimeType() {
|
|
530
|
-
return MIME_TYPE.
|
|
530
|
+
return MIME_TYPE.mp4;
|
|
531
531
|
};
|
|
532
532
|
|
|
533
533
|
var formatTime = function formatTime(time) {
|
|
@@ -578,41 +578,44 @@ var getRecorderTimeLimitInHumanFormat = function getRecorderTimeLimitInHumanForm
|
|
|
578
578
|
var getDeviceInfo = /*#__PURE__*/function () {
|
|
579
579
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
580
580
|
var _yield$chrome$storage, _platform$os;
|
|
581
|
-
var
|
|
581
|
+
var mimeType,
|
|
582
|
+
isCameraEnabled,
|
|
583
|
+
_args = arguments;
|
|
582
584
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
583
585
|
while (1) switch (_context.prev = _context.next) {
|
|
584
586
|
case 0:
|
|
587
|
+
mimeType = _args.length > 0 && _args[0] !== undefined ? _args[0] : getSupportedMimeType();
|
|
585
588
|
if (!IS_EXTENSION$1) {
|
|
586
|
-
_context.next =
|
|
589
|
+
_context.next = 16;
|
|
587
590
|
break;
|
|
588
591
|
}
|
|
589
|
-
_context.next =
|
|
592
|
+
_context.next = 4;
|
|
590
593
|
return chrome.storage.local.get("isCameraOn");
|
|
591
|
-
case
|
|
594
|
+
case 4:
|
|
592
595
|
_context.t2 = _yield$chrome$storage = _context.sent;
|
|
593
596
|
_context.t1 = _context.t2 === null;
|
|
594
597
|
if (_context.t1) {
|
|
595
|
-
_context.next =
|
|
598
|
+
_context.next = 8;
|
|
596
599
|
break;
|
|
597
600
|
}
|
|
598
601
|
_context.t1 = _yield$chrome$storage === void 0;
|
|
599
|
-
case
|
|
602
|
+
case 8:
|
|
600
603
|
if (!_context.t1) {
|
|
601
|
-
_context.next =
|
|
604
|
+
_context.next = 12;
|
|
602
605
|
break;
|
|
603
606
|
}
|
|
604
607
|
_context.t3 = void 0;
|
|
605
|
-
_context.next =
|
|
608
|
+
_context.next = 13;
|
|
606
609
|
break;
|
|
607
|
-
case 11:
|
|
608
|
-
_context.t3 = _yield$chrome$storage.isCameraOn;
|
|
609
610
|
case 12:
|
|
611
|
+
_context.t3 = _yield$chrome$storage.isCameraOn;
|
|
612
|
+
case 13:
|
|
610
613
|
_context.t0 = _context.t3;
|
|
611
|
-
_context.next =
|
|
614
|
+
_context.next = 17;
|
|
612
615
|
break;
|
|
613
|
-
case 15:
|
|
614
|
-
_context.t0 = false;
|
|
615
616
|
case 16:
|
|
617
|
+
_context.t0 = false;
|
|
618
|
+
case 17:
|
|
616
619
|
isCameraEnabled = _context.t0;
|
|
617
620
|
return _context.abrupt("return", {
|
|
618
621
|
os: (_platform$os = platform.os) === null || _platform$os === void 0 ? void 0 : _platform$os.toString(),
|
|
@@ -620,9 +623,10 @@ var getDeviceInfo = /*#__PURE__*/function () {
|
|
|
620
623
|
browser: "".concat(platform.name, " v").concat(platform.version),
|
|
621
624
|
isCameraEnabled: isCameraEnabled,
|
|
622
625
|
isMicEnabled: !!screenRecorder.audioConfiguration,
|
|
623
|
-
displaySurface: screenRecorder.displaySurface
|
|
626
|
+
displaySurface: screenRecorder.displaySurface,
|
|
627
|
+
mimeType: mimeType
|
|
624
628
|
});
|
|
625
|
-
case
|
|
629
|
+
case 19:
|
|
626
630
|
case "end":
|
|
627
631
|
return _context.stop();
|
|
628
632
|
}
|
|
@@ -633,7 +637,8 @@ var getDeviceInfo = /*#__PURE__*/function () {
|
|
|
633
637
|
};
|
|
634
638
|
}();
|
|
635
639
|
var isMp4Supported = function isMp4Supported() {
|
|
636
|
-
|
|
640
|
+
var mimeType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getSupportedMimeType();
|
|
641
|
+
return mimeType === MIME_TYPE$1.mp4;
|
|
637
642
|
};
|
|
638
643
|
|
|
639
644
|
var baseUrl = "/api/v1/recordings";
|
|
@@ -641,7 +646,7 @@ var create = function create(deviceInfo) {
|
|
|
641
646
|
return axios.post(baseUrl, {
|
|
642
647
|
recording: {
|
|
643
648
|
deviceInfo: deviceInfo,
|
|
644
|
-
isMp4: isMp4Supported()
|
|
649
|
+
isMp4: isMp4Supported(deviceInfo.mimeType)
|
|
645
650
|
}
|
|
646
651
|
});
|
|
647
652
|
};
|
|
@@ -875,45 +880,33 @@ var Controls = function Controls(_ref) {
|
|
|
875
880
|
}), isStatus(SCREEN_RECORDER_STATUS.recording) && /*#__PURE__*/jsx(Button, {
|
|
876
881
|
className: "flex-shrink-0",
|
|
877
882
|
"data-cy": "media-recorder-pause-button",
|
|
878
|
-
size: "large",
|
|
879
883
|
style: "text",
|
|
880
|
-
icon: function icon() {
|
|
881
|
-
return /*#__PURE__*/jsx(Pause, {
|
|
882
|
-
className: "nr-control-button__icon--neeto",
|
|
883
|
-
size: 28
|
|
884
|
-
});
|
|
885
|
-
},
|
|
886
884
|
tooltipProps: {
|
|
887
885
|
content: t("neetoMediaRecorder.record.pause"),
|
|
888
886
|
position: "top"
|
|
889
887
|
},
|
|
890
|
-
onClick: pauseRecording
|
|
888
|
+
onClick: pauseRecording,
|
|
889
|
+
children: /*#__PURE__*/jsx(Pause, {
|
|
890
|
+
className: "nr-control-button__icon--neeto",
|
|
891
|
+
size: 28
|
|
892
|
+
})
|
|
891
893
|
}), isStatus(SCREEN_RECORDER_STATUS.paused) && /*#__PURE__*/jsx(Button, {
|
|
892
894
|
className: "flex-shrink-0",
|
|
893
895
|
"data-cy": "media-recorder-play-button",
|
|
894
|
-
icon: function icon() {
|
|
895
|
-
return /*#__PURE__*/jsx(PlayIcon, {
|
|
896
|
-
size: 28
|
|
897
|
-
});
|
|
898
|
-
},
|
|
899
|
-
size: "large",
|
|
900
896
|
style: "text",
|
|
901
897
|
tooltipProps: {
|
|
902
898
|
content: t("neetoMediaRecorder.record.resume"),
|
|
903
899
|
position: "top"
|
|
904
900
|
},
|
|
905
|
-
onClick: resumeRecording
|
|
901
|
+
onClick: resumeRecording,
|
|
902
|
+
children: /*#__PURE__*/jsx(PlayIcon, {
|
|
903
|
+
size: 28
|
|
904
|
+
})
|
|
906
905
|
}), hasRecordingStarted && /*#__PURE__*/jsxs("div", {
|
|
907
906
|
className: "flex items-center gap-3",
|
|
908
907
|
children: [/*#__PURE__*/jsx(Button, {
|
|
909
908
|
className: "flex-shrink-0",
|
|
910
909
|
"data-cy": "media-recorder-restart-button",
|
|
911
|
-
icon: function icon() {
|
|
912
|
-
return /*#__PURE__*/jsx(RestartIcon, {
|
|
913
|
-
size: 28
|
|
914
|
-
});
|
|
915
|
-
},
|
|
916
|
-
size: "large",
|
|
917
910
|
style: "text",
|
|
918
911
|
tooltipProps: {
|
|
919
912
|
content: t("neetoMediaRecorder.record.restart"),
|
|
@@ -921,25 +914,25 @@ var Controls = function Controls(_ref) {
|
|
|
921
914
|
},
|
|
922
915
|
onClick: function onClick() {
|
|
923
916
|
return setIsRestartAlertOpen(true);
|
|
924
|
-
}
|
|
917
|
+
},
|
|
918
|
+
children: /*#__PURE__*/jsx(RestartIcon, {
|
|
919
|
+
size: 28
|
|
920
|
+
})
|
|
925
921
|
}), /*#__PURE__*/jsx(Button, {
|
|
926
922
|
className: "flex-shrink-0",
|
|
927
923
|
"data-cy": "media-recorder-discard-button",
|
|
928
|
-
size: "large",
|
|
929
924
|
style: "text",
|
|
930
|
-
icon: function icon() {
|
|
931
|
-
return /*#__PURE__*/jsx(Delete, {
|
|
932
|
-
className: "nr-control-button__icon--neeto",
|
|
933
|
-
size: 28
|
|
934
|
-
});
|
|
935
|
-
},
|
|
936
925
|
tooltipProps: {
|
|
937
926
|
content: t("neetoMediaRecorder.record.discard"),
|
|
938
927
|
position: "top"
|
|
939
928
|
},
|
|
940
929
|
onClick: function onClick() {
|
|
941
930
|
return setIsDiscardAlertOpen(true);
|
|
942
|
-
}
|
|
931
|
+
},
|
|
932
|
+
children: /*#__PURE__*/jsx(Delete, {
|
|
933
|
+
className: "nr-control-button__icon--neeto",
|
|
934
|
+
size: 28
|
|
935
|
+
})
|
|
943
936
|
})]
|
|
944
937
|
})]
|
|
945
938
|
});
|
|
@@ -1284,7 +1277,9 @@ var MediaRecorder = function MediaRecorder(_ref, ref) {
|
|
|
1284
1277
|
_ref$onDiscard = _ref.onDiscard,
|
|
1285
1278
|
onDiscard = _ref$onDiscard === void 0 ? noop : _ref$onDiscard,
|
|
1286
1279
|
_ref$appName = _ref.appName,
|
|
1287
|
-
appName = _ref$appName === void 0 ? globalProps.appName : _ref$appName
|
|
1280
|
+
appName = _ref$appName === void 0 ? globalProps.appName : _ref$appName,
|
|
1281
|
+
_ref$mimeType = _ref.mimeType,
|
|
1282
|
+
mimeType = _ref$mimeType === void 0 ? getSupportedMimeType() : _ref$mimeType;
|
|
1288
1283
|
var _useTranslation = useTranslation(),
|
|
1289
1284
|
t = _useTranslation.t;
|
|
1290
1285
|
var _useState = useState(false),
|
|
@@ -1335,6 +1330,7 @@ var MediaRecorder = function MediaRecorder(_ref, ref) {
|
|
|
1335
1330
|
uploadId = _ref2.uploadId;
|
|
1336
1331
|
var multipartS3Uploader = getMultipartS3Uploader();
|
|
1337
1332
|
multipartS3Uploader.setRecording(recording.id, uploadId);
|
|
1333
|
+
multipartS3Uploader.setMimeType(mimeType);
|
|
1338
1334
|
var uploadStatus = multipartS3Uploader.status;
|
|
1339
1335
|
var recorderStatus = useRecorderStore.getState().status;
|
|
1340
1336
|
if (uploadStatus === UPLOAD_STATUS$1.uploading || isRetryUpload) {
|
|
@@ -1364,7 +1360,7 @@ var MediaRecorder = function MediaRecorder(_ref, ref) {
|
|
|
1364
1360
|
while (1) switch (_context.prev = _context.next) {
|
|
1365
1361
|
case 0:
|
|
1366
1362
|
_context.next = 2;
|
|
1367
|
-
return getDeviceInfo();
|
|
1363
|
+
return getDeviceInfo(mimeType);
|
|
1368
1364
|
case 2:
|
|
1369
1365
|
deviceInfo = _context.sent;
|
|
1370
1366
|
createRecordingPromise.current = createRecording(deviceInfo);
|