@bigbinary/neeto-media-recorder 2.7.1 → 2.7.2

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
@@ -835,6 +835,17 @@ var getMediaRecorderOptions = function getMediaRecorderOptions() {
835
835
  mimeType: mimeType
836
836
  };
837
837
  };
838
+ var addGainNode = function addGainNode(audioStream) {
839
+ var gain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1.5;
840
+ var audioContext = new AudioContext();
841
+ var audioStreamSource = audioContext.createMediaStreamSource(audioStream);
842
+ var destinationStream = audioContext.createMediaStreamDestination();
843
+ var gainNode = audioContext.createGain();
844
+ gainNode.gain.value = gain;
845
+ audioStreamSource.connect(gainNode);
846
+ gainNode.connect(destinationStream);
847
+ return destinationStream.stream;
848
+ };
838
849
 
839
850
  var s3AxiosInstance = axios.create({
840
851
  headers: {
@@ -1815,7 +1826,7 @@ var ScreenRecorder = /*#__PURE__*/function () {
1815
1826
  });
1816
1827
  _context2.prev = 1;
1817
1828
  if (!_classPrivateFieldGet(_this, _audio)) {
1818
- _context2.next = 24;
1829
+ _context2.next = 25;
1819
1830
  break;
1820
1831
  }
1821
1832
  _context2.next = 5;
@@ -1826,46 +1837,47 @@ var ScreenRecorder = /*#__PURE__*/function () {
1826
1837
  });
1827
1838
  case 5:
1828
1839
  audioStream = _context2.sent;
1840
+ audioStream = addGainNode(audioStream, 1.75); // Increase volume by 50%
1829
1841
  _classPrivateFieldSet(_this, _audioStream, audioStream);
1830
1842
  if (!_classPrivateFieldGet(_this, _enableNoiseCancellation)) {
1831
- _context2.next = 24;
1843
+ _context2.next = 25;
1832
1844
  break;
1833
1845
  }
1834
- _context2.prev = 8;
1846
+ _context2.prev = 9;
1835
1847
  workletUrl = IS_EXTENSION ? chrome.runtime.getURL("public/NoiseSuppressorWorklet.js") : "NoiseSuppressorWorklet.js";
1836
1848
  audioContext = new AudioContext();
1837
- _context2.next = 13;
1849
+ _context2.next = 14;
1838
1850
  return audioContext.audioWorklet.addModule(workletUrl);
1839
- case 13:
1851
+ case 14:
1840
1852
  audioStreamSource = audioContext.createMediaStreamSource(audioStream);
1841
1853
  destinationStream = audioContext.createMediaStreamDestination();
1842
1854
  noiseSuppressorNode = new AudioWorkletNode(audioContext, "nn-suppressor-processor");
1843
1855
  audioStreamSource.connect(noiseSuppressorNode);
1844
1856
  noiseSuppressorNode.connect(destinationStream);
1845
1857
  _classPrivateFieldSet(_this, _audioStream, destinationStream.stream);
1846
- _context2.next = 24;
1858
+ _context2.next = 25;
1847
1859
  break;
1848
- case 21:
1849
- _context2.prev = 21;
1850
- _context2.t0 = _context2["catch"](8);
1860
+ case 22:
1861
+ _context2.prev = 22;
1862
+ _context2.t0 = _context2["catch"](9);
1851
1863
  console.error("Failed to load audio worklet:", _context2.t0);
1852
- case 24:
1864
+ case 25:
1853
1865
  if (!_classPrivateFieldGet(_this, _videoStream)) {
1854
- _context2.next = 28;
1866
+ _context2.next = 29;
1855
1867
  break;
1856
1868
  }
1857
1869
  stream = _classPrivateFieldGet(_this, _videoStream);
1858
- _context2.next = 31;
1870
+ _context2.next = 32;
1859
1871
  break;
1860
- case 28:
1861
- _context2.next = 30;
1872
+ case 29:
1873
+ _context2.next = 31;
1862
1874
  return window.navigator.mediaDevices.getDisplayMedia({
1863
1875
  video: _classPrivateFieldGet(_this, _video) || true,
1864
1876
  audio: true
1865
1877
  });
1866
- case 30:
1867
- stream = _context2.sent;
1868
1878
  case 31:
1879
+ stream = _context2.sent;
1880
+ case 32:
1869
1881
  // Event triggered when the user clicks on the stop sharing overlay button
1870
1882
  stream.getVideoTracks()[0].addEventListener("ended", function () {
1871
1883
  _this.stopRecording();
@@ -1896,10 +1908,10 @@ var ScreenRecorder = /*#__PURE__*/function () {
1896
1908
  _classPrivateFieldGet(_this, _store).setState({
1897
1909
  status: SCREEN_RECORDER_STATUS.media_acquired
1898
1910
  });
1899
- _context2.next = 43;
1911
+ _context2.next = 44;
1900
1912
  break;
1901
- case 40:
1902
- _context2.prev = 40;
1913
+ case 41:
1914
+ _context2.prev = 41;
1903
1915
  _context2.t1 = _context2["catch"](1);
1904
1916
  if (_classPrivateFieldGet(_this, _audio) && !_classPrivateFieldGet(_this, _audioStream)) {
1905
1917
  _classPrivateFieldGet(_this, _store).setState({
@@ -1912,11 +1924,11 @@ var ScreenRecorder = /*#__PURE__*/function () {
1912
1924
  status: SCREEN_RECORDER_STATUS.idle
1913
1925
  });
1914
1926
  }
1915
- case 43:
1927
+ case 44:
1916
1928
  case "end":
1917
1929
  return _context2.stop();
1918
1930
  }
1919
- }, _callee2, null, [[1, 40], [8, 21]]);
1931
+ }, _callee2, null, [[1, 41], [9, 22]]);
1920
1932
  }));
1921
1933
  function value() {
1922
1934
  return _value.apply(this, arguments);