@bigbinary/neeto-media-recorder 2.7.21 → 2.7.23

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 CHANGED
@@ -1934,7 +1934,7 @@ var ScreenRecorder = /*#__PURE__*/function () {
1934
1934
  writable: true,
1935
1935
  value: function () {
1936
1936
  var _value = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
1937
- var stream, audioStream, workletUrl, audioContext, audioStreamSource, destinationStream, noiseSuppressorNode, constraints, finalStream, _audioContext, desktopAudio, microphoneAudio, combinedAudio;
1937
+ var stream, constraints, audioConfig, audioStream, workletUrl, audioContext, audioStreamSource, destinationStream, noiseSuppressorNode, finalStream, _audioContext, desktopAudio, microphoneAudio, combinedAudio;
1938
1938
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1939
1939
  while (1) switch (_context2.prev = _context2.next) {
1940
1940
  case 0:
@@ -1943,68 +1943,74 @@ var ScreenRecorder = /*#__PURE__*/function () {
1943
1943
  status: SCREEN_RECORDER_STATUS.acquiring_media
1944
1944
  });
1945
1945
  _context2.prev = 2;
1946
+ if (!_classPrivateFieldGet(_this, _videoStream)) {
1947
+ _context2.next = 7;
1948
+ break;
1949
+ }
1950
+ stream = _classPrivateFieldGet(_this, _videoStream);
1951
+ _context2.next = 13;
1952
+ break;
1953
+ case 7:
1954
+ constraints = {
1955
+ video: _classPrivateFieldGet(_this, _video),
1956
+ audio: _classPrivateFieldGet(_this, _recordSystemAudio)
1957
+ };
1958
+ _classPrivateFieldGet(_this, _logger).info("screenRecorder -> getDisplayMedia contraints.", constraints);
1959
+ _context2.next = 11;
1960
+ return window.navigator.mediaDevices.getDisplayMedia(constraints);
1961
+ case 11:
1962
+ stream = _context2.sent;
1963
+ _classPrivateFieldGet(_this, _fireCallbacks).call(_this, SCREEN_RECORDER_EVENT.onShareSelected);
1964
+ case 13:
1946
1965
  if (!_classPrivateFieldGet(_this, _audio)) {
1947
- _context2.next = 30;
1966
+ _context2.next = 42;
1948
1967
  break;
1949
1968
  }
1969
+ audioConfig = {
1970
+ audio: _objectSpread(_objectSpread({
1971
+ echoCancellation: false
1972
+ }, _classPrivateFieldGet(_this, _audio)), _classPrivateFieldGet(_this, _audio).deviceId && {
1973
+ deviceId: {
1974
+ exact: _classPrivateFieldGet(_this, _audio).deviceId
1975
+ }
1976
+ })
1977
+ };
1978
+ _classPrivateFieldGet(_this, _logger).info("screenRecorder -> audioConfig", audioConfig);
1950
1979
  _context2.t0 = _classPrivateFieldSet;
1951
1980
  _context2.t1 = _this;
1952
1981
  _context2.t2 = _micAudioStream;
1953
- _context2.next = 9;
1954
- return window.navigator.mediaDevices.getUserMedia({
1955
- audio: _classPrivateFieldGet(_this, _audio) ? _objectSpread({
1956
- echoCancellation: false
1957
- }, _classPrivateFieldGet(_this, _audio)) : false
1958
- });
1959
- case 9:
1982
+ _context2.next = 21;
1983
+ return window.navigator.mediaDevices.getUserMedia(audioConfig);
1984
+ case 21:
1960
1985
  _context2.t3 = _context2.sent;
1961
1986
  (0, _context2.t0)(_context2.t1, _context2.t2, _context2.t3);
1962
1987
  audioStream = addGainNode(_classPrivateFieldGet(_this, _micAudioStream), 1.75); // Increase volume by 50%
1963
1988
  _classPrivateFieldSet(_this, _audioStream, audioStream);
1964
1989
  if (!_classPrivateFieldGet(_this, _enableNoiseCancellation)) {
1965
- _context2.next = 30;
1990
+ _context2.next = 42;
1966
1991
  break;
1967
1992
  }
1968
- _context2.prev = 14;
1993
+ _context2.prev = 26;
1969
1994
  workletUrl = IS_EXTENSION ?
1970
1995
  // eslint-disable-next-line no-undef
1971
1996
  chrome.runtime.getURL("public/NoiseSuppressorWorklet.js") : "NoiseSuppressorWorklet.js";
1972
1997
  audioContext = new AudioContext();
1973
- _context2.next = 19;
1998
+ _context2.next = 31;
1974
1999
  return audioContext.audioWorklet.addModule(workletUrl);
1975
- case 19:
2000
+ case 31:
1976
2001
  audioStreamSource = audioContext.createMediaStreamSource(audioStream);
1977
2002
  destinationStream = audioContext.createMediaStreamDestination();
1978
2003
  noiseSuppressorNode = new AudioWorkletNode(audioContext, "nn-suppressor-processor");
1979
2004
  audioStreamSource.connect(noiseSuppressorNode);
1980
2005
  noiseSuppressorNode.connect(destinationStream);
1981
2006
  _classPrivateFieldSet(_this, _audioStream, destinationStream.stream);
1982
- _context2.next = 30;
2007
+ _context2.next = 42;
1983
2008
  break;
1984
- case 27:
1985
- _context2.prev = 27;
1986
- _context2.t4 = _context2["catch"](14);
2009
+ case 39:
2010
+ _context2.prev = 39;
2011
+ _context2.t4 = _context2["catch"](26);
1987
2012
  logger.error("Failed to load audio worklet:", _context2.t4);
1988
- case 30:
1989
- if (!_classPrivateFieldGet(_this, _videoStream)) {
1990
- _context2.next = 34;
1991
- break;
1992
- }
1993
- stream = _classPrivateFieldGet(_this, _videoStream);
1994
- _context2.next = 40;
1995
- break;
1996
- case 34:
1997
- constraints = {
1998
- video: _classPrivateFieldGet(_this, _video),
1999
- audio: _classPrivateFieldGet(_this, _recordSystemAudio)
2000
- };
2001
- _classPrivateFieldGet(_this, _logger).info("screenRecorder -> getDisplayMedia contraints.", constraints);
2002
- _context2.next = 38;
2003
- return window.navigator.mediaDevices.getDisplayMedia(constraints);
2004
- case 38:
2005
- stream = _context2.sent;
2006
- _classPrivateFieldGet(_this, _fireCallbacks).call(_this, SCREEN_RECORDER_EVENT.onShareSelected);
2007
- case 40:
2013
+ case 42:
2008
2014
  // Event triggered when the user clicks on the stop sharing overlay button
2009
2015
  stream.getVideoTracks()[0].addEventListener("ended", function () {
2010
2016
  _this.stopRecording();
@@ -2039,10 +2045,10 @@ var ScreenRecorder = /*#__PURE__*/function () {
2039
2045
  _classPrivateFieldGet(_this, _store).setState({
2040
2046
  status: SCREEN_RECORDER_STATUS.media_acquired
2041
2047
  });
2042
- _context2.next = 52;
2048
+ _context2.next = 54;
2043
2049
  break;
2044
- case 49:
2045
- _context2.prev = 49;
2050
+ case 51:
2051
+ _context2.prev = 51;
2046
2052
  _context2.t5 = _context2["catch"](2);
2047
2053
  if (_classPrivateFieldGet(_this, _audio) && !_classPrivateFieldGet(_this, _audioStream)) {
2048
2054
  _classPrivateFieldGet(_this, _store).setState({
@@ -2055,11 +2061,11 @@ var ScreenRecorder = /*#__PURE__*/function () {
2055
2061
  status: SCREEN_RECORDER_STATUS.idle
2056
2062
  });
2057
2063
  }
2058
- case 52:
2064
+ case 54:
2059
2065
  case "end":
2060
2066
  return _context2.stop();
2061
2067
  }
2062
- }, _callee2, null, [[2, 49], [14, 27]]);
2068
+ }, _callee2, null, [[2, 51], [26, 39]]);
2063
2069
  }));
2064
2070
  function value() {
2065
2071
  return _value.apply(this, arguments);