@bigbinary/neeto-media-recorder 2.7.30 → 2.7.32
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 +50 -27
- package/core.js.map +1 -1
- package/index.js +56 -66
- package/index.js.map +1 -1
- package/package.json +1 -1
package/core.js
CHANGED
|
@@ -1550,6 +1550,7 @@ var _timeLimit = /*#__PURE__*/new WeakMap();
|
|
|
1550
1550
|
var _startRecordingTimeoutID = /*#__PURE__*/new WeakMap();
|
|
1551
1551
|
var _enableNoiseCancellation = /*#__PURE__*/new WeakMap();
|
|
1552
1552
|
var _showCountdown = /*#__PURE__*/new WeakMap();
|
|
1553
|
+
var _playCountdownAudio = /*#__PURE__*/new WeakMap();
|
|
1553
1554
|
var _mimeType = /*#__PURE__*/new WeakMap();
|
|
1554
1555
|
var _dataReceiving = /*#__PURE__*/new WeakMap();
|
|
1555
1556
|
var _recordSystemAudio = /*#__PURE__*/new WeakMap();
|
|
@@ -1567,6 +1568,10 @@ var _startTimer = /*#__PURE__*/new WeakMap();
|
|
|
1567
1568
|
var _stopTimer = /*#__PURE__*/new WeakMap();
|
|
1568
1569
|
var _checkIfTimeLimitReached = /*#__PURE__*/new WeakMap();
|
|
1569
1570
|
var ScreenRecorder = /*#__PURE__*/function () {
|
|
1571
|
+
// Lets a host (e.g. the chrome extension) take over the countdown beeps and
|
|
1572
|
+
// recording-start chime so it can schedule them via Web Audio. Defaults to
|
|
1573
|
+
// true to preserve behavior for callers that don't manage audio themselves.
|
|
1574
|
+
|
|
1570
1575
|
function ScreenRecorder(_audio2, video) {
|
|
1571
1576
|
var _this = this;
|
|
1572
1577
|
_classCallCheck(this, ScreenRecorder);
|
|
@@ -1662,6 +1667,10 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
1662
1667
|
writable: true,
|
|
1663
1668
|
value: true
|
|
1664
1669
|
});
|
|
1670
|
+
_classPrivateFieldInitSpec(this, _playCountdownAudio, {
|
|
1671
|
+
writable: true,
|
|
1672
|
+
value: true
|
|
1673
|
+
});
|
|
1665
1674
|
_classPrivateFieldInitSpec(this, _mimeType, {
|
|
1666
1675
|
writable: true,
|
|
1667
1676
|
value: getSupportedMimeType()
|
|
@@ -1718,6 +1727,9 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
1718
1727
|
_defineProperty(this, "setShowCountdown", function (showCountdown) {
|
|
1719
1728
|
return _classPrivateFieldSet(_this, _showCountdown, showCountdown);
|
|
1720
1729
|
});
|
|
1730
|
+
_defineProperty(this, "setPlayCountdownAudio", function (value) {
|
|
1731
|
+
return _classPrivateFieldSet(_this, _playCountdownAudio, value);
|
|
1732
|
+
});
|
|
1721
1733
|
_defineProperty(this, "setTimeLimit", function () {
|
|
1722
1734
|
var timeLimit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : RECORDING_TIME_LIMIT_FREE_PLAN;
|
|
1723
1735
|
return _classPrivateFieldSet(_this, _timeLimit, timeLimit);
|
|
@@ -1970,9 +1982,10 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
1970
1982
|
_classPrivateFieldGet(_this, _fireCallbacks).call(_this, SCREEN_RECORDER_EVENT.onShareSelected);
|
|
1971
1983
|
case 13:
|
|
1972
1984
|
if (!_classPrivateFieldGet(_this, _audio)) {
|
|
1973
|
-
_context2.next =
|
|
1985
|
+
_context2.next = 48;
|
|
1974
1986
|
break;
|
|
1975
1987
|
}
|
|
1988
|
+
_context2.prev = 14;
|
|
1976
1989
|
audioConfig = {
|
|
1977
1990
|
audio: _objectSpread(_objectSpread({
|
|
1978
1991
|
echoCancellation: false
|
|
@@ -1986,38 +1999,49 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
1986
1999
|
_context2.t0 = _classPrivateFieldSet;
|
|
1987
2000
|
_context2.t1 = _this;
|
|
1988
2001
|
_context2.t2 = _micAudioStream;
|
|
1989
|
-
_context2.next =
|
|
2002
|
+
_context2.next = 22;
|
|
1990
2003
|
return window.navigator.mediaDevices.getUserMedia(audioConfig);
|
|
1991
|
-
case
|
|
2004
|
+
case 22:
|
|
1992
2005
|
_context2.t3 = _context2.sent;
|
|
1993
2006
|
(0, _context2.t0)(_context2.t1, _context2.t2, _context2.t3);
|
|
1994
2007
|
audioStream = addGainNode(_classPrivateFieldGet(_this, _micAudioStream), 1.75); // Increase volume by 50%
|
|
1995
2008
|
_classPrivateFieldSet(_this, _audioStream, audioStream);
|
|
1996
2009
|
if (!_classPrivateFieldGet(_this, _enableNoiseCancellation)) {
|
|
1997
|
-
_context2.next =
|
|
2010
|
+
_context2.next = 43;
|
|
1998
2011
|
break;
|
|
1999
2012
|
}
|
|
2000
|
-
_context2.prev =
|
|
2013
|
+
_context2.prev = 27;
|
|
2001
2014
|
workletUrl = IS_EXTENSION ?
|
|
2002
2015
|
// eslint-disable-next-line no-undef
|
|
2003
2016
|
chrome.runtime.getURL("public/NoiseSuppressorWorklet.js") : "NoiseSuppressorWorklet.js";
|
|
2004
2017
|
audioContext = new AudioContext();
|
|
2005
|
-
_context2.next =
|
|
2018
|
+
_context2.next = 32;
|
|
2006
2019
|
return audioContext.audioWorklet.addModule(workletUrl);
|
|
2007
|
-
case
|
|
2020
|
+
case 32:
|
|
2008
2021
|
audioStreamSource = audioContext.createMediaStreamSource(audioStream);
|
|
2009
2022
|
destinationStream = audioContext.createMediaStreamDestination();
|
|
2010
2023
|
noiseSuppressorNode = new AudioWorkletNode(audioContext, "nn-suppressor-processor");
|
|
2011
2024
|
audioStreamSource.connect(noiseSuppressorNode);
|
|
2012
2025
|
noiseSuppressorNode.connect(destinationStream);
|
|
2013
2026
|
_classPrivateFieldSet(_this, _audioStream, destinationStream.stream);
|
|
2014
|
-
_context2.next =
|
|
2027
|
+
_context2.next = 43;
|
|
2028
|
+
break;
|
|
2029
|
+
case 40:
|
|
2030
|
+
_context2.prev = 40;
|
|
2031
|
+
_context2.t4 = _context2["catch"](27);
|
|
2032
|
+
_classPrivateFieldGet(_this, _logger).error("Failed to load audio worklet:", _context2.t4);
|
|
2033
|
+
case 43:
|
|
2034
|
+
_context2.next = 48;
|
|
2015
2035
|
break;
|
|
2016
|
-
case
|
|
2017
|
-
_context2.prev =
|
|
2018
|
-
_context2.
|
|
2019
|
-
|
|
2020
|
-
|
|
2036
|
+
case 45:
|
|
2037
|
+
_context2.prev = 45;
|
|
2038
|
+
_context2.t5 = _context2["catch"](14);
|
|
2039
|
+
// Mic access can fail independently of screen capture (OS-level
|
|
2040
|
+
// block, no device, deviceId mismatch). Screen sharing already
|
|
2041
|
+
// succeeded, so fall back to a video-only recording instead of
|
|
2042
|
+
// surfacing the failure as a screen permission error.
|
|
2043
|
+
_classPrivateFieldGet(_this, _logger).info("screenRecorder -> mic unavailable, recording without audio", _context2.t5 === null || _context2.t5 === void 0 ? void 0 : _context2.t5.name, _context2.t5 === null || _context2.t5 === void 0 ? void 0 : _context2.t5.message);
|
|
2044
|
+
case 48:
|
|
2021
2045
|
// Event triggered when the user clicks on the stop sharing overlay button
|
|
2022
2046
|
stream.getVideoTracks()[0].addEventListener("ended", function () {
|
|
2023
2047
|
_this.stopRecording();
|
|
@@ -2052,15 +2076,15 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
2052
2076
|
_classPrivateFieldGet(_this, _store).setState({
|
|
2053
2077
|
status: SCREEN_RECORDER_STATUS.media_acquired
|
|
2054
2078
|
});
|
|
2055
|
-
_context2.next =
|
|
2079
|
+
_context2.next = 61;
|
|
2056
2080
|
break;
|
|
2057
|
-
case
|
|
2058
|
-
_context2.prev =
|
|
2059
|
-
_context2.
|
|
2060
|
-
_classPrivateFieldGet(_this, _logger).info("screenRecorder -> acquireMediaStream:error", _context2.
|
|
2061
|
-
if (SCREEN_RECORDER_ERROR[_context2.
|
|
2081
|
+
case 57:
|
|
2082
|
+
_context2.prev = 57;
|
|
2083
|
+
_context2.t6 = _context2["catch"](2);
|
|
2084
|
+
_classPrivateFieldGet(_this, _logger).info("screenRecorder -> acquireMediaStream:error", _context2.t6 === null || _context2.t6 === void 0 ? void 0 : _context2.t6.name, _context2.t6 === null || _context2.t6 === void 0 ? void 0 : _context2.t6.message);
|
|
2085
|
+
if (SCREEN_RECORDER_ERROR[_context2.t6 === null || _context2.t6 === void 0 ? void 0 : _context2.t6.name]) {
|
|
2062
2086
|
_classPrivateFieldGet(_this, _store).setState({
|
|
2063
|
-
error: SCREEN_RECORDER_ERROR[_context2.
|
|
2087
|
+
error: SCREEN_RECORDER_ERROR[_context2.t6.name],
|
|
2064
2088
|
status: SCREEN_RECORDER_STATUS.idle
|
|
2065
2089
|
});
|
|
2066
2090
|
} else if (_classPrivateFieldGet(_this, _audio) && !_classPrivateFieldGet(_this, _audioStream)) {
|
|
@@ -2070,15 +2094,15 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
2070
2094
|
});
|
|
2071
2095
|
} else if (!_classPrivateFieldGet(_this, _mediaStream) || isStreamEnded(_classPrivateFieldGet(_this, _mediaStream))) {
|
|
2072
2096
|
_classPrivateFieldGet(_this, _store).setState({
|
|
2073
|
-
error: SCREEN_RECORDER_ERROR[_context2.
|
|
2097
|
+
error: SCREEN_RECORDER_ERROR[_context2.t6 === null || _context2.t6 === void 0 ? void 0 : _context2.t6.name],
|
|
2074
2098
|
status: SCREEN_RECORDER_STATUS.idle
|
|
2075
2099
|
});
|
|
2076
2100
|
}
|
|
2077
|
-
case
|
|
2101
|
+
case 61:
|
|
2078
2102
|
case "end":
|
|
2079
2103
|
return _context2.stop();
|
|
2080
2104
|
}
|
|
2081
|
-
}, _callee2, null, [[2,
|
|
2105
|
+
}, _callee2, null, [[2, 57], [14, 45], [27, 40]]);
|
|
2082
2106
|
}));
|
|
2083
2107
|
function value() {
|
|
2084
2108
|
return _value.apply(this, arguments);
|
|
@@ -2192,7 +2216,7 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
2192
2216
|
if (_classPrivateFieldGet(_this, _countdownTimerId)) return;
|
|
2193
2217
|
_classPrivateFieldGet(_this, _fireCallbacks).call(_this, SCREEN_RECORDER_EVENT.onCountdownStart);
|
|
2194
2218
|
_classPrivateFieldSet(_this, _countdownTimerId, setInterval(function () {
|
|
2195
|
-
var shouldBeep =
|
|
2219
|
+
var shouldBeep = false;
|
|
2196
2220
|
_classPrivateFieldGet(_this, _store).setState(function (_ref3) {
|
|
2197
2221
|
var countdownTimeLeft = _ref3.countdownTimeLeft;
|
|
2198
2222
|
if (countdownTimeLeft - ONE_SECOND > 0) {
|
|
@@ -2204,9 +2228,8 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
2204
2228
|
};
|
|
2205
2229
|
}
|
|
2206
2230
|
_classPrivateFieldGet(_this, _fireCallbacks).call(_this, SCREEN_RECORDER_EVENT.onCountdown, [0]);
|
|
2207
|
-
shouldBeep = false;
|
|
2208
2231
|
setTimeout(function () {
|
|
2209
|
-
_classPrivateFieldGet(_this, _startRecordingAudio).play();
|
|
2232
|
+
if (_classPrivateFieldGet(_this, _playCountdownAudio)) _classPrivateFieldGet(_this, _startRecordingAudio).play();
|
|
2210
2233
|
_classPrivateFieldGet(_this, _fireCallbacks).call(_this, SCREEN_RECORDER_EVENT.onCountdownEnd);
|
|
2211
2234
|
_classPrivateFieldGet(_this, _store).setState({
|
|
2212
2235
|
status: SCREEN_RECORDER_STATUS.recording
|
|
@@ -2219,7 +2242,7 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
2219
2242
|
countdownTimeLeft: 0
|
|
2220
2243
|
};
|
|
2221
2244
|
});
|
|
2222
|
-
if (shouldBeep) _classPrivateFieldGet(_this, _playCountdownBeep).call(_this);
|
|
2245
|
+
if (shouldBeep && _classPrivateFieldGet(_this, _playCountdownAudio)) _classPrivateFieldGet(_this, _playCountdownBeep).call(_this);
|
|
2223
2246
|
}, ONE_SECOND_IN_MILLISECONDS));
|
|
2224
2247
|
}
|
|
2225
2248
|
});
|