@whereby.com/media 9.7.4 → 10.0.0
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/dist/index.cjs +81 -195
- package/dist/index.d.cts +10 -11
- package/dist/index.d.mts +10 -11
- package/dist/index.d.ts +10 -11
- package/dist/index.mjs +81 -195
- package/dist/legacy-esm.js +81 -195
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2450,79 +2450,11 @@ fromLocation(typeof window !== "undefined" ? window.location : undefined);
|
|
|
2450
2450
|
|
|
2451
2451
|
var _a$2, _b$1;
|
|
2452
2452
|
const adapter$2 = (_a$2 = adapterRaw.default) !== null && _a$2 !== void 0 ? _a$2 : adapterRaw;
|
|
2453
|
-
const isSafari = ((_b$1 = adapter$2.browserDetails) === null || _b$1 === void 0 ? void 0 : _b$1.browser) === "safari";
|
|
2454
|
-
const parseResolution = (res) => res.split(/[^\d]/g).map((n) => parseInt(n, 10));
|
|
2455
|
-
function getMediaConstraints({ disableAEC, disableAGC, hd, lax, lowDataMode, preferredDeviceIds, resolution, simulcast, widescreen, }) {
|
|
2456
|
-
var _a, _b;
|
|
2457
|
-
let HIGH_HEIGHT = 480;
|
|
2458
|
-
let LOW_HEIGHT = 240;
|
|
2459
|
-
if (hd) {
|
|
2460
|
-
HIGH_HEIGHT = lax || isSafari ? 720 : { min: 360, ideal: 720 };
|
|
2461
|
-
}
|
|
2462
|
-
if (simulcast) {
|
|
2463
|
-
if (hd === false) {
|
|
2464
|
-
HIGH_HEIGHT = 360;
|
|
2465
|
-
LOW_HEIGHT = 270;
|
|
2466
|
-
}
|
|
2467
|
-
else {
|
|
2468
|
-
LOW_HEIGHT = 360;
|
|
2469
|
-
}
|
|
2470
|
-
}
|
|
2471
|
-
const constraints = {
|
|
2472
|
-
audio: Object.assign({}, (preferredDeviceIds.audioId && { deviceId: preferredDeviceIds.audioId })),
|
|
2473
|
-
video: Object.assign(Object.assign({}, (preferredDeviceIds.videoId ? { deviceId: preferredDeviceIds.videoId } : { facingMode: "user" })), { height: lowDataMode ? LOW_HEIGHT : HIGH_HEIGHT, frameRate: lowDataMode && !simulcast ? 15 : 24 }),
|
|
2474
|
-
};
|
|
2475
|
-
if (lax) {
|
|
2476
|
-
if (!((_a = constraints.audio) === null || _a === void 0 ? void 0 : _a.deviceId))
|
|
2477
|
-
constraints.audio = true;
|
|
2478
|
-
(_b = constraints.video) === null || _b === void 0 ? true : delete _b.facingMode;
|
|
2479
|
-
return constraints;
|
|
2480
|
-
}
|
|
2481
|
-
if (resolution) {
|
|
2482
|
-
const [w, h, fps] = parseResolution(resolution);
|
|
2483
|
-
if (w)
|
|
2484
|
-
constraints.video.width = { exact: w };
|
|
2485
|
-
if (h)
|
|
2486
|
-
constraints.video.height = { exact: h };
|
|
2487
|
-
if (fps)
|
|
2488
|
-
constraints.video.frameRate = { exact: fps };
|
|
2489
|
-
delete constraints.video.facingMode;
|
|
2490
|
-
}
|
|
2491
|
-
else {
|
|
2492
|
-
constraints.video.aspectRatio = widescreen ? 16 / 9 : 4 / 3;
|
|
2493
|
-
}
|
|
2494
|
-
if (disableAGC)
|
|
2495
|
-
constraints.audio.autoGainControl = false;
|
|
2496
|
-
if (disableAEC)
|
|
2497
|
-
constraints.audio.echoCancellation = false;
|
|
2498
|
-
return constraints;
|
|
2499
|
-
}
|
|
2500
|
-
function getConstraints({ devices, videoId, audioId, options, type = "ideal" }) {
|
|
2501
|
-
const strict = !!devices;
|
|
2502
|
-
const audioDevices = devices === null || devices === void 0 ? void 0 : devices.filter((d) => d.kind === "audioinput");
|
|
2503
|
-
const videoDevices = devices === null || devices === void 0 ? void 0 : devices.filter((d) => d.kind === "videoinput");
|
|
2504
|
-
const useDefaultAudio = !audioId || (strict && !(audioDevices === null || audioDevices === void 0 ? void 0 : audioDevices.some((d) => d.deviceId === audioId)));
|
|
2505
|
-
const useDefaultVideo = !videoId || (strict && !(videoDevices === null || videoDevices === void 0 ? void 0 : videoDevices.some((d) => d.deviceId === videoId)));
|
|
2506
|
-
const constraints = getMediaConstraints(Object.assign({ preferredDeviceIds: {
|
|
2507
|
-
audioId: useDefaultAudio ? null : { [type]: audioId },
|
|
2508
|
-
videoId: useDefaultVideo ? null : { [type]: videoId },
|
|
2509
|
-
} }, options));
|
|
2510
|
-
if (audioId === false || (strict && !(audioDevices === null || audioDevices === void 0 ? void 0 : audioDevices.length))) {
|
|
2511
|
-
delete constraints.audio;
|
|
2512
|
-
}
|
|
2513
|
-
if (videoId === false || (strict && !(videoDevices === null || videoDevices === void 0 ? void 0 : videoDevices.length))) {
|
|
2514
|
-
delete constraints.video;
|
|
2515
|
-
}
|
|
2516
|
-
return constraints;
|
|
2517
|
-
}
|
|
2518
|
-
|
|
2519
|
-
var _a$1, _b;
|
|
2520
|
-
const adapter$1 = (_a$1 = adapterRaw.default) !== null && _a$1 !== void 0 ? _a$1 : adapterRaw;
|
|
2521
2453
|
const logger$6 = new Logger();
|
|
2522
2454
|
const ICE_PUBLIC_IP_GATHERING_TIMEOUT = 3 * 1000;
|
|
2523
2455
|
const ICE_RESTART_DELAY = 2 * 1000;
|
|
2524
|
-
const browserName$1 = (_b = adapter$
|
|
2525
|
-
const browserVersion = adapter$
|
|
2456
|
+
const browserName$1 = (_b$1 = adapter$2.browserDetails) === null || _b$1 === void 0 ? void 0 : _b$1.browser;
|
|
2457
|
+
const browserVersion = adapter$2.browserDetails.version;
|
|
2526
2458
|
let unloading$1 = false;
|
|
2527
2459
|
if (browserName$1 === "chrome") {
|
|
2528
2460
|
window.document.addEventListener("beforeunload", () => {
|
|
@@ -2548,7 +2480,6 @@ class P2pRtcManager {
|
|
|
2548
2480
|
this._closed = false;
|
|
2549
2481
|
this._videoTrackIdByStreamId = {};
|
|
2550
2482
|
this._fetchMediaServersTimer = null;
|
|
2551
|
-
this._stopCameraTimeout = null;
|
|
2552
2483
|
this._icePublicIPGatheringTimeoutID = null;
|
|
2553
2484
|
this.offerOptions = { offerToReceiveAudio: true, offerToReceiveVideo: true };
|
|
2554
2485
|
this._audioTrackOnEnded = () => {
|
|
@@ -2568,7 +2499,6 @@ class P2pRtcManager {
|
|
|
2568
2499
|
});
|
|
2569
2500
|
this.analytics = {
|
|
2570
2501
|
P2POffendingInitialOffer: 0,
|
|
2571
|
-
P2PNonErrorRejectionValueGUMError: 0,
|
|
2572
2502
|
numNewPc: 0,
|
|
2573
2503
|
numIceConnected: 0,
|
|
2574
2504
|
numIceDisconnected: 0,
|
|
@@ -2601,9 +2531,8 @@ class P2pRtcManager {
|
|
|
2601
2531
|
isInitializedWith({ selfId, roomName, isSfu }) {
|
|
2602
2532
|
return this._selfId === selfId && this._roomName === roomName && !isSfu;
|
|
2603
2533
|
}
|
|
2604
|
-
addCameraStream(stream, {
|
|
2534
|
+
addCameraStream(stream, { beforeEffectTracks = [] } = { beforeEffectTracks: [] }) {
|
|
2605
2535
|
logger$6.info("addCameraStream: [stream.id: %s]", stream.id);
|
|
2606
|
-
this._webcamPaused = videoPaused;
|
|
2607
2536
|
if (stream === this._localCameraStream) {
|
|
2608
2537
|
return;
|
|
2609
2538
|
}
|
|
@@ -3480,65 +3409,7 @@ class P2pRtcManager {
|
|
|
3480
3409
|
}
|
|
3481
3410
|
}
|
|
3482
3411
|
}
|
|
3483
|
-
stopOrResumeVideo(
|
|
3484
|
-
var _a;
|
|
3485
|
-
logger$6.info("stopOrResumeVideo() [enable: %s]", enable);
|
|
3486
|
-
this._webcamPaused = !enable;
|
|
3487
|
-
if (!["chrome", "safari"].includes(browserName$1)) {
|
|
3488
|
-
return;
|
|
3489
|
-
}
|
|
3490
|
-
if (this._stopCameraTimeout) {
|
|
3491
|
-
clearTimeout(this._stopCameraTimeout);
|
|
3492
|
-
this._stopCameraTimeout = null;
|
|
3493
|
-
}
|
|
3494
|
-
if (enable === false) {
|
|
3495
|
-
const stopCameraDelay = ((_a = localStream.getVideoTracks().find((t) => !t.enabled)) === null || _a === void 0 ? void 0 : _a.readyState) === "ended" ? 0 : 5000;
|
|
3496
|
-
this._stopCameraTimeout = setTimeout(() => {
|
|
3497
|
-
localStream.getVideoTracks().forEach((track) => {
|
|
3498
|
-
if (track.enabled === false) {
|
|
3499
|
-
track.stop();
|
|
3500
|
-
localStream.removeTrack(track);
|
|
3501
|
-
this._emit(EVENTS.LOCAL_STREAM_TRACK_REMOVED, {
|
|
3502
|
-
stream: localStream,
|
|
3503
|
-
track,
|
|
3504
|
-
});
|
|
3505
|
-
this._handleStopOrResumeVideo({ enable, track });
|
|
3506
|
-
}
|
|
3507
|
-
});
|
|
3508
|
-
}, stopCameraDelay);
|
|
3509
|
-
}
|
|
3510
|
-
else {
|
|
3511
|
-
if (localStream.getVideoTracks().length === 0) {
|
|
3512
|
-
const constraints = getConstraints(this._webrtcProvider.getMediaOptions()).video;
|
|
3513
|
-
if (!constraints) {
|
|
3514
|
-
return;
|
|
3515
|
-
}
|
|
3516
|
-
navigator.mediaDevices
|
|
3517
|
-
.getUserMedia({ video: constraints })
|
|
3518
|
-
.then((stream) => {
|
|
3519
|
-
const track = stream.getVideoTracks()[0];
|
|
3520
|
-
if (this._webcamPaused) {
|
|
3521
|
-
track.stop();
|
|
3522
|
-
return;
|
|
3523
|
-
}
|
|
3524
|
-
localStream.addTrack(track);
|
|
3525
|
-
this._monitorVideoTrack(track);
|
|
3526
|
-
this._emit(EVENTS.LOCAL_STREAM_TRACK_ADDED, {
|
|
3527
|
-
streamId: localStream.id,
|
|
3528
|
-
tracks: [track],
|
|
3529
|
-
screenShare: false,
|
|
3530
|
-
});
|
|
3531
|
-
this._handleStopOrResumeVideo({ enable, track });
|
|
3532
|
-
})
|
|
3533
|
-
.catch((e) => {
|
|
3534
|
-
if (!(e instanceof Error)) {
|
|
3535
|
-
this.analytics.P2PNonErrorRejectionValueGUMError++;
|
|
3536
|
-
e = new Error(`non-error gUM rejection value: ${JSON.stringify(e)}`);
|
|
3537
|
-
}
|
|
3538
|
-
throw e;
|
|
3539
|
-
});
|
|
3540
|
-
}
|
|
3541
|
-
}
|
|
3412
|
+
stopOrResumeVideo() {
|
|
3542
3413
|
}
|
|
3543
3414
|
removeScreenshareStream(stream, { requestedByClientId } = {}) {
|
|
3544
3415
|
logger$6.info("removeScreenshareStream() [stream.id: %s, requestedByClientId: %s]", stream.id, requestedByClientId);
|
|
@@ -4406,10 +4277,10 @@ const STREAM_TYPES = {
|
|
|
4406
4277
|
screenshare: "screenshare",
|
|
4407
4278
|
};
|
|
4408
4279
|
|
|
4409
|
-
var _a;
|
|
4410
|
-
const adapter = (_a = adapterRaw.default) !== null && _a !== void 0 ? _a : adapterRaw;
|
|
4280
|
+
var _a$1;
|
|
4281
|
+
const adapter$1 = (_a$1 = adapterRaw.default) !== null && _a$1 !== void 0 ? _a$1 : adapterRaw;
|
|
4411
4282
|
const logger$2 = new Logger();
|
|
4412
|
-
const browserName = adapter.browserDetails.browser;
|
|
4283
|
+
const browserName = adapter$1.browserDetails.browser;
|
|
4413
4284
|
let unloading = false;
|
|
4414
4285
|
const RESTARTICE_ERROR_RETRY_THRESHOLD_IN_MS = 3500;
|
|
4415
4286
|
const RESTARTICE_ERROR_MAX_RETRY_COUNT = 5;
|
|
@@ -4460,7 +4331,6 @@ class VegaRtcManager {
|
|
|
4460
4331
|
this._sndTransportIceRestartPromise = null;
|
|
4461
4332
|
this._rcvTransportIceRestartPromise = null;
|
|
4462
4333
|
this._colocation = null;
|
|
4463
|
-
this._stopCameraTimeout = null;
|
|
4464
4334
|
this._audioTrackOnEnded = () => {
|
|
4465
4335
|
rtcStats.sendEvent("audio_ended", { unloading });
|
|
4466
4336
|
this._emitToPWA(rtcManagerEvents.MICROPHONE_STOPPED_WORKING, {});
|
|
@@ -4503,7 +4373,6 @@ class VegaRtcManager {
|
|
|
4503
4373
|
vegaIceRestarts: 0,
|
|
4504
4374
|
vegaIceRestartMissingTransport: 0,
|
|
4505
4375
|
vegaIceRestartWrongTransportId: 0,
|
|
4506
|
-
vegaNonErrorRejectionValueGUMError: 0,
|
|
4507
4376
|
vegaReplaceTrackNoProducerNoEnabledTrack: 0,
|
|
4508
4377
|
vegaMicProducerFailed: 0,
|
|
4509
4378
|
vegaWebcamProducerFailed: 0,
|
|
@@ -5553,9 +5422,9 @@ class VegaRtcManager {
|
|
|
5553
5422
|
return;
|
|
5554
5423
|
}
|
|
5555
5424
|
}
|
|
5556
|
-
stopOrResumeAudio(
|
|
5557
|
-
logger$2.info("stopOrResumeAudio() [
|
|
5558
|
-
this._micPaused = !
|
|
5425
|
+
stopOrResumeAudio({ enable }) {
|
|
5426
|
+
logger$2.info("stopOrResumeAudio() [enable:%s]", enable);
|
|
5427
|
+
this._micPaused = !enable;
|
|
5559
5428
|
this._pauseResumeMic();
|
|
5560
5429
|
}
|
|
5561
5430
|
_handleStopOrResumeVideo({ enable, track }) {
|
|
@@ -5570,61 +5439,10 @@ class VegaRtcManager {
|
|
|
5570
5439
|
this._sendWebcam(track);
|
|
5571
5440
|
}
|
|
5572
5441
|
}
|
|
5573
|
-
stopOrResumeVideo(
|
|
5574
|
-
var _a;
|
|
5442
|
+
stopOrResumeVideo({ enable }) {
|
|
5575
5443
|
logger$2.info("stopOrResumeVideo() [enable:%s]", enable);
|
|
5576
5444
|
this._webcamPaused = !enable;
|
|
5577
5445
|
this._pauseResumeWebcam();
|
|
5578
|
-
if (!["chrome", "safari"].includes(browserName)) {
|
|
5579
|
-
return;
|
|
5580
|
-
}
|
|
5581
|
-
if (this._stopCameraTimeout) {
|
|
5582
|
-
clearTimeout(this._stopCameraTimeout);
|
|
5583
|
-
this._stopCameraTimeout = null;
|
|
5584
|
-
}
|
|
5585
|
-
if (!enable) {
|
|
5586
|
-
const stopCameraDelay = ((_a = localStream.getVideoTracks().find((t) => !t.enabled)) === null || _a === void 0 ? void 0 : _a.readyState) === "ended" ? 0 : 5000;
|
|
5587
|
-
this._stopCameraTimeout = setTimeout(() => {
|
|
5588
|
-
localStream.getVideoTracks().forEach((track) => {
|
|
5589
|
-
if (track.enabled === false) {
|
|
5590
|
-
track.stop();
|
|
5591
|
-
localStream.removeTrack(track);
|
|
5592
|
-
this._emitToPWA(EVENTS.LOCAL_STREAM_TRACK_REMOVED, {
|
|
5593
|
-
stream: localStream,
|
|
5594
|
-
track,
|
|
5595
|
-
});
|
|
5596
|
-
this._handleStopOrResumeVideo({ enable, track });
|
|
5597
|
-
}
|
|
5598
|
-
});
|
|
5599
|
-
}, stopCameraDelay);
|
|
5600
|
-
}
|
|
5601
|
-
else if (localStream.getVideoTracks().length === 0) {
|
|
5602
|
-
const constraints = getConstraints(this._webrtcProvider.getMediaOptions()).video;
|
|
5603
|
-
navigator.mediaDevices
|
|
5604
|
-
.getUserMedia({ video: constraints })
|
|
5605
|
-
.then((stream) => {
|
|
5606
|
-
const track = stream.getVideoTracks()[0];
|
|
5607
|
-
if (this._webcamPaused) {
|
|
5608
|
-
track.stop();
|
|
5609
|
-
return;
|
|
5610
|
-
}
|
|
5611
|
-
localStream.addTrack(track);
|
|
5612
|
-
this._monitorVideoTrack(track);
|
|
5613
|
-
this._emitToPWA(EVENTS.LOCAL_STREAM_TRACK_ADDED, {
|
|
5614
|
-
streamId: localStream.id,
|
|
5615
|
-
tracks: [track],
|
|
5616
|
-
screenShare: false,
|
|
5617
|
-
});
|
|
5618
|
-
this._handleStopOrResumeVideo({ enable, track });
|
|
5619
|
-
})
|
|
5620
|
-
.catch((e) => {
|
|
5621
|
-
if (!(e instanceof Error)) {
|
|
5622
|
-
this.analytics.vegaNonErrorRejectionValueGUMError++;
|
|
5623
|
-
e = new Error(`non-error gUM rejection value: ${JSON.stringify(e)}`);
|
|
5624
|
-
}
|
|
5625
|
-
throw e;
|
|
5626
|
-
});
|
|
5627
|
-
}
|
|
5628
5446
|
}
|
|
5629
5447
|
acceptNewStream({ streamId, clientId }) {
|
|
5630
5448
|
logger$2.info("acceptNewStream()", { streamId, clientId });
|
|
@@ -7233,6 +7051,74 @@ class BandwidthTester extends EventEmitter {
|
|
|
7233
7051
|
}
|
|
7234
7052
|
}
|
|
7235
7053
|
|
|
7054
|
+
var _a, _b;
|
|
7055
|
+
const adapter = (_a = adapterRaw.default) !== null && _a !== void 0 ? _a : adapterRaw;
|
|
7056
|
+
const isSafari = ((_b = adapter.browserDetails) === null || _b === void 0 ? void 0 : _b.browser) === "safari";
|
|
7057
|
+
const parseResolution = (res) => res.split(/[^\d]/g).map((n) => parseInt(n, 10));
|
|
7058
|
+
function getMediaConstraints({ disableAEC, disableAGC, hd, lax, lowDataMode, preferredDeviceIds, resolution, simulcast, widescreen, }) {
|
|
7059
|
+
var _a, _b;
|
|
7060
|
+
let HIGH_HEIGHT = 480;
|
|
7061
|
+
let LOW_HEIGHT = 240;
|
|
7062
|
+
if (hd) {
|
|
7063
|
+
HIGH_HEIGHT = lax || isSafari ? 720 : { min: 360, ideal: 720 };
|
|
7064
|
+
}
|
|
7065
|
+
if (simulcast) {
|
|
7066
|
+
if (hd === false) {
|
|
7067
|
+
HIGH_HEIGHT = 360;
|
|
7068
|
+
LOW_HEIGHT = 270;
|
|
7069
|
+
}
|
|
7070
|
+
else {
|
|
7071
|
+
LOW_HEIGHT = 360;
|
|
7072
|
+
}
|
|
7073
|
+
}
|
|
7074
|
+
const constraints = {
|
|
7075
|
+
audio: Object.assign({}, (preferredDeviceIds.audioId && { deviceId: preferredDeviceIds.audioId })),
|
|
7076
|
+
video: Object.assign(Object.assign({}, (preferredDeviceIds.videoId ? { deviceId: preferredDeviceIds.videoId } : { facingMode: "user" })), { height: lowDataMode ? LOW_HEIGHT : HIGH_HEIGHT, frameRate: lowDataMode && !simulcast ? 15 : 24 }),
|
|
7077
|
+
};
|
|
7078
|
+
if (lax) {
|
|
7079
|
+
if (!((_a = constraints.audio) === null || _a === void 0 ? void 0 : _a.deviceId))
|
|
7080
|
+
constraints.audio = true;
|
|
7081
|
+
(_b = constraints.video) === null || _b === void 0 ? true : delete _b.facingMode;
|
|
7082
|
+
return constraints;
|
|
7083
|
+
}
|
|
7084
|
+
if (resolution) {
|
|
7085
|
+
const [w, h, fps] = parseResolution(resolution);
|
|
7086
|
+
if (w)
|
|
7087
|
+
constraints.video.width = { exact: w };
|
|
7088
|
+
if (h)
|
|
7089
|
+
constraints.video.height = { exact: h };
|
|
7090
|
+
if (fps)
|
|
7091
|
+
constraints.video.frameRate = { exact: fps };
|
|
7092
|
+
delete constraints.video.facingMode;
|
|
7093
|
+
}
|
|
7094
|
+
else {
|
|
7095
|
+
constraints.video.aspectRatio = widescreen ? 16 / 9 : 4 / 3;
|
|
7096
|
+
}
|
|
7097
|
+
if (disableAGC)
|
|
7098
|
+
constraints.audio.autoGainControl = false;
|
|
7099
|
+
if (disableAEC)
|
|
7100
|
+
constraints.audio.echoCancellation = false;
|
|
7101
|
+
return constraints;
|
|
7102
|
+
}
|
|
7103
|
+
function getConstraints({ devices, videoId, audioId, options, type = "ideal" }) {
|
|
7104
|
+
const strict = !!devices;
|
|
7105
|
+
const audioDevices = devices === null || devices === void 0 ? void 0 : devices.filter((d) => d.kind === "audioinput");
|
|
7106
|
+
const videoDevices = devices === null || devices === void 0 ? void 0 : devices.filter((d) => d.kind === "videoinput");
|
|
7107
|
+
const useDefaultAudio = !audioId || (strict && !(audioDevices === null || audioDevices === void 0 ? void 0 : audioDevices.some((d) => d.deviceId === audioId)));
|
|
7108
|
+
const useDefaultVideo = !videoId || (strict && !(videoDevices === null || videoDevices === void 0 ? void 0 : videoDevices.some((d) => d.deviceId === videoId)));
|
|
7109
|
+
const constraints = getMediaConstraints(Object.assign({ preferredDeviceIds: {
|
|
7110
|
+
audioId: useDefaultAudio ? null : { [type]: audioId },
|
|
7111
|
+
videoId: useDefaultVideo ? null : { [type]: videoId },
|
|
7112
|
+
} }, options));
|
|
7113
|
+
if (audioId === false || (strict && !(audioDevices === null || audioDevices === void 0 ? void 0 : audioDevices.length))) {
|
|
7114
|
+
delete constraints.audio;
|
|
7115
|
+
}
|
|
7116
|
+
if (videoId === false || (strict && !(videoDevices === null || videoDevices === void 0 ? void 0 : videoDevices.length))) {
|
|
7117
|
+
delete constraints.video;
|
|
7118
|
+
}
|
|
7119
|
+
return constraints;
|
|
7120
|
+
}
|
|
7121
|
+
|
|
7236
7122
|
const logger = new Logger();
|
|
7237
7123
|
const isMobile = typeof navigator !== "undefined" && /mobi/i.test(navigator.userAgent);
|
|
7238
7124
|
class NoDevicesError extends Error {
|
|
@@ -7306,9 +7192,9 @@ function getSettingsFromTrack(kind, track, devices, lastUsedId) {
|
|
|
7306
7192
|
settings.deviceId = (_c = track.getConstraints()) === null || _c === void 0 ? void 0 : _c.deviceId;
|
|
7307
7193
|
return settings;
|
|
7308
7194
|
}
|
|
7309
|
-
function getDeviceData({ audioTrack, videoTrack, devices,
|
|
7195
|
+
function getDeviceData({ audioTrack, videoTrack, devices, lastAudioId, lastVideoId, }) {
|
|
7310
7196
|
const usable = (d) => ((d === null || d === void 0 ? void 0 : d.readyState) === "live" ? d : null);
|
|
7311
|
-
videoTrack = usable(videoTrack)
|
|
7197
|
+
videoTrack = usable(videoTrack);
|
|
7312
7198
|
audioTrack = usable(audioTrack);
|
|
7313
7199
|
const video = getSettingsFromTrack("videoinput", videoTrack, devices, lastVideoId);
|
|
7314
7200
|
const audio = getSettingsFromTrack("audioinput", audioTrack, devices, lastAudioId);
|
package/dist/index.d.cts
CHANGED
|
@@ -435,7 +435,6 @@ type VegaAnalytics = {
|
|
|
435
435
|
vegaIceRestarts: number;
|
|
436
436
|
vegaIceRestartMissingTransport: number;
|
|
437
437
|
vegaIceRestartWrongTransportId: number;
|
|
438
|
-
vegaNonErrorRejectionValueGUMError: number;
|
|
439
438
|
vegaReplaceTrackNoProducerNoEnabledTrack: number;
|
|
440
439
|
vegaMicProducerFailed: number;
|
|
441
440
|
vegaWebcamProducerFailed: number;
|
|
@@ -904,6 +903,7 @@ interface CloudRecordingStartedEvent {
|
|
|
904
903
|
}
|
|
905
904
|
interface ClientLeftEvent {
|
|
906
905
|
clientId: string;
|
|
906
|
+
eventClaim: string;
|
|
907
907
|
}
|
|
908
908
|
interface NewClientEvent {
|
|
909
909
|
client: SignalClient;
|
|
@@ -1382,11 +1382,10 @@ declare function buildDeviceList({ busyDeviceIds, devices, kind }: BuildDeviceLi
|
|
|
1382
1382
|
label: string;
|
|
1383
1383
|
}[];
|
|
1384
1384
|
declare function getUserMedia(constraints: any): Promise<MediaStream>;
|
|
1385
|
-
declare function getDeviceData({ audioTrack, videoTrack, devices,
|
|
1385
|
+
declare function getDeviceData({ audioTrack, videoTrack, devices, lastAudioId, lastVideoId, }: {
|
|
1386
1386
|
audioTrack?: MediaStreamTrack | null;
|
|
1387
1387
|
videoTrack?: MediaStreamTrack | null;
|
|
1388
1388
|
devices: MediaDeviceInfo[];
|
|
1389
|
-
stoppedVideoTrack?: MediaStreamTrack;
|
|
1390
1389
|
lastAudioId?: string | undefined;
|
|
1391
1390
|
lastVideoId?: string | undefined;
|
|
1392
1391
|
}): GetDeviceDataResult;
|
|
@@ -1631,7 +1630,6 @@ interface NegotiatePeerConnectionOptions {
|
|
|
1631
1630
|
}
|
|
1632
1631
|
type P2PAnalytics = {
|
|
1633
1632
|
P2POffendingInitialOffer: number;
|
|
1634
|
-
P2PNonErrorRejectionValueGUMError: number;
|
|
1635
1633
|
numNewPc: number;
|
|
1636
1634
|
numIceConnected: number;
|
|
1637
1635
|
numIceDisconnected: number;
|
|
@@ -1685,7 +1683,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1685
1683
|
_turnServers: any;
|
|
1686
1684
|
_mediaserverConfigTtlSeconds: any;
|
|
1687
1685
|
_fetchMediaServersTimer: ClearableTimeout | null;
|
|
1688
|
-
_stopCameraTimeout: ClearableTimeout | null;
|
|
1689
1686
|
_icePublicIPGatheringTimeoutID: ClearableTimeout | null;
|
|
1690
1687
|
_stoppedVideoTrack?: MediaStreamTrack;
|
|
1691
1688
|
_videoTrackBeingMonitored?: MediaStreamTrack;
|
|
@@ -1693,7 +1690,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1693
1690
|
_closed: boolean;
|
|
1694
1691
|
analytics: P2PAnalytics;
|
|
1695
1692
|
_rtcStatsDisconnectTimeout?: ReturnType<typeof setTimeout>;
|
|
1696
|
-
_webcamPaused?: boolean;
|
|
1697
1693
|
_videoTrackIdByStreamId: Record<string, string>;
|
|
1698
1694
|
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features }: RtcManagerOptions);
|
|
1699
1695
|
numberOfPeerconnections(): number;
|
|
@@ -1702,7 +1698,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1702
1698
|
roomName: string;
|
|
1703
1699
|
isSfu: boolean;
|
|
1704
1700
|
}): boolean;
|
|
1705
|
-
addCameraStream(stream: MediaStream, {
|
|
1701
|
+
addCameraStream(stream: MediaStream, { beforeEffectTracks }?: AddCameraStreamOptions): void;
|
|
1706
1702
|
_enableStopResumeVideoForBrowserSDK(stream: MediaStream): void;
|
|
1707
1703
|
addScreenshareStream(stream: MediaStream): void;
|
|
1708
1704
|
replaceTrack(oldTrack: MediaStreamTrack | null, newTrack: MediaStreamTrack): Promise<void | any[]>;
|
|
@@ -1756,7 +1752,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1756
1752
|
enable: boolean;
|
|
1757
1753
|
track: MediaStreamTrack;
|
|
1758
1754
|
}): void;
|
|
1759
|
-
stopOrResumeVideo(
|
|
1755
|
+
stopOrResumeVideo(): void;
|
|
1760
1756
|
removeScreenshareStream(stream: MediaStream, { requestedByClientId }?: RemoveScreenshareStreamOptions): void;
|
|
1761
1757
|
hasClient(clientId: string): boolean;
|
|
1762
1758
|
shouldAcceptStreamsFromBothSides(): boolean;
|
|
@@ -2015,7 +2011,6 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2015
2011
|
_sndTransportIceRestartPromise: any;
|
|
2016
2012
|
_rcvTransportIceRestartPromise: any;
|
|
2017
2013
|
_colocation: any;
|
|
2018
|
-
_stopCameraTimeout: ClearableTimeout | null;
|
|
2019
2014
|
_audioTrackOnEnded: any;
|
|
2020
2015
|
_videoTrackOnEnded: any;
|
|
2021
2016
|
_socketListenerDeregisterFunctions: any;
|
|
@@ -2094,12 +2089,16 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2094
2089
|
_enableStopResumeVideoForBrowserSDK(stream: MediaStream): void;
|
|
2095
2090
|
addScreenshareStream(stream: MediaStream): void;
|
|
2096
2091
|
_syncMicAnalyser(): void;
|
|
2097
|
-
stopOrResumeAudio(
|
|
2092
|
+
stopOrResumeAudio({ enable }: {
|
|
2093
|
+
enable: boolean;
|
|
2094
|
+
}): void;
|
|
2098
2095
|
_handleStopOrResumeVideo({ enable, track }: {
|
|
2099
2096
|
enable: boolean;
|
|
2100
2097
|
track: MediaStreamTrack;
|
|
2101
2098
|
}): void;
|
|
2102
|
-
stopOrResumeVideo(
|
|
2099
|
+
stopOrResumeVideo({ enable }: {
|
|
2100
|
+
enable: boolean;
|
|
2101
|
+
}): void;
|
|
2103
2102
|
acceptNewStream({ streamId, clientId }: {
|
|
2104
2103
|
streamId: string;
|
|
2105
2104
|
clientId: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -435,7 +435,6 @@ type VegaAnalytics = {
|
|
|
435
435
|
vegaIceRestarts: number;
|
|
436
436
|
vegaIceRestartMissingTransport: number;
|
|
437
437
|
vegaIceRestartWrongTransportId: number;
|
|
438
|
-
vegaNonErrorRejectionValueGUMError: number;
|
|
439
438
|
vegaReplaceTrackNoProducerNoEnabledTrack: number;
|
|
440
439
|
vegaMicProducerFailed: number;
|
|
441
440
|
vegaWebcamProducerFailed: number;
|
|
@@ -904,6 +903,7 @@ interface CloudRecordingStartedEvent {
|
|
|
904
903
|
}
|
|
905
904
|
interface ClientLeftEvent {
|
|
906
905
|
clientId: string;
|
|
906
|
+
eventClaim: string;
|
|
907
907
|
}
|
|
908
908
|
interface NewClientEvent {
|
|
909
909
|
client: SignalClient;
|
|
@@ -1382,11 +1382,10 @@ declare function buildDeviceList({ busyDeviceIds, devices, kind }: BuildDeviceLi
|
|
|
1382
1382
|
label: string;
|
|
1383
1383
|
}[];
|
|
1384
1384
|
declare function getUserMedia(constraints: any): Promise<MediaStream>;
|
|
1385
|
-
declare function getDeviceData({ audioTrack, videoTrack, devices,
|
|
1385
|
+
declare function getDeviceData({ audioTrack, videoTrack, devices, lastAudioId, lastVideoId, }: {
|
|
1386
1386
|
audioTrack?: MediaStreamTrack | null;
|
|
1387
1387
|
videoTrack?: MediaStreamTrack | null;
|
|
1388
1388
|
devices: MediaDeviceInfo[];
|
|
1389
|
-
stoppedVideoTrack?: MediaStreamTrack;
|
|
1390
1389
|
lastAudioId?: string | undefined;
|
|
1391
1390
|
lastVideoId?: string | undefined;
|
|
1392
1391
|
}): GetDeviceDataResult;
|
|
@@ -1631,7 +1630,6 @@ interface NegotiatePeerConnectionOptions {
|
|
|
1631
1630
|
}
|
|
1632
1631
|
type P2PAnalytics = {
|
|
1633
1632
|
P2POffendingInitialOffer: number;
|
|
1634
|
-
P2PNonErrorRejectionValueGUMError: number;
|
|
1635
1633
|
numNewPc: number;
|
|
1636
1634
|
numIceConnected: number;
|
|
1637
1635
|
numIceDisconnected: number;
|
|
@@ -1685,7 +1683,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1685
1683
|
_turnServers: any;
|
|
1686
1684
|
_mediaserverConfigTtlSeconds: any;
|
|
1687
1685
|
_fetchMediaServersTimer: ClearableTimeout | null;
|
|
1688
|
-
_stopCameraTimeout: ClearableTimeout | null;
|
|
1689
1686
|
_icePublicIPGatheringTimeoutID: ClearableTimeout | null;
|
|
1690
1687
|
_stoppedVideoTrack?: MediaStreamTrack;
|
|
1691
1688
|
_videoTrackBeingMonitored?: MediaStreamTrack;
|
|
@@ -1693,7 +1690,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1693
1690
|
_closed: boolean;
|
|
1694
1691
|
analytics: P2PAnalytics;
|
|
1695
1692
|
_rtcStatsDisconnectTimeout?: ReturnType<typeof setTimeout>;
|
|
1696
|
-
_webcamPaused?: boolean;
|
|
1697
1693
|
_videoTrackIdByStreamId: Record<string, string>;
|
|
1698
1694
|
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features }: RtcManagerOptions);
|
|
1699
1695
|
numberOfPeerconnections(): number;
|
|
@@ -1702,7 +1698,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1702
1698
|
roomName: string;
|
|
1703
1699
|
isSfu: boolean;
|
|
1704
1700
|
}): boolean;
|
|
1705
|
-
addCameraStream(stream: MediaStream, {
|
|
1701
|
+
addCameraStream(stream: MediaStream, { beforeEffectTracks }?: AddCameraStreamOptions): void;
|
|
1706
1702
|
_enableStopResumeVideoForBrowserSDK(stream: MediaStream): void;
|
|
1707
1703
|
addScreenshareStream(stream: MediaStream): void;
|
|
1708
1704
|
replaceTrack(oldTrack: MediaStreamTrack | null, newTrack: MediaStreamTrack): Promise<void | any[]>;
|
|
@@ -1756,7 +1752,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1756
1752
|
enable: boolean;
|
|
1757
1753
|
track: MediaStreamTrack;
|
|
1758
1754
|
}): void;
|
|
1759
|
-
stopOrResumeVideo(
|
|
1755
|
+
stopOrResumeVideo(): void;
|
|
1760
1756
|
removeScreenshareStream(stream: MediaStream, { requestedByClientId }?: RemoveScreenshareStreamOptions): void;
|
|
1761
1757
|
hasClient(clientId: string): boolean;
|
|
1762
1758
|
shouldAcceptStreamsFromBothSides(): boolean;
|
|
@@ -2015,7 +2011,6 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2015
2011
|
_sndTransportIceRestartPromise: any;
|
|
2016
2012
|
_rcvTransportIceRestartPromise: any;
|
|
2017
2013
|
_colocation: any;
|
|
2018
|
-
_stopCameraTimeout: ClearableTimeout | null;
|
|
2019
2014
|
_audioTrackOnEnded: any;
|
|
2020
2015
|
_videoTrackOnEnded: any;
|
|
2021
2016
|
_socketListenerDeregisterFunctions: any;
|
|
@@ -2094,12 +2089,16 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2094
2089
|
_enableStopResumeVideoForBrowserSDK(stream: MediaStream): void;
|
|
2095
2090
|
addScreenshareStream(stream: MediaStream): void;
|
|
2096
2091
|
_syncMicAnalyser(): void;
|
|
2097
|
-
stopOrResumeAudio(
|
|
2092
|
+
stopOrResumeAudio({ enable }: {
|
|
2093
|
+
enable: boolean;
|
|
2094
|
+
}): void;
|
|
2098
2095
|
_handleStopOrResumeVideo({ enable, track }: {
|
|
2099
2096
|
enable: boolean;
|
|
2100
2097
|
track: MediaStreamTrack;
|
|
2101
2098
|
}): void;
|
|
2102
|
-
stopOrResumeVideo(
|
|
2099
|
+
stopOrResumeVideo({ enable }: {
|
|
2100
|
+
enable: boolean;
|
|
2101
|
+
}): void;
|
|
2103
2102
|
acceptNewStream({ streamId, clientId }: {
|
|
2104
2103
|
streamId: string;
|
|
2105
2104
|
clientId: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -435,7 +435,6 @@ type VegaAnalytics = {
|
|
|
435
435
|
vegaIceRestarts: number;
|
|
436
436
|
vegaIceRestartMissingTransport: number;
|
|
437
437
|
vegaIceRestartWrongTransportId: number;
|
|
438
|
-
vegaNonErrorRejectionValueGUMError: number;
|
|
439
438
|
vegaReplaceTrackNoProducerNoEnabledTrack: number;
|
|
440
439
|
vegaMicProducerFailed: number;
|
|
441
440
|
vegaWebcamProducerFailed: number;
|
|
@@ -904,6 +903,7 @@ interface CloudRecordingStartedEvent {
|
|
|
904
903
|
}
|
|
905
904
|
interface ClientLeftEvent {
|
|
906
905
|
clientId: string;
|
|
906
|
+
eventClaim: string;
|
|
907
907
|
}
|
|
908
908
|
interface NewClientEvent {
|
|
909
909
|
client: SignalClient;
|
|
@@ -1382,11 +1382,10 @@ declare function buildDeviceList({ busyDeviceIds, devices, kind }: BuildDeviceLi
|
|
|
1382
1382
|
label: string;
|
|
1383
1383
|
}[];
|
|
1384
1384
|
declare function getUserMedia(constraints: any): Promise<MediaStream>;
|
|
1385
|
-
declare function getDeviceData({ audioTrack, videoTrack, devices,
|
|
1385
|
+
declare function getDeviceData({ audioTrack, videoTrack, devices, lastAudioId, lastVideoId, }: {
|
|
1386
1386
|
audioTrack?: MediaStreamTrack | null;
|
|
1387
1387
|
videoTrack?: MediaStreamTrack | null;
|
|
1388
1388
|
devices: MediaDeviceInfo[];
|
|
1389
|
-
stoppedVideoTrack?: MediaStreamTrack;
|
|
1390
1389
|
lastAudioId?: string | undefined;
|
|
1391
1390
|
lastVideoId?: string | undefined;
|
|
1392
1391
|
}): GetDeviceDataResult;
|
|
@@ -1631,7 +1630,6 @@ interface NegotiatePeerConnectionOptions {
|
|
|
1631
1630
|
}
|
|
1632
1631
|
type P2PAnalytics = {
|
|
1633
1632
|
P2POffendingInitialOffer: number;
|
|
1634
|
-
P2PNonErrorRejectionValueGUMError: number;
|
|
1635
1633
|
numNewPc: number;
|
|
1636
1634
|
numIceConnected: number;
|
|
1637
1635
|
numIceDisconnected: number;
|
|
@@ -1685,7 +1683,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1685
1683
|
_turnServers: any;
|
|
1686
1684
|
_mediaserverConfigTtlSeconds: any;
|
|
1687
1685
|
_fetchMediaServersTimer: ClearableTimeout | null;
|
|
1688
|
-
_stopCameraTimeout: ClearableTimeout | null;
|
|
1689
1686
|
_icePublicIPGatheringTimeoutID: ClearableTimeout | null;
|
|
1690
1687
|
_stoppedVideoTrack?: MediaStreamTrack;
|
|
1691
1688
|
_videoTrackBeingMonitored?: MediaStreamTrack;
|
|
@@ -1693,7 +1690,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1693
1690
|
_closed: boolean;
|
|
1694
1691
|
analytics: P2PAnalytics;
|
|
1695
1692
|
_rtcStatsDisconnectTimeout?: ReturnType<typeof setTimeout>;
|
|
1696
|
-
_webcamPaused?: boolean;
|
|
1697
1693
|
_videoTrackIdByStreamId: Record<string, string>;
|
|
1698
1694
|
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features }: RtcManagerOptions);
|
|
1699
1695
|
numberOfPeerconnections(): number;
|
|
@@ -1702,7 +1698,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1702
1698
|
roomName: string;
|
|
1703
1699
|
isSfu: boolean;
|
|
1704
1700
|
}): boolean;
|
|
1705
|
-
addCameraStream(stream: MediaStream, {
|
|
1701
|
+
addCameraStream(stream: MediaStream, { beforeEffectTracks }?: AddCameraStreamOptions): void;
|
|
1706
1702
|
_enableStopResumeVideoForBrowserSDK(stream: MediaStream): void;
|
|
1707
1703
|
addScreenshareStream(stream: MediaStream): void;
|
|
1708
1704
|
replaceTrack(oldTrack: MediaStreamTrack | null, newTrack: MediaStreamTrack): Promise<void | any[]>;
|
|
@@ -1756,7 +1752,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1756
1752
|
enable: boolean;
|
|
1757
1753
|
track: MediaStreamTrack;
|
|
1758
1754
|
}): void;
|
|
1759
|
-
stopOrResumeVideo(
|
|
1755
|
+
stopOrResumeVideo(): void;
|
|
1760
1756
|
removeScreenshareStream(stream: MediaStream, { requestedByClientId }?: RemoveScreenshareStreamOptions): void;
|
|
1761
1757
|
hasClient(clientId: string): boolean;
|
|
1762
1758
|
shouldAcceptStreamsFromBothSides(): boolean;
|
|
@@ -2015,7 +2011,6 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2015
2011
|
_sndTransportIceRestartPromise: any;
|
|
2016
2012
|
_rcvTransportIceRestartPromise: any;
|
|
2017
2013
|
_colocation: any;
|
|
2018
|
-
_stopCameraTimeout: ClearableTimeout | null;
|
|
2019
2014
|
_audioTrackOnEnded: any;
|
|
2020
2015
|
_videoTrackOnEnded: any;
|
|
2021
2016
|
_socketListenerDeregisterFunctions: any;
|
|
@@ -2094,12 +2089,16 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2094
2089
|
_enableStopResumeVideoForBrowserSDK(stream: MediaStream): void;
|
|
2095
2090
|
addScreenshareStream(stream: MediaStream): void;
|
|
2096
2091
|
_syncMicAnalyser(): void;
|
|
2097
|
-
stopOrResumeAudio(
|
|
2092
|
+
stopOrResumeAudio({ enable }: {
|
|
2093
|
+
enable: boolean;
|
|
2094
|
+
}): void;
|
|
2098
2095
|
_handleStopOrResumeVideo({ enable, track }: {
|
|
2099
2096
|
enable: boolean;
|
|
2100
2097
|
track: MediaStreamTrack;
|
|
2101
2098
|
}): void;
|
|
2102
|
-
stopOrResumeVideo(
|
|
2099
|
+
stopOrResumeVideo({ enable }: {
|
|
2100
|
+
enable: boolean;
|
|
2101
|
+
}): void;
|
|
2103
2102
|
acceptNewStream({ streamId, clientId }: {
|
|
2104
2103
|
streamId: string;
|
|
2105
2104
|
clientId: string;
|