@whereby.com/media 2.6.8 → 2.6.9
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 +74 -55
- package/dist/index.d.cts +88 -86
- package/dist/index.d.mts +88 -86
- package/dist/index.d.ts +88 -86
- package/dist/index.mjs +74 -55
- package/dist/legacy-esm.js +74 -55
- 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, incrementAnalyticMetric, }) {
|
|
2170
|
+
constructor({ peerConnectionId, clientId, bandwidth, peerConnectionConfig, deprioritizeH264Encoding, shouldAddLocalVideo, incrementAnalyticMetric, }) {
|
|
2171
2171
|
this.peerConnectionId = peerConnectionId;
|
|
2172
2172
|
this.relayCandidateSeen = false;
|
|
2173
2173
|
this.serverReflexiveCandidateSeen = false;
|
|
@@ -2176,7 +2176,24 @@ class Session {
|
|
|
2176
2176
|
this.ipv6HostCandidateTeredoSeen = false;
|
|
2177
2177
|
this.ipv6HostCandidate6to4Seen = false;
|
|
2178
2178
|
this.mdnsHostCandidateSeen = false;
|
|
2179
|
-
this.
|
|
2179
|
+
this.peerConnectionConfig = peerConnectionConfig;
|
|
2180
|
+
this.shouldAddLocalVideo = shouldAddLocalVideo;
|
|
2181
|
+
this.clientId = clientId;
|
|
2182
|
+
this.pc = new RTCPeerConnection(this.peerConnectionConfig);
|
|
2183
|
+
this.signalingState = this.pc.signalingState;
|
|
2184
|
+
this.pc.addEventListener("signalingstatechange", () => {
|
|
2185
|
+
if (this.signalingState === this.pc.signalingState) {
|
|
2186
|
+
return;
|
|
2187
|
+
}
|
|
2188
|
+
this.signalingState = this.pc.signalingState;
|
|
2189
|
+
if (this.pc.signalingState === "stable") {
|
|
2190
|
+
this.isOperationPending = false;
|
|
2191
|
+
const action = this.pending.shift();
|
|
2192
|
+
if (action) {
|
|
2193
|
+
action.apply();
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
});
|
|
2180
2197
|
this.wasEverConnected = false;
|
|
2181
2198
|
this.connectionStatus = null;
|
|
2182
2199
|
this.stats = {
|
|
@@ -2196,27 +2213,6 @@ class Session {
|
|
|
2196
2213
|
this._deprioritizeH264Encoding = deprioritizeH264Encoding;
|
|
2197
2214
|
this._incrementAnalyticMetric = incrementAnalyticMetric;
|
|
2198
2215
|
}
|
|
2199
|
-
setAndGetPeerConnection({ clientId, constraints, peerConnectionConfig, shouldAddLocalVideo, }) {
|
|
2200
|
-
this.peerConnectionConfig = peerConnectionConfig;
|
|
2201
|
-
this.shouldAddLocalVideo = shouldAddLocalVideo;
|
|
2202
|
-
this.clientId = clientId;
|
|
2203
|
-
this.pc = new RTCPeerConnection(peerConnectionConfig);
|
|
2204
|
-
this.signalingState = this.pc.signalingState;
|
|
2205
|
-
this.pc.addEventListener("signalingstatechange", () => {
|
|
2206
|
-
if (this.signalingState === this.pc.signalingState) {
|
|
2207
|
-
return;
|
|
2208
|
-
}
|
|
2209
|
-
this.signalingState = this.pc.signalingState;
|
|
2210
|
-
if (this.pc.signalingState === "stable") {
|
|
2211
|
-
this.isOperationPending = false;
|
|
2212
|
-
const action = this.pending.shift();
|
|
2213
|
-
if (action) {
|
|
2214
|
-
action.apply();
|
|
2215
|
-
}
|
|
2216
|
-
}
|
|
2217
|
-
});
|
|
2218
|
-
return this.pc;
|
|
2219
|
-
}
|
|
2220
2216
|
addStream(stream) {
|
|
2221
2217
|
this.streamIds.push(stream.id);
|
|
2222
2218
|
this.streams.push(stream);
|
|
@@ -2351,7 +2347,7 @@ class Session {
|
|
|
2351
2347
|
return this.pc && this.pc.connectionState === "connected";
|
|
2352
2348
|
}
|
|
2353
2349
|
replaceTrack(oldTrack, newTrack) {
|
|
2354
|
-
var _a;
|
|
2350
|
+
var _a, _b;
|
|
2355
2351
|
const pc = this.pc;
|
|
2356
2352
|
if (!pc) {
|
|
2357
2353
|
rtcStats.sendEvent("P2PReplaceTrackNoPC", {
|
|
@@ -2442,11 +2438,12 @@ class Session {
|
|
|
2442
2438
|
setTimeout(() => {
|
|
2443
2439
|
pc.onnegotiationneeded = onn;
|
|
2444
2440
|
}, 0);
|
|
2445
|
-
if (pc.localDescription.type === "offer") {
|
|
2441
|
+
if (((_b = pc.localDescription) === null || _b === void 0 ? void 0 : _b.type) === "offer") {
|
|
2446
2442
|
return pc
|
|
2447
2443
|
.createOffer()
|
|
2448
2444
|
.then((offer) => {
|
|
2449
|
-
|
|
2445
|
+
var _a;
|
|
2446
|
+
offer.sdp = replaceSSRCs((_a = pc.localDescription) === null || _a === void 0 ? void 0 : _a.sdp, offer.sdp);
|
|
2450
2447
|
return pc.setLocalDescription(offer);
|
|
2451
2448
|
})
|
|
2452
2449
|
.then(() => {
|
|
@@ -2459,12 +2456,14 @@ class Session {
|
|
|
2459
2456
|
return pc.createAnswer();
|
|
2460
2457
|
})
|
|
2461
2458
|
.then((answer) => {
|
|
2462
|
-
|
|
2459
|
+
var _a;
|
|
2460
|
+
answer.sdp = replaceSSRCs((_a = pc.localDescription) === null || _a === void 0 ? void 0 : _a.sdp, answer.sdp);
|
|
2463
2461
|
return pc.setLocalDescription(answer);
|
|
2464
2462
|
});
|
|
2465
2463
|
}
|
|
2466
2464
|
}
|
|
2467
2465
|
changeBandwidth(bandwidth) {
|
|
2466
|
+
var _a;
|
|
2468
2467
|
if (bandwidth === this.bandwidth) {
|
|
2469
2468
|
return;
|
|
2470
2469
|
}
|
|
@@ -2473,22 +2472,24 @@ class Session {
|
|
|
2473
2472
|
return;
|
|
2474
2473
|
}
|
|
2475
2474
|
this.bandwidth = bandwidth;
|
|
2476
|
-
if (
|
|
2475
|
+
if (((_a = this.pc.localDescription) === null || _a === void 0 ? void 0 : _a.type) === "") {
|
|
2476
|
+
this._incrementAnalyticMetric("P2PChangeBandwidthEmptySDPType");
|
|
2477
|
+
return;
|
|
2478
|
+
}
|
|
2479
|
+
if (!this.pc.localDescription) {
|
|
2477
2480
|
return;
|
|
2478
2481
|
}
|
|
2479
2482
|
setVideoBandwidthUsingSetParameters(this.pc, this.bandwidth);
|
|
2480
2483
|
}
|
|
2481
2484
|
setAudioOnly(enable, excludedTrackIds = []) {
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
.filter((videoTransceiver) => {
|
|
2485
|
+
var _a;
|
|
2486
|
+
(_a = this.pc) === null || _a === void 0 ? void 0 : _a.getTransceivers().filter((videoTransceiver) => {
|
|
2485
2487
|
var _a, _b, _c, _d, _e, _f;
|
|
2486
2488
|
return (videoTransceiver === null || videoTransceiver === void 0 ? void 0 : videoTransceiver.direction) !== "recvonly" &&
|
|
2487
2489
|
((_b = (_a = videoTransceiver === null || videoTransceiver === void 0 ? void 0 : videoTransceiver.receiver) === null || _a === void 0 ? void 0 : _a.track) === null || _b === void 0 ? void 0 : _b.kind) === "video" &&
|
|
2488
2490
|
!excludedTrackIds.includes((_d = (_c = videoTransceiver === null || videoTransceiver === void 0 ? void 0 : videoTransceiver.receiver) === null || _c === void 0 ? void 0 : _c.track) === null || _d === void 0 ? void 0 : _d.id) &&
|
|
2489
2491
|
!excludedTrackIds.includes((_f = (_e = videoTransceiver === null || videoTransceiver === void 0 ? void 0 : videoTransceiver.sender) === null || _e === void 0 ? void 0 : _e.track) === null || _f === void 0 ? void 0 : _f.id);
|
|
2490
|
-
})
|
|
2491
|
-
.forEach((videoTransceiver) => {
|
|
2492
|
+
}).forEach((videoTransceiver) => {
|
|
2492
2493
|
videoTransceiver.direction = enable ? "sendonly" : "sendrecv";
|
|
2493
2494
|
});
|
|
2494
2495
|
}
|
|
@@ -2682,6 +2683,9 @@ class P2pRtcManager {
|
|
|
2682
2683
|
numPcSldFailure: 0,
|
|
2683
2684
|
numPcOnAnswerFailure: 0,
|
|
2684
2685
|
numPcOnOfferFailure: 0,
|
|
2686
|
+
P2PChangeBandwidthEmptySDPType: 0,
|
|
2687
|
+
P2PNegotiationNeeded: 0,
|
|
2688
|
+
P2PSessionAlreadyCreated: 0,
|
|
2685
2689
|
};
|
|
2686
2690
|
}
|
|
2687
2691
|
numberOfPeerconnections() {
|
|
@@ -2801,7 +2805,7 @@ class P2pRtcManager {
|
|
|
2801
2805
|
logger$6.warn("No RTCPeerConnection on SDP_OFFER", data);
|
|
2802
2806
|
return;
|
|
2803
2807
|
}
|
|
2804
|
-
const offer = this._transformIncomingSdp(data.message
|
|
2808
|
+
const offer = this._transformIncomingSdp(data.message);
|
|
2805
2809
|
(_b = (_a = session
|
|
2806
2810
|
.handleOffer(offer)
|
|
2807
2811
|
.then((answer) => {
|
|
@@ -2820,7 +2824,7 @@ class P2pRtcManager {
|
|
|
2820
2824
|
logger$6.warn("No RTCPeerConnection on SDP_ANSWER", data);
|
|
2821
2825
|
return;
|
|
2822
2826
|
}
|
|
2823
|
-
const answer = this._transformIncomingSdp(data.message
|
|
2827
|
+
const answer = this._transformIncomingSdp(data.message);
|
|
2824
2828
|
(_b = (_a = session.handleAnswer(answer)) === null || _a === void 0 ? void 0 : _a.catch) === null || _b === void 0 ? void 0 : _b.call(_a, (e) => {
|
|
2825
2829
|
logger$6.warn("Could not set remote description from remote answer: ", e);
|
|
2826
2830
|
this.analytics.numPcOnAnswerFailure++;
|
|
@@ -2959,7 +2963,7 @@ class P2pRtcManager {
|
|
|
2959
2963
|
}
|
|
2960
2964
|
return this.peerConnections[peerConnectionId];
|
|
2961
2965
|
}
|
|
2962
|
-
_getOrCreateSession(peerConnectionId, initialBandwidth) {
|
|
2966
|
+
_getOrCreateSession({ peerConnectionId, clientId, initialBandwidth, peerConnectionConfig, shouldAddLocalVideo, }) {
|
|
2963
2967
|
let session = this.peerConnections[peerConnectionId];
|
|
2964
2968
|
if (session === undefined) {
|
|
2965
2969
|
const deprioritizeH264Encoding = browserName$1 === "safari" &&
|
|
@@ -2968,12 +2972,22 @@ class P2pRtcManager {
|
|
|
2968
2972
|
this._features.deprioritizeH264OnSafari;
|
|
2969
2973
|
this.peerConnections[peerConnectionId] = session = new Session({
|
|
2970
2974
|
peerConnectionId,
|
|
2975
|
+
clientId,
|
|
2976
|
+
peerConnectionConfig,
|
|
2971
2977
|
bandwidth: initialBandwidth,
|
|
2972
2978
|
deprioritizeH264Encoding,
|
|
2979
|
+
shouldAddLocalVideo,
|
|
2973
2980
|
incrementAnalyticMetric: (metric) => this.analytics[metric]++,
|
|
2974
2981
|
});
|
|
2975
2982
|
this.totalSessionsCreated++;
|
|
2976
2983
|
}
|
|
2984
|
+
else {
|
|
2985
|
+
this.analytics.P2PSessionAlreadyCreated++;
|
|
2986
|
+
rtcStats.sendEvent("P2PSessionAlreadyCreated", {
|
|
2987
|
+
clientId,
|
|
2988
|
+
peerConnectionId,
|
|
2989
|
+
});
|
|
2990
|
+
}
|
|
2977
2991
|
return session;
|
|
2978
2992
|
}
|
|
2979
2993
|
_getLocalCameraStream() {
|
|
@@ -2989,7 +3003,7 @@ class P2pRtcManager {
|
|
|
2989
3003
|
const streamIds = this._getNonLocalCameraStreamIds();
|
|
2990
3004
|
return streamIds.length === 0 ? null : this.localStreams[streamIds[0]];
|
|
2991
3005
|
}
|
|
2992
|
-
_transformIncomingSdp(original
|
|
3006
|
+
_transformIncomingSdp(original) {
|
|
2993
3007
|
return { type: original.type, sdp: original.sdpU };
|
|
2994
3008
|
}
|
|
2995
3009
|
_transformOutgoingSdp(original) {
|
|
@@ -3002,34 +3016,33 @@ class P2pRtcManager {
|
|
|
3002
3016
|
if (!clientId) {
|
|
3003
3017
|
throw new Error("clientId is missing");
|
|
3004
3018
|
}
|
|
3005
|
-
const
|
|
3019
|
+
const peerConnectionConfig = {
|
|
3020
|
+
iceServers: this._features.turnServersOn ? this._turnServers : this._iceServers,
|
|
3021
|
+
};
|
|
3006
3022
|
const constraints = { optional: [] };
|
|
3023
|
+
constraints.optional.push({ rtcStatsRoomSessionId: this._roomSessionId });
|
|
3024
|
+
constraints.optional.push({ rtcStatsClientId: this._selfId });
|
|
3025
|
+
constraints.optional.push({ rtcStatsPeerId: peerConnectionId });
|
|
3026
|
+
constraints.optional.push({ rtcStatsConferenceId: this._roomName });
|
|
3007
3027
|
if (browserName$1 === "chrome") {
|
|
3008
3028
|
constraints.optional.push({
|
|
3009
3029
|
googCpuOveruseDetection: true,
|
|
3010
3030
|
});
|
|
3031
|
+
peerConnectionConfig.sdpSemantics = "unified-plan";
|
|
3011
3032
|
}
|
|
3012
|
-
constraints.optional.push({ rtcStatsRoomSessionId: this._roomSessionId });
|
|
3013
|
-
constraints.optional.push({ rtcStatsClientId: this._selfId });
|
|
3014
|
-
constraints.optional.push({ rtcStatsPeerId: peerConnectionId });
|
|
3015
|
-
constraints.optional.push({ rtcStatsConferenceId: this._roomName });
|
|
3016
|
-
const peerConnectionConfig = {
|
|
3017
|
-
iceServers: this._features.turnServersOn ? this._turnServers : this._iceServers,
|
|
3018
|
-
};
|
|
3019
3033
|
peerConnectionConfig.iceServers = turnServerOverride(peerConnectionConfig.iceServers, this._features.turnServerOverrideHost);
|
|
3020
3034
|
external_stun_servers(peerConnectionConfig, this._features);
|
|
3021
3035
|
maybeTurnOnly(peerConnectionConfig, this._features);
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
constraints,
|
|
3036
|
+
const session = this._getOrCreateSession({
|
|
3037
|
+
peerConnectionId,
|
|
3038
|
+
clientId,
|
|
3039
|
+
initialBandwidth,
|
|
3027
3040
|
peerConnectionConfig,
|
|
3028
3041
|
shouldAddLocalVideo,
|
|
3029
|
-
clientId,
|
|
3030
3042
|
});
|
|
3031
3043
|
setTimeout(() => this._emit(rtcManagerEvents.NEW_PC), 0);
|
|
3032
3044
|
this.analytics.numNewPc++;
|
|
3045
|
+
const { pc } = session;
|
|
3033
3046
|
pc.ontrack = (event) => {
|
|
3034
3047
|
const stream = event.streams[0];
|
|
3035
3048
|
if (stream.id === "default" && stream.getAudioTracks().length === 0) {
|
|
@@ -3388,7 +3401,7 @@ class P2pRtcManager {
|
|
|
3388
3401
|
}
|
|
3389
3402
|
_withForcedRenegotiation(session, action) {
|
|
3390
3403
|
const pc = session.pc;
|
|
3391
|
-
const originalOnnegotationneeded = pc.
|
|
3404
|
+
const originalOnnegotationneeded = pc.onnegotiationneeded;
|
|
3392
3405
|
pc.onnegotiationneeded = null;
|
|
3393
3406
|
action();
|
|
3394
3407
|
this._negotiatePeerConnection(session.clientId, session);
|
|
@@ -3453,7 +3466,7 @@ class P2pRtcManager {
|
|
|
3453
3466
|
if (!session.publicHostCandidateSeen &&
|
|
3454
3467
|
!session.relayCandidateSeen &&
|
|
3455
3468
|
!session.serverReflexiveCandidateSeen) {
|
|
3456
|
-
if (pc.iceConnectionState !== "connected"
|
|
3469
|
+
if (pc.iceConnectionState !== "connected" && pc.iceConnectionState !== "completed")
|
|
3457
3470
|
this.analytics.numIceNoPublicIpGatheredIn3sec++;
|
|
3458
3471
|
}
|
|
3459
3472
|
}, ICE_PUBLIC_IP_GATHERING_TIMEOUT);
|
|
@@ -3537,6 +3550,8 @@ class P2pRtcManager {
|
|
|
3537
3550
|
}
|
|
3538
3551
|
};
|
|
3539
3552
|
pc.onnegotiationneeded = () => {
|
|
3553
|
+
this.analytics.P2PNegotiationNeeded++;
|
|
3554
|
+
rtcStats.sendEvent("P2PNegotiationNeeded", {});
|
|
3540
3555
|
if (pc.iceConnectionState === "new" || !session.connectionStatus) {
|
|
3541
3556
|
return;
|
|
3542
3557
|
}
|
|
@@ -7036,8 +7051,12 @@ class BandwidthTester extends EventEmitter {
|
|
|
7036
7051
|
this._sendTransport.getStats(),
|
|
7037
7052
|
this._receiveTransport.getStats(),
|
|
7038
7053
|
]);
|
|
7039
|
-
|
|
7040
|
-
|
|
7054
|
+
let availableOutgoingBitrate = 5000000;
|
|
7055
|
+
try {
|
|
7056
|
+
availableOutgoingBitrate = (yield this._vegaConnection.request("getTransportStats")).recvStats[0]
|
|
7057
|
+
.availableOutgoingBitrate;
|
|
7058
|
+
}
|
|
7059
|
+
catch (_a) { }
|
|
7041
7060
|
let outboundPackets = 0;
|
|
7042
7061
|
let remotePacketsLost = 0;
|
|
7043
7062
|
localSendStats.forEach((localSendStat) => {
|
package/dist/index.d.cts
CHANGED
|
@@ -381,13 +381,13 @@ type RtcEvents = {
|
|
|
381
381
|
remote_stream_track_added: void;
|
|
382
382
|
remote_stream_track_removed: void;
|
|
383
383
|
};
|
|
384
|
-
type
|
|
385
|
-
|
|
386
|
-
|
|
384
|
+
type UnifiedPlanSDP = {
|
|
385
|
+
sdpU: string;
|
|
386
|
+
type: RTCSdpType;
|
|
387
387
|
};
|
|
388
|
-
type
|
|
388
|
+
type SDPRelayMessage = {
|
|
389
389
|
clientId: string;
|
|
390
|
-
message:
|
|
390
|
+
message: UnifiedPlanSDP;
|
|
391
391
|
};
|
|
392
392
|
type GetMediaConstraintsOptions = {
|
|
393
393
|
disableAEC: boolean;
|
|
@@ -499,6 +499,67 @@ declare function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, cur
|
|
|
499
499
|
currentSpeakerId?: string | undefined;
|
|
500
500
|
}): GetUpdatedDevicesResult;
|
|
501
501
|
|
|
502
|
+
interface P2PSessionOptions {
|
|
503
|
+
peerConnectionId: string;
|
|
504
|
+
clientId: string;
|
|
505
|
+
bandwidth: number;
|
|
506
|
+
peerConnectionConfig: RTCConfiguration;
|
|
507
|
+
deprioritizeH264Encoding: boolean;
|
|
508
|
+
shouldAddLocalVideo: boolean;
|
|
509
|
+
incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
510
|
+
}
|
|
511
|
+
declare class Session {
|
|
512
|
+
peerConnectionId: any;
|
|
513
|
+
relayCandidateSeen: boolean;
|
|
514
|
+
serverReflexiveCandidateSeen: boolean;
|
|
515
|
+
publicHostCandidateSeen: boolean;
|
|
516
|
+
ipv6HostCandidateSeen: boolean;
|
|
517
|
+
ipv6HostCandidateTeredoSeen: boolean;
|
|
518
|
+
ipv6HostCandidate6to4Seen: boolean;
|
|
519
|
+
mdnsHostCandidateSeen: boolean;
|
|
520
|
+
pc: RTCPeerConnection;
|
|
521
|
+
wasEverConnected: boolean;
|
|
522
|
+
connectionStatus: any;
|
|
523
|
+
stats: {
|
|
524
|
+
totalSent: number;
|
|
525
|
+
totalRecv: number;
|
|
526
|
+
};
|
|
527
|
+
bandwidth: any;
|
|
528
|
+
pending: any[];
|
|
529
|
+
isOperationPending: boolean;
|
|
530
|
+
streamIds: any[];
|
|
531
|
+
streams: MediaStream[];
|
|
532
|
+
earlyIceCandidates: any[];
|
|
533
|
+
afterConnected: Promise<unknown>;
|
|
534
|
+
registerConnected: any;
|
|
535
|
+
offerOptions: {
|
|
536
|
+
offerToReceiveAudio: boolean;
|
|
537
|
+
offerToReceiveVideo: boolean;
|
|
538
|
+
};
|
|
539
|
+
_deprioritizeH264Encoding: any;
|
|
540
|
+
clientId: any;
|
|
541
|
+
peerConnectionConfig: RTCConfiguration;
|
|
542
|
+
shouldAddLocalVideo: boolean;
|
|
543
|
+
signalingState: any;
|
|
544
|
+
srdComplete: any;
|
|
545
|
+
_incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
546
|
+
constructor({ peerConnectionId, clientId, bandwidth, peerConnectionConfig, deprioritizeH264Encoding, shouldAddLocalVideo, incrementAnalyticMetric, }: P2PSessionOptions);
|
|
547
|
+
addStream(stream: MediaStream): void;
|
|
548
|
+
addTrack(track: MediaStreamTrack, stream?: MediaStream): void;
|
|
549
|
+
removeTrack(track: MediaStreamTrack): void;
|
|
550
|
+
removeStream(stream: MediaStream): void;
|
|
551
|
+
_setRemoteDescription(desc: any): any;
|
|
552
|
+
handleOffer(message: RTCSessionDescription): any;
|
|
553
|
+
handleAnswer(message: RTCSessionDescription): any;
|
|
554
|
+
addIceCandidate(candidate: any): void;
|
|
555
|
+
canModifyPeerConnection(): boolean;
|
|
556
|
+
close(): void;
|
|
557
|
+
hasConnectedPeerConnection(): boolean;
|
|
558
|
+
replaceTrack(oldTrack: CustomMediaStreamTrack | undefined | null, newTrack: MediaStreamTrack): any;
|
|
559
|
+
changeBandwidth(bandwidth: any): void;
|
|
560
|
+
setAudioOnly(enable: boolean, excludedTrackIds?: string[]): void;
|
|
561
|
+
}
|
|
562
|
+
|
|
502
563
|
declare const assert: {
|
|
503
564
|
fail: (message?: string | Error) => void;
|
|
504
565
|
ok: (value: any, message?: string | Error) => void;
|
|
@@ -1086,6 +1147,13 @@ declare function fromLocation({ host, protocol }?: {
|
|
|
1086
1147
|
subdomain: string;
|
|
1087
1148
|
};
|
|
1088
1149
|
|
|
1150
|
+
interface GetOrCreateSessionOptions {
|
|
1151
|
+
peerConnectionId: string;
|
|
1152
|
+
clientId: string;
|
|
1153
|
+
shouldAddLocalVideo: boolean;
|
|
1154
|
+
initialBandwidth: number;
|
|
1155
|
+
peerConnectionConfig: RTCConfiguration;
|
|
1156
|
+
}
|
|
1089
1157
|
type P2PAnalytics = {
|
|
1090
1158
|
P2PReplaceTrackNoPC: number;
|
|
1091
1159
|
P2PNonErrorRejectionValueGUMError: number;
|
|
@@ -1103,6 +1171,9 @@ type P2PAnalytics = {
|
|
|
1103
1171
|
numPcOnAnswerFailure: number;
|
|
1104
1172
|
numPcOnOfferFailure: number;
|
|
1105
1173
|
numPcSldFailure: number;
|
|
1174
|
+
P2PChangeBandwidthEmptySDPType: number;
|
|
1175
|
+
P2PNegotiationNeeded: number;
|
|
1176
|
+
P2PSessionAlreadyCreated: number;
|
|
1106
1177
|
};
|
|
1107
1178
|
type P2PAnalyticMetric = keyof P2PAnalytics;
|
|
1108
1179
|
type P2PIncrementAnalyticMetric = (metric: P2PAnalyticMetric) => void;
|
|
@@ -1110,10 +1181,10 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1110
1181
|
_selfId: any;
|
|
1111
1182
|
_roomName: any;
|
|
1112
1183
|
_roomSessionId: any;
|
|
1113
|
-
peerConnections:
|
|
1184
|
+
peerConnections: Record<string, Session>;
|
|
1114
1185
|
localStreams: any;
|
|
1115
1186
|
enabledLocalStreamIds: any[];
|
|
1116
|
-
_screenshareVideoTrackIds:
|
|
1187
|
+
_screenshareVideoTrackIds: string[];
|
|
1117
1188
|
_socketListenerDeregisterFunctions: any[];
|
|
1118
1189
|
_localStreamDeregisterFunction: any;
|
|
1119
1190
|
_emitter: any;
|
|
@@ -1177,27 +1248,21 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1177
1248
|
_emit(eventName: string, data?: any): void;
|
|
1178
1249
|
_addEnabledLocalStreamId(streamId: string): void;
|
|
1179
1250
|
_deleteEnabledLocalStreamId(streamId: string): void;
|
|
1180
|
-
_getSession(peerConnectionId: string):
|
|
1181
|
-
_getOrCreateSession(peerConnectionId
|
|
1251
|
+
_getSession(peerConnectionId: string): Session | null;
|
|
1252
|
+
_getOrCreateSession({ peerConnectionId, clientId, initialBandwidth, peerConnectionConfig, shouldAddLocalVideo, }: GetOrCreateSessionOptions): Session;
|
|
1182
1253
|
_getLocalCameraStream(): any;
|
|
1183
1254
|
_getNonLocalCameraStreamIds(): string[];
|
|
1184
1255
|
_isScreensharingLocally(): boolean;
|
|
1185
1256
|
_getFirstLocalNonCameraStream(): any;
|
|
1186
|
-
_transformIncomingSdp(original:
|
|
1187
|
-
|
|
1188
|
-
sdp: any;
|
|
1189
|
-
};
|
|
1190
|
-
_transformOutgoingSdp(original: any): {
|
|
1191
|
-
type: any;
|
|
1192
|
-
sdpU: any;
|
|
1193
|
-
};
|
|
1257
|
+
_transformIncomingSdp(original: UnifiedPlanSDP): RTCSessionDescription;
|
|
1258
|
+
_transformOutgoingSdp(original: RTCSessionDescription): UnifiedPlanSDP;
|
|
1194
1259
|
_createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, shouldAddLocalVideo, }: {
|
|
1195
1260
|
clientId: string;
|
|
1196
1261
|
initialBandwidth: any;
|
|
1197
1262
|
isOfferer: any;
|
|
1198
1263
|
peerConnectionId: string;
|
|
1199
1264
|
shouldAddLocalVideo: boolean;
|
|
1200
|
-
}):
|
|
1265
|
+
}): Session;
|
|
1201
1266
|
_cleanup(peerConnectionId: string): void;
|
|
1202
1267
|
_forEachPeerConnection(func: any): void;
|
|
1203
1268
|
_addStreamToPeerConnections(stream: any): void;
|
|
@@ -1211,23 +1276,23 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1211
1276
|
_clearMediaServersRefresh(): void;
|
|
1212
1277
|
_monitorAudioTrack(track: any): void;
|
|
1213
1278
|
_monitorVideoTrack(track: CustomMediaStreamTrack): void;
|
|
1214
|
-
_connect(clientId: string): Promise<
|
|
1279
|
+
_connect(clientId: string): Promise<Session>;
|
|
1215
1280
|
_maybeRestartIce(clientId: string, session: any): void;
|
|
1216
1281
|
_setCodecPreferences(pc: RTCPeerConnection): Promise<void>;
|
|
1217
1282
|
_negotiatePeerConnection(clientId: string, session: any, constraints?: any): void;
|
|
1218
|
-
_withForcedRenegotiation(session:
|
|
1283
|
+
_withForcedRenegotiation(session: Session, action: any): void;
|
|
1219
1284
|
_changeBandwidthForAllClients(isJoining: boolean): number;
|
|
1220
1285
|
_createP2pSession({ clientId, initialBandwidth, shouldAddLocalVideo, isOfferer, }: {
|
|
1221
1286
|
clientId: string;
|
|
1222
1287
|
initialBandwidth: number;
|
|
1223
1288
|
shouldAddLocalVideo: boolean;
|
|
1224
1289
|
isOfferer: boolean;
|
|
1225
|
-
}):
|
|
1290
|
+
}): Session;
|
|
1226
1291
|
acceptNewStream({ streamId, clientId, shouldAddLocalVideo, }: {
|
|
1227
1292
|
streamId: string;
|
|
1228
1293
|
clientId: string;
|
|
1229
1294
|
shouldAddLocalVideo?: boolean;
|
|
1230
|
-
}):
|
|
1295
|
+
}): Session;
|
|
1231
1296
|
disconnect(clientId: string): void;
|
|
1232
1297
|
updateStreamResolution(): void;
|
|
1233
1298
|
stopOrResumeAudio(): void;
|
|
@@ -1297,69 +1362,6 @@ declare function changeMediaDirection(sdp: any, active: any): string;
|
|
|
1297
1362
|
declare function addExtMap(sdp: any, extmapUri: any, modifyAudio?: any, modifyVideo?: any): any;
|
|
1298
1363
|
declare function addAbsCaptureTimeExtMap(sdp: any): any;
|
|
1299
1364
|
|
|
1300
|
-
declare class Session {
|
|
1301
|
-
peerConnectionId: any;
|
|
1302
|
-
relayCandidateSeen: boolean;
|
|
1303
|
-
serverReflexiveCandidateSeen: boolean;
|
|
1304
|
-
publicHostCandidateSeen: boolean;
|
|
1305
|
-
ipv6HostCandidateSeen: boolean;
|
|
1306
|
-
ipv6HostCandidateTeredoSeen: boolean;
|
|
1307
|
-
ipv6HostCandidate6to4Seen: boolean;
|
|
1308
|
-
mdnsHostCandidateSeen: boolean;
|
|
1309
|
-
pc: any;
|
|
1310
|
-
wasEverConnected: boolean;
|
|
1311
|
-
connectionStatus: any;
|
|
1312
|
-
stats: {
|
|
1313
|
-
totalSent: number;
|
|
1314
|
-
totalRecv: number;
|
|
1315
|
-
};
|
|
1316
|
-
bandwidth: any;
|
|
1317
|
-
pending: any[];
|
|
1318
|
-
isOperationPending: boolean;
|
|
1319
|
-
streamIds: any[];
|
|
1320
|
-
streams: any[];
|
|
1321
|
-
earlyIceCandidates: any[];
|
|
1322
|
-
afterConnected: Promise<unknown>;
|
|
1323
|
-
registerConnected: any;
|
|
1324
|
-
offerOptions: {
|
|
1325
|
-
offerToReceiveAudio: boolean;
|
|
1326
|
-
offerToReceiveVideo: boolean;
|
|
1327
|
-
};
|
|
1328
|
-
_deprioritizeH264Encoding: any;
|
|
1329
|
-
clientId: any;
|
|
1330
|
-
peerConnectionConfig: any;
|
|
1331
|
-
shouldAddLocalVideo: any;
|
|
1332
|
-
signalingState: any;
|
|
1333
|
-
srdComplete: any;
|
|
1334
|
-
_incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
1335
|
-
constructor({ peerConnectionId, bandwidth, deprioritizeH264Encoding, incrementAnalyticMetric, }: {
|
|
1336
|
-
peerConnectionId: any;
|
|
1337
|
-
bandwidth: any;
|
|
1338
|
-
deprioritizeH264Encoding: any;
|
|
1339
|
-
incrementAnalyticMetric: P2PIncrementAnalyticMetric;
|
|
1340
|
-
});
|
|
1341
|
-
setAndGetPeerConnection({ clientId, constraints, peerConnectionConfig, shouldAddLocalVideo, }: {
|
|
1342
|
-
clientId: any;
|
|
1343
|
-
constraints: any;
|
|
1344
|
-
peerConnectionConfig: any;
|
|
1345
|
-
shouldAddLocalVideo: any;
|
|
1346
|
-
}): any;
|
|
1347
|
-
addStream(stream: MediaStream): void;
|
|
1348
|
-
addTrack(track: MediaStreamTrack, stream?: MediaStream): void;
|
|
1349
|
-
removeTrack(track: MediaStreamTrack): void;
|
|
1350
|
-
removeStream(stream: MediaStream): void;
|
|
1351
|
-
_setRemoteDescription(desc: any): any;
|
|
1352
|
-
handleOffer(message: RTCSessionDescription): any;
|
|
1353
|
-
handleAnswer(message: RTCSessionDescription): any;
|
|
1354
|
-
addIceCandidate(candidate: any): void;
|
|
1355
|
-
canModifyPeerConnection(): boolean;
|
|
1356
|
-
close(): void;
|
|
1357
|
-
hasConnectedPeerConnection(): any;
|
|
1358
|
-
replaceTrack(oldTrack: CustomMediaStreamTrack | undefined | null, newTrack: MediaStreamTrack): any;
|
|
1359
|
-
changeBandwidth(bandwidth: any): void;
|
|
1360
|
-
setAudioOnly(enable: boolean, excludedTrackIds?: any[]): void;
|
|
1361
|
-
}
|
|
1362
|
-
|
|
1363
1365
|
declare class SfuV2Parser {
|
|
1364
1366
|
static parse(raw: any): any;
|
|
1365
1367
|
static _handleRequest(rawMessage: any): any;
|
|
@@ -1887,4 +1889,4 @@ declare class RtcStream {
|
|
|
1887
1889
|
}
|
|
1888
1890
|
|
|
1889
1891
|
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 };
|
|
1890
|
-
export type { AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, CannotJoinUnclaimedRoomError, ChatMessage, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, Credentials, CustomMediaStreamTrack, 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, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomFullError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcStreamAddedPayload,
|
|
1892
|
+
export type { AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, CannotJoinUnclaimedRoomError, ChatMessage, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, Credentials, CustomMediaStreamTrack, 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, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomFullError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcStreamAddedPayload, SDPRelayMessage, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalKnocker, SignalRequests, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UnifiedPlanSDP, UpdatedDeviceInfo, UpdatedDevicesInfo, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent };
|