@whereby.com/media 2.6.4 → 2.6.6
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 +35 -25
- package/dist/index.d.cts +11 -3
- package/dist/index.d.mts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.mjs +35 -25
- package/dist/legacy-esm.js +35 -25
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2167,7 +2167,7 @@ var _a$4;
|
|
|
2167
2167
|
const adapter$4 = (_a$4 = adapterRaw.default) !== null && _a$4 !== void 0 ? _a$4 : adapterRaw;
|
|
2168
2168
|
const logger$7 = new Logger();
|
|
2169
2169
|
class Session {
|
|
2170
|
-
constructor({ peerConnectionId, bandwidth, deprioritizeH264Encoding, }) {
|
|
2170
|
+
constructor({ peerConnectionId, bandwidth, deprioritizeH264Encoding, incrementAnalyticMetric, }) {
|
|
2171
2171
|
this.peerConnectionId = peerConnectionId;
|
|
2172
2172
|
this.relayCandidateSeen = false;
|
|
2173
2173
|
this.serverReflexiveCandidateSeen = false;
|
|
@@ -2194,6 +2194,7 @@ class Session {
|
|
|
2194
2194
|
});
|
|
2195
2195
|
this.offerOptions = { offerToReceiveAudio: true, offerToReceiveVideo: true };
|
|
2196
2196
|
this._deprioritizeH264Encoding = deprioritizeH264Encoding;
|
|
2197
|
+
this._incrementAnalyticMetric = incrementAnalyticMetric;
|
|
2197
2198
|
}
|
|
2198
2199
|
setAndGetPeerConnection({ clientId, constraints, peerConnectionConfig, shouldAddLocalVideo, }) {
|
|
2199
2200
|
this.peerConnectionConfig = peerConnectionConfig;
|
|
@@ -2354,8 +2355,14 @@ class Session {
|
|
|
2354
2355
|
replaceTrack(oldTrack, newTrack) {
|
|
2355
2356
|
var _a;
|
|
2356
2357
|
const pc = this.pc;
|
|
2357
|
-
if (!pc)
|
|
2358
|
+
if (!pc) {
|
|
2359
|
+
rtcStats.sendEvent("P2PReplaceTrackNoPC", {
|
|
2360
|
+
oldTrackId: oldTrack === null || oldTrack === void 0 ? void 0 : oldTrack.id,
|
|
2361
|
+
newTrackId: newTrack === null || newTrack === void 0 ? void 0 : newTrack.id,
|
|
2362
|
+
});
|
|
2363
|
+
this._incrementAnalyticMetric("P2PReplaceTrackNoPC");
|
|
2358
2364
|
return false;
|
|
2365
|
+
}
|
|
2359
2366
|
const senders = pc.getSenders();
|
|
2360
2367
|
const oldTrackFallback = (_a = senders.find((s) => { var _a; return ((_a = s.track) === null || _a === void 0 ? void 0 : _a.kind) === newTrack.kind; })) === null || _a === void 0 ? void 0 : _a.track;
|
|
2361
2368
|
const oldTrackToReplace = oldTrack || oldTrackFallback;
|
|
@@ -2590,10 +2597,6 @@ class RtcStream {
|
|
|
2590
2597
|
static getCameraId() {
|
|
2591
2598
|
return CAMERA_STREAM_ID$1;
|
|
2592
2599
|
}
|
|
2593
|
-
static getTypeFromId(id) {
|
|
2594
|
-
const streamId = "" + id;
|
|
2595
|
-
return streamId === CAMERA_STREAM_ID$1 ? STREAM_TYPES.CAMERA : STREAM_TYPES.SCREEN_SHARE;
|
|
2596
|
-
}
|
|
2597
2600
|
}
|
|
2598
2601
|
|
|
2599
2602
|
var rtcManagerEvents = {
|
|
@@ -2670,6 +2673,10 @@ class P2pRtcManager {
|
|
|
2670
2673
|
mediaserverConfigTtlSeconds,
|
|
2671
2674
|
});
|
|
2672
2675
|
this.totalSessionsCreated = 0;
|
|
2676
|
+
this.analytics = {
|
|
2677
|
+
P2PReplaceTrackNoPC: 0,
|
|
2678
|
+
P2PNonErrorRejectionValueGUMError: 0,
|
|
2679
|
+
};
|
|
2673
2680
|
}
|
|
2674
2681
|
numberOfPeerconnections() {
|
|
2675
2682
|
return Object.keys(this.peerConnections).length;
|
|
@@ -2752,23 +2759,6 @@ class P2pRtcManager {
|
|
|
2752
2759
|
this._localStreamDeregisterFunction = null;
|
|
2753
2760
|
}
|
|
2754
2761
|
}
|
|
2755
|
-
fixChromeAudio(constraints) {
|
|
2756
|
-
if (browserName$1 !== "chrome") {
|
|
2757
|
-
return;
|
|
2758
|
-
}
|
|
2759
|
-
const localStream = this._getLocalCameraStream();
|
|
2760
|
-
const audioTrack = localStream.getAudioTracks()[0];
|
|
2761
|
-
if (!audioTrack || audioTrack.readyState !== "ended") {
|
|
2762
|
-
return;
|
|
2763
|
-
}
|
|
2764
|
-
return navigator.mediaDevices.getUserMedia({ audio: constraints }).then((stream) => {
|
|
2765
|
-
const track = stream.getAudioTracks()[0];
|
|
2766
|
-
track.enabled = audioTrack.enabled;
|
|
2767
|
-
localStream.removeTrack(audioTrack);
|
|
2768
|
-
localStream.addTrack(track);
|
|
2769
|
-
return this.replaceTrack(audioTrack, track);
|
|
2770
|
-
});
|
|
2771
|
-
}
|
|
2772
2762
|
setupSocketListeners() {
|
|
2773
2763
|
this._socketListenerDeregisterFunctions = [
|
|
2774
2764
|
() => this._clearMediaServersRefresh(),
|
|
@@ -2970,6 +2960,7 @@ class P2pRtcManager {
|
|
|
2970
2960
|
peerConnectionId,
|
|
2971
2961
|
bandwidth: initialBandwidth,
|
|
2972
2962
|
deprioritizeH264Encoding,
|
|
2963
|
+
incrementAnalyticMetric: (metric) => this.analytics[metric]++,
|
|
2973
2964
|
});
|
|
2974
2965
|
this.totalSessionsCreated++;
|
|
2975
2966
|
}
|
|
@@ -3628,7 +3619,9 @@ class P2pRtcManager {
|
|
|
3628
3619
|
if (!constraints) {
|
|
3629
3620
|
return;
|
|
3630
3621
|
}
|
|
3631
|
-
navigator.mediaDevices
|
|
3622
|
+
navigator.mediaDevices
|
|
3623
|
+
.getUserMedia({ video: constraints })
|
|
3624
|
+
.then((stream) => {
|
|
3632
3625
|
const track = stream.getVideoTracks()[0];
|
|
3633
3626
|
localStream.addTrack(track);
|
|
3634
3627
|
this._monitorVideoTrack(track);
|
|
@@ -3638,6 +3631,13 @@ class P2pRtcManager {
|
|
|
3638
3631
|
screenShare: false,
|
|
3639
3632
|
});
|
|
3640
3633
|
this._handleStopOrResumeVideo({ enable, track });
|
|
3634
|
+
})
|
|
3635
|
+
.catch((e) => {
|
|
3636
|
+
if (!(e instanceof Error)) {
|
|
3637
|
+
this.analytics.P2PNonErrorRejectionValueGUMError++;
|
|
3638
|
+
e = new Error(`non-error gUM rejection value: ${JSON.stringify(e)}`);
|
|
3639
|
+
}
|
|
3640
|
+
throw e;
|
|
3641
3641
|
});
|
|
3642
3642
|
}
|
|
3643
3643
|
}
|
|
@@ -4570,6 +4570,7 @@ class VegaRtcManager {
|
|
|
4570
4570
|
vegaIceRestarts: 0,
|
|
4571
4571
|
vegaIceRestartMissingTransport: 0,
|
|
4572
4572
|
vegaIceRestartWrongTransportId: 0,
|
|
4573
|
+
vegaNonErrorRejectionValueGUMError: 0,
|
|
4573
4574
|
};
|
|
4574
4575
|
}
|
|
4575
4576
|
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, sfuServers, mediaserverConfigTtlSeconds, }) {
|
|
@@ -5566,7 +5567,9 @@ class VegaRtcManager {
|
|
|
5566
5567
|
}
|
|
5567
5568
|
else if (localStream.getVideoTracks().length === 0) {
|
|
5568
5569
|
const constraints = this._webrtcProvider.getMediaConstraints().video;
|
|
5569
|
-
navigator.mediaDevices
|
|
5570
|
+
navigator.mediaDevices
|
|
5571
|
+
.getUserMedia({ video: constraints })
|
|
5572
|
+
.then((stream) => {
|
|
5570
5573
|
const track = stream.getVideoTracks()[0];
|
|
5571
5574
|
localStream.addTrack(track);
|
|
5572
5575
|
this._monitorVideoTrack(track);
|
|
@@ -5576,6 +5579,13 @@ class VegaRtcManager {
|
|
|
5576
5579
|
screenShare: false,
|
|
5577
5580
|
});
|
|
5578
5581
|
this._handleStopOrResumeVideo({ enable, track });
|
|
5582
|
+
})
|
|
5583
|
+
.catch((e) => {
|
|
5584
|
+
if (!(e instanceof Error)) {
|
|
5585
|
+
this.analytics.vegaNonErrorRejectionValueGUMError++;
|
|
5586
|
+
e = new Error(`non-error gUM rejection value: ${JSON.stringify(e)}`);
|
|
5587
|
+
}
|
|
5588
|
+
throw e;
|
|
5579
5589
|
});
|
|
5580
5590
|
}
|
|
5581
5591
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1078,6 +1078,12 @@ declare function fromLocation({ host, protocol }?: {
|
|
|
1078
1078
|
subdomain: string;
|
|
1079
1079
|
};
|
|
1080
1080
|
|
|
1081
|
+
type P2PAnalytics = {
|
|
1082
|
+
P2PReplaceTrackNoPC: number;
|
|
1083
|
+
P2PNonErrorRejectionValueGUMError: number;
|
|
1084
|
+
};
|
|
1085
|
+
type P2PAnalyticMetric = keyof P2PAnalytics;
|
|
1086
|
+
type P2PIncrementAnalyticMetric = (metric: P2PAnalyticMetric) => void;
|
|
1081
1087
|
declare class P2pRtcManager implements RtcManager {
|
|
1082
1088
|
_selfId: any;
|
|
1083
1089
|
_roomName: any;
|
|
@@ -1116,6 +1122,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1116
1122
|
_audioTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
1117
1123
|
_closed: boolean;
|
|
1118
1124
|
skipEmittingServerMessageCount: number;
|
|
1125
|
+
analytics: P2PAnalytics;
|
|
1119
1126
|
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, }: {
|
|
1120
1127
|
selfId: any;
|
|
1121
1128
|
room: any;
|
|
@@ -1135,7 +1142,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1135
1142
|
replaceTrack(oldTrack: CustomMediaStreamTrack | null, newTrack: CustomMediaStreamTrack): Promise<any[]>;
|
|
1136
1143
|
close(): void;
|
|
1137
1144
|
disconnectAll(): void;
|
|
1138
|
-
fixChromeAudio(constraints: any): Promise<any[]> | undefined;
|
|
1139
1145
|
setupSocketListeners(): void;
|
|
1140
1146
|
sendAudioMutedStats(muted: boolean): void;
|
|
1141
1147
|
sendVideoMutedStats(muted: boolean): void;
|
|
@@ -1314,10 +1320,12 @@ declare class Session {
|
|
|
1314
1320
|
shouldAddLocalVideo: any;
|
|
1315
1321
|
signalingState: any;
|
|
1316
1322
|
srdComplete: any;
|
|
1317
|
-
|
|
1323
|
+
_incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
1324
|
+
constructor({ peerConnectionId, bandwidth, deprioritizeH264Encoding, incrementAnalyticMetric, }: {
|
|
1318
1325
|
peerConnectionId: any;
|
|
1319
1326
|
bandwidth: any;
|
|
1320
1327
|
deprioritizeH264Encoding: any;
|
|
1328
|
+
incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
1321
1329
|
});
|
|
1322
1330
|
setAndGetPeerConnection({ clientId, constraints, peerConnectionConfig, shouldAddLocalVideo, }: {
|
|
1323
1331
|
clientId: any;
|
|
@@ -1493,6 +1501,7 @@ type VegaAnalytics = {
|
|
|
1493
1501
|
vegaIceRestarts: number;
|
|
1494
1502
|
vegaIceRestartMissingTransport: number;
|
|
1495
1503
|
vegaIceRestartWrongTransportId: number;
|
|
1504
|
+
vegaNonErrorRejectionValueGUMError: number;
|
|
1496
1505
|
};
|
|
1497
1506
|
|
|
1498
1507
|
type MediaStreamWhichMayHaveInboundId = MediaStream & { inboundId?: string };
|
|
@@ -1862,7 +1871,6 @@ declare class RtcStream {
|
|
|
1862
1871
|
setVideoEnabled(isEnabled: boolean): void;
|
|
1863
1872
|
setAudioEnabled(isEnabled: boolean): void;
|
|
1864
1873
|
static getCameraId(): string;
|
|
1865
|
-
static getTypeFromId(id: string): string;
|
|
1866
1874
|
}
|
|
1867
1875
|
|
|
1868
1876
|
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, RtcStream, 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, changeMediaDirection, 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, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, turnServerOverride, variance };
|
package/dist/index.d.mts
CHANGED
|
@@ -1078,6 +1078,12 @@ declare function fromLocation({ host, protocol }?: {
|
|
|
1078
1078
|
subdomain: string;
|
|
1079
1079
|
};
|
|
1080
1080
|
|
|
1081
|
+
type P2PAnalytics = {
|
|
1082
|
+
P2PReplaceTrackNoPC: number;
|
|
1083
|
+
P2PNonErrorRejectionValueGUMError: number;
|
|
1084
|
+
};
|
|
1085
|
+
type P2PAnalyticMetric = keyof P2PAnalytics;
|
|
1086
|
+
type P2PIncrementAnalyticMetric = (metric: P2PAnalyticMetric) => void;
|
|
1081
1087
|
declare class P2pRtcManager implements RtcManager {
|
|
1082
1088
|
_selfId: any;
|
|
1083
1089
|
_roomName: any;
|
|
@@ -1116,6 +1122,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1116
1122
|
_audioTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
1117
1123
|
_closed: boolean;
|
|
1118
1124
|
skipEmittingServerMessageCount: number;
|
|
1125
|
+
analytics: P2PAnalytics;
|
|
1119
1126
|
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, }: {
|
|
1120
1127
|
selfId: any;
|
|
1121
1128
|
room: any;
|
|
@@ -1135,7 +1142,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1135
1142
|
replaceTrack(oldTrack: CustomMediaStreamTrack | null, newTrack: CustomMediaStreamTrack): Promise<any[]>;
|
|
1136
1143
|
close(): void;
|
|
1137
1144
|
disconnectAll(): void;
|
|
1138
|
-
fixChromeAudio(constraints: any): Promise<any[]> | undefined;
|
|
1139
1145
|
setupSocketListeners(): void;
|
|
1140
1146
|
sendAudioMutedStats(muted: boolean): void;
|
|
1141
1147
|
sendVideoMutedStats(muted: boolean): void;
|
|
@@ -1314,10 +1320,12 @@ declare class Session {
|
|
|
1314
1320
|
shouldAddLocalVideo: any;
|
|
1315
1321
|
signalingState: any;
|
|
1316
1322
|
srdComplete: any;
|
|
1317
|
-
|
|
1323
|
+
_incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
1324
|
+
constructor({ peerConnectionId, bandwidth, deprioritizeH264Encoding, incrementAnalyticMetric, }: {
|
|
1318
1325
|
peerConnectionId: any;
|
|
1319
1326
|
bandwidth: any;
|
|
1320
1327
|
deprioritizeH264Encoding: any;
|
|
1328
|
+
incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
1321
1329
|
});
|
|
1322
1330
|
setAndGetPeerConnection({ clientId, constraints, peerConnectionConfig, shouldAddLocalVideo, }: {
|
|
1323
1331
|
clientId: any;
|
|
@@ -1493,6 +1501,7 @@ type VegaAnalytics = {
|
|
|
1493
1501
|
vegaIceRestarts: number;
|
|
1494
1502
|
vegaIceRestartMissingTransport: number;
|
|
1495
1503
|
vegaIceRestartWrongTransportId: number;
|
|
1504
|
+
vegaNonErrorRejectionValueGUMError: number;
|
|
1496
1505
|
};
|
|
1497
1506
|
|
|
1498
1507
|
type MediaStreamWhichMayHaveInboundId = MediaStream & { inboundId?: string };
|
|
@@ -1862,7 +1871,6 @@ declare class RtcStream {
|
|
|
1862
1871
|
setVideoEnabled(isEnabled: boolean): void;
|
|
1863
1872
|
setAudioEnabled(isEnabled: boolean): void;
|
|
1864
1873
|
static getCameraId(): string;
|
|
1865
|
-
static getTypeFromId(id: string): string;
|
|
1866
1874
|
}
|
|
1867
1875
|
|
|
1868
1876
|
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, RtcStream, 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, changeMediaDirection, 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, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, turnServerOverride, variance };
|
package/dist/index.d.ts
CHANGED
|
@@ -1078,6 +1078,12 @@ declare function fromLocation({ host, protocol }?: {
|
|
|
1078
1078
|
subdomain: string;
|
|
1079
1079
|
};
|
|
1080
1080
|
|
|
1081
|
+
type P2PAnalytics = {
|
|
1082
|
+
P2PReplaceTrackNoPC: number;
|
|
1083
|
+
P2PNonErrorRejectionValueGUMError: number;
|
|
1084
|
+
};
|
|
1085
|
+
type P2PAnalyticMetric = keyof P2PAnalytics;
|
|
1086
|
+
type P2PIncrementAnalyticMetric = (metric: P2PAnalyticMetric) => void;
|
|
1081
1087
|
declare class P2pRtcManager implements RtcManager {
|
|
1082
1088
|
_selfId: any;
|
|
1083
1089
|
_roomName: any;
|
|
@@ -1116,6 +1122,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1116
1122
|
_audioTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
1117
1123
|
_closed: boolean;
|
|
1118
1124
|
skipEmittingServerMessageCount: number;
|
|
1125
|
+
analytics: P2PAnalytics;
|
|
1119
1126
|
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, }: {
|
|
1120
1127
|
selfId: any;
|
|
1121
1128
|
room: any;
|
|
@@ -1135,7 +1142,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1135
1142
|
replaceTrack(oldTrack: CustomMediaStreamTrack | null, newTrack: CustomMediaStreamTrack): Promise<any[]>;
|
|
1136
1143
|
close(): void;
|
|
1137
1144
|
disconnectAll(): void;
|
|
1138
|
-
fixChromeAudio(constraints: any): Promise<any[]> | undefined;
|
|
1139
1145
|
setupSocketListeners(): void;
|
|
1140
1146
|
sendAudioMutedStats(muted: boolean): void;
|
|
1141
1147
|
sendVideoMutedStats(muted: boolean): void;
|
|
@@ -1314,10 +1320,12 @@ declare class Session {
|
|
|
1314
1320
|
shouldAddLocalVideo: any;
|
|
1315
1321
|
signalingState: any;
|
|
1316
1322
|
srdComplete: any;
|
|
1317
|
-
|
|
1323
|
+
_incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
1324
|
+
constructor({ peerConnectionId, bandwidth, deprioritizeH264Encoding, incrementAnalyticMetric, }: {
|
|
1318
1325
|
peerConnectionId: any;
|
|
1319
1326
|
bandwidth: any;
|
|
1320
1327
|
deprioritizeH264Encoding: any;
|
|
1328
|
+
incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
1321
1329
|
});
|
|
1322
1330
|
setAndGetPeerConnection({ clientId, constraints, peerConnectionConfig, shouldAddLocalVideo, }: {
|
|
1323
1331
|
clientId: any;
|
|
@@ -1493,6 +1501,7 @@ type VegaAnalytics = {
|
|
|
1493
1501
|
vegaIceRestarts: number;
|
|
1494
1502
|
vegaIceRestartMissingTransport: number;
|
|
1495
1503
|
vegaIceRestartWrongTransportId: number;
|
|
1504
|
+
vegaNonErrorRejectionValueGUMError: number;
|
|
1496
1505
|
};
|
|
1497
1506
|
|
|
1498
1507
|
type MediaStreamWhichMayHaveInboundId = MediaStream & { inboundId?: string };
|
|
@@ -1862,7 +1871,6 @@ declare class RtcStream {
|
|
|
1862
1871
|
setVideoEnabled(isEnabled: boolean): void;
|
|
1863
1872
|
setAudioEnabled(isEnabled: boolean): void;
|
|
1864
1873
|
static getCameraId(): string;
|
|
1865
|
-
static getTypeFromId(id: string): string;
|
|
1866
1874
|
}
|
|
1867
1875
|
|
|
1868
1876
|
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, RtcStream, 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, changeMediaDirection, 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, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, turnServerOverride, variance };
|
package/dist/index.mjs
CHANGED
|
@@ -2146,7 +2146,7 @@ var _a$4;
|
|
|
2146
2146
|
const adapter$4 = (_a$4 = adapterRaw.default) !== null && _a$4 !== void 0 ? _a$4 : adapterRaw;
|
|
2147
2147
|
const logger$7 = new Logger();
|
|
2148
2148
|
class Session {
|
|
2149
|
-
constructor({ peerConnectionId, bandwidth, deprioritizeH264Encoding, }) {
|
|
2149
|
+
constructor({ peerConnectionId, bandwidth, deprioritizeH264Encoding, incrementAnalyticMetric, }) {
|
|
2150
2150
|
this.peerConnectionId = peerConnectionId;
|
|
2151
2151
|
this.relayCandidateSeen = false;
|
|
2152
2152
|
this.serverReflexiveCandidateSeen = false;
|
|
@@ -2173,6 +2173,7 @@ class Session {
|
|
|
2173
2173
|
});
|
|
2174
2174
|
this.offerOptions = { offerToReceiveAudio: true, offerToReceiveVideo: true };
|
|
2175
2175
|
this._deprioritizeH264Encoding = deprioritizeH264Encoding;
|
|
2176
|
+
this._incrementAnalyticMetric = incrementAnalyticMetric;
|
|
2176
2177
|
}
|
|
2177
2178
|
setAndGetPeerConnection({ clientId, constraints, peerConnectionConfig, shouldAddLocalVideo, }) {
|
|
2178
2179
|
this.peerConnectionConfig = peerConnectionConfig;
|
|
@@ -2333,8 +2334,14 @@ class Session {
|
|
|
2333
2334
|
replaceTrack(oldTrack, newTrack) {
|
|
2334
2335
|
var _a;
|
|
2335
2336
|
const pc = this.pc;
|
|
2336
|
-
if (!pc)
|
|
2337
|
+
if (!pc) {
|
|
2338
|
+
rtcStats.sendEvent("P2PReplaceTrackNoPC", {
|
|
2339
|
+
oldTrackId: oldTrack === null || oldTrack === void 0 ? void 0 : oldTrack.id,
|
|
2340
|
+
newTrackId: newTrack === null || newTrack === void 0 ? void 0 : newTrack.id,
|
|
2341
|
+
});
|
|
2342
|
+
this._incrementAnalyticMetric("P2PReplaceTrackNoPC");
|
|
2337
2343
|
return false;
|
|
2344
|
+
}
|
|
2338
2345
|
const senders = pc.getSenders();
|
|
2339
2346
|
const oldTrackFallback = (_a = senders.find((s) => { var _a; return ((_a = s.track) === null || _a === void 0 ? void 0 : _a.kind) === newTrack.kind; })) === null || _a === void 0 ? void 0 : _a.track;
|
|
2340
2347
|
const oldTrackToReplace = oldTrack || oldTrackFallback;
|
|
@@ -2569,10 +2576,6 @@ class RtcStream {
|
|
|
2569
2576
|
static getCameraId() {
|
|
2570
2577
|
return CAMERA_STREAM_ID$1;
|
|
2571
2578
|
}
|
|
2572
|
-
static getTypeFromId(id) {
|
|
2573
|
-
const streamId = "" + id;
|
|
2574
|
-
return streamId === CAMERA_STREAM_ID$1 ? STREAM_TYPES.CAMERA : STREAM_TYPES.SCREEN_SHARE;
|
|
2575
|
-
}
|
|
2576
2579
|
}
|
|
2577
2580
|
|
|
2578
2581
|
var rtcManagerEvents = {
|
|
@@ -2649,6 +2652,10 @@ class P2pRtcManager {
|
|
|
2649
2652
|
mediaserverConfigTtlSeconds,
|
|
2650
2653
|
});
|
|
2651
2654
|
this.totalSessionsCreated = 0;
|
|
2655
|
+
this.analytics = {
|
|
2656
|
+
P2PReplaceTrackNoPC: 0,
|
|
2657
|
+
P2PNonErrorRejectionValueGUMError: 0,
|
|
2658
|
+
};
|
|
2652
2659
|
}
|
|
2653
2660
|
numberOfPeerconnections() {
|
|
2654
2661
|
return Object.keys(this.peerConnections).length;
|
|
@@ -2731,23 +2738,6 @@ class P2pRtcManager {
|
|
|
2731
2738
|
this._localStreamDeregisterFunction = null;
|
|
2732
2739
|
}
|
|
2733
2740
|
}
|
|
2734
|
-
fixChromeAudio(constraints) {
|
|
2735
|
-
if (browserName$1 !== "chrome") {
|
|
2736
|
-
return;
|
|
2737
|
-
}
|
|
2738
|
-
const localStream = this._getLocalCameraStream();
|
|
2739
|
-
const audioTrack = localStream.getAudioTracks()[0];
|
|
2740
|
-
if (!audioTrack || audioTrack.readyState !== "ended") {
|
|
2741
|
-
return;
|
|
2742
|
-
}
|
|
2743
|
-
return navigator.mediaDevices.getUserMedia({ audio: constraints }).then((stream) => {
|
|
2744
|
-
const track = stream.getAudioTracks()[0];
|
|
2745
|
-
track.enabled = audioTrack.enabled;
|
|
2746
|
-
localStream.removeTrack(audioTrack);
|
|
2747
|
-
localStream.addTrack(track);
|
|
2748
|
-
return this.replaceTrack(audioTrack, track);
|
|
2749
|
-
});
|
|
2750
|
-
}
|
|
2751
2741
|
setupSocketListeners() {
|
|
2752
2742
|
this._socketListenerDeregisterFunctions = [
|
|
2753
2743
|
() => this._clearMediaServersRefresh(),
|
|
@@ -2949,6 +2939,7 @@ class P2pRtcManager {
|
|
|
2949
2939
|
peerConnectionId,
|
|
2950
2940
|
bandwidth: initialBandwidth,
|
|
2951
2941
|
deprioritizeH264Encoding,
|
|
2942
|
+
incrementAnalyticMetric: (metric) => this.analytics[metric]++,
|
|
2952
2943
|
});
|
|
2953
2944
|
this.totalSessionsCreated++;
|
|
2954
2945
|
}
|
|
@@ -3607,7 +3598,9 @@ class P2pRtcManager {
|
|
|
3607
3598
|
if (!constraints) {
|
|
3608
3599
|
return;
|
|
3609
3600
|
}
|
|
3610
|
-
navigator.mediaDevices
|
|
3601
|
+
navigator.mediaDevices
|
|
3602
|
+
.getUserMedia({ video: constraints })
|
|
3603
|
+
.then((stream) => {
|
|
3611
3604
|
const track = stream.getVideoTracks()[0];
|
|
3612
3605
|
localStream.addTrack(track);
|
|
3613
3606
|
this._monitorVideoTrack(track);
|
|
@@ -3617,6 +3610,13 @@ class P2pRtcManager {
|
|
|
3617
3610
|
screenShare: false,
|
|
3618
3611
|
});
|
|
3619
3612
|
this._handleStopOrResumeVideo({ enable, track });
|
|
3613
|
+
})
|
|
3614
|
+
.catch((e) => {
|
|
3615
|
+
if (!(e instanceof Error)) {
|
|
3616
|
+
this.analytics.P2PNonErrorRejectionValueGUMError++;
|
|
3617
|
+
e = new Error(`non-error gUM rejection value: ${JSON.stringify(e)}`);
|
|
3618
|
+
}
|
|
3619
|
+
throw e;
|
|
3620
3620
|
});
|
|
3621
3621
|
}
|
|
3622
3622
|
}
|
|
@@ -4549,6 +4549,7 @@ class VegaRtcManager {
|
|
|
4549
4549
|
vegaIceRestarts: 0,
|
|
4550
4550
|
vegaIceRestartMissingTransport: 0,
|
|
4551
4551
|
vegaIceRestartWrongTransportId: 0,
|
|
4552
|
+
vegaNonErrorRejectionValueGUMError: 0,
|
|
4552
4553
|
};
|
|
4553
4554
|
}
|
|
4554
4555
|
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, sfuServers, mediaserverConfigTtlSeconds, }) {
|
|
@@ -5545,7 +5546,9 @@ class VegaRtcManager {
|
|
|
5545
5546
|
}
|
|
5546
5547
|
else if (localStream.getVideoTracks().length === 0) {
|
|
5547
5548
|
const constraints = this._webrtcProvider.getMediaConstraints().video;
|
|
5548
|
-
navigator.mediaDevices
|
|
5549
|
+
navigator.mediaDevices
|
|
5550
|
+
.getUserMedia({ video: constraints })
|
|
5551
|
+
.then((stream) => {
|
|
5549
5552
|
const track = stream.getVideoTracks()[0];
|
|
5550
5553
|
localStream.addTrack(track);
|
|
5551
5554
|
this._monitorVideoTrack(track);
|
|
@@ -5555,6 +5558,13 @@ class VegaRtcManager {
|
|
|
5555
5558
|
screenShare: false,
|
|
5556
5559
|
});
|
|
5557
5560
|
this._handleStopOrResumeVideo({ enable, track });
|
|
5561
|
+
})
|
|
5562
|
+
.catch((e) => {
|
|
5563
|
+
if (!(e instanceof Error)) {
|
|
5564
|
+
this.analytics.vegaNonErrorRejectionValueGUMError++;
|
|
5565
|
+
e = new Error(`non-error gUM rejection value: ${JSON.stringify(e)}`);
|
|
5566
|
+
}
|
|
5567
|
+
throw e;
|
|
5558
5568
|
});
|
|
5559
5569
|
}
|
|
5560
5570
|
}
|
package/dist/legacy-esm.js
CHANGED
|
@@ -2146,7 +2146,7 @@ var _a$4;
|
|
|
2146
2146
|
const adapter$4 = (_a$4 = adapterRaw.default) !== null && _a$4 !== void 0 ? _a$4 : adapterRaw;
|
|
2147
2147
|
const logger$7 = new Logger();
|
|
2148
2148
|
class Session {
|
|
2149
|
-
constructor({ peerConnectionId, bandwidth, deprioritizeH264Encoding, }) {
|
|
2149
|
+
constructor({ peerConnectionId, bandwidth, deprioritizeH264Encoding, incrementAnalyticMetric, }) {
|
|
2150
2150
|
this.peerConnectionId = peerConnectionId;
|
|
2151
2151
|
this.relayCandidateSeen = false;
|
|
2152
2152
|
this.serverReflexiveCandidateSeen = false;
|
|
@@ -2173,6 +2173,7 @@ class Session {
|
|
|
2173
2173
|
});
|
|
2174
2174
|
this.offerOptions = { offerToReceiveAudio: true, offerToReceiveVideo: true };
|
|
2175
2175
|
this._deprioritizeH264Encoding = deprioritizeH264Encoding;
|
|
2176
|
+
this._incrementAnalyticMetric = incrementAnalyticMetric;
|
|
2176
2177
|
}
|
|
2177
2178
|
setAndGetPeerConnection({ clientId, constraints, peerConnectionConfig, shouldAddLocalVideo, }) {
|
|
2178
2179
|
this.peerConnectionConfig = peerConnectionConfig;
|
|
@@ -2333,8 +2334,14 @@ class Session {
|
|
|
2333
2334
|
replaceTrack(oldTrack, newTrack) {
|
|
2334
2335
|
var _a;
|
|
2335
2336
|
const pc = this.pc;
|
|
2336
|
-
if (!pc)
|
|
2337
|
+
if (!pc) {
|
|
2338
|
+
rtcStats.sendEvent("P2PReplaceTrackNoPC", {
|
|
2339
|
+
oldTrackId: oldTrack === null || oldTrack === void 0 ? void 0 : oldTrack.id,
|
|
2340
|
+
newTrackId: newTrack === null || newTrack === void 0 ? void 0 : newTrack.id,
|
|
2341
|
+
});
|
|
2342
|
+
this._incrementAnalyticMetric("P2PReplaceTrackNoPC");
|
|
2337
2343
|
return false;
|
|
2344
|
+
}
|
|
2338
2345
|
const senders = pc.getSenders();
|
|
2339
2346
|
const oldTrackFallback = (_a = senders.find((s) => { var _a; return ((_a = s.track) === null || _a === void 0 ? void 0 : _a.kind) === newTrack.kind; })) === null || _a === void 0 ? void 0 : _a.track;
|
|
2340
2347
|
const oldTrackToReplace = oldTrack || oldTrackFallback;
|
|
@@ -2569,10 +2576,6 @@ class RtcStream {
|
|
|
2569
2576
|
static getCameraId() {
|
|
2570
2577
|
return CAMERA_STREAM_ID$1;
|
|
2571
2578
|
}
|
|
2572
|
-
static getTypeFromId(id) {
|
|
2573
|
-
const streamId = "" + id;
|
|
2574
|
-
return streamId === CAMERA_STREAM_ID$1 ? STREAM_TYPES.CAMERA : STREAM_TYPES.SCREEN_SHARE;
|
|
2575
|
-
}
|
|
2576
2579
|
}
|
|
2577
2580
|
|
|
2578
2581
|
var rtcManagerEvents = {
|
|
@@ -2649,6 +2652,10 @@ class P2pRtcManager {
|
|
|
2649
2652
|
mediaserverConfigTtlSeconds,
|
|
2650
2653
|
});
|
|
2651
2654
|
this.totalSessionsCreated = 0;
|
|
2655
|
+
this.analytics = {
|
|
2656
|
+
P2PReplaceTrackNoPC: 0,
|
|
2657
|
+
P2PNonErrorRejectionValueGUMError: 0,
|
|
2658
|
+
};
|
|
2652
2659
|
}
|
|
2653
2660
|
numberOfPeerconnections() {
|
|
2654
2661
|
return Object.keys(this.peerConnections).length;
|
|
@@ -2731,23 +2738,6 @@ class P2pRtcManager {
|
|
|
2731
2738
|
this._localStreamDeregisterFunction = null;
|
|
2732
2739
|
}
|
|
2733
2740
|
}
|
|
2734
|
-
fixChromeAudio(constraints) {
|
|
2735
|
-
if (browserName$1 !== "chrome") {
|
|
2736
|
-
return;
|
|
2737
|
-
}
|
|
2738
|
-
const localStream = this._getLocalCameraStream();
|
|
2739
|
-
const audioTrack = localStream.getAudioTracks()[0];
|
|
2740
|
-
if (!audioTrack || audioTrack.readyState !== "ended") {
|
|
2741
|
-
return;
|
|
2742
|
-
}
|
|
2743
|
-
return navigator.mediaDevices.getUserMedia({ audio: constraints }).then((stream) => {
|
|
2744
|
-
const track = stream.getAudioTracks()[0];
|
|
2745
|
-
track.enabled = audioTrack.enabled;
|
|
2746
|
-
localStream.removeTrack(audioTrack);
|
|
2747
|
-
localStream.addTrack(track);
|
|
2748
|
-
return this.replaceTrack(audioTrack, track);
|
|
2749
|
-
});
|
|
2750
|
-
}
|
|
2751
2741
|
setupSocketListeners() {
|
|
2752
2742
|
this._socketListenerDeregisterFunctions = [
|
|
2753
2743
|
() => this._clearMediaServersRefresh(),
|
|
@@ -2949,6 +2939,7 @@ class P2pRtcManager {
|
|
|
2949
2939
|
peerConnectionId,
|
|
2950
2940
|
bandwidth: initialBandwidth,
|
|
2951
2941
|
deprioritizeH264Encoding,
|
|
2942
|
+
incrementAnalyticMetric: (metric) => this.analytics[metric]++,
|
|
2952
2943
|
});
|
|
2953
2944
|
this.totalSessionsCreated++;
|
|
2954
2945
|
}
|
|
@@ -3607,7 +3598,9 @@ class P2pRtcManager {
|
|
|
3607
3598
|
if (!constraints) {
|
|
3608
3599
|
return;
|
|
3609
3600
|
}
|
|
3610
|
-
navigator.mediaDevices
|
|
3601
|
+
navigator.mediaDevices
|
|
3602
|
+
.getUserMedia({ video: constraints })
|
|
3603
|
+
.then((stream) => {
|
|
3611
3604
|
const track = stream.getVideoTracks()[0];
|
|
3612
3605
|
localStream.addTrack(track);
|
|
3613
3606
|
this._monitorVideoTrack(track);
|
|
@@ -3617,6 +3610,13 @@ class P2pRtcManager {
|
|
|
3617
3610
|
screenShare: false,
|
|
3618
3611
|
});
|
|
3619
3612
|
this._handleStopOrResumeVideo({ enable, track });
|
|
3613
|
+
})
|
|
3614
|
+
.catch((e) => {
|
|
3615
|
+
if (!(e instanceof Error)) {
|
|
3616
|
+
this.analytics.P2PNonErrorRejectionValueGUMError++;
|
|
3617
|
+
e = new Error(`non-error gUM rejection value: ${JSON.stringify(e)}`);
|
|
3618
|
+
}
|
|
3619
|
+
throw e;
|
|
3620
3620
|
});
|
|
3621
3621
|
}
|
|
3622
3622
|
}
|
|
@@ -4549,6 +4549,7 @@ class VegaRtcManager {
|
|
|
4549
4549
|
vegaIceRestarts: 0,
|
|
4550
4550
|
vegaIceRestartMissingTransport: 0,
|
|
4551
4551
|
vegaIceRestartWrongTransportId: 0,
|
|
4552
|
+
vegaNonErrorRejectionValueGUMError: 0,
|
|
4552
4553
|
};
|
|
4553
4554
|
}
|
|
4554
4555
|
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, sfuServers, mediaserverConfigTtlSeconds, }) {
|
|
@@ -5545,7 +5546,9 @@ class VegaRtcManager {
|
|
|
5545
5546
|
}
|
|
5546
5547
|
else if (localStream.getVideoTracks().length === 0) {
|
|
5547
5548
|
const constraints = this._webrtcProvider.getMediaConstraints().video;
|
|
5548
|
-
navigator.mediaDevices
|
|
5549
|
+
navigator.mediaDevices
|
|
5550
|
+
.getUserMedia({ video: constraints })
|
|
5551
|
+
.then((stream) => {
|
|
5549
5552
|
const track = stream.getVideoTracks()[0];
|
|
5550
5553
|
localStream.addTrack(track);
|
|
5551
5554
|
this._monitorVideoTrack(track);
|
|
@@ -5555,6 +5558,13 @@ class VegaRtcManager {
|
|
|
5555
5558
|
screenShare: false,
|
|
5556
5559
|
});
|
|
5557
5560
|
this._handleStopOrResumeVideo({ enable, track });
|
|
5561
|
+
})
|
|
5562
|
+
.catch((e) => {
|
|
5563
|
+
if (!(e instanceof Error)) {
|
|
5564
|
+
this.analytics.vegaNonErrorRejectionValueGUMError++;
|
|
5565
|
+
e = new Error(`non-error gUM rejection value: ${JSON.stringify(e)}`);
|
|
5566
|
+
}
|
|
5567
|
+
throw e;
|
|
5558
5568
|
});
|
|
5559
5569
|
}
|
|
5560
5570
|
}
|