@whereby.com/media 2.6.4 → 2.6.5
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 +13 -23
- package/dist/index.d.cts +9 -3
- package/dist/index.d.mts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.mjs +13 -23
- package/dist/legacy-esm.js +13 -23
- 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,9 @@ class P2pRtcManager {
|
|
|
2670
2673
|
mediaserverConfigTtlSeconds,
|
|
2671
2674
|
});
|
|
2672
2675
|
this.totalSessionsCreated = 0;
|
|
2676
|
+
this.analytics = {
|
|
2677
|
+
P2PReplaceTrackNoPC: 0,
|
|
2678
|
+
};
|
|
2673
2679
|
}
|
|
2674
2680
|
numberOfPeerconnections() {
|
|
2675
2681
|
return Object.keys(this.peerConnections).length;
|
|
@@ -2752,23 +2758,6 @@ class P2pRtcManager {
|
|
|
2752
2758
|
this._localStreamDeregisterFunction = null;
|
|
2753
2759
|
}
|
|
2754
2760
|
}
|
|
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
2761
|
setupSocketListeners() {
|
|
2773
2762
|
this._socketListenerDeregisterFunctions = [
|
|
2774
2763
|
() => this._clearMediaServersRefresh(),
|
|
@@ -2970,6 +2959,7 @@ class P2pRtcManager {
|
|
|
2970
2959
|
peerConnectionId,
|
|
2971
2960
|
bandwidth: initialBandwidth,
|
|
2972
2961
|
deprioritizeH264Encoding,
|
|
2962
|
+
incrementAnalyticMetric: (metric) => this.analytics[metric]++,
|
|
2973
2963
|
});
|
|
2974
2964
|
this.totalSessionsCreated++;
|
|
2975
2965
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1078,6 +1078,11 @@ declare function fromLocation({ host, protocol }?: {
|
|
|
1078
1078
|
subdomain: string;
|
|
1079
1079
|
};
|
|
1080
1080
|
|
|
1081
|
+
type P2PAnalytics = {
|
|
1082
|
+
P2PReplaceTrackNoPC: number;
|
|
1083
|
+
};
|
|
1084
|
+
type P2PAnalyticMetric = "P2PReplaceTrackNoPC";
|
|
1085
|
+
type P2PIncrementAnalyticMetric = (metric: P2PAnalyticMetric) => void;
|
|
1081
1086
|
declare class P2pRtcManager implements RtcManager {
|
|
1082
1087
|
_selfId: any;
|
|
1083
1088
|
_roomName: any;
|
|
@@ -1116,6 +1121,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1116
1121
|
_audioTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
1117
1122
|
_closed: boolean;
|
|
1118
1123
|
skipEmittingServerMessageCount: number;
|
|
1124
|
+
analytics: P2PAnalytics;
|
|
1119
1125
|
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, }: {
|
|
1120
1126
|
selfId: any;
|
|
1121
1127
|
room: any;
|
|
@@ -1135,7 +1141,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1135
1141
|
replaceTrack(oldTrack: CustomMediaStreamTrack | null, newTrack: CustomMediaStreamTrack): Promise<any[]>;
|
|
1136
1142
|
close(): void;
|
|
1137
1143
|
disconnectAll(): void;
|
|
1138
|
-
fixChromeAudio(constraints: any): Promise<any[]> | undefined;
|
|
1139
1144
|
setupSocketListeners(): void;
|
|
1140
1145
|
sendAudioMutedStats(muted: boolean): void;
|
|
1141
1146
|
sendVideoMutedStats(muted: boolean): void;
|
|
@@ -1314,10 +1319,12 @@ declare class Session {
|
|
|
1314
1319
|
shouldAddLocalVideo: any;
|
|
1315
1320
|
signalingState: any;
|
|
1316
1321
|
srdComplete: any;
|
|
1317
|
-
|
|
1322
|
+
_incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
1323
|
+
constructor({ peerConnectionId, bandwidth, deprioritizeH264Encoding, incrementAnalyticMetric, }: {
|
|
1318
1324
|
peerConnectionId: any;
|
|
1319
1325
|
bandwidth: any;
|
|
1320
1326
|
deprioritizeH264Encoding: any;
|
|
1327
|
+
incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
1321
1328
|
});
|
|
1322
1329
|
setAndGetPeerConnection({ clientId, constraints, peerConnectionConfig, shouldAddLocalVideo, }: {
|
|
1323
1330
|
clientId: any;
|
|
@@ -1862,7 +1869,6 @@ declare class RtcStream {
|
|
|
1862
1869
|
setVideoEnabled(isEnabled: boolean): void;
|
|
1863
1870
|
setAudioEnabled(isEnabled: boolean): void;
|
|
1864
1871
|
static getCameraId(): string;
|
|
1865
|
-
static getTypeFromId(id: string): string;
|
|
1866
1872
|
}
|
|
1867
1873
|
|
|
1868
1874
|
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,11 @@ declare function fromLocation({ host, protocol }?: {
|
|
|
1078
1078
|
subdomain: string;
|
|
1079
1079
|
};
|
|
1080
1080
|
|
|
1081
|
+
type P2PAnalytics = {
|
|
1082
|
+
P2PReplaceTrackNoPC: number;
|
|
1083
|
+
};
|
|
1084
|
+
type P2PAnalyticMetric = "P2PReplaceTrackNoPC";
|
|
1085
|
+
type P2PIncrementAnalyticMetric = (metric: P2PAnalyticMetric) => void;
|
|
1081
1086
|
declare class P2pRtcManager implements RtcManager {
|
|
1082
1087
|
_selfId: any;
|
|
1083
1088
|
_roomName: any;
|
|
@@ -1116,6 +1121,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1116
1121
|
_audioTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
1117
1122
|
_closed: boolean;
|
|
1118
1123
|
skipEmittingServerMessageCount: number;
|
|
1124
|
+
analytics: P2PAnalytics;
|
|
1119
1125
|
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, }: {
|
|
1120
1126
|
selfId: any;
|
|
1121
1127
|
room: any;
|
|
@@ -1135,7 +1141,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1135
1141
|
replaceTrack(oldTrack: CustomMediaStreamTrack | null, newTrack: CustomMediaStreamTrack): Promise<any[]>;
|
|
1136
1142
|
close(): void;
|
|
1137
1143
|
disconnectAll(): void;
|
|
1138
|
-
fixChromeAudio(constraints: any): Promise<any[]> | undefined;
|
|
1139
1144
|
setupSocketListeners(): void;
|
|
1140
1145
|
sendAudioMutedStats(muted: boolean): void;
|
|
1141
1146
|
sendVideoMutedStats(muted: boolean): void;
|
|
@@ -1314,10 +1319,12 @@ declare class Session {
|
|
|
1314
1319
|
shouldAddLocalVideo: any;
|
|
1315
1320
|
signalingState: any;
|
|
1316
1321
|
srdComplete: any;
|
|
1317
|
-
|
|
1322
|
+
_incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
1323
|
+
constructor({ peerConnectionId, bandwidth, deprioritizeH264Encoding, incrementAnalyticMetric, }: {
|
|
1318
1324
|
peerConnectionId: any;
|
|
1319
1325
|
bandwidth: any;
|
|
1320
1326
|
deprioritizeH264Encoding: any;
|
|
1327
|
+
incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
1321
1328
|
});
|
|
1322
1329
|
setAndGetPeerConnection({ clientId, constraints, peerConnectionConfig, shouldAddLocalVideo, }: {
|
|
1323
1330
|
clientId: any;
|
|
@@ -1862,7 +1869,6 @@ declare class RtcStream {
|
|
|
1862
1869
|
setVideoEnabled(isEnabled: boolean): void;
|
|
1863
1870
|
setAudioEnabled(isEnabled: boolean): void;
|
|
1864
1871
|
static getCameraId(): string;
|
|
1865
|
-
static getTypeFromId(id: string): string;
|
|
1866
1872
|
}
|
|
1867
1873
|
|
|
1868
1874
|
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,11 @@ declare function fromLocation({ host, protocol }?: {
|
|
|
1078
1078
|
subdomain: string;
|
|
1079
1079
|
};
|
|
1080
1080
|
|
|
1081
|
+
type P2PAnalytics = {
|
|
1082
|
+
P2PReplaceTrackNoPC: number;
|
|
1083
|
+
};
|
|
1084
|
+
type P2PAnalyticMetric = "P2PReplaceTrackNoPC";
|
|
1085
|
+
type P2PIncrementAnalyticMetric = (metric: P2PAnalyticMetric) => void;
|
|
1081
1086
|
declare class P2pRtcManager implements RtcManager {
|
|
1082
1087
|
_selfId: any;
|
|
1083
1088
|
_roomName: any;
|
|
@@ -1116,6 +1121,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1116
1121
|
_audioTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
1117
1122
|
_closed: boolean;
|
|
1118
1123
|
skipEmittingServerMessageCount: number;
|
|
1124
|
+
analytics: P2PAnalytics;
|
|
1119
1125
|
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, }: {
|
|
1120
1126
|
selfId: any;
|
|
1121
1127
|
room: any;
|
|
@@ -1135,7 +1141,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1135
1141
|
replaceTrack(oldTrack: CustomMediaStreamTrack | null, newTrack: CustomMediaStreamTrack): Promise<any[]>;
|
|
1136
1142
|
close(): void;
|
|
1137
1143
|
disconnectAll(): void;
|
|
1138
|
-
fixChromeAudio(constraints: any): Promise<any[]> | undefined;
|
|
1139
1144
|
setupSocketListeners(): void;
|
|
1140
1145
|
sendAudioMutedStats(muted: boolean): void;
|
|
1141
1146
|
sendVideoMutedStats(muted: boolean): void;
|
|
@@ -1314,10 +1319,12 @@ declare class Session {
|
|
|
1314
1319
|
shouldAddLocalVideo: any;
|
|
1315
1320
|
signalingState: any;
|
|
1316
1321
|
srdComplete: any;
|
|
1317
|
-
|
|
1322
|
+
_incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
1323
|
+
constructor({ peerConnectionId, bandwidth, deprioritizeH264Encoding, incrementAnalyticMetric, }: {
|
|
1318
1324
|
peerConnectionId: any;
|
|
1319
1325
|
bandwidth: any;
|
|
1320
1326
|
deprioritizeH264Encoding: any;
|
|
1327
|
+
incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
1321
1328
|
});
|
|
1322
1329
|
setAndGetPeerConnection({ clientId, constraints, peerConnectionConfig, shouldAddLocalVideo, }: {
|
|
1323
1330
|
clientId: any;
|
|
@@ -1862,7 +1869,6 @@ declare class RtcStream {
|
|
|
1862
1869
|
setVideoEnabled(isEnabled: boolean): void;
|
|
1863
1870
|
setAudioEnabled(isEnabled: boolean): void;
|
|
1864
1871
|
static getCameraId(): string;
|
|
1865
|
-
static getTypeFromId(id: string): string;
|
|
1866
1872
|
}
|
|
1867
1873
|
|
|
1868
1874
|
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,9 @@ class P2pRtcManager {
|
|
|
2649
2652
|
mediaserverConfigTtlSeconds,
|
|
2650
2653
|
});
|
|
2651
2654
|
this.totalSessionsCreated = 0;
|
|
2655
|
+
this.analytics = {
|
|
2656
|
+
P2PReplaceTrackNoPC: 0,
|
|
2657
|
+
};
|
|
2652
2658
|
}
|
|
2653
2659
|
numberOfPeerconnections() {
|
|
2654
2660
|
return Object.keys(this.peerConnections).length;
|
|
@@ -2731,23 +2737,6 @@ class P2pRtcManager {
|
|
|
2731
2737
|
this._localStreamDeregisterFunction = null;
|
|
2732
2738
|
}
|
|
2733
2739
|
}
|
|
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
2740
|
setupSocketListeners() {
|
|
2752
2741
|
this._socketListenerDeregisterFunctions = [
|
|
2753
2742
|
() => this._clearMediaServersRefresh(),
|
|
@@ -2949,6 +2938,7 @@ class P2pRtcManager {
|
|
|
2949
2938
|
peerConnectionId,
|
|
2950
2939
|
bandwidth: initialBandwidth,
|
|
2951
2940
|
deprioritizeH264Encoding,
|
|
2941
|
+
incrementAnalyticMetric: (metric) => this.analytics[metric]++,
|
|
2952
2942
|
});
|
|
2953
2943
|
this.totalSessionsCreated++;
|
|
2954
2944
|
}
|
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,9 @@ class P2pRtcManager {
|
|
|
2649
2652
|
mediaserverConfigTtlSeconds,
|
|
2650
2653
|
});
|
|
2651
2654
|
this.totalSessionsCreated = 0;
|
|
2655
|
+
this.analytics = {
|
|
2656
|
+
P2PReplaceTrackNoPC: 0,
|
|
2657
|
+
};
|
|
2652
2658
|
}
|
|
2653
2659
|
numberOfPeerconnections() {
|
|
2654
2660
|
return Object.keys(this.peerConnections).length;
|
|
@@ -2731,23 +2737,6 @@ class P2pRtcManager {
|
|
|
2731
2737
|
this._localStreamDeregisterFunction = null;
|
|
2732
2738
|
}
|
|
2733
2739
|
}
|
|
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
2740
|
setupSocketListeners() {
|
|
2752
2741
|
this._socketListenerDeregisterFunctions = [
|
|
2753
2742
|
() => this._clearMediaServersRefresh(),
|
|
@@ -2949,6 +2938,7 @@ class P2pRtcManager {
|
|
|
2949
2938
|
peerConnectionId,
|
|
2950
2939
|
bandwidth: initialBandwidth,
|
|
2951
2940
|
deprioritizeH264Encoding,
|
|
2941
|
+
incrementAnalyticMetric: (metric) => this.analytics[metric]++,
|
|
2952
2942
|
});
|
|
2953
2943
|
this.totalSessionsCreated++;
|
|
2954
2944
|
}
|