@whereby.com/media 1.13.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -17
- package/dist/index.d.cts +73 -4
- package/dist/index.d.mts +73 -4
- package/dist/index.d.ts +73 -4
- package/dist/index.mjs +8 -17
- package/dist/legacy-esm.js +8 -17
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -907,13 +907,13 @@ const metrics = [
|
|
|
907
907
|
id: "turn-usage",
|
|
908
908
|
global: true,
|
|
909
909
|
enabled: ({ stats }) => !!Object.values(stats.candidatePairs).length,
|
|
910
|
-
value: ({ stats }) => Object.values(stats.candidatePairs).some((cp) => cp.usingTurn)
|
|
910
|
+
value: ({ stats }) => Object.values(stats.candidatePairs).some((cp) => cp.usingTurn),
|
|
911
911
|
},
|
|
912
912
|
{
|
|
913
913
|
id: "turn-tls-usage",
|
|
914
914
|
global: true,
|
|
915
915
|
enabled: ({ stats }) => !!Object.values(stats.candidatePairs).length,
|
|
916
|
-
value: ({ stats }) => Object.values(stats.candidatePairs).some((cp) => cp.turnProtocol ===
|
|
916
|
+
value: ({ stats }) => Object.values(stats.candidatePairs).some((cp) => cp.turnProtocol === "tls"),
|
|
917
917
|
},
|
|
918
918
|
{
|
|
919
919
|
id: "concealment",
|
|
@@ -2546,10 +2546,7 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2546
2546
|
if (hasPassedOnRoomSessionId &&
|
|
2547
2547
|
newRoomSessionIdValue &&
|
|
2548
2548
|
newRoomSessionIdValue !== oldRoomSessionIdValue) {
|
|
2549
|
-
|
|
2550
|
-
ws.close();
|
|
2551
|
-
return;
|
|
2552
|
-
}
|
|
2549
|
+
ws === null || ws === void 0 ? void 0 : ws.close();
|
|
2553
2550
|
}
|
|
2554
2551
|
if (newRoomSessionIdValue)
|
|
2555
2552
|
hasPassedOnRoomSessionId = true;
|
|
@@ -2581,7 +2578,7 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2581
2578
|
else if (args[0] === "customEvent" && args[2].type === "featureFlags") {
|
|
2582
2579
|
featureFlags = args;
|
|
2583
2580
|
}
|
|
2584
|
-
if (ws.readyState === WebSocket.OPEN) {
|
|
2581
|
+
if ((ws === null || ws === void 0 ? void 0 : ws.readyState) === WebSocket.OPEN) {
|
|
2585
2582
|
connectionAttempt = 0;
|
|
2586
2583
|
ws.send(JSON.stringify(args));
|
|
2587
2584
|
}
|
|
@@ -2595,7 +2592,7 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2595
2592
|
else {
|
|
2596
2593
|
buffer.push(args);
|
|
2597
2594
|
}
|
|
2598
|
-
if (ws.readyState === WebSocket.CLOSED && connectionShouldBeOpen) {
|
|
2595
|
+
if ((ws === null || ws === void 0 ? void 0 : ws.readyState) === WebSocket.CLOSED && connectionShouldBeOpen) {
|
|
2599
2596
|
setTimeout(() => {
|
|
2600
2597
|
if (ws.readyState === WebSocket.CLOSED && connectionShouldBeOpen) {
|
|
2601
2598
|
connection.connect();
|
|
@@ -2605,16 +2602,12 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2605
2602
|
},
|
|
2606
2603
|
close: () => {
|
|
2607
2604
|
connectionShouldBeOpen = false;
|
|
2608
|
-
|
|
2609
|
-
ws.close();
|
|
2610
|
-
}
|
|
2605
|
+
ws === null || ws === void 0 ? void 0 : ws.close();
|
|
2611
2606
|
},
|
|
2612
2607
|
connect: () => {
|
|
2613
2608
|
connectionShouldBeOpen = true;
|
|
2614
2609
|
connectionAttempt += 1;
|
|
2615
|
-
|
|
2616
|
-
ws.close();
|
|
2617
|
-
}
|
|
2610
|
+
ws === null || ws === void 0 ? void 0 : ws.close();
|
|
2618
2611
|
connection.connected = true;
|
|
2619
2612
|
ws = new WebSocket(wsURL + window.location.pathname, RTCSTATS_PROTOCOL_VERSION);
|
|
2620
2613
|
ws.onerror = (e) => {
|
|
@@ -2666,7 +2659,6 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2666
2659
|
};
|
|
2667
2660
|
},
|
|
2668
2661
|
};
|
|
2669
|
-
connection.connect();
|
|
2670
2662
|
return connection;
|
|
2671
2663
|
}
|
|
2672
2664
|
const server = rtcStatsConnection(process.env.RTCSTATS_URL || "wss://rtcstats.srv.whereby.com");
|
|
@@ -4163,7 +4155,6 @@ class P2pRtcManager {
|
|
|
4163
4155
|
this._videoTrackBeingMonitored = track;
|
|
4164
4156
|
}
|
|
4165
4157
|
_connect(clientId) {
|
|
4166
|
-
this.rtcStatsReconnect();
|
|
4167
4158
|
let session = this._getSession(clientId);
|
|
4168
4159
|
let initialBandwidth = (session && session.bandwidth) || 0;
|
|
4169
4160
|
if (session) {
|
|
@@ -5974,7 +5965,6 @@ class VegaRtcManager {
|
|
|
5974
5965
|
}
|
|
5975
5966
|
acceptNewStream({ streamId, clientId }) {
|
|
5976
5967
|
logger$1.info("acceptNewStream()", { streamId, clientId });
|
|
5977
|
-
this.rtcStatsReconnect();
|
|
5978
5968
|
const clientState = this._getOrCreateClientState(clientId);
|
|
5979
5969
|
const isScreenShare = streamId !== clientId;
|
|
5980
5970
|
if (isScreenShare) {
|
|
@@ -6382,6 +6372,7 @@ class RtcManagerDispatcher {
|
|
|
6382
6372
|
else {
|
|
6383
6373
|
rtcManager = new P2pRtcManager(config);
|
|
6384
6374
|
}
|
|
6375
|
+
rtcManager.rtcStatsReconnect();
|
|
6385
6376
|
rtcManager.setupSocketListeners();
|
|
6386
6377
|
emitter.emit(EVENTS.RTC_MANAGER_CREATED, { rtcManager });
|
|
6387
6378
|
this.currentManager = rtcManager;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,77 @@
|
|
|
1
1
|
import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
|
|
2
2
|
import * as mediasoup_client_lib_Device from 'mediasoup-client/lib/Device';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
interface MetricData {
|
|
5
|
+
ticks: number;
|
|
6
|
+
sum: number;
|
|
7
|
+
avg: number;
|
|
8
|
+
min: number;
|
|
9
|
+
max: number;
|
|
10
|
+
}
|
|
11
|
+
interface MetricDataAggregated {
|
|
12
|
+
ticks: number;
|
|
13
|
+
sum: number;
|
|
14
|
+
min: number;
|
|
15
|
+
max: number;
|
|
16
|
+
avg: number;
|
|
17
|
+
curTicks: number;
|
|
18
|
+
curMin: number;
|
|
19
|
+
curMax: number;
|
|
20
|
+
curAvg: number;
|
|
21
|
+
curSum: number;
|
|
22
|
+
totTicks: number;
|
|
23
|
+
totMin: number;
|
|
24
|
+
totMax: number;
|
|
25
|
+
totAvg: number;
|
|
26
|
+
totSum: number;
|
|
27
|
+
}
|
|
28
|
+
type AggregatedMetrics = {
|
|
29
|
+
[aggregatedMetricKey: string]: MetricDataAggregated;
|
|
30
|
+
};
|
|
31
|
+
interface IssueData {
|
|
32
|
+
active: boolean;
|
|
33
|
+
ticks: number;
|
|
34
|
+
registered: number;
|
|
35
|
+
initial: number;
|
|
36
|
+
periods: number;
|
|
37
|
+
current: number;
|
|
38
|
+
longest: number;
|
|
39
|
+
}
|
|
40
|
+
interface IssueDataAggregated {
|
|
41
|
+
active: boolean;
|
|
42
|
+
ticks: number;
|
|
43
|
+
registered: number;
|
|
44
|
+
initial: number;
|
|
45
|
+
curTicks: number;
|
|
46
|
+
curRegistered: number;
|
|
47
|
+
}
|
|
48
|
+
type AggregatedIssues = {
|
|
49
|
+
[aggregatedIssueKey: string]: IssueDataAggregated;
|
|
50
|
+
};
|
|
51
|
+
type IssuesAndMetrics = {
|
|
52
|
+
issues: {
|
|
53
|
+
[issueKey: string]: IssueData;
|
|
54
|
+
};
|
|
55
|
+
metrics: {
|
|
56
|
+
[metricKey: string]: MetricData;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
type IssuesAndMetricsAggregated = {
|
|
60
|
+
issues: AggregatedIssues;
|
|
61
|
+
metrics: AggregatedMetrics;
|
|
62
|
+
};
|
|
63
|
+
type IssuesAndMetricsByView = {
|
|
64
|
+
[clientId: string]: IssuesAndMetrics | IssuesAndMetricsAggregated;
|
|
65
|
+
aggregated: IssuesAndMetricsAggregated;
|
|
66
|
+
};
|
|
67
|
+
declare const getIssuesAndMetrics: () => {
|
|
68
|
+
[x: string]: IssuesAndMetrics | IssuesAndMetricsAggregated;
|
|
69
|
+
aggregated: IssuesAndMetricsAggregated;
|
|
70
|
+
};
|
|
71
|
+
declare function subscribeIssues(subscription: {
|
|
72
|
+
onUpdatedIssues: (issuesAndMetricsByView: IssuesAndMetricsByView, statsByView: any, clients: any) => void;
|
|
73
|
+
}): {
|
|
74
|
+
stop: () => void;
|
|
7
75
|
};
|
|
8
76
|
|
|
9
77
|
declare function startPerformanceMonitor({ onMetricsUpdated, onTerminated, isHidden, }: {
|
|
@@ -527,6 +595,7 @@ interface RtcManager {
|
|
|
527
595
|
disconnect(streamId: string, activeBreakout: boolean | null, eventClaim?: string): void;
|
|
528
596
|
disconnectAll(): void;
|
|
529
597
|
rtcStatsDisconnect(): void;
|
|
598
|
+
rtcStatsReconnect(): void;
|
|
530
599
|
replaceTrack(oldTrack: CustomMediaStreamTrack, newTrack: CustomMediaStreamTrack): void;
|
|
531
600
|
removeStream(streamId: string, _stream: MediaStream, requestedByClientId: string | null): void;
|
|
532
601
|
shouldAcceptStreamsFromBothSides?: () => boolean;
|
|
@@ -1422,4 +1491,4 @@ declare class RtcStream {
|
|
|
1422
1491
|
static getTypeFromId(id: string): string;
|
|
1423
1492
|
}
|
|
1424
1493
|
|
|
1425
|
-
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getStream2, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
|
|
1494
|
+
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getStream2, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,77 @@
|
|
|
1
1
|
import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
|
|
2
2
|
import * as mediasoup_client_lib_Device from 'mediasoup-client/lib/Device';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
interface MetricData {
|
|
5
|
+
ticks: number;
|
|
6
|
+
sum: number;
|
|
7
|
+
avg: number;
|
|
8
|
+
min: number;
|
|
9
|
+
max: number;
|
|
10
|
+
}
|
|
11
|
+
interface MetricDataAggregated {
|
|
12
|
+
ticks: number;
|
|
13
|
+
sum: number;
|
|
14
|
+
min: number;
|
|
15
|
+
max: number;
|
|
16
|
+
avg: number;
|
|
17
|
+
curTicks: number;
|
|
18
|
+
curMin: number;
|
|
19
|
+
curMax: number;
|
|
20
|
+
curAvg: number;
|
|
21
|
+
curSum: number;
|
|
22
|
+
totTicks: number;
|
|
23
|
+
totMin: number;
|
|
24
|
+
totMax: number;
|
|
25
|
+
totAvg: number;
|
|
26
|
+
totSum: number;
|
|
27
|
+
}
|
|
28
|
+
type AggregatedMetrics = {
|
|
29
|
+
[aggregatedMetricKey: string]: MetricDataAggregated;
|
|
30
|
+
};
|
|
31
|
+
interface IssueData {
|
|
32
|
+
active: boolean;
|
|
33
|
+
ticks: number;
|
|
34
|
+
registered: number;
|
|
35
|
+
initial: number;
|
|
36
|
+
periods: number;
|
|
37
|
+
current: number;
|
|
38
|
+
longest: number;
|
|
39
|
+
}
|
|
40
|
+
interface IssueDataAggregated {
|
|
41
|
+
active: boolean;
|
|
42
|
+
ticks: number;
|
|
43
|
+
registered: number;
|
|
44
|
+
initial: number;
|
|
45
|
+
curTicks: number;
|
|
46
|
+
curRegistered: number;
|
|
47
|
+
}
|
|
48
|
+
type AggregatedIssues = {
|
|
49
|
+
[aggregatedIssueKey: string]: IssueDataAggregated;
|
|
50
|
+
};
|
|
51
|
+
type IssuesAndMetrics = {
|
|
52
|
+
issues: {
|
|
53
|
+
[issueKey: string]: IssueData;
|
|
54
|
+
};
|
|
55
|
+
metrics: {
|
|
56
|
+
[metricKey: string]: MetricData;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
type IssuesAndMetricsAggregated = {
|
|
60
|
+
issues: AggregatedIssues;
|
|
61
|
+
metrics: AggregatedMetrics;
|
|
62
|
+
};
|
|
63
|
+
type IssuesAndMetricsByView = {
|
|
64
|
+
[clientId: string]: IssuesAndMetrics | IssuesAndMetricsAggregated;
|
|
65
|
+
aggregated: IssuesAndMetricsAggregated;
|
|
66
|
+
};
|
|
67
|
+
declare const getIssuesAndMetrics: () => {
|
|
68
|
+
[x: string]: IssuesAndMetrics | IssuesAndMetricsAggregated;
|
|
69
|
+
aggregated: IssuesAndMetricsAggregated;
|
|
70
|
+
};
|
|
71
|
+
declare function subscribeIssues(subscription: {
|
|
72
|
+
onUpdatedIssues: (issuesAndMetricsByView: IssuesAndMetricsByView, statsByView: any, clients: any) => void;
|
|
73
|
+
}): {
|
|
74
|
+
stop: () => void;
|
|
7
75
|
};
|
|
8
76
|
|
|
9
77
|
declare function startPerformanceMonitor({ onMetricsUpdated, onTerminated, isHidden, }: {
|
|
@@ -527,6 +595,7 @@ interface RtcManager {
|
|
|
527
595
|
disconnect(streamId: string, activeBreakout: boolean | null, eventClaim?: string): void;
|
|
528
596
|
disconnectAll(): void;
|
|
529
597
|
rtcStatsDisconnect(): void;
|
|
598
|
+
rtcStatsReconnect(): void;
|
|
530
599
|
replaceTrack(oldTrack: CustomMediaStreamTrack, newTrack: CustomMediaStreamTrack): void;
|
|
531
600
|
removeStream(streamId: string, _stream: MediaStream, requestedByClientId: string | null): void;
|
|
532
601
|
shouldAcceptStreamsFromBothSides?: () => boolean;
|
|
@@ -1422,4 +1491,4 @@ declare class RtcStream {
|
|
|
1422
1491
|
static getTypeFromId(id: string): string;
|
|
1423
1492
|
}
|
|
1424
1493
|
|
|
1425
|
-
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getStream2, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
|
|
1494
|
+
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getStream2, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,77 @@
|
|
|
1
1
|
import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
|
|
2
2
|
import * as mediasoup_client_lib_Device from 'mediasoup-client/lib/Device';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
interface MetricData {
|
|
5
|
+
ticks: number;
|
|
6
|
+
sum: number;
|
|
7
|
+
avg: number;
|
|
8
|
+
min: number;
|
|
9
|
+
max: number;
|
|
10
|
+
}
|
|
11
|
+
interface MetricDataAggregated {
|
|
12
|
+
ticks: number;
|
|
13
|
+
sum: number;
|
|
14
|
+
min: number;
|
|
15
|
+
max: number;
|
|
16
|
+
avg: number;
|
|
17
|
+
curTicks: number;
|
|
18
|
+
curMin: number;
|
|
19
|
+
curMax: number;
|
|
20
|
+
curAvg: number;
|
|
21
|
+
curSum: number;
|
|
22
|
+
totTicks: number;
|
|
23
|
+
totMin: number;
|
|
24
|
+
totMax: number;
|
|
25
|
+
totAvg: number;
|
|
26
|
+
totSum: number;
|
|
27
|
+
}
|
|
28
|
+
type AggregatedMetrics = {
|
|
29
|
+
[aggregatedMetricKey: string]: MetricDataAggregated;
|
|
30
|
+
};
|
|
31
|
+
interface IssueData {
|
|
32
|
+
active: boolean;
|
|
33
|
+
ticks: number;
|
|
34
|
+
registered: number;
|
|
35
|
+
initial: number;
|
|
36
|
+
periods: number;
|
|
37
|
+
current: number;
|
|
38
|
+
longest: number;
|
|
39
|
+
}
|
|
40
|
+
interface IssueDataAggregated {
|
|
41
|
+
active: boolean;
|
|
42
|
+
ticks: number;
|
|
43
|
+
registered: number;
|
|
44
|
+
initial: number;
|
|
45
|
+
curTicks: number;
|
|
46
|
+
curRegistered: number;
|
|
47
|
+
}
|
|
48
|
+
type AggregatedIssues = {
|
|
49
|
+
[aggregatedIssueKey: string]: IssueDataAggregated;
|
|
50
|
+
};
|
|
51
|
+
type IssuesAndMetrics = {
|
|
52
|
+
issues: {
|
|
53
|
+
[issueKey: string]: IssueData;
|
|
54
|
+
};
|
|
55
|
+
metrics: {
|
|
56
|
+
[metricKey: string]: MetricData;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
type IssuesAndMetricsAggregated = {
|
|
60
|
+
issues: AggregatedIssues;
|
|
61
|
+
metrics: AggregatedMetrics;
|
|
62
|
+
};
|
|
63
|
+
type IssuesAndMetricsByView = {
|
|
64
|
+
[clientId: string]: IssuesAndMetrics | IssuesAndMetricsAggregated;
|
|
65
|
+
aggregated: IssuesAndMetricsAggregated;
|
|
66
|
+
};
|
|
67
|
+
declare const getIssuesAndMetrics: () => {
|
|
68
|
+
[x: string]: IssuesAndMetrics | IssuesAndMetricsAggregated;
|
|
69
|
+
aggregated: IssuesAndMetricsAggregated;
|
|
70
|
+
};
|
|
71
|
+
declare function subscribeIssues(subscription: {
|
|
72
|
+
onUpdatedIssues: (issuesAndMetricsByView: IssuesAndMetricsByView, statsByView: any, clients: any) => void;
|
|
73
|
+
}): {
|
|
74
|
+
stop: () => void;
|
|
7
75
|
};
|
|
8
76
|
|
|
9
77
|
declare function startPerformanceMonitor({ onMetricsUpdated, onTerminated, isHidden, }: {
|
|
@@ -527,6 +595,7 @@ interface RtcManager {
|
|
|
527
595
|
disconnect(streamId: string, activeBreakout: boolean | null, eventClaim?: string): void;
|
|
528
596
|
disconnectAll(): void;
|
|
529
597
|
rtcStatsDisconnect(): void;
|
|
598
|
+
rtcStatsReconnect(): void;
|
|
530
599
|
replaceTrack(oldTrack: CustomMediaStreamTrack, newTrack: CustomMediaStreamTrack): void;
|
|
531
600
|
removeStream(streamId: string, _stream: MediaStream, requestedByClientId: string | null): void;
|
|
532
601
|
shouldAcceptStreamsFromBothSides?: () => boolean;
|
|
@@ -1422,4 +1491,4 @@ declare class RtcStream {
|
|
|
1422
1491
|
static getTypeFromId(id: string): string;
|
|
1423
1492
|
}
|
|
1424
1493
|
|
|
1425
|
-
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getStream2, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
|
|
1494
|
+
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getStream2, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
|
package/dist/index.mjs
CHANGED
|
@@ -886,13 +886,13 @@ const metrics = [
|
|
|
886
886
|
id: "turn-usage",
|
|
887
887
|
global: true,
|
|
888
888
|
enabled: ({ stats }) => !!Object.values(stats.candidatePairs).length,
|
|
889
|
-
value: ({ stats }) => Object.values(stats.candidatePairs).some((cp) => cp.usingTurn)
|
|
889
|
+
value: ({ stats }) => Object.values(stats.candidatePairs).some((cp) => cp.usingTurn),
|
|
890
890
|
},
|
|
891
891
|
{
|
|
892
892
|
id: "turn-tls-usage",
|
|
893
893
|
global: true,
|
|
894
894
|
enabled: ({ stats }) => !!Object.values(stats.candidatePairs).length,
|
|
895
|
-
value: ({ stats }) => Object.values(stats.candidatePairs).some((cp) => cp.turnProtocol ===
|
|
895
|
+
value: ({ stats }) => Object.values(stats.candidatePairs).some((cp) => cp.turnProtocol === "tls"),
|
|
896
896
|
},
|
|
897
897
|
{
|
|
898
898
|
id: "concealment",
|
|
@@ -2525,10 +2525,7 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2525
2525
|
if (hasPassedOnRoomSessionId &&
|
|
2526
2526
|
newRoomSessionIdValue &&
|
|
2527
2527
|
newRoomSessionIdValue !== oldRoomSessionIdValue) {
|
|
2528
|
-
|
|
2529
|
-
ws.close();
|
|
2530
|
-
return;
|
|
2531
|
-
}
|
|
2528
|
+
ws === null || ws === void 0 ? void 0 : ws.close();
|
|
2532
2529
|
}
|
|
2533
2530
|
if (newRoomSessionIdValue)
|
|
2534
2531
|
hasPassedOnRoomSessionId = true;
|
|
@@ -2560,7 +2557,7 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2560
2557
|
else if (args[0] === "customEvent" && args[2].type === "featureFlags") {
|
|
2561
2558
|
featureFlags = args;
|
|
2562
2559
|
}
|
|
2563
|
-
if (ws.readyState === WebSocket.OPEN) {
|
|
2560
|
+
if ((ws === null || ws === void 0 ? void 0 : ws.readyState) === WebSocket.OPEN) {
|
|
2564
2561
|
connectionAttempt = 0;
|
|
2565
2562
|
ws.send(JSON.stringify(args));
|
|
2566
2563
|
}
|
|
@@ -2574,7 +2571,7 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2574
2571
|
else {
|
|
2575
2572
|
buffer.push(args);
|
|
2576
2573
|
}
|
|
2577
|
-
if (ws.readyState === WebSocket.CLOSED && connectionShouldBeOpen) {
|
|
2574
|
+
if ((ws === null || ws === void 0 ? void 0 : ws.readyState) === WebSocket.CLOSED && connectionShouldBeOpen) {
|
|
2578
2575
|
setTimeout(() => {
|
|
2579
2576
|
if (ws.readyState === WebSocket.CLOSED && connectionShouldBeOpen) {
|
|
2580
2577
|
connection.connect();
|
|
@@ -2584,16 +2581,12 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2584
2581
|
},
|
|
2585
2582
|
close: () => {
|
|
2586
2583
|
connectionShouldBeOpen = false;
|
|
2587
|
-
|
|
2588
|
-
ws.close();
|
|
2589
|
-
}
|
|
2584
|
+
ws === null || ws === void 0 ? void 0 : ws.close();
|
|
2590
2585
|
},
|
|
2591
2586
|
connect: () => {
|
|
2592
2587
|
connectionShouldBeOpen = true;
|
|
2593
2588
|
connectionAttempt += 1;
|
|
2594
|
-
|
|
2595
|
-
ws.close();
|
|
2596
|
-
}
|
|
2589
|
+
ws === null || ws === void 0 ? void 0 : ws.close();
|
|
2597
2590
|
connection.connected = true;
|
|
2598
2591
|
ws = new WebSocket(wsURL + window.location.pathname, RTCSTATS_PROTOCOL_VERSION);
|
|
2599
2592
|
ws.onerror = (e) => {
|
|
@@ -2645,7 +2638,6 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2645
2638
|
};
|
|
2646
2639
|
},
|
|
2647
2640
|
};
|
|
2648
|
-
connection.connect();
|
|
2649
2641
|
return connection;
|
|
2650
2642
|
}
|
|
2651
2643
|
const server = rtcStatsConnection(process.env.RTCSTATS_URL || "wss://rtcstats.srv.whereby.com");
|
|
@@ -4142,7 +4134,6 @@ class P2pRtcManager {
|
|
|
4142
4134
|
this._videoTrackBeingMonitored = track;
|
|
4143
4135
|
}
|
|
4144
4136
|
_connect(clientId) {
|
|
4145
|
-
this.rtcStatsReconnect();
|
|
4146
4137
|
let session = this._getSession(clientId);
|
|
4147
4138
|
let initialBandwidth = (session && session.bandwidth) || 0;
|
|
4148
4139
|
if (session) {
|
|
@@ -5953,7 +5944,6 @@ class VegaRtcManager {
|
|
|
5953
5944
|
}
|
|
5954
5945
|
acceptNewStream({ streamId, clientId }) {
|
|
5955
5946
|
logger$1.info("acceptNewStream()", { streamId, clientId });
|
|
5956
|
-
this.rtcStatsReconnect();
|
|
5957
5947
|
const clientState = this._getOrCreateClientState(clientId);
|
|
5958
5948
|
const isScreenShare = streamId !== clientId;
|
|
5959
5949
|
if (isScreenShare) {
|
|
@@ -6361,6 +6351,7 @@ class RtcManagerDispatcher {
|
|
|
6361
6351
|
else {
|
|
6362
6352
|
rtcManager = new P2pRtcManager(config);
|
|
6363
6353
|
}
|
|
6354
|
+
rtcManager.rtcStatsReconnect();
|
|
6364
6355
|
rtcManager.setupSocketListeners();
|
|
6365
6356
|
emitter.emit(EVENTS.RTC_MANAGER_CREATED, { rtcManager });
|
|
6366
6357
|
this.currentManager = rtcManager;
|
package/dist/legacy-esm.js
CHANGED
|
@@ -886,13 +886,13 @@ const metrics = [
|
|
|
886
886
|
id: "turn-usage",
|
|
887
887
|
global: true,
|
|
888
888
|
enabled: ({ stats }) => !!Object.values(stats.candidatePairs).length,
|
|
889
|
-
value: ({ stats }) => Object.values(stats.candidatePairs).some((cp) => cp.usingTurn)
|
|
889
|
+
value: ({ stats }) => Object.values(stats.candidatePairs).some((cp) => cp.usingTurn),
|
|
890
890
|
},
|
|
891
891
|
{
|
|
892
892
|
id: "turn-tls-usage",
|
|
893
893
|
global: true,
|
|
894
894
|
enabled: ({ stats }) => !!Object.values(stats.candidatePairs).length,
|
|
895
|
-
value: ({ stats }) => Object.values(stats.candidatePairs).some((cp) => cp.turnProtocol ===
|
|
895
|
+
value: ({ stats }) => Object.values(stats.candidatePairs).some((cp) => cp.turnProtocol === "tls"),
|
|
896
896
|
},
|
|
897
897
|
{
|
|
898
898
|
id: "concealment",
|
|
@@ -2525,10 +2525,7 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2525
2525
|
if (hasPassedOnRoomSessionId &&
|
|
2526
2526
|
newRoomSessionIdValue &&
|
|
2527
2527
|
newRoomSessionIdValue !== oldRoomSessionIdValue) {
|
|
2528
|
-
|
|
2529
|
-
ws.close();
|
|
2530
|
-
return;
|
|
2531
|
-
}
|
|
2528
|
+
ws === null || ws === void 0 ? void 0 : ws.close();
|
|
2532
2529
|
}
|
|
2533
2530
|
if (newRoomSessionIdValue)
|
|
2534
2531
|
hasPassedOnRoomSessionId = true;
|
|
@@ -2560,7 +2557,7 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2560
2557
|
else if (args[0] === "customEvent" && args[2].type === "featureFlags") {
|
|
2561
2558
|
featureFlags = args;
|
|
2562
2559
|
}
|
|
2563
|
-
if (ws.readyState === WebSocket.OPEN) {
|
|
2560
|
+
if ((ws === null || ws === void 0 ? void 0 : ws.readyState) === WebSocket.OPEN) {
|
|
2564
2561
|
connectionAttempt = 0;
|
|
2565
2562
|
ws.send(JSON.stringify(args));
|
|
2566
2563
|
}
|
|
@@ -2574,7 +2571,7 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2574
2571
|
else {
|
|
2575
2572
|
buffer.push(args);
|
|
2576
2573
|
}
|
|
2577
|
-
if (ws.readyState === WebSocket.CLOSED && connectionShouldBeOpen) {
|
|
2574
|
+
if ((ws === null || ws === void 0 ? void 0 : ws.readyState) === WebSocket.CLOSED && connectionShouldBeOpen) {
|
|
2578
2575
|
setTimeout(() => {
|
|
2579
2576
|
if (ws.readyState === WebSocket.CLOSED && connectionShouldBeOpen) {
|
|
2580
2577
|
connection.connect();
|
|
@@ -2584,16 +2581,12 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2584
2581
|
},
|
|
2585
2582
|
close: () => {
|
|
2586
2583
|
connectionShouldBeOpen = false;
|
|
2587
|
-
|
|
2588
|
-
ws.close();
|
|
2589
|
-
}
|
|
2584
|
+
ws === null || ws === void 0 ? void 0 : ws.close();
|
|
2590
2585
|
},
|
|
2591
2586
|
connect: () => {
|
|
2592
2587
|
connectionShouldBeOpen = true;
|
|
2593
2588
|
connectionAttempt += 1;
|
|
2594
|
-
|
|
2595
|
-
ws.close();
|
|
2596
|
-
}
|
|
2589
|
+
ws === null || ws === void 0 ? void 0 : ws.close();
|
|
2597
2590
|
connection.connected = true;
|
|
2598
2591
|
ws = new WebSocket(wsURL + window.location.pathname, RTCSTATS_PROTOCOL_VERSION);
|
|
2599
2592
|
ws.onerror = (e) => {
|
|
@@ -2645,7 +2638,6 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
2645
2638
|
};
|
|
2646
2639
|
},
|
|
2647
2640
|
};
|
|
2648
|
-
connection.connect();
|
|
2649
2641
|
return connection;
|
|
2650
2642
|
}
|
|
2651
2643
|
const server = rtcStatsConnection(process.env.RTCSTATS_URL || "wss://rtcstats.srv.whereby.com");
|
|
@@ -4142,7 +4134,6 @@ class P2pRtcManager {
|
|
|
4142
4134
|
this._videoTrackBeingMonitored = track;
|
|
4143
4135
|
}
|
|
4144
4136
|
_connect(clientId) {
|
|
4145
|
-
this.rtcStatsReconnect();
|
|
4146
4137
|
let session = this._getSession(clientId);
|
|
4147
4138
|
let initialBandwidth = (session && session.bandwidth) || 0;
|
|
4148
4139
|
if (session) {
|
|
@@ -5953,7 +5944,6 @@ class VegaRtcManager {
|
|
|
5953
5944
|
}
|
|
5954
5945
|
acceptNewStream({ streamId, clientId }) {
|
|
5955
5946
|
logger$1.info("acceptNewStream()", { streamId, clientId });
|
|
5956
|
-
this.rtcStatsReconnect();
|
|
5957
5947
|
const clientState = this._getOrCreateClientState(clientId);
|
|
5958
5948
|
const isScreenShare = streamId !== clientId;
|
|
5959
5949
|
if (isScreenShare) {
|
|
@@ -6361,6 +6351,7 @@ class RtcManagerDispatcher {
|
|
|
6361
6351
|
else {
|
|
6362
6352
|
rtcManager = new P2pRtcManager(config);
|
|
6363
6353
|
}
|
|
6354
|
+
rtcManager.rtcStatsReconnect();
|
|
6364
6355
|
rtcManager.setupSocketListeners();
|
|
6365
6356
|
emitter.emit(EVENTS.RTC_MANAGER_CREATED, { rtcManager });
|
|
6366
6357
|
this.currentManager = rtcManager;
|