@bigbinary/neeto-media-recorder 2.1.0 → 2.1.2-beta
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/core.js +47 -18
- package/core.js.map +1 -1
- package/index.js +4 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
package/core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { isPresent, isNotEmpty, isNot, existsBy } from '@bigbinary/neeto-cist';
|
|
3
|
-
import { RETRIABLE_ERRORS, UPLOAD_STATUS, UPLOAD_EVENT, SCREEN_RECORDER_STATUS, START_RECORDING_SOUND, RECORDING_LIMIT_REACHED_WARNING_SOUND, MIME_TYPE as MIME_TYPE$1, SCREEN_RECORDER_ERROR, SCREEN_RECORDER_EVENT, RECORDING_TIME_LIMIT_FREE_PLAN, ONE_SECOND, HALF_A_SECOND_IN_MILLISECONDS, ONE_SECOND_IN_MILLISECONDS, TWO_HUNDRED_MILLISECONDS, ONE_MINUTE_IN_MILLISECONDS, STOP_RECORDING_DUE_TO_LIMIT_REACHED_SOUND } from '@bigbinary/neeto-media-recorder/constants';
|
|
3
|
+
import { RETRIABLE_ERRORS, UPLOAD_STATUS, UPLOAD_EVENT, SCREEN_RECORDER_STATUS, START_RECORDING_SOUND, RECORDING_LIMIT_REACHED_WARNING_SOUND, MIME_TYPE as MIME_TYPE$1, SCREEN_RECORDER_ERROR, SCREEN_RECORDER_EVENT, RECORDING_TIME_LIMIT_FREE_PLAN, ONE_SECOND, HALF_A_SECOND_IN_MILLISECONDS, ONE_SECOND_IN_MILLISECONDS, TWO_HUNDRED_MILLISECONDS, ONE_MINUTE_IN_MILLISECONDS, STOP_RECORDING_DUE_TO_LIMIT_REACHED_SOUND, IS_EXTENSION } from '@bigbinary/neeto-media-recorder/constants';
|
|
4
4
|
import { isNotNil, min, identity, isEmpty, isNil, pick, equals, not } from 'ramda';
|
|
5
5
|
import platform from 'platform';
|
|
6
6
|
import withImmutableActions from '@bigbinary/neeto-commons-frontend/react-utils/withImmutableActions';
|
|
@@ -1133,7 +1133,7 @@ var MultipartS3Uploader = /*#__PURE__*/function () {
|
|
|
1133
1133
|
}, {
|
|
1134
1134
|
key: "hasSufficientData",
|
|
1135
1135
|
get: function get() {
|
|
1136
|
-
return isNotEmpty(_classPrivateFieldGet(this, _unUploadedChunks)) || isNotEmpty(_classPrivateFieldGet(this, _s3PartUploadPromises));
|
|
1136
|
+
return isNotEmpty(_classPrivateFieldGet(this, _unUploadedChunks)) || isNotEmpty(_classPrivateFieldGet(this, _pendingS3ChunkUploads)) || isNotEmpty(_classPrivateFieldGet(this, _s3PartUploadPromises));
|
|
1137
1137
|
}
|
|
1138
1138
|
}]);
|
|
1139
1139
|
return MultipartS3Uploader;
|
|
@@ -1270,6 +1270,7 @@ var _recordingLimitWarningAudio = /*#__PURE__*/new WeakMap();
|
|
|
1270
1270
|
var _stopRecordingDueToLimitReachedAudio = /*#__PURE__*/new WeakMap();
|
|
1271
1271
|
var _stream = /*#__PURE__*/new WeakMap();
|
|
1272
1272
|
var _audioStream = /*#__PURE__*/new WeakMap();
|
|
1273
|
+
var _audioContext = /*#__PURE__*/new WeakMap();
|
|
1273
1274
|
var _timeLimit = /*#__PURE__*/new WeakMap();
|
|
1274
1275
|
var _startRecordingTimeoutID = /*#__PURE__*/new WeakMap();
|
|
1275
1276
|
var _checkCompatibility = /*#__PURE__*/new WeakMap();
|
|
@@ -1346,6 +1347,10 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
1346
1347
|
writable: true,
|
|
1347
1348
|
value: void 0
|
|
1348
1349
|
});
|
|
1350
|
+
_classPrivateFieldInitSpec(this, _audioContext, {
|
|
1351
|
+
writable: true,
|
|
1352
|
+
value: void 0
|
|
1353
|
+
});
|
|
1349
1354
|
_classPrivateFieldInitSpec(this, _timeLimit, {
|
|
1350
1355
|
writable: true,
|
|
1351
1356
|
value: RECORDING_TIME_LIMIT_FREE_PLAN
|
|
@@ -1568,34 +1573,58 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
1568
1573
|
writable: true,
|
|
1569
1574
|
value: function () {
|
|
1570
1575
|
var _value = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
1571
|
-
var stream, audioStream, finalStream, audioContext, desktopAudio, microphoneAudio, combinedAudio;
|
|
1576
|
+
var isAudioWorkletLoaded, stream, workletUrl, audioStream, audioStreamSource, destinationStream, noiseSuppressorNode, finalStream, audioContext, desktopAudio, microphoneAudio, combinedAudio;
|
|
1572
1577
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
1573
1578
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1574
1579
|
case 0:
|
|
1575
1580
|
_classPrivateFieldGet(_this, _store).setState({
|
|
1576
1581
|
status: SCREEN_RECORDER_STATUS.acquiring_media
|
|
1577
1582
|
});
|
|
1578
|
-
|
|
1583
|
+
isAudioWorkletLoaded = false;
|
|
1584
|
+
_context2.prev = 2;
|
|
1579
1585
|
if (!_classPrivateFieldGet(_this, _audio)) {
|
|
1580
|
-
_context2.next =
|
|
1586
|
+
_context2.next = 19;
|
|
1581
1587
|
break;
|
|
1582
1588
|
}
|
|
1583
|
-
|
|
1589
|
+
_classPrivateFieldSet(_this, _audioContext, new AudioContext());
|
|
1590
|
+
_context2.prev = 5;
|
|
1591
|
+
workletUrl = IS_EXTENSION ? chrome.runtime.getURL("public/NoiseSuppressorWorklet.js") : "NoiseSuppressorWorklet.js";
|
|
1592
|
+
_context2.next = 9;
|
|
1593
|
+
return _classPrivateFieldGet(_this, _audioContext).audioWorklet.addModule(workletUrl);
|
|
1594
|
+
case 9:
|
|
1595
|
+
isAudioWorkletLoaded = true;
|
|
1596
|
+
_context2.next = 15;
|
|
1597
|
+
break;
|
|
1598
|
+
case 12:
|
|
1599
|
+
_context2.prev = 12;
|
|
1600
|
+
_context2.t0 = _context2["catch"](5);
|
|
1601
|
+
console.error("Failed to load audio worklet:", _context2.t0);
|
|
1602
|
+
case 15:
|
|
1603
|
+
_context2.next = 17;
|
|
1584
1604
|
return window.navigator.mediaDevices.getUserMedia({
|
|
1585
1605
|
audio: _classPrivateFieldGet(_this, _audio) ? _objectSpread({
|
|
1586
1606
|
echoCancellation: false
|
|
1587
1607
|
}, _classPrivateFieldGet(_this, _audio)) : false
|
|
1588
1608
|
});
|
|
1589
|
-
case
|
|
1609
|
+
case 17:
|
|
1590
1610
|
audioStream = _context2.sent;
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1611
|
+
if (isAudioWorkletLoaded) {
|
|
1612
|
+
audioStreamSource = _classPrivateFieldGet(_this, _audioContext).createMediaStreamSource(audioStream);
|
|
1613
|
+
destinationStream = _classPrivateFieldGet(_this, _audioContext).createMediaStreamDestination();
|
|
1614
|
+
noiseSuppressorNode = new AudioWorkletNode(_classPrivateFieldGet(_this, _audioContext), "nn-suppressor-processor");
|
|
1615
|
+
audioStreamSource.connect(noiseSuppressorNode);
|
|
1616
|
+
noiseSuppressorNode.connect(destinationStream);
|
|
1617
|
+
_classPrivateFieldSet(_this, _audioStream, destinationStream.stream);
|
|
1618
|
+
} else {
|
|
1619
|
+
_classPrivateFieldSet(_this, _audioStream, audioStream);
|
|
1620
|
+
}
|
|
1621
|
+
case 19:
|
|
1622
|
+
_context2.next = 21;
|
|
1594
1623
|
return window.navigator.mediaDevices.getDisplayMedia({
|
|
1595
1624
|
video: _classPrivateFieldGet(_this, _video) || true,
|
|
1596
1625
|
audio: true
|
|
1597
1626
|
});
|
|
1598
|
-
case
|
|
1627
|
+
case 21:
|
|
1599
1628
|
stream = _context2.sent;
|
|
1600
1629
|
// Event triggered when the user clicks on the stop sharing overlay button
|
|
1601
1630
|
stream.getVideoTracks()[0].addEventListener("ended", function () {
|
|
@@ -1627,11 +1656,11 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
1627
1656
|
_classPrivateFieldGet(_this, _store).setState({
|
|
1628
1657
|
status: SCREEN_RECORDER_STATUS.media_acquired
|
|
1629
1658
|
});
|
|
1630
|
-
_context2.next =
|
|
1659
|
+
_context2.next = 34;
|
|
1631
1660
|
break;
|
|
1632
|
-
case
|
|
1633
|
-
_context2.prev =
|
|
1634
|
-
_context2.
|
|
1661
|
+
case 31:
|
|
1662
|
+
_context2.prev = 31;
|
|
1663
|
+
_context2.t1 = _context2["catch"](2);
|
|
1635
1664
|
if (_classPrivateFieldGet(_this, _audio) && !_classPrivateFieldGet(_this, _audioStream)) {
|
|
1636
1665
|
_classPrivateFieldGet(_this, _store).setState({
|
|
1637
1666
|
error: SCREEN_RECORDER_ERROR.MicPermissionDenied,
|
|
@@ -1639,15 +1668,15 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
1639
1668
|
});
|
|
1640
1669
|
} else if (!stream) {
|
|
1641
1670
|
_classPrivateFieldGet(_this, _store).setState({
|
|
1642
|
-
error: SCREEN_RECORDER_ERROR[_context2.
|
|
1671
|
+
error: SCREEN_RECORDER_ERROR[_context2.t1.name],
|
|
1643
1672
|
status: SCREEN_RECORDER_STATUS.idle
|
|
1644
1673
|
});
|
|
1645
1674
|
}
|
|
1646
|
-
case
|
|
1675
|
+
case 34:
|
|
1647
1676
|
case "end":
|
|
1648
1677
|
return _context2.stop();
|
|
1649
1678
|
}
|
|
1650
|
-
}, _callee2, null, [[
|
|
1679
|
+
}, _callee2, null, [[2, 31], [5, 12]]);
|
|
1651
1680
|
}));
|
|
1652
1681
|
function value() {
|
|
1653
1682
|
return _value.apply(this, arguments);
|