@bigbinary/neeto-media-recorder 2.7.30 → 2.7.31

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.
Files changed (3) hide show
  1. package/index.js +56 -66
  2. package/index.js.map +1 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1940,61 +1940,45 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
1940
1940
  onError(SCREEN_RECORDER_ERROR.InsufficientData);
1941
1941
  }
1942
1942
  }, [elapsedTime]);
1943
- recordingRef.current = recording;
1944
1943
  var handleCreateRecordingError = function handleCreateRecordingError(error) {
1945
1944
  if (isCancelledError(error)) return;
1946
1945
  screenRecorder.setError(SCREEN_RECORDER_ERROR.CreateRecordingError);
1947
1946
  onError(SCREEN_RECORDER_ERROR.CreateRecordingError);
1948
1947
  };
1949
- var handleCreateRecording = /*#__PURE__*/function () {
1950
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
1951
- var payload;
1952
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
1953
- while (1) switch (_context3.prev = _context3.next) {
1948
+ var handleCreateRecording = function handleCreateRecording() {
1949
+ if (!upload) return;
1950
+ recordingRef.current = {};
1951
+ createRecordingPromise.current = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
1952
+ var payload, result;
1953
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1954
+ while (1) switch (_context2.prev = _context2.next) {
1954
1955
  case 0:
1955
- if (upload) {
1956
- _context3.next = 2;
1957
- break;
1958
- }
1959
- return _context3.abrupt("return");
1960
- case 2:
1956
+ _context2.prev = 0;
1961
1957
  payload = {
1962
1958
  folderId: folderId
1963
1959
  };
1964
- _context3.next = 5;
1960
+ _context2.next = 4;
1965
1961
  return getDeviceInfo(mimeType);
1966
- case 5:
1967
- payload.deviceInfo = _context3.sent;
1968
- createRecordingPromise.current = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
1969
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1970
- while (1) switch (_context2.prev = _context2.next) {
1971
- case 0:
1972
- _context2.prev = 0;
1973
- _context2.next = 3;
1974
- return createRecording(payload);
1975
- case 3:
1976
- _context2.next = 8;
1977
- break;
1978
- case 5:
1979
- _context2.prev = 5;
1980
- _context2.t0 = _context2["catch"](0);
1981
- handleCreateRecordingError(_context2.t0);
1982
- case 8:
1983
- case "end":
1984
- return _context2.stop();
1985
- }
1986
- }, _callee2, null, [[0, 5]]);
1987
- }))();
1962
+ case 4:
1963
+ payload.deviceInfo = _context2.sent;
1964
+ _context2.next = 7;
1965
+ return createRecording(payload);
1988
1966
  case 7:
1967
+ result = _context2.sent;
1968
+ if (result !== null && result !== void 0 && result.recording) recordingRef.current = result.recording;
1969
+ _context2.next = 14;
1970
+ break;
1971
+ case 11:
1972
+ _context2.prev = 11;
1973
+ _context2.t0 = _context2["catch"](0);
1974
+ handleCreateRecordingError(_context2.t0);
1975
+ case 14:
1989
1976
  case "end":
1990
- return _context3.stop();
1977
+ return _context2.stop();
1991
1978
  }
1992
- }, _callee3);
1993
- }));
1994
- return function handleCreateRecording() {
1995
- return _ref4.apply(this, arguments);
1996
- };
1997
- }();
1979
+ }, _callee2, null, [[0, 11]]);
1980
+ }))();
1981
+ };
1998
1982
  var handleStopRecording = function handleStopRecording() {
1999
1983
  if (upload) {
2000
1984
  copyRecordingLinkToClipboardOnStop({
@@ -2011,42 +1995,42 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
2011
1995
  return onUploadComplete((_recordingRef$current = recordingRef.current) === null || _recordingRef$current === void 0 ? void 0 : _recordingRef$current.id);
2012
1996
  };
2013
1997
  var handleDiscardRecording = /*#__PURE__*/function () {
2014
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
2015
- var _ref7,
2016
- _ref7$forceAbort,
1998
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
1999
+ var _ref6,
2000
+ _ref6$forceAbort,
2017
2001
  forceAbort,
2018
2002
  multipartS3Uploader,
2019
- _args4 = arguments;
2020
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
2021
- while (1) switch (_context4.prev = _context4.next) {
2003
+ _args3 = arguments;
2004
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
2005
+ while (1) switch (_context3.prev = _context3.next) {
2022
2006
  case 0:
2023
- _ref7 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref7$forceAbort = _ref7.forceAbort, forceAbort = _ref7$forceAbort === void 0 ? false : _ref7$forceAbort;
2007
+ _ref6 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, _ref6$forceAbort = _ref6.forceAbort, forceAbort = _ref6$forceAbort === void 0 ? false : _ref6$forceAbort;
2024
2008
  if (upload) {
2025
- _context4.next = 4;
2009
+ _context3.next = 4;
2026
2010
  break;
2027
2011
  }
2028
2012
  onDiscard();
2029
- return _context4.abrupt("return");
2013
+ return _context3.abrupt("return");
2030
2014
  case 4:
2031
2015
  multipartS3Uploader = getMultipartS3Uploader();
2032
- _context4.next = 7;
2016
+ _context3.next = 7;
2033
2017
  return multipartS3Uploader.abortUpload(forceAbort);
2034
2018
  case 7:
2035
2019
  if (!(multipartS3Uploader.status === UPLOAD_STATUS$1.aborting)) {
2036
- _context4.next = 9;
2020
+ _context3.next = 9;
2037
2021
  break;
2038
2022
  }
2039
- return _context4.abrupt("return");
2023
+ return _context3.abrupt("return");
2040
2024
  case 9:
2041
2025
  onDiscard();
2042
2026
  case 10:
2043
2027
  case "end":
2044
- return _context4.stop();
2028
+ return _context3.stop();
2045
2029
  }
2046
- }, _callee4);
2030
+ }, _callee3);
2047
2031
  }));
2048
2032
  return function handleDiscardRecording() {
2049
- return _ref6.apply(this, arguments);
2033
+ return _ref5.apply(this, arguments);
2050
2034
  };
2051
2035
  }();
2052
2036
  var handleRestartRecording = function handleRestartRecording() {
@@ -2098,6 +2082,12 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
2098
2082
  newMultipartS3Uploader.addCallback(key, uploaderCallbacks[key]);
2099
2083
  });
2100
2084
  handleCreateRecording();
2085
+ copyRecordingLinkToClipboardOnStop({
2086
+ createRecordingPromise: createRecordingPromise,
2087
+ recordingRef: recordingRef,
2088
+ baseURLRef: baseURLRef,
2089
+ successMessage: t("neetoMediaRecorder.record.copyToClipboardToastrMessage")
2090
+ });
2101
2091
  };
2102
2092
  useImperativeHandle(ref, function () {
2103
2093
  return {
@@ -2121,25 +2111,25 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
2121
2111
  var multipartS3Uploader = upload ? getMultipartS3Uploader({
2122
2112
  initialize: true
2123
2113
  }) : null;
2124
- var recorderCallbacks = (_recorderCallbacks = {}, _defineProperty(_recorderCallbacks, SCREEN_RECORDER_EVENT.onDataAvailable, upload ? multipartS3Uploader.push : noop), _defineProperty(_recorderCallbacks, SCREEN_RECORDER_EVENT.onStop, _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
2114
+ var recorderCallbacks = (_recorderCallbacks = {}, _defineProperty(_recorderCallbacks, SCREEN_RECORDER_EVENT.onDataAvailable, upload ? multipartS3Uploader.push : noop), _defineProperty(_recorderCallbacks, SCREEN_RECORDER_EVENT.onStop, _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
2125
2115
  var blob;
2126
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
2127
- while (1) switch (_context5.prev = _context5.next) {
2116
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
2117
+ while (1) switch (_context4.prev = _context4.next) {
2128
2118
  case 0:
2129
2119
  if (upload) {
2130
- _context5.next = 5;
2120
+ _context4.next = 5;
2131
2121
  break;
2132
2122
  }
2133
2123
  blob = screenRecorder.getWebmMediaBlob();
2134
2124
  RequestedRecordingCallback(blob);
2135
2125
  onRecordingCompleted(blob);
2136
- return _context5.abrupt("return");
2126
+ return _context4.abrupt("return");
2137
2127
  case 5:
2138
2128
  if (!createRecordingPromise.current) {
2139
- _context5.next = 9;
2129
+ _context4.next = 9;
2140
2130
  break;
2141
2131
  }
2142
- _context5.next = 8;
2132
+ _context4.next = 8;
2143
2133
  return createRecordingPromise.current;
2144
2134
  case 8:
2145
2135
  createRecordingPromise.current = null;
@@ -2147,9 +2137,9 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
2147
2137
  multipartS3Uploader.completeUpload();
2148
2138
  case 10:
2149
2139
  case "end":
2150
- return _context5.stop();
2140
+ return _context4.stop();
2151
2141
  }
2152
- }, _callee5);
2142
+ }, _callee4);
2153
2143
  }))), _defineProperty(_recorderCallbacks, SCREEN_RECORDER_EVENT.onDiscard, handleDiscardRecording), _defineProperty(_recorderCallbacks, SCREEN_RECORDER_EVENT.onRestart, handleRestartRecording), _recorderCallbacks);
2154
2144
  Object.keys(recorderCallbacks).forEach(function (key) {
2155
2145
  screenRecorder.addCallback(key, recorderCallbacks[key]);