@whereby.com/media 8.0.6 → 8.0.8
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 +38 -44
- package/dist/index.d.cts +43 -31
- package/dist/index.d.mts +43 -31
- package/dist/index.d.ts +43 -31
- package/dist/index.mjs +38 -44
- package/dist/legacy-esm.js +38 -44
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -295,7 +295,7 @@ class Logger {
|
|
|
295
295
|
|
|
296
296
|
var _a$6, _b$2;
|
|
297
297
|
const adapter$6 = (_a$6 = adapterRaw.default) !== null && _a$6 !== void 0 ? _a$6 : adapterRaw;
|
|
298
|
-
const logger$
|
|
298
|
+
const logger$b = new Logger();
|
|
299
299
|
const browserName$2 = (_b$2 = adapter$6.browserDetails) === null || _b$2 === void 0 ? void 0 : _b$2.browser;
|
|
300
300
|
const browserVersion$1 = adapter$6.browserDetails.version;
|
|
301
301
|
function setCodecPreferenceSDP({ sdp, redOn }) {
|
|
@@ -336,7 +336,7 @@ function setCodecPreferenceSDP({ sdp, redOn }) {
|
|
|
336
336
|
return newSdp;
|
|
337
337
|
}
|
|
338
338
|
catch (error) {
|
|
339
|
-
logger$
|
|
339
|
+
logger$b.error("setCodecPreferenceSDP error:", error);
|
|
340
340
|
return sdp;
|
|
341
341
|
}
|
|
342
342
|
}
|
|
@@ -487,7 +487,7 @@ function trackAnnotations(o) {
|
|
|
487
487
|
|
|
488
488
|
var _a$5;
|
|
489
489
|
const adapter$5 = (_a$5 = adapterRaw.default) !== null && _a$5 !== void 0 ? _a$5 : adapterRaw;
|
|
490
|
-
const logger$
|
|
490
|
+
const logger$a = new Logger();
|
|
491
491
|
class Session {
|
|
492
492
|
constructor({ clientId, bandwidth, peerConnectionConfig, deprioritizeH264Encoding, incrementAnalyticMetric, }) {
|
|
493
493
|
this.relayCandidateSeen = false;
|
|
@@ -636,7 +636,7 @@ class Session {
|
|
|
636
636
|
return;
|
|
637
637
|
}
|
|
638
638
|
this.pc.addIceCandidate(candidate).catch((e) => {
|
|
639
|
-
logger$
|
|
639
|
+
logger$a.warn("Failed to add ICE candidate ('%s'): %s", candidate ? candidate.candidate : null, e);
|
|
640
640
|
});
|
|
641
641
|
});
|
|
642
642
|
}
|
|
@@ -655,7 +655,7 @@ class Session {
|
|
|
655
655
|
pc.close();
|
|
656
656
|
}
|
|
657
657
|
catch (e) {
|
|
658
|
-
logger$
|
|
658
|
+
logger$a.warn("failures during close of session", e);
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
661
|
hasConnectedPeerConnection() {
|
|
@@ -663,7 +663,7 @@ class Session {
|
|
|
663
663
|
}
|
|
664
664
|
replaceTrack(oldTrack, newTrack) {
|
|
665
665
|
return __awaiter(this, void 0, void 0, function* () {
|
|
666
|
-
logger$
|
|
666
|
+
logger$a.info("replacetrack() [oldTrackId: %s, newTrackId: %s]", oldTrack === null || oldTrack === void 0 ? void 0 : oldTrack.id, newTrack.id);
|
|
667
667
|
if (newTrack.readyState === "ended") {
|
|
668
668
|
throw new Error(`refusing to use ended track with id: ${newTrack.id}, kind: ${newTrack.kind}`);
|
|
669
669
|
}
|
|
@@ -1064,7 +1064,7 @@ const getMediasoupDeviceAsync = (features) => __awaiter(void 0, void 0, void 0,
|
|
|
1064
1064
|
return new mediasoupClient.Device({ handlerName });
|
|
1065
1065
|
});
|
|
1066
1066
|
|
|
1067
|
-
const logger$
|
|
1067
|
+
const logger$9 = new Logger();
|
|
1068
1068
|
const AUDIO_SETTINGS = {
|
|
1069
1069
|
codecOptions: {
|
|
1070
1070
|
opusDtx: true,
|
|
@@ -1244,7 +1244,7 @@ function sortCodecsByPowerEfficiency(codecs) {
|
|
|
1244
1244
|
codecPowerEfficiencyEntries = yield Promise.all(codecs.map(({ mimeType }) => getIsCodecDecodingPowerEfficient(mimeType).then((val) => [mimeType, val])));
|
|
1245
1245
|
}
|
|
1246
1246
|
catch (error) {
|
|
1247
|
-
logger$
|
|
1247
|
+
logger$9.error(error);
|
|
1248
1248
|
return codecs;
|
|
1249
1249
|
}
|
|
1250
1250
|
const codecPowerEfficiencies = Object.fromEntries(codecPowerEfficiencyEntries);
|
|
@@ -1734,42 +1734,17 @@ function collectStats(state_1, _a, immediate_1) {
|
|
|
1734
1734
|
});
|
|
1735
1735
|
}
|
|
1736
1736
|
|
|
1737
|
-
const
|
|
1738
|
-
function registerOriginTrials(trials, registeredTrials = REGISTERED_TRIALS, document = window.document) {
|
|
1739
|
-
trials.forEach(({ hostnamePattern, token }) => {
|
|
1740
|
-
const key = `${hostnamePattern}-${token}`;
|
|
1741
|
-
if (registeredTrials[key]) {
|
|
1742
|
-
return;
|
|
1743
|
-
}
|
|
1744
|
-
if (hostnamePattern.test(document.location.hostname)) {
|
|
1745
|
-
const otMeta = document.createElement("meta");
|
|
1746
|
-
otMeta.httpEquiv = "origin-trial";
|
|
1747
|
-
otMeta.content = token;
|
|
1748
|
-
document.head.append(otMeta);
|
|
1749
|
-
registeredTrials[key] = true;
|
|
1750
|
-
}
|
|
1751
|
-
});
|
|
1752
|
-
}
|
|
1753
|
-
|
|
1737
|
+
const logger$8 = new Logger();
|
|
1754
1738
|
const CPU_OBSERVER_OPTIONS = {
|
|
1755
1739
|
sampleRate: 1,
|
|
1756
|
-
originTrials: [
|
|
1757
|
-
{
|
|
1758
|
-
hostnamePattern: /hereby\.dev/,
|
|
1759
|
-
token: "AkSNPHJw6EK08X0QU7kORnK9NABzRLAC7dqfXOwk5JwFAQG4Ey7WxLXxsnhieCgC1QHUdevE2EFICy7uBGDANwUAAABqeyJvcmlnaW4iOiJodHRwczovL2hlcmVieS5kZXY6NDQ0MyIsImZlYXR1cmUiOiJDb21wdXRlUHJlc3N1cmVfdjIiLCJleHBpcnkiOjE3MTY5NDA3OTksImlzU3ViZG9tYWluIjp0cnVlfQ==",
|
|
1760
|
-
},
|
|
1761
|
-
{
|
|
1762
|
-
hostnamePattern: /whereby\.com/,
|
|
1763
|
-
token: "Asc2wu8KpSx648i932NICteQDFcB05yl2QUUSHD7AQo8JGP2Fp6FF91TvYVJBsKGzLMH349rysPw5q9tqPC/PAUAAABqeyJvcmlnaW4iOiJodHRwczovL3doZXJlYnkuY29tOjQ0MyIsImZlYXR1cmUiOiJDb21wdXRlUHJlc3N1cmVfdjIiLCJleHBpcnkiOjE3MTY5NDA3OTksImlzU3ViZG9tYWluIjp0cnVlfQ==",
|
|
1764
|
-
},
|
|
1765
|
-
],
|
|
1766
1740
|
};
|
|
1767
|
-
function startCpuObserver(cb, { sampleRate,
|
|
1768
|
-
|
|
1741
|
+
function startCpuObserver(cb, { sampleRate, } = CPU_OBSERVER_OPTIONS, window = globalThis.window) {
|
|
1742
|
+
var _a;
|
|
1769
1743
|
let pressureObserver;
|
|
1770
|
-
if ("PressureObserver" in window
|
|
1744
|
+
if ("PressureObserver" in window &&
|
|
1745
|
+
(window.PressureObserver.knownSources || []).includes("cpu")) {
|
|
1771
1746
|
pressureObserver = new window.PressureObserver(cb, { sampleRate });
|
|
1772
|
-
pressureObserver.observe("cpu", { sampleInterval: sampleRate * 1000 });
|
|
1747
|
+
(_a = pressureObserver.observe("cpu", { sampleInterval: sampleRate * 1000 })) === null || _a === void 0 ? void 0 : _a.catch(logger$8.error);
|
|
1773
1748
|
return {
|
|
1774
1749
|
stop: () => {
|
|
1775
1750
|
pressureObserver.unobserve("cpu");
|
|
@@ -4035,9 +4010,10 @@ class SfuV2Parser {
|
|
|
4035
4010
|
|
|
4036
4011
|
const logger$3 = new Logger();
|
|
4037
4012
|
class VegaConnection extends EventEmitter.EventEmitter {
|
|
4038
|
-
constructor(wsUrl, protocol = "whereby-sfu#v4") {
|
|
4013
|
+
constructor(wsUrl, { protocol = "whereby-sfu#v4", incrementAnalyticMetric }) {
|
|
4039
4014
|
super();
|
|
4040
4015
|
this.socket = null;
|
|
4016
|
+
this.incrementAnalyticMetric = incrementAnalyticMetric;
|
|
4041
4017
|
this.wsUrl = wsUrl;
|
|
4042
4018
|
this.protocol = protocol;
|
|
4043
4019
|
this.sents = new Map();
|
|
@@ -4087,9 +4063,16 @@ class VegaConnection extends EventEmitter.EventEmitter {
|
|
|
4087
4063
|
logger$3.info("Error", error);
|
|
4088
4064
|
}
|
|
4089
4065
|
_handleResponse(socketMessage) {
|
|
4066
|
+
var _a;
|
|
4090
4067
|
const sent = this.sents.get(socketMessage.id);
|
|
4091
4068
|
if (!sent) {
|
|
4092
4069
|
logger$3.warn(`Received unknown message with id ${socketMessage.id} from SFU.`);
|
|
4070
|
+
(_a = this.incrementAnalyticMetric) === null || _a === void 0 ? void 0 : _a.call(this, "vegaUnknownResponse");
|
|
4071
|
+
rtcStats.sendEvent("VegaUnknownResponse", {
|
|
4072
|
+
id: socketMessage.id,
|
|
4073
|
+
code: socketMessage.errorCode,
|
|
4074
|
+
reason: socketMessage.errorReason,
|
|
4075
|
+
});
|
|
4093
4076
|
return;
|
|
4094
4077
|
}
|
|
4095
4078
|
if (socketMessage.ok) {
|
|
@@ -4132,6 +4115,12 @@ class VegaConnection extends EventEmitter.EventEmitter {
|
|
|
4132
4115
|
pReject(error);
|
|
4133
4116
|
},
|
|
4134
4117
|
timer: setTimeout(() => {
|
|
4118
|
+
var _a;
|
|
4119
|
+
(_a = this.incrementAnalyticMetric) === null || _a === void 0 ? void 0 : _a.call(this, "vegaRequestTimeout");
|
|
4120
|
+
rtcStats.sendEvent("VegaRequestTimeout", {
|
|
4121
|
+
id: request.id,
|
|
4122
|
+
method: request.method,
|
|
4123
|
+
});
|
|
4135
4124
|
if (!this.sents.delete(request.id))
|
|
4136
4125
|
return;
|
|
4137
4126
|
pReject(new Error("request timeout"));
|
|
@@ -4172,7 +4161,7 @@ function createVegaConnectionManager(config) {
|
|
|
4172
4161
|
};
|
|
4173
4162
|
let connectionAttemptInProgress = false;
|
|
4174
4163
|
let hasPendingConnectionAttempt = false;
|
|
4175
|
-
const connect = () => {
|
|
4164
|
+
const connect = (incrementAnalyticMetric) => {
|
|
4176
4165
|
if (connectionAttemptInProgress) {
|
|
4177
4166
|
hasPendingConnectionAttempt = true;
|
|
4178
4167
|
return;
|
|
@@ -4236,7 +4225,10 @@ function createVegaConnectionManager(config) {
|
|
|
4236
4225
|
});
|
|
4237
4226
|
return;
|
|
4238
4227
|
}
|
|
4239
|
-
const vegaConnection = new VegaConnection(((_a = config.getUrlForHost) === null || _a === void 0 ? void 0 : _a.call(config, host)) || host
|
|
4228
|
+
const vegaConnection = new VegaConnection(((_a = config.getUrlForHost) === null || _a === void 0 ? void 0 : _a.call(config, host)) || host, {
|
|
4229
|
+
protocol: "whereby-sfu#v4",
|
|
4230
|
+
incrementAnalyticMetric,
|
|
4231
|
+
});
|
|
4240
4232
|
let wasClosed = false;
|
|
4241
4233
|
vegaConnection.on("open", () => {
|
|
4242
4234
|
setTimeout(() => {
|
|
@@ -4410,6 +4402,8 @@ class VegaRtcManager {
|
|
|
4410
4402
|
this._networkIsDetectedUpBySignal = false;
|
|
4411
4403
|
this._cpuOveruseDetected = false;
|
|
4412
4404
|
this.analytics = {
|
|
4405
|
+
vegaRequestTimeout: 0,
|
|
4406
|
+
vegaUnknownResponse: 0,
|
|
4413
4407
|
vegaJoinFailed: 0,
|
|
4414
4408
|
vegaJoinWithoutVegaConnection: 0,
|
|
4415
4409
|
vegaCreateTransportWithoutVegaConnection: 0,
|
|
@@ -4545,7 +4539,7 @@ class VegaRtcManager {
|
|
|
4545
4539
|
},
|
|
4546
4540
|
});
|
|
4547
4541
|
}
|
|
4548
|
-
this._vegaConnectionManager.connect();
|
|
4542
|
+
this._vegaConnectionManager.connect((metric) => this.analytics[metric]++);
|
|
4549
4543
|
this._isConnectingOrConnected = true;
|
|
4550
4544
|
}
|
|
4551
4545
|
_onClose() {
|
|
@@ -6614,7 +6608,7 @@ class BandwidthTester extends EventEmitter {
|
|
|
6614
6608
|
this._startTime = Date.now();
|
|
6615
6609
|
const host = this._features.sfuServerOverrideHost || "any.sfu.svc.whereby.com";
|
|
6616
6610
|
const wsUrl = `wss://${host}`;
|
|
6617
|
-
this._vegaConnection = new VegaConnection(wsUrl, "whereby-sfu#bw-test-v1");
|
|
6611
|
+
this._vegaConnection = new VegaConnection(wsUrl, { protocol: "whereby-sfu#bw-test-v1" });
|
|
6618
6612
|
this._vegaConnection.on("open", () => this._start());
|
|
6619
6613
|
this._vegaConnection.on("close", () => this.close(true));
|
|
6620
6614
|
this._vegaConnection.on("message", (message) => this._onMessage(message));
|
package/dist/index.d.cts
CHANGED
|
@@ -205,6 +205,7 @@ declare function startPerformanceMonitor({ onMetricsUpdated, onTerminated, isHid
|
|
|
205
205
|
};
|
|
206
206
|
|
|
207
207
|
interface PressureObserver {
|
|
208
|
+
knownSources: string[];
|
|
208
209
|
observe: (source: string, options: {
|
|
209
210
|
sampleInterval: number;
|
|
210
211
|
}) => Promise<undefined>;
|
|
@@ -382,6 +383,40 @@ declare function sortCodecs(codecs: Codec[], features: {
|
|
|
382
383
|
av1On?: boolean;
|
|
383
384
|
}): Promise<Codec[]>;
|
|
384
385
|
|
|
386
|
+
type VegaTransportDirection = "send" | "recv";
|
|
387
|
+
|
|
388
|
+
type VegaAnalytics = {
|
|
389
|
+
vegaUnknownResponse: number;
|
|
390
|
+
vegaRequestTimeout: number;
|
|
391
|
+
vegaJoinFailed: number;
|
|
392
|
+
vegaJoinWithoutVegaConnection: number;
|
|
393
|
+
vegaCreateTransportWithoutVegaConnection: number;
|
|
394
|
+
vegaIceRestarts: number;
|
|
395
|
+
vegaIceRestartMissingTransport: number;
|
|
396
|
+
vegaIceRestartWrongTransportId: number;
|
|
397
|
+
vegaNonErrorRejectionValueGUMError: number;
|
|
398
|
+
vegaReplaceTrackNoProducerNoEnabledTrack: number;
|
|
399
|
+
micTrackEndedCount: number;
|
|
400
|
+
camTrackEndedCount: number;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
type VegaAnalyticMetric = keyof VegaAnalytics;
|
|
404
|
+
|
|
405
|
+
type VegaIncrementAnalyticMetric = (metric: VegaAnalyticMetric) => void;
|
|
406
|
+
|
|
407
|
+
type MediaStreamWhichMayHaveInboundId = MediaStream & { inboundId?: string };
|
|
408
|
+
|
|
409
|
+
type ClientState = {
|
|
410
|
+
hasAcceptedWebcamStream: Boolean;
|
|
411
|
+
hasAcceptedScreenStream: Boolean;
|
|
412
|
+
hasEmittedWebcamStream: Boolean;
|
|
413
|
+
hasEmittedScreenStream: Boolean;
|
|
414
|
+
webcamStream?: MediaStreamWhichMayHaveInboundId;
|
|
415
|
+
screenStream?: MediaStreamWhichMayHaveInboundId;
|
|
416
|
+
screenShareStreamId?: string;
|
|
417
|
+
camStreamId?: string;
|
|
418
|
+
};
|
|
419
|
+
|
|
385
420
|
declare enum RtcEventNames {
|
|
386
421
|
rtc_manager_created = "rtc_manager_created",
|
|
387
422
|
stream_added = "stream_added"
|
|
@@ -400,6 +435,10 @@ interface RtcManagerOptions {
|
|
|
400
435
|
interface VegaRtcManagerOptions extends RtcManagerOptions {
|
|
401
436
|
eventClaim: string;
|
|
402
437
|
}
|
|
438
|
+
interface VegaConnectionOptions {
|
|
439
|
+
protocol?: string;
|
|
440
|
+
incrementAnalyticMetric?: VegaIncrementAnalyticMetric;
|
|
441
|
+
}
|
|
403
442
|
interface RtcManager {
|
|
404
443
|
acceptNewStream: ({ clientId, streamId }: {
|
|
405
444
|
clientId: string;
|
|
@@ -1476,7 +1515,8 @@ declare class VegaConnection extends EventEmitter$1 {
|
|
|
1476
1515
|
protocol: string;
|
|
1477
1516
|
socket: WebSocket | null;
|
|
1478
1517
|
sents: Map<any, any>;
|
|
1479
|
-
|
|
1518
|
+
incrementAnalyticMetric?: VegaIncrementAnalyticMetric;
|
|
1519
|
+
constructor(wsUrl: string, { protocol, incrementAnalyticMetric }: VegaConnectionOptions);
|
|
1480
1520
|
_setupSocket(): void;
|
|
1481
1521
|
_tearDown(): void;
|
|
1482
1522
|
close(): void;
|
|
@@ -1578,40 +1618,12 @@ declare function createVegaConnectionManager(config: {
|
|
|
1578
1618
|
onDisconnected?: () => void;
|
|
1579
1619
|
onFailed?: () => void;
|
|
1580
1620
|
}): {
|
|
1581
|
-
connect: () => void;
|
|
1621
|
+
connect: (incrementAnalyticMetric?: VegaIncrementAnalyticMetric) => void;
|
|
1582
1622
|
updateHostList: (updatedHostList: string | HostListEntryOptionalDC[]) => void;
|
|
1583
1623
|
networkIsUp: () => void;
|
|
1584
1624
|
networkIsPossiblyDown: () => void;
|
|
1585
1625
|
};
|
|
1586
1626
|
|
|
1587
|
-
type VegaTransportDirection = "send" | "recv";
|
|
1588
|
-
|
|
1589
|
-
type VegaAnalytics = {
|
|
1590
|
-
vegaJoinFailed: number;
|
|
1591
|
-
vegaJoinWithoutVegaConnection: number;
|
|
1592
|
-
vegaCreateTransportWithoutVegaConnection: number;
|
|
1593
|
-
vegaIceRestarts: number;
|
|
1594
|
-
vegaIceRestartMissingTransport: number;
|
|
1595
|
-
vegaIceRestartWrongTransportId: number;
|
|
1596
|
-
vegaNonErrorRejectionValueGUMError: number;
|
|
1597
|
-
vegaReplaceTrackNoProducerNoEnabledTrack: number;
|
|
1598
|
-
micTrackEndedCount: number;
|
|
1599
|
-
camTrackEndedCount: number;
|
|
1600
|
-
};
|
|
1601
|
-
|
|
1602
|
-
type MediaStreamWhichMayHaveInboundId = MediaStream & { inboundId?: string };
|
|
1603
|
-
|
|
1604
|
-
type ClientState = {
|
|
1605
|
-
hasAcceptedWebcamStream: Boolean;
|
|
1606
|
-
hasAcceptedScreenStream: Boolean;
|
|
1607
|
-
hasEmittedWebcamStream: Boolean;
|
|
1608
|
-
hasEmittedScreenStream: Boolean;
|
|
1609
|
-
webcamStream?: MediaStreamWhichMayHaveInboundId;
|
|
1610
|
-
screenStream?: MediaStreamWhichMayHaveInboundId;
|
|
1611
|
-
screenShareStreamId?: string;
|
|
1612
|
-
camStreamId?: string;
|
|
1613
|
-
};
|
|
1614
|
-
|
|
1615
1627
|
declare class VegaRtcManager implements RtcManager {
|
|
1616
1628
|
_selfId: any;
|
|
1617
1629
|
_room: any;
|
|
@@ -1947,4 +1959,4 @@ declare const STREAM_TYPES: {
|
|
|
1947
1959
|
};
|
|
1948
1960
|
|
|
1949
1961
|
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, CAMERA_STREAM_ID, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, issueDetectorOrMetricEnabled, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, variance };
|
|
1950
|
-
export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatMessage, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, Credentials, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockRejectedEvent, KnockRoomRequest, KnockerLeftEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
|
|
1962
|
+
export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatMessage, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, Credentials, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockRejectedEvent, KnockRoomRequest, KnockerLeftEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
|
package/dist/index.d.mts
CHANGED
|
@@ -205,6 +205,7 @@ declare function startPerformanceMonitor({ onMetricsUpdated, onTerminated, isHid
|
|
|
205
205
|
};
|
|
206
206
|
|
|
207
207
|
interface PressureObserver {
|
|
208
|
+
knownSources: string[];
|
|
208
209
|
observe: (source: string, options: {
|
|
209
210
|
sampleInterval: number;
|
|
210
211
|
}) => Promise<undefined>;
|
|
@@ -382,6 +383,40 @@ declare function sortCodecs(codecs: Codec[], features: {
|
|
|
382
383
|
av1On?: boolean;
|
|
383
384
|
}): Promise<Codec[]>;
|
|
384
385
|
|
|
386
|
+
type VegaTransportDirection = "send" | "recv";
|
|
387
|
+
|
|
388
|
+
type VegaAnalytics = {
|
|
389
|
+
vegaUnknownResponse: number;
|
|
390
|
+
vegaRequestTimeout: number;
|
|
391
|
+
vegaJoinFailed: number;
|
|
392
|
+
vegaJoinWithoutVegaConnection: number;
|
|
393
|
+
vegaCreateTransportWithoutVegaConnection: number;
|
|
394
|
+
vegaIceRestarts: number;
|
|
395
|
+
vegaIceRestartMissingTransport: number;
|
|
396
|
+
vegaIceRestartWrongTransportId: number;
|
|
397
|
+
vegaNonErrorRejectionValueGUMError: number;
|
|
398
|
+
vegaReplaceTrackNoProducerNoEnabledTrack: number;
|
|
399
|
+
micTrackEndedCount: number;
|
|
400
|
+
camTrackEndedCount: number;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
type VegaAnalyticMetric = keyof VegaAnalytics;
|
|
404
|
+
|
|
405
|
+
type VegaIncrementAnalyticMetric = (metric: VegaAnalyticMetric) => void;
|
|
406
|
+
|
|
407
|
+
type MediaStreamWhichMayHaveInboundId = MediaStream & { inboundId?: string };
|
|
408
|
+
|
|
409
|
+
type ClientState = {
|
|
410
|
+
hasAcceptedWebcamStream: Boolean;
|
|
411
|
+
hasAcceptedScreenStream: Boolean;
|
|
412
|
+
hasEmittedWebcamStream: Boolean;
|
|
413
|
+
hasEmittedScreenStream: Boolean;
|
|
414
|
+
webcamStream?: MediaStreamWhichMayHaveInboundId;
|
|
415
|
+
screenStream?: MediaStreamWhichMayHaveInboundId;
|
|
416
|
+
screenShareStreamId?: string;
|
|
417
|
+
camStreamId?: string;
|
|
418
|
+
};
|
|
419
|
+
|
|
385
420
|
declare enum RtcEventNames {
|
|
386
421
|
rtc_manager_created = "rtc_manager_created",
|
|
387
422
|
stream_added = "stream_added"
|
|
@@ -400,6 +435,10 @@ interface RtcManagerOptions {
|
|
|
400
435
|
interface VegaRtcManagerOptions extends RtcManagerOptions {
|
|
401
436
|
eventClaim: string;
|
|
402
437
|
}
|
|
438
|
+
interface VegaConnectionOptions {
|
|
439
|
+
protocol?: string;
|
|
440
|
+
incrementAnalyticMetric?: VegaIncrementAnalyticMetric;
|
|
441
|
+
}
|
|
403
442
|
interface RtcManager {
|
|
404
443
|
acceptNewStream: ({ clientId, streamId }: {
|
|
405
444
|
clientId: string;
|
|
@@ -1476,7 +1515,8 @@ declare class VegaConnection extends EventEmitter$1 {
|
|
|
1476
1515
|
protocol: string;
|
|
1477
1516
|
socket: WebSocket | null;
|
|
1478
1517
|
sents: Map<any, any>;
|
|
1479
|
-
|
|
1518
|
+
incrementAnalyticMetric?: VegaIncrementAnalyticMetric;
|
|
1519
|
+
constructor(wsUrl: string, { protocol, incrementAnalyticMetric }: VegaConnectionOptions);
|
|
1480
1520
|
_setupSocket(): void;
|
|
1481
1521
|
_tearDown(): void;
|
|
1482
1522
|
close(): void;
|
|
@@ -1578,40 +1618,12 @@ declare function createVegaConnectionManager(config: {
|
|
|
1578
1618
|
onDisconnected?: () => void;
|
|
1579
1619
|
onFailed?: () => void;
|
|
1580
1620
|
}): {
|
|
1581
|
-
connect: () => void;
|
|
1621
|
+
connect: (incrementAnalyticMetric?: VegaIncrementAnalyticMetric) => void;
|
|
1582
1622
|
updateHostList: (updatedHostList: string | HostListEntryOptionalDC[]) => void;
|
|
1583
1623
|
networkIsUp: () => void;
|
|
1584
1624
|
networkIsPossiblyDown: () => void;
|
|
1585
1625
|
};
|
|
1586
1626
|
|
|
1587
|
-
type VegaTransportDirection = "send" | "recv";
|
|
1588
|
-
|
|
1589
|
-
type VegaAnalytics = {
|
|
1590
|
-
vegaJoinFailed: number;
|
|
1591
|
-
vegaJoinWithoutVegaConnection: number;
|
|
1592
|
-
vegaCreateTransportWithoutVegaConnection: number;
|
|
1593
|
-
vegaIceRestarts: number;
|
|
1594
|
-
vegaIceRestartMissingTransport: number;
|
|
1595
|
-
vegaIceRestartWrongTransportId: number;
|
|
1596
|
-
vegaNonErrorRejectionValueGUMError: number;
|
|
1597
|
-
vegaReplaceTrackNoProducerNoEnabledTrack: number;
|
|
1598
|
-
micTrackEndedCount: number;
|
|
1599
|
-
camTrackEndedCount: number;
|
|
1600
|
-
};
|
|
1601
|
-
|
|
1602
|
-
type MediaStreamWhichMayHaveInboundId = MediaStream & { inboundId?: string };
|
|
1603
|
-
|
|
1604
|
-
type ClientState = {
|
|
1605
|
-
hasAcceptedWebcamStream: Boolean;
|
|
1606
|
-
hasAcceptedScreenStream: Boolean;
|
|
1607
|
-
hasEmittedWebcamStream: Boolean;
|
|
1608
|
-
hasEmittedScreenStream: Boolean;
|
|
1609
|
-
webcamStream?: MediaStreamWhichMayHaveInboundId;
|
|
1610
|
-
screenStream?: MediaStreamWhichMayHaveInboundId;
|
|
1611
|
-
screenShareStreamId?: string;
|
|
1612
|
-
camStreamId?: string;
|
|
1613
|
-
};
|
|
1614
|
-
|
|
1615
1627
|
declare class VegaRtcManager implements RtcManager {
|
|
1616
1628
|
_selfId: any;
|
|
1617
1629
|
_room: any;
|
|
@@ -1947,4 +1959,4 @@ declare const STREAM_TYPES: {
|
|
|
1947
1959
|
};
|
|
1948
1960
|
|
|
1949
1961
|
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, CAMERA_STREAM_ID, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, issueDetectorOrMetricEnabled, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, variance };
|
|
1950
|
-
export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatMessage, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, Credentials, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockRejectedEvent, KnockRoomRequest, KnockerLeftEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
|
|
1962
|
+
export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatMessage, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, Credentials, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockRejectedEvent, KnockRoomRequest, KnockerLeftEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
|
package/dist/index.d.ts
CHANGED
|
@@ -205,6 +205,7 @@ declare function startPerformanceMonitor({ onMetricsUpdated, onTerminated, isHid
|
|
|
205
205
|
};
|
|
206
206
|
|
|
207
207
|
interface PressureObserver {
|
|
208
|
+
knownSources: string[];
|
|
208
209
|
observe: (source: string, options: {
|
|
209
210
|
sampleInterval: number;
|
|
210
211
|
}) => Promise<undefined>;
|
|
@@ -382,6 +383,40 @@ declare function sortCodecs(codecs: Codec[], features: {
|
|
|
382
383
|
av1On?: boolean;
|
|
383
384
|
}): Promise<Codec[]>;
|
|
384
385
|
|
|
386
|
+
type VegaTransportDirection = "send" | "recv";
|
|
387
|
+
|
|
388
|
+
type VegaAnalytics = {
|
|
389
|
+
vegaUnknownResponse: number;
|
|
390
|
+
vegaRequestTimeout: number;
|
|
391
|
+
vegaJoinFailed: number;
|
|
392
|
+
vegaJoinWithoutVegaConnection: number;
|
|
393
|
+
vegaCreateTransportWithoutVegaConnection: number;
|
|
394
|
+
vegaIceRestarts: number;
|
|
395
|
+
vegaIceRestartMissingTransport: number;
|
|
396
|
+
vegaIceRestartWrongTransportId: number;
|
|
397
|
+
vegaNonErrorRejectionValueGUMError: number;
|
|
398
|
+
vegaReplaceTrackNoProducerNoEnabledTrack: number;
|
|
399
|
+
micTrackEndedCount: number;
|
|
400
|
+
camTrackEndedCount: number;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
type VegaAnalyticMetric = keyof VegaAnalytics;
|
|
404
|
+
|
|
405
|
+
type VegaIncrementAnalyticMetric = (metric: VegaAnalyticMetric) => void;
|
|
406
|
+
|
|
407
|
+
type MediaStreamWhichMayHaveInboundId = MediaStream & { inboundId?: string };
|
|
408
|
+
|
|
409
|
+
type ClientState = {
|
|
410
|
+
hasAcceptedWebcamStream: Boolean;
|
|
411
|
+
hasAcceptedScreenStream: Boolean;
|
|
412
|
+
hasEmittedWebcamStream: Boolean;
|
|
413
|
+
hasEmittedScreenStream: Boolean;
|
|
414
|
+
webcamStream?: MediaStreamWhichMayHaveInboundId;
|
|
415
|
+
screenStream?: MediaStreamWhichMayHaveInboundId;
|
|
416
|
+
screenShareStreamId?: string;
|
|
417
|
+
camStreamId?: string;
|
|
418
|
+
};
|
|
419
|
+
|
|
385
420
|
declare enum RtcEventNames {
|
|
386
421
|
rtc_manager_created = "rtc_manager_created",
|
|
387
422
|
stream_added = "stream_added"
|
|
@@ -400,6 +435,10 @@ interface RtcManagerOptions {
|
|
|
400
435
|
interface VegaRtcManagerOptions extends RtcManagerOptions {
|
|
401
436
|
eventClaim: string;
|
|
402
437
|
}
|
|
438
|
+
interface VegaConnectionOptions {
|
|
439
|
+
protocol?: string;
|
|
440
|
+
incrementAnalyticMetric?: VegaIncrementAnalyticMetric;
|
|
441
|
+
}
|
|
403
442
|
interface RtcManager {
|
|
404
443
|
acceptNewStream: ({ clientId, streamId }: {
|
|
405
444
|
clientId: string;
|
|
@@ -1476,7 +1515,8 @@ declare class VegaConnection extends EventEmitter$1 {
|
|
|
1476
1515
|
protocol: string;
|
|
1477
1516
|
socket: WebSocket | null;
|
|
1478
1517
|
sents: Map<any, any>;
|
|
1479
|
-
|
|
1518
|
+
incrementAnalyticMetric?: VegaIncrementAnalyticMetric;
|
|
1519
|
+
constructor(wsUrl: string, { protocol, incrementAnalyticMetric }: VegaConnectionOptions);
|
|
1480
1520
|
_setupSocket(): void;
|
|
1481
1521
|
_tearDown(): void;
|
|
1482
1522
|
close(): void;
|
|
@@ -1578,40 +1618,12 @@ declare function createVegaConnectionManager(config: {
|
|
|
1578
1618
|
onDisconnected?: () => void;
|
|
1579
1619
|
onFailed?: () => void;
|
|
1580
1620
|
}): {
|
|
1581
|
-
connect: () => void;
|
|
1621
|
+
connect: (incrementAnalyticMetric?: VegaIncrementAnalyticMetric) => void;
|
|
1582
1622
|
updateHostList: (updatedHostList: string | HostListEntryOptionalDC[]) => void;
|
|
1583
1623
|
networkIsUp: () => void;
|
|
1584
1624
|
networkIsPossiblyDown: () => void;
|
|
1585
1625
|
};
|
|
1586
1626
|
|
|
1587
|
-
type VegaTransportDirection = "send" | "recv";
|
|
1588
|
-
|
|
1589
|
-
type VegaAnalytics = {
|
|
1590
|
-
vegaJoinFailed: number;
|
|
1591
|
-
vegaJoinWithoutVegaConnection: number;
|
|
1592
|
-
vegaCreateTransportWithoutVegaConnection: number;
|
|
1593
|
-
vegaIceRestarts: number;
|
|
1594
|
-
vegaIceRestartMissingTransport: number;
|
|
1595
|
-
vegaIceRestartWrongTransportId: number;
|
|
1596
|
-
vegaNonErrorRejectionValueGUMError: number;
|
|
1597
|
-
vegaReplaceTrackNoProducerNoEnabledTrack: number;
|
|
1598
|
-
micTrackEndedCount: number;
|
|
1599
|
-
camTrackEndedCount: number;
|
|
1600
|
-
};
|
|
1601
|
-
|
|
1602
|
-
type MediaStreamWhichMayHaveInboundId = MediaStream & { inboundId?: string };
|
|
1603
|
-
|
|
1604
|
-
type ClientState = {
|
|
1605
|
-
hasAcceptedWebcamStream: Boolean;
|
|
1606
|
-
hasAcceptedScreenStream: Boolean;
|
|
1607
|
-
hasEmittedWebcamStream: Boolean;
|
|
1608
|
-
hasEmittedScreenStream: Boolean;
|
|
1609
|
-
webcamStream?: MediaStreamWhichMayHaveInboundId;
|
|
1610
|
-
screenStream?: MediaStreamWhichMayHaveInboundId;
|
|
1611
|
-
screenShareStreamId?: string;
|
|
1612
|
-
camStreamId?: string;
|
|
1613
|
-
};
|
|
1614
|
-
|
|
1615
1627
|
declare class VegaRtcManager implements RtcManager {
|
|
1616
1628
|
_selfId: any;
|
|
1617
1629
|
_room: any;
|
|
@@ -1947,4 +1959,4 @@ declare const STREAM_TYPES: {
|
|
|
1947
1959
|
};
|
|
1948
1960
|
|
|
1949
1961
|
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, CAMERA_STREAM_ID, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, issueDetectorOrMetricEnabled, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, variance };
|
|
1950
|
-
export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatMessage, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, Credentials, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockRejectedEvent, KnockRoomRequest, KnockerLeftEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
|
|
1962
|
+
export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatMessage, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, Credentials, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockRejectedEvent, KnockRoomRequest, KnockerLeftEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
|
package/dist/index.mjs
CHANGED
|
@@ -274,7 +274,7 @@ class Logger {
|
|
|
274
274
|
|
|
275
275
|
var _a$6, _b$2;
|
|
276
276
|
const adapter$6 = (_a$6 = adapterRaw.default) !== null && _a$6 !== void 0 ? _a$6 : adapterRaw;
|
|
277
|
-
const logger$
|
|
277
|
+
const logger$b = new Logger();
|
|
278
278
|
const browserName$2 = (_b$2 = adapter$6.browserDetails) === null || _b$2 === void 0 ? void 0 : _b$2.browser;
|
|
279
279
|
const browserVersion$1 = adapter$6.browserDetails.version;
|
|
280
280
|
function setCodecPreferenceSDP({ sdp, redOn }) {
|
|
@@ -315,7 +315,7 @@ function setCodecPreferenceSDP({ sdp, redOn }) {
|
|
|
315
315
|
return newSdp;
|
|
316
316
|
}
|
|
317
317
|
catch (error) {
|
|
318
|
-
logger$
|
|
318
|
+
logger$b.error("setCodecPreferenceSDP error:", error);
|
|
319
319
|
return sdp;
|
|
320
320
|
}
|
|
321
321
|
}
|
|
@@ -466,7 +466,7 @@ function trackAnnotations(o) {
|
|
|
466
466
|
|
|
467
467
|
var _a$5;
|
|
468
468
|
const adapter$5 = (_a$5 = adapterRaw.default) !== null && _a$5 !== void 0 ? _a$5 : adapterRaw;
|
|
469
|
-
const logger$
|
|
469
|
+
const logger$a = new Logger();
|
|
470
470
|
class Session {
|
|
471
471
|
constructor({ clientId, bandwidth, peerConnectionConfig, deprioritizeH264Encoding, incrementAnalyticMetric, }) {
|
|
472
472
|
this.relayCandidateSeen = false;
|
|
@@ -615,7 +615,7 @@ class Session {
|
|
|
615
615
|
return;
|
|
616
616
|
}
|
|
617
617
|
this.pc.addIceCandidate(candidate).catch((e) => {
|
|
618
|
-
logger$
|
|
618
|
+
logger$a.warn("Failed to add ICE candidate ('%s'): %s", candidate ? candidate.candidate : null, e);
|
|
619
619
|
});
|
|
620
620
|
});
|
|
621
621
|
}
|
|
@@ -634,7 +634,7 @@ class Session {
|
|
|
634
634
|
pc.close();
|
|
635
635
|
}
|
|
636
636
|
catch (e) {
|
|
637
|
-
logger$
|
|
637
|
+
logger$a.warn("failures during close of session", e);
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
640
|
hasConnectedPeerConnection() {
|
|
@@ -642,7 +642,7 @@ class Session {
|
|
|
642
642
|
}
|
|
643
643
|
replaceTrack(oldTrack, newTrack) {
|
|
644
644
|
return __awaiter(this, void 0, void 0, function* () {
|
|
645
|
-
logger$
|
|
645
|
+
logger$a.info("replacetrack() [oldTrackId: %s, newTrackId: %s]", oldTrack === null || oldTrack === void 0 ? void 0 : oldTrack.id, newTrack.id);
|
|
646
646
|
if (newTrack.readyState === "ended") {
|
|
647
647
|
throw new Error(`refusing to use ended track with id: ${newTrack.id}, kind: ${newTrack.kind}`);
|
|
648
648
|
}
|
|
@@ -1043,7 +1043,7 @@ const getMediasoupDeviceAsync = (features) => __awaiter(void 0, void 0, void 0,
|
|
|
1043
1043
|
return new Device({ handlerName });
|
|
1044
1044
|
});
|
|
1045
1045
|
|
|
1046
|
-
const logger$
|
|
1046
|
+
const logger$9 = new Logger();
|
|
1047
1047
|
const AUDIO_SETTINGS = {
|
|
1048
1048
|
codecOptions: {
|
|
1049
1049
|
opusDtx: true,
|
|
@@ -1223,7 +1223,7 @@ function sortCodecsByPowerEfficiency(codecs) {
|
|
|
1223
1223
|
codecPowerEfficiencyEntries = yield Promise.all(codecs.map(({ mimeType }) => getIsCodecDecodingPowerEfficient(mimeType).then((val) => [mimeType, val])));
|
|
1224
1224
|
}
|
|
1225
1225
|
catch (error) {
|
|
1226
|
-
logger$
|
|
1226
|
+
logger$9.error(error);
|
|
1227
1227
|
return codecs;
|
|
1228
1228
|
}
|
|
1229
1229
|
const codecPowerEfficiencies = Object.fromEntries(codecPowerEfficiencyEntries);
|
|
@@ -1713,42 +1713,17 @@ function collectStats(state_1, _a, immediate_1) {
|
|
|
1713
1713
|
});
|
|
1714
1714
|
}
|
|
1715
1715
|
|
|
1716
|
-
const
|
|
1717
|
-
function registerOriginTrials(trials, registeredTrials = REGISTERED_TRIALS, document = window.document) {
|
|
1718
|
-
trials.forEach(({ hostnamePattern, token }) => {
|
|
1719
|
-
const key = `${hostnamePattern}-${token}`;
|
|
1720
|
-
if (registeredTrials[key]) {
|
|
1721
|
-
return;
|
|
1722
|
-
}
|
|
1723
|
-
if (hostnamePattern.test(document.location.hostname)) {
|
|
1724
|
-
const otMeta = document.createElement("meta");
|
|
1725
|
-
otMeta.httpEquiv = "origin-trial";
|
|
1726
|
-
otMeta.content = token;
|
|
1727
|
-
document.head.append(otMeta);
|
|
1728
|
-
registeredTrials[key] = true;
|
|
1729
|
-
}
|
|
1730
|
-
});
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1716
|
+
const logger$8 = new Logger();
|
|
1733
1717
|
const CPU_OBSERVER_OPTIONS = {
|
|
1734
1718
|
sampleRate: 1,
|
|
1735
|
-
originTrials: [
|
|
1736
|
-
{
|
|
1737
|
-
hostnamePattern: /hereby\.dev/,
|
|
1738
|
-
token: "AkSNPHJw6EK08X0QU7kORnK9NABzRLAC7dqfXOwk5JwFAQG4Ey7WxLXxsnhieCgC1QHUdevE2EFICy7uBGDANwUAAABqeyJvcmlnaW4iOiJodHRwczovL2hlcmVieS5kZXY6NDQ0MyIsImZlYXR1cmUiOiJDb21wdXRlUHJlc3N1cmVfdjIiLCJleHBpcnkiOjE3MTY5NDA3OTksImlzU3ViZG9tYWluIjp0cnVlfQ==",
|
|
1739
|
-
},
|
|
1740
|
-
{
|
|
1741
|
-
hostnamePattern: /whereby\.com/,
|
|
1742
|
-
token: "Asc2wu8KpSx648i932NICteQDFcB05yl2QUUSHD7AQo8JGP2Fp6FF91TvYVJBsKGzLMH349rysPw5q9tqPC/PAUAAABqeyJvcmlnaW4iOiJodHRwczovL3doZXJlYnkuY29tOjQ0MyIsImZlYXR1cmUiOiJDb21wdXRlUHJlc3N1cmVfdjIiLCJleHBpcnkiOjE3MTY5NDA3OTksImlzU3ViZG9tYWluIjp0cnVlfQ==",
|
|
1743
|
-
},
|
|
1744
|
-
],
|
|
1745
1719
|
};
|
|
1746
|
-
function startCpuObserver(cb, { sampleRate,
|
|
1747
|
-
|
|
1720
|
+
function startCpuObserver(cb, { sampleRate, } = CPU_OBSERVER_OPTIONS, window = globalThis.window) {
|
|
1721
|
+
var _a;
|
|
1748
1722
|
let pressureObserver;
|
|
1749
|
-
if ("PressureObserver" in window
|
|
1723
|
+
if ("PressureObserver" in window &&
|
|
1724
|
+
(window.PressureObserver.knownSources || []).includes("cpu")) {
|
|
1750
1725
|
pressureObserver = new window.PressureObserver(cb, { sampleRate });
|
|
1751
|
-
pressureObserver.observe("cpu", { sampleInterval: sampleRate * 1000 });
|
|
1726
|
+
(_a = pressureObserver.observe("cpu", { sampleInterval: sampleRate * 1000 })) === null || _a === void 0 ? void 0 : _a.catch(logger$8.error);
|
|
1752
1727
|
return {
|
|
1753
1728
|
stop: () => {
|
|
1754
1729
|
pressureObserver.unobserve("cpu");
|
|
@@ -4014,9 +3989,10 @@ class SfuV2Parser {
|
|
|
4014
3989
|
|
|
4015
3990
|
const logger$3 = new Logger();
|
|
4016
3991
|
class VegaConnection extends EventEmitter$1 {
|
|
4017
|
-
constructor(wsUrl, protocol = "whereby-sfu#v4") {
|
|
3992
|
+
constructor(wsUrl, { protocol = "whereby-sfu#v4", incrementAnalyticMetric }) {
|
|
4018
3993
|
super();
|
|
4019
3994
|
this.socket = null;
|
|
3995
|
+
this.incrementAnalyticMetric = incrementAnalyticMetric;
|
|
4020
3996
|
this.wsUrl = wsUrl;
|
|
4021
3997
|
this.protocol = protocol;
|
|
4022
3998
|
this.sents = new Map();
|
|
@@ -4066,9 +4042,16 @@ class VegaConnection extends EventEmitter$1 {
|
|
|
4066
4042
|
logger$3.info("Error", error);
|
|
4067
4043
|
}
|
|
4068
4044
|
_handleResponse(socketMessage) {
|
|
4045
|
+
var _a;
|
|
4069
4046
|
const sent = this.sents.get(socketMessage.id);
|
|
4070
4047
|
if (!sent) {
|
|
4071
4048
|
logger$3.warn(`Received unknown message with id ${socketMessage.id} from SFU.`);
|
|
4049
|
+
(_a = this.incrementAnalyticMetric) === null || _a === void 0 ? void 0 : _a.call(this, "vegaUnknownResponse");
|
|
4050
|
+
rtcStats.sendEvent("VegaUnknownResponse", {
|
|
4051
|
+
id: socketMessage.id,
|
|
4052
|
+
code: socketMessage.errorCode,
|
|
4053
|
+
reason: socketMessage.errorReason,
|
|
4054
|
+
});
|
|
4072
4055
|
return;
|
|
4073
4056
|
}
|
|
4074
4057
|
if (socketMessage.ok) {
|
|
@@ -4111,6 +4094,12 @@ class VegaConnection extends EventEmitter$1 {
|
|
|
4111
4094
|
pReject(error);
|
|
4112
4095
|
},
|
|
4113
4096
|
timer: setTimeout(() => {
|
|
4097
|
+
var _a;
|
|
4098
|
+
(_a = this.incrementAnalyticMetric) === null || _a === void 0 ? void 0 : _a.call(this, "vegaRequestTimeout");
|
|
4099
|
+
rtcStats.sendEvent("VegaRequestTimeout", {
|
|
4100
|
+
id: request.id,
|
|
4101
|
+
method: request.method,
|
|
4102
|
+
});
|
|
4114
4103
|
if (!this.sents.delete(request.id))
|
|
4115
4104
|
return;
|
|
4116
4105
|
pReject(new Error("request timeout"));
|
|
@@ -4151,7 +4140,7 @@ function createVegaConnectionManager(config) {
|
|
|
4151
4140
|
};
|
|
4152
4141
|
let connectionAttemptInProgress = false;
|
|
4153
4142
|
let hasPendingConnectionAttempt = false;
|
|
4154
|
-
const connect = () => {
|
|
4143
|
+
const connect = (incrementAnalyticMetric) => {
|
|
4155
4144
|
if (connectionAttemptInProgress) {
|
|
4156
4145
|
hasPendingConnectionAttempt = true;
|
|
4157
4146
|
return;
|
|
@@ -4215,7 +4204,10 @@ function createVegaConnectionManager(config) {
|
|
|
4215
4204
|
});
|
|
4216
4205
|
return;
|
|
4217
4206
|
}
|
|
4218
|
-
const vegaConnection = new VegaConnection(((_a = config.getUrlForHost) === null || _a === void 0 ? void 0 : _a.call(config, host)) || host
|
|
4207
|
+
const vegaConnection = new VegaConnection(((_a = config.getUrlForHost) === null || _a === void 0 ? void 0 : _a.call(config, host)) || host, {
|
|
4208
|
+
protocol: "whereby-sfu#v4",
|
|
4209
|
+
incrementAnalyticMetric,
|
|
4210
|
+
});
|
|
4219
4211
|
let wasClosed = false;
|
|
4220
4212
|
vegaConnection.on("open", () => {
|
|
4221
4213
|
setTimeout(() => {
|
|
@@ -4389,6 +4381,8 @@ class VegaRtcManager {
|
|
|
4389
4381
|
this._networkIsDetectedUpBySignal = false;
|
|
4390
4382
|
this._cpuOveruseDetected = false;
|
|
4391
4383
|
this.analytics = {
|
|
4384
|
+
vegaRequestTimeout: 0,
|
|
4385
|
+
vegaUnknownResponse: 0,
|
|
4392
4386
|
vegaJoinFailed: 0,
|
|
4393
4387
|
vegaJoinWithoutVegaConnection: 0,
|
|
4394
4388
|
vegaCreateTransportWithoutVegaConnection: 0,
|
|
@@ -4524,7 +4518,7 @@ class VegaRtcManager {
|
|
|
4524
4518
|
},
|
|
4525
4519
|
});
|
|
4526
4520
|
}
|
|
4527
|
-
this._vegaConnectionManager.connect();
|
|
4521
|
+
this._vegaConnectionManager.connect((metric) => this.analytics[metric]++);
|
|
4528
4522
|
this._isConnectingOrConnected = true;
|
|
4529
4523
|
}
|
|
4530
4524
|
_onClose() {
|
|
@@ -6593,7 +6587,7 @@ class BandwidthTester extends EventEmitter {
|
|
|
6593
6587
|
this._startTime = Date.now();
|
|
6594
6588
|
const host = this._features.sfuServerOverrideHost || "any.sfu.svc.whereby.com";
|
|
6595
6589
|
const wsUrl = `wss://${host}`;
|
|
6596
|
-
this._vegaConnection = new VegaConnection(wsUrl, "whereby-sfu#bw-test-v1");
|
|
6590
|
+
this._vegaConnection = new VegaConnection(wsUrl, { protocol: "whereby-sfu#bw-test-v1" });
|
|
6597
6591
|
this._vegaConnection.on("open", () => this._start());
|
|
6598
6592
|
this._vegaConnection.on("close", () => this.close(true));
|
|
6599
6593
|
this._vegaConnection.on("message", (message) => this._onMessage(message));
|
package/dist/legacy-esm.js
CHANGED
|
@@ -274,7 +274,7 @@ class Logger {
|
|
|
274
274
|
|
|
275
275
|
var _a$6, _b$2;
|
|
276
276
|
const adapter$6 = (_a$6 = adapterRaw.default) !== null && _a$6 !== void 0 ? _a$6 : adapterRaw;
|
|
277
|
-
const logger$
|
|
277
|
+
const logger$b = new Logger();
|
|
278
278
|
const browserName$2 = (_b$2 = adapter$6.browserDetails) === null || _b$2 === void 0 ? void 0 : _b$2.browser;
|
|
279
279
|
const browserVersion$1 = adapter$6.browserDetails.version;
|
|
280
280
|
function setCodecPreferenceSDP({ sdp, redOn }) {
|
|
@@ -315,7 +315,7 @@ function setCodecPreferenceSDP({ sdp, redOn }) {
|
|
|
315
315
|
return newSdp;
|
|
316
316
|
}
|
|
317
317
|
catch (error) {
|
|
318
|
-
logger$
|
|
318
|
+
logger$b.error("setCodecPreferenceSDP error:", error);
|
|
319
319
|
return sdp;
|
|
320
320
|
}
|
|
321
321
|
}
|
|
@@ -466,7 +466,7 @@ function trackAnnotations(o) {
|
|
|
466
466
|
|
|
467
467
|
var _a$5;
|
|
468
468
|
const adapter$5 = (_a$5 = adapterRaw.default) !== null && _a$5 !== void 0 ? _a$5 : adapterRaw;
|
|
469
|
-
const logger$
|
|
469
|
+
const logger$a = new Logger();
|
|
470
470
|
class Session {
|
|
471
471
|
constructor({ clientId, bandwidth, peerConnectionConfig, deprioritizeH264Encoding, incrementAnalyticMetric, }) {
|
|
472
472
|
this.relayCandidateSeen = false;
|
|
@@ -615,7 +615,7 @@ class Session {
|
|
|
615
615
|
return;
|
|
616
616
|
}
|
|
617
617
|
this.pc.addIceCandidate(candidate).catch((e) => {
|
|
618
|
-
logger$
|
|
618
|
+
logger$a.warn("Failed to add ICE candidate ('%s'): %s", candidate ? candidate.candidate : null, e);
|
|
619
619
|
});
|
|
620
620
|
});
|
|
621
621
|
}
|
|
@@ -634,7 +634,7 @@ class Session {
|
|
|
634
634
|
pc.close();
|
|
635
635
|
}
|
|
636
636
|
catch (e) {
|
|
637
|
-
logger$
|
|
637
|
+
logger$a.warn("failures during close of session", e);
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
640
|
hasConnectedPeerConnection() {
|
|
@@ -642,7 +642,7 @@ class Session {
|
|
|
642
642
|
}
|
|
643
643
|
replaceTrack(oldTrack, newTrack) {
|
|
644
644
|
return __awaiter(this, void 0, void 0, function* () {
|
|
645
|
-
logger$
|
|
645
|
+
logger$a.info("replacetrack() [oldTrackId: %s, newTrackId: %s]", oldTrack === null || oldTrack === void 0 ? void 0 : oldTrack.id, newTrack.id);
|
|
646
646
|
if (newTrack.readyState === "ended") {
|
|
647
647
|
throw new Error(`refusing to use ended track with id: ${newTrack.id}, kind: ${newTrack.kind}`);
|
|
648
648
|
}
|
|
@@ -1043,7 +1043,7 @@ const getMediasoupDeviceAsync = (features) => __awaiter(void 0, void 0, void 0,
|
|
|
1043
1043
|
return new Device({ handlerName });
|
|
1044
1044
|
});
|
|
1045
1045
|
|
|
1046
|
-
const logger$
|
|
1046
|
+
const logger$9 = new Logger();
|
|
1047
1047
|
const AUDIO_SETTINGS = {
|
|
1048
1048
|
codecOptions: {
|
|
1049
1049
|
opusDtx: true,
|
|
@@ -1223,7 +1223,7 @@ function sortCodecsByPowerEfficiency(codecs) {
|
|
|
1223
1223
|
codecPowerEfficiencyEntries = yield Promise.all(codecs.map(({ mimeType }) => getIsCodecDecodingPowerEfficient(mimeType).then((val) => [mimeType, val])));
|
|
1224
1224
|
}
|
|
1225
1225
|
catch (error) {
|
|
1226
|
-
logger$
|
|
1226
|
+
logger$9.error(error);
|
|
1227
1227
|
return codecs;
|
|
1228
1228
|
}
|
|
1229
1229
|
const codecPowerEfficiencies = Object.fromEntries(codecPowerEfficiencyEntries);
|
|
@@ -1713,42 +1713,17 @@ function collectStats(state_1, _a, immediate_1) {
|
|
|
1713
1713
|
});
|
|
1714
1714
|
}
|
|
1715
1715
|
|
|
1716
|
-
const
|
|
1717
|
-
function registerOriginTrials(trials, registeredTrials = REGISTERED_TRIALS, document = window.document) {
|
|
1718
|
-
trials.forEach(({ hostnamePattern, token }) => {
|
|
1719
|
-
const key = `${hostnamePattern}-${token}`;
|
|
1720
|
-
if (registeredTrials[key]) {
|
|
1721
|
-
return;
|
|
1722
|
-
}
|
|
1723
|
-
if (hostnamePattern.test(document.location.hostname)) {
|
|
1724
|
-
const otMeta = document.createElement("meta");
|
|
1725
|
-
otMeta.httpEquiv = "origin-trial";
|
|
1726
|
-
otMeta.content = token;
|
|
1727
|
-
document.head.append(otMeta);
|
|
1728
|
-
registeredTrials[key] = true;
|
|
1729
|
-
}
|
|
1730
|
-
});
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1716
|
+
const logger$8 = new Logger();
|
|
1733
1717
|
const CPU_OBSERVER_OPTIONS = {
|
|
1734
1718
|
sampleRate: 1,
|
|
1735
|
-
originTrials: [
|
|
1736
|
-
{
|
|
1737
|
-
hostnamePattern: /hereby\.dev/,
|
|
1738
|
-
token: "AkSNPHJw6EK08X0QU7kORnK9NABzRLAC7dqfXOwk5JwFAQG4Ey7WxLXxsnhieCgC1QHUdevE2EFICy7uBGDANwUAAABqeyJvcmlnaW4iOiJodHRwczovL2hlcmVieS5kZXY6NDQ0MyIsImZlYXR1cmUiOiJDb21wdXRlUHJlc3N1cmVfdjIiLCJleHBpcnkiOjE3MTY5NDA3OTksImlzU3ViZG9tYWluIjp0cnVlfQ==",
|
|
1739
|
-
},
|
|
1740
|
-
{
|
|
1741
|
-
hostnamePattern: /whereby\.com/,
|
|
1742
|
-
token: "Asc2wu8KpSx648i932NICteQDFcB05yl2QUUSHD7AQo8JGP2Fp6FF91TvYVJBsKGzLMH349rysPw5q9tqPC/PAUAAABqeyJvcmlnaW4iOiJodHRwczovL3doZXJlYnkuY29tOjQ0MyIsImZlYXR1cmUiOiJDb21wdXRlUHJlc3N1cmVfdjIiLCJleHBpcnkiOjE3MTY5NDA3OTksImlzU3ViZG9tYWluIjp0cnVlfQ==",
|
|
1743
|
-
},
|
|
1744
|
-
],
|
|
1745
1719
|
};
|
|
1746
|
-
function startCpuObserver(cb, { sampleRate,
|
|
1747
|
-
|
|
1720
|
+
function startCpuObserver(cb, { sampleRate, } = CPU_OBSERVER_OPTIONS, window = globalThis.window) {
|
|
1721
|
+
var _a;
|
|
1748
1722
|
let pressureObserver;
|
|
1749
|
-
if ("PressureObserver" in window
|
|
1723
|
+
if ("PressureObserver" in window &&
|
|
1724
|
+
(window.PressureObserver.knownSources || []).includes("cpu")) {
|
|
1750
1725
|
pressureObserver = new window.PressureObserver(cb, { sampleRate });
|
|
1751
|
-
pressureObserver.observe("cpu", { sampleInterval: sampleRate * 1000 });
|
|
1726
|
+
(_a = pressureObserver.observe("cpu", { sampleInterval: sampleRate * 1000 })) === null || _a === void 0 ? void 0 : _a.catch(logger$8.error);
|
|
1752
1727
|
return {
|
|
1753
1728
|
stop: () => {
|
|
1754
1729
|
pressureObserver.unobserve("cpu");
|
|
@@ -4014,9 +3989,10 @@ class SfuV2Parser {
|
|
|
4014
3989
|
|
|
4015
3990
|
const logger$3 = new Logger();
|
|
4016
3991
|
class VegaConnection extends EventEmitter$1 {
|
|
4017
|
-
constructor(wsUrl, protocol = "whereby-sfu#v4") {
|
|
3992
|
+
constructor(wsUrl, { protocol = "whereby-sfu#v4", incrementAnalyticMetric }) {
|
|
4018
3993
|
super();
|
|
4019
3994
|
this.socket = null;
|
|
3995
|
+
this.incrementAnalyticMetric = incrementAnalyticMetric;
|
|
4020
3996
|
this.wsUrl = wsUrl;
|
|
4021
3997
|
this.protocol = protocol;
|
|
4022
3998
|
this.sents = new Map();
|
|
@@ -4066,9 +4042,16 @@ class VegaConnection extends EventEmitter$1 {
|
|
|
4066
4042
|
logger$3.info("Error", error);
|
|
4067
4043
|
}
|
|
4068
4044
|
_handleResponse(socketMessage) {
|
|
4045
|
+
var _a;
|
|
4069
4046
|
const sent = this.sents.get(socketMessage.id);
|
|
4070
4047
|
if (!sent) {
|
|
4071
4048
|
logger$3.warn(`Received unknown message with id ${socketMessage.id} from SFU.`);
|
|
4049
|
+
(_a = this.incrementAnalyticMetric) === null || _a === void 0 ? void 0 : _a.call(this, "vegaUnknownResponse");
|
|
4050
|
+
rtcStats.sendEvent("VegaUnknownResponse", {
|
|
4051
|
+
id: socketMessage.id,
|
|
4052
|
+
code: socketMessage.errorCode,
|
|
4053
|
+
reason: socketMessage.errorReason,
|
|
4054
|
+
});
|
|
4072
4055
|
return;
|
|
4073
4056
|
}
|
|
4074
4057
|
if (socketMessage.ok) {
|
|
@@ -4111,6 +4094,12 @@ class VegaConnection extends EventEmitter$1 {
|
|
|
4111
4094
|
pReject(error);
|
|
4112
4095
|
},
|
|
4113
4096
|
timer: setTimeout(() => {
|
|
4097
|
+
var _a;
|
|
4098
|
+
(_a = this.incrementAnalyticMetric) === null || _a === void 0 ? void 0 : _a.call(this, "vegaRequestTimeout");
|
|
4099
|
+
rtcStats.sendEvent("VegaRequestTimeout", {
|
|
4100
|
+
id: request.id,
|
|
4101
|
+
method: request.method,
|
|
4102
|
+
});
|
|
4114
4103
|
if (!this.sents.delete(request.id))
|
|
4115
4104
|
return;
|
|
4116
4105
|
pReject(new Error("request timeout"));
|
|
@@ -4151,7 +4140,7 @@ function createVegaConnectionManager(config) {
|
|
|
4151
4140
|
};
|
|
4152
4141
|
let connectionAttemptInProgress = false;
|
|
4153
4142
|
let hasPendingConnectionAttempt = false;
|
|
4154
|
-
const connect = () => {
|
|
4143
|
+
const connect = (incrementAnalyticMetric) => {
|
|
4155
4144
|
if (connectionAttemptInProgress) {
|
|
4156
4145
|
hasPendingConnectionAttempt = true;
|
|
4157
4146
|
return;
|
|
@@ -4215,7 +4204,10 @@ function createVegaConnectionManager(config) {
|
|
|
4215
4204
|
});
|
|
4216
4205
|
return;
|
|
4217
4206
|
}
|
|
4218
|
-
const vegaConnection = new VegaConnection(((_a = config.getUrlForHost) === null || _a === void 0 ? void 0 : _a.call(config, host)) || host
|
|
4207
|
+
const vegaConnection = new VegaConnection(((_a = config.getUrlForHost) === null || _a === void 0 ? void 0 : _a.call(config, host)) || host, {
|
|
4208
|
+
protocol: "whereby-sfu#v4",
|
|
4209
|
+
incrementAnalyticMetric,
|
|
4210
|
+
});
|
|
4219
4211
|
let wasClosed = false;
|
|
4220
4212
|
vegaConnection.on("open", () => {
|
|
4221
4213
|
setTimeout(() => {
|
|
@@ -4389,6 +4381,8 @@ class VegaRtcManager {
|
|
|
4389
4381
|
this._networkIsDetectedUpBySignal = false;
|
|
4390
4382
|
this._cpuOveruseDetected = false;
|
|
4391
4383
|
this.analytics = {
|
|
4384
|
+
vegaRequestTimeout: 0,
|
|
4385
|
+
vegaUnknownResponse: 0,
|
|
4392
4386
|
vegaJoinFailed: 0,
|
|
4393
4387
|
vegaJoinWithoutVegaConnection: 0,
|
|
4394
4388
|
vegaCreateTransportWithoutVegaConnection: 0,
|
|
@@ -4524,7 +4518,7 @@ class VegaRtcManager {
|
|
|
4524
4518
|
},
|
|
4525
4519
|
});
|
|
4526
4520
|
}
|
|
4527
|
-
this._vegaConnectionManager.connect();
|
|
4521
|
+
this._vegaConnectionManager.connect((metric) => this.analytics[metric]++);
|
|
4528
4522
|
this._isConnectingOrConnected = true;
|
|
4529
4523
|
}
|
|
4530
4524
|
_onClose() {
|
|
@@ -6593,7 +6587,7 @@ class BandwidthTester extends EventEmitter {
|
|
|
6593
6587
|
this._startTime = Date.now();
|
|
6594
6588
|
const host = this._features.sfuServerOverrideHost || "any.sfu.svc.whereby.com";
|
|
6595
6589
|
const wsUrl = `wss://${host}`;
|
|
6596
|
-
this._vegaConnection = new VegaConnection(wsUrl, "whereby-sfu#bw-test-v1");
|
|
6590
|
+
this._vegaConnection = new VegaConnection(wsUrl, { protocol: "whereby-sfu#bw-test-v1" });
|
|
6597
6591
|
this._vegaConnection.on("open", () => this._start());
|
|
6598
6592
|
this._vegaConnection.on("close", () => this.close(true));
|
|
6599
6593
|
this._vegaConnection.on("message", (message) => this._onMessage(message));
|