@bigbinary/neeto-media-recorder 2.7.33 → 2.7.34
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 +105 -36
- package/core.js.map +1 -1
- package/package.json +1 -1
package/core.js
CHANGED
|
@@ -1719,6 +1719,7 @@ var _fireCallbacks = /*#__PURE__*/new WeakMap();
|
|
|
1719
1719
|
var _onRecordingStart = /*#__PURE__*/new WeakMap();
|
|
1720
1720
|
var _onRecordingActive = /*#__PURE__*/new WeakMap();
|
|
1721
1721
|
var _onRecordingStop = /*#__PURE__*/new WeakMap();
|
|
1722
|
+
var _queryMicPermissionState = /*#__PURE__*/new WeakMap();
|
|
1722
1723
|
var _serializeError = /*#__PURE__*/new WeakMap();
|
|
1723
1724
|
var _summarizeStream = /*#__PURE__*/new WeakMap();
|
|
1724
1725
|
var _summarizeRecorderState = /*#__PURE__*/new WeakMap();
|
|
@@ -2171,7 +2172,7 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
2171
2172
|
writable: true,
|
|
2172
2173
|
value: function () {
|
|
2173
2174
|
var _value = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
2174
|
-
var acquireStartedAt, stream, constraints, displayMediaStartedAt, audioConfig, micStartedAt, audioStream, workletUrl, workletStartedAt, audioContext, audioStreamSource, destinationStream, noiseSuppressorNode, finalStream, _audioContext, desktopAudio, microphoneAudio, combinedAudio;
|
|
2175
|
+
var acquireStartedAt, micState, stream, constraints, displayMediaStartedAt, audioConfig, micStartedAt, audioStream, workletUrl, workletStartedAt, audioContext, audioStreamSource, destinationStream, noiseSuppressorNode, finalStream, _audioContext, desktopAudio, microphoneAudio, combinedAudio;
|
|
2175
2176
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
2176
2177
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2177
2178
|
case 0:
|
|
@@ -2185,37 +2186,58 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
2185
2186
|
_classPrivateFieldGet(_this, _store).setState({
|
|
2186
2187
|
status: SCREEN_RECORDER_STATUS.acquiring_media
|
|
2187
2188
|
});
|
|
2188
|
-
|
|
2189
|
+
if (!(_classPrivateFieldGet(_this, _audio) && !_classPrivateFieldGet(_this, _videoStream))) {
|
|
2190
|
+
_context2.next = 11;
|
|
2191
|
+
break;
|
|
2192
|
+
}
|
|
2193
|
+
_context2.next = 6;
|
|
2194
|
+
return _classPrivateFieldGet(_this, _queryMicPermissionState).call(_this);
|
|
2195
|
+
case 6:
|
|
2196
|
+
micState = _context2.sent;
|
|
2197
|
+
if (!(micState === "denied")) {
|
|
2198
|
+
_context2.next = 11;
|
|
2199
|
+
break;
|
|
2200
|
+
}
|
|
2201
|
+
_classPrivateFieldGet(_this, _logger).warn("acquireMediaStream -> mic permission denied, skipping screen prompt", {
|
|
2202
|
+
micState: micState
|
|
2203
|
+
});
|
|
2204
|
+
_classPrivateFieldGet(_this, _store).setState({
|
|
2205
|
+
error: SCREEN_RECORDER_ERROR.MicPermissionDenied,
|
|
2206
|
+
status: SCREEN_RECORDER_STATUS.idle
|
|
2207
|
+
});
|
|
2208
|
+
return _context2.abrupt("return");
|
|
2209
|
+
case 11:
|
|
2210
|
+
_context2.prev = 11;
|
|
2189
2211
|
if (!_classPrivateFieldGet(_this, _videoStream)) {
|
|
2190
|
-
_context2.next =
|
|
2212
|
+
_context2.next = 17;
|
|
2191
2213
|
break;
|
|
2192
2214
|
}
|
|
2193
2215
|
_classPrivateFieldGet(_this, _logger).info("acquireMediaStream -> using injected videoStream", _classPrivateFieldGet(_this, _summarizeStream).call(_this, _classPrivateFieldGet(_this, _videoStream)));
|
|
2194
2216
|
stream = _classPrivateFieldGet(_this, _videoStream);
|
|
2195
|
-
_context2.next =
|
|
2217
|
+
_context2.next = 25;
|
|
2196
2218
|
break;
|
|
2197
|
-
case
|
|
2219
|
+
case 17:
|
|
2198
2220
|
constraints = {
|
|
2199
2221
|
video: _classPrivateFieldGet(_this, _video),
|
|
2200
2222
|
audio: _classPrivateFieldGet(_this, _recordSystemAudio)
|
|
2201
2223
|
};
|
|
2202
2224
|
_classPrivateFieldGet(_this, _logger).info("acquireMediaStream -> getDisplayMedia constraints", constraints);
|
|
2203
2225
|
displayMediaStartedAt = Date.now();
|
|
2204
|
-
_context2.next =
|
|
2226
|
+
_context2.next = 22;
|
|
2205
2227
|
return window.navigator.mediaDevices.getDisplayMedia(constraints);
|
|
2206
|
-
case
|
|
2228
|
+
case 22:
|
|
2207
2229
|
stream = _context2.sent;
|
|
2208
2230
|
_classPrivateFieldGet(_this, _logger).info("acquireMediaStream -> getDisplayMedia resolved", {
|
|
2209
2231
|
durationMs: Date.now() - displayMediaStartedAt,
|
|
2210
2232
|
stream: _classPrivateFieldGet(_this, _summarizeStream).call(_this, stream)
|
|
2211
2233
|
});
|
|
2212
2234
|
_classPrivateFieldGet(_this, _fireCallbacks).call(_this, SCREEN_RECORDER_EVENT.onShareSelected);
|
|
2213
|
-
case
|
|
2235
|
+
case 25:
|
|
2214
2236
|
if (!_classPrivateFieldGet(_this, _audio)) {
|
|
2215
|
-
_context2.next =
|
|
2237
|
+
_context2.next = 68;
|
|
2216
2238
|
break;
|
|
2217
2239
|
}
|
|
2218
|
-
_context2.prev =
|
|
2240
|
+
_context2.prev = 26;
|
|
2219
2241
|
audioConfig = {
|
|
2220
2242
|
audio: _objectSpread(_objectSpread({
|
|
2221
2243
|
echoCancellation: false
|
|
@@ -2230,9 +2252,9 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
2230
2252
|
_context2.t0 = _classPrivateFieldSet;
|
|
2231
2253
|
_context2.t1 = _this;
|
|
2232
2254
|
_context2.t2 = _micAudioStream;
|
|
2233
|
-
_context2.next =
|
|
2255
|
+
_context2.next = 35;
|
|
2234
2256
|
return window.navigator.mediaDevices.getUserMedia(audioConfig);
|
|
2235
|
-
case
|
|
2257
|
+
case 35:
|
|
2236
2258
|
_context2.t3 = _context2.sent;
|
|
2237
2259
|
(0, _context2.t0)(_context2.t1, _context2.t2, _context2.t3);
|
|
2238
2260
|
_classPrivateFieldGet(_this, _logger).info("acquireMediaStream -> mic acquired", {
|
|
@@ -2242,10 +2264,10 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
2242
2264
|
audioStream = addGainNode(_classPrivateFieldGet(_this, _micAudioStream), 1.75); // Increase volume by 50%
|
|
2243
2265
|
_classPrivateFieldSet(_this, _audioStream, audioStream);
|
|
2244
2266
|
if (!_classPrivateFieldGet(_this, _enableNoiseCancellation)) {
|
|
2245
|
-
_context2.next =
|
|
2267
|
+
_context2.next = 60;
|
|
2246
2268
|
break;
|
|
2247
2269
|
}
|
|
2248
|
-
_context2.prev =
|
|
2270
|
+
_context2.prev = 41;
|
|
2249
2271
|
workletUrl = IS_EXTENSION ?
|
|
2250
2272
|
// eslint-disable-next-line no-undef
|
|
2251
2273
|
chrome.runtime.getURL("public/NoiseSuppressorWorklet.js") : "NoiseSuppressorWorklet.js";
|
|
@@ -2254,9 +2276,9 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
2254
2276
|
});
|
|
2255
2277
|
workletStartedAt = Date.now();
|
|
2256
2278
|
audioContext = new AudioContext();
|
|
2257
|
-
_context2.next =
|
|
2279
|
+
_context2.next = 48;
|
|
2258
2280
|
return audioContext.audioWorklet.addModule(workletUrl);
|
|
2259
|
-
case
|
|
2281
|
+
case 48:
|
|
2260
2282
|
audioStreamSource = audioContext.createMediaStreamSource(audioStream);
|
|
2261
2283
|
destinationStream = audioContext.createMediaStreamDestination();
|
|
2262
2284
|
noiseSuppressorNode = new AudioWorkletNode(audioContext, "nn-suppressor-processor");
|
|
@@ -2266,26 +2288,38 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
2266
2288
|
_classPrivateFieldGet(_this, _logger).info("acquireMediaStream -> noise suppressor wired up", {
|
|
2267
2289
|
durationMs: Date.now() - workletStartedAt
|
|
2268
2290
|
});
|
|
2269
|
-
_context2.next =
|
|
2291
|
+
_context2.next = 60;
|
|
2270
2292
|
break;
|
|
2271
|
-
case
|
|
2272
|
-
_context2.prev =
|
|
2273
|
-
_context2.t4 = _context2["catch"](
|
|
2293
|
+
case 57:
|
|
2294
|
+
_context2.prev = 57;
|
|
2295
|
+
_context2.t4 = _context2["catch"](41);
|
|
2274
2296
|
_classPrivateFieldGet(_this, _logger).error("acquireMediaStream -> failed to load audio worklet", _classPrivateFieldGet(_this, _serializeError).call(_this, _context2.t4));
|
|
2275
|
-
case
|
|
2276
|
-
_context2.next =
|
|
2297
|
+
case 60:
|
|
2298
|
+
_context2.next = 68;
|
|
2277
2299
|
break;
|
|
2278
|
-
case
|
|
2279
|
-
_context2.prev =
|
|
2280
|
-
_context2.t5 = _context2["catch"](
|
|
2300
|
+
case 62:
|
|
2301
|
+
_context2.prev = 62;
|
|
2302
|
+
_context2.t5 = _context2["catch"](26);
|
|
2281
2303
|
// Mic access can fail independently of screen capture (OS-level
|
|
2282
|
-
// block, no device, deviceId mismatch).
|
|
2283
|
-
//
|
|
2284
|
-
//
|
|
2285
|
-
|
|
2304
|
+
// block, no device, deviceId mismatch). Stop the screen stream and
|
|
2305
|
+
// surface a mic-only error so the user sees the proper callout
|
|
2306
|
+
// ("doesn't have access to your microphone" with Grant / I don't
|
|
2307
|
+
// need audio actions) instead of being misrouted to the screen
|
|
2308
|
+
// permission denied flow.
|
|
2309
|
+
_classPrivateFieldGet(_this, _logger).warn("acquireMediaStream -> mic unavailable", _classPrivateFieldGet(_this, _serializeError).call(_this, _context2.t5), {
|
|
2286
2310
|
audioConfigRequested: _classPrivateFieldGet(_this, _audio)
|
|
2287
2311
|
});
|
|
2288
|
-
|
|
2312
|
+
if (!_classPrivateFieldGet(_this, _videoStream)) {
|
|
2313
|
+
stream.getTracks().forEach(function (track) {
|
|
2314
|
+
return track.stop();
|
|
2315
|
+
});
|
|
2316
|
+
}
|
|
2317
|
+
_classPrivateFieldGet(_this, _store).setState({
|
|
2318
|
+
error: SCREEN_RECORDER_ERROR.MicPermissionDenied,
|
|
2319
|
+
status: SCREEN_RECORDER_STATUS.idle
|
|
2320
|
+
});
|
|
2321
|
+
return _context2.abrupt("return");
|
|
2322
|
+
case 68:
|
|
2289
2323
|
// Event triggered when the user clicks on the stop sharing overlay button
|
|
2290
2324
|
stream.getVideoTracks()[0].addEventListener("ended", function () {
|
|
2291
2325
|
var _classPrivateFieldGet15;
|
|
@@ -2335,11 +2369,11 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
2335
2369
|
totalDurationMs: Date.now() - acquireStartedAt,
|
|
2336
2370
|
finalStream: _classPrivateFieldGet(_this, _summarizeStream).call(_this, _classPrivateFieldGet(_this, _mediaStream))
|
|
2337
2371
|
});
|
|
2338
|
-
_context2.next =
|
|
2372
|
+
_context2.next = 82;
|
|
2339
2373
|
break;
|
|
2340
|
-
case
|
|
2341
|
-
_context2.prev =
|
|
2342
|
-
_context2.t6 = _context2["catch"](
|
|
2374
|
+
case 78:
|
|
2375
|
+
_context2.prev = 78;
|
|
2376
|
+
_context2.t6 = _context2["catch"](11);
|
|
2343
2377
|
_classPrivateFieldGet(_this, _logger).error("acquireMediaStream -> error", _classPrivateFieldGet(_this, _serializeError).call(_this, _context2.t6), {
|
|
2344
2378
|
totalDurationMs: Date.now() - acquireStartedAt,
|
|
2345
2379
|
hasAudio: Boolean(_classPrivateFieldGet(_this, _audio)),
|
|
@@ -2362,11 +2396,11 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
2362
2396
|
status: SCREEN_RECORDER_STATUS.idle
|
|
2363
2397
|
});
|
|
2364
2398
|
}
|
|
2365
|
-
case
|
|
2399
|
+
case 82:
|
|
2366
2400
|
case "end":
|
|
2367
2401
|
return _context2.stop();
|
|
2368
2402
|
}
|
|
2369
|
-
}, _callee2, null, [[
|
|
2403
|
+
}, _callee2, null, [[11, 78], [26, 62], [41, 57]]);
|
|
2370
2404
|
}));
|
|
2371
2405
|
function value() {
|
|
2372
2406
|
return _value.apply(this, arguments);
|
|
@@ -2445,6 +2479,41 @@ var ScreenRecorder = /*#__PURE__*/function () {
|
|
|
2445
2479
|
}
|
|
2446
2480
|
}
|
|
2447
2481
|
});
|
|
2482
|
+
_classPrivateFieldInitSpec(this, _queryMicPermissionState, {
|
|
2483
|
+
writable: true,
|
|
2484
|
+
value: function () {
|
|
2485
|
+
var _value2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
2486
|
+
var result;
|
|
2487
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
2488
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
2489
|
+
case 0:
|
|
2490
|
+
_context3.prev = 0;
|
|
2491
|
+
_context3.next = 3;
|
|
2492
|
+
return window.navigator.permissions.query({
|
|
2493
|
+
name: "microphone"
|
|
2494
|
+
});
|
|
2495
|
+
case 3:
|
|
2496
|
+
result = _context3.sent;
|
|
2497
|
+
return _context3.abrupt("return", result.state);
|
|
2498
|
+
case 7:
|
|
2499
|
+
_context3.prev = 7;
|
|
2500
|
+
_context3.t0 = _context3["catch"](0);
|
|
2501
|
+
// Permissions API or the "microphone" descriptor is unsupported
|
|
2502
|
+
// (e.g. Safari). Fall through to the live getUserMedia attempt.
|
|
2503
|
+
_classPrivateFieldGet(_this, _logger).info("queryMicPermissionState -> unsupported", _classPrivateFieldGet(_this, _serializeError).call(_this, _context3.t0));
|
|
2504
|
+
return _context3.abrupt("return", "prompt");
|
|
2505
|
+
case 11:
|
|
2506
|
+
case "end":
|
|
2507
|
+
return _context3.stop();
|
|
2508
|
+
}
|
|
2509
|
+
}, _callee3, null, [[0, 7]]);
|
|
2510
|
+
}));
|
|
2511
|
+
function value() {
|
|
2512
|
+
return _value2.apply(this, arguments);
|
|
2513
|
+
}
|
|
2514
|
+
return value;
|
|
2515
|
+
}()
|
|
2516
|
+
});
|
|
2448
2517
|
_classPrivateFieldInitSpec(this, _serializeError, {
|
|
2449
2518
|
writable: true,
|
|
2450
2519
|
value: function value(error) {
|