@whereby.com/media 2.5.2 → 2.5.3
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 +31 -18
- package/dist/index.d.cts +139 -136
- package/dist/index.d.mts +139 -136
- package/dist/index.d.ts +139 -136
- package/dist/index.mjs +31 -18
- package/dist/legacy-esm.js +31 -18
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1568,6 +1568,7 @@ class ServerSocket {
|
|
|
1568
1568
|
this._wasConnectedUsingWebsocket = false;
|
|
1569
1569
|
this._reconnectManager = null;
|
|
1570
1570
|
this._socket = socket_ioClient.io(hostName, Object.assign({ path: DEFAULT_SOCKET_PATH, randomizationFactor: 0.5, reconnectionDelay: 250, reconnectionDelayMax: 5000, timeout: 5000, transports: ["websocket"], withCredentials: true }, optionsOverrides));
|
|
1571
|
+
this.joinRoomFinished = false;
|
|
1571
1572
|
this._socket.io.on("reconnect", () => {
|
|
1572
1573
|
this._socket.sendBuffer = [];
|
|
1573
1574
|
});
|
|
@@ -1585,6 +1586,12 @@ class ServerSocket {
|
|
|
1585
1586
|
});
|
|
1586
1587
|
if (glitchFree)
|
|
1587
1588
|
this._reconnectManager = new ReconnectManager(this._socket);
|
|
1589
|
+
this._socket.on("room_joined", (payload) => {
|
|
1590
|
+
const { error } = payload;
|
|
1591
|
+
if (!error) {
|
|
1592
|
+
this.joinRoomFinished = true;
|
|
1593
|
+
}
|
|
1594
|
+
});
|
|
1588
1595
|
this._socket.on("connect", () => {
|
|
1589
1596
|
const transport = this.getTransport();
|
|
1590
1597
|
if (transport === "websocket") {
|
|
@@ -1601,6 +1608,7 @@ class ServerSocket {
|
|
|
1601
1608
|
}
|
|
1602
1609
|
});
|
|
1603
1610
|
this._socket.on("disconnect", () => {
|
|
1611
|
+
this.joinRoomFinished = false;
|
|
1604
1612
|
this.disconnectTimestamp = Date.now();
|
|
1605
1613
|
if (this.noopKeepaliveInterval) {
|
|
1606
1614
|
clearInterval(this.noopKeepaliveInterval);
|
|
@@ -1622,26 +1630,12 @@ class ServerSocket {
|
|
|
1622
1630
|
disconnect() {
|
|
1623
1631
|
this._socket.disconnect();
|
|
1624
1632
|
}
|
|
1625
|
-
disconnectOnConnect() {
|
|
1626
|
-
this._socket.once("connect", () => {
|
|
1627
|
-
this._socket.disconnect();
|
|
1628
|
-
});
|
|
1629
|
-
}
|
|
1630
1633
|
emit(eventName, ...args) {
|
|
1631
1634
|
this._socket.emit.apply(this._socket, arguments);
|
|
1632
1635
|
}
|
|
1633
|
-
emitIfConnected(eventName, data) {
|
|
1634
|
-
if (!this.isConnected()) {
|
|
1635
|
-
return;
|
|
1636
|
-
}
|
|
1637
|
-
this.emit(eventName, data);
|
|
1638
|
-
}
|
|
1639
1636
|
getTransport() {
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
this._socket.io.engine &&
|
|
1643
|
-
this._socket.io.engine.transport &&
|
|
1644
|
-
this._socket.io.engine.transport.name);
|
|
1637
|
+
var _a, _b, _c, _d;
|
|
1638
|
+
return (_d = (_c = (_b = (_a = this._socket) === null || _a === void 0 ? void 0 : _a.io) === null || _b === void 0 ? void 0 : _b.engine) === null || _c === void 0 ? void 0 : _c.transport) === null || _d === void 0 ? void 0 : _d.name;
|
|
1645
1639
|
}
|
|
1646
1640
|
getManager() {
|
|
1647
1641
|
return this._socket.io;
|
|
@@ -2603,6 +2597,8 @@ class P2pRtcManager {
|
|
|
2603
2597
|
this._webrtcProvider = webrtcProvider;
|
|
2604
2598
|
this._features = features || {};
|
|
2605
2599
|
this._isAudioOnlyMode = false;
|
|
2600
|
+
this._closed = false;
|
|
2601
|
+
this.skipEmittingServerMessageCount = 0;
|
|
2606
2602
|
this.offerOptions = { offerToReceiveAudio: true, offerToReceiveVideo: true };
|
|
2607
2603
|
this._pendingActionsForConnectedPeerConnections = [];
|
|
2608
2604
|
this._audioTrackOnEnded = () => {
|
|
@@ -2684,6 +2680,10 @@ class P2pRtcManager {
|
|
|
2684
2680
|
}
|
|
2685
2681
|
return this._replaceTrackToPeerConnections(oldTrack, newTrack);
|
|
2686
2682
|
}
|
|
2683
|
+
close() {
|
|
2684
|
+
this._closed = true;
|
|
2685
|
+
this.disconnectAll();
|
|
2686
|
+
}
|
|
2687
2687
|
disconnectAll() {
|
|
2688
2688
|
Object.keys(this.peerConnections).forEach((peerConnectionId) => {
|
|
2689
2689
|
this.disconnect(peerConnectionId);
|
|
@@ -2869,8 +2869,18 @@ class P2pRtcManager {
|
|
|
2869
2869
|
logger$6.error("Error during setting jitter buffer target:", error);
|
|
2870
2870
|
}
|
|
2871
2871
|
}
|
|
2872
|
-
_emitServerEvent(eventName, data
|
|
2873
|
-
this.
|
|
2872
|
+
_emitServerEvent(eventName, data) {
|
|
2873
|
+
if (this._closed) {
|
|
2874
|
+
logger$6.warn("RtcManager closed. Will not send event", eventName, data);
|
|
2875
|
+
return;
|
|
2876
|
+
}
|
|
2877
|
+
if (this._features.awaitJoinRoomFinished && !this._serverSocket.joinRoomFinished) {
|
|
2878
|
+
rtcStats.sendEvent("skip_emitting_server_message", { eventName });
|
|
2879
|
+
this.skipEmittingServerMessageCount++;
|
|
2880
|
+
}
|
|
2881
|
+
else {
|
|
2882
|
+
this._serverSocket.emit(eventName, data);
|
|
2883
|
+
}
|
|
2874
2884
|
}
|
|
2875
2885
|
_emit(eventName, data) {
|
|
2876
2886
|
this._emitter.emit(eventName, data);
|
|
@@ -5506,6 +5516,9 @@ class VegaRtcManager {
|
|
|
5506
5516
|
});
|
|
5507
5517
|
}
|
|
5508
5518
|
}
|
|
5519
|
+
close() {
|
|
5520
|
+
this.disconnectAll();
|
|
5521
|
+
}
|
|
5509
5522
|
disconnectAll() {
|
|
5510
5523
|
var _a, _b, _c, _d;
|
|
5511
5524
|
this._reconnect = false;
|
package/dist/index.d.cts
CHANGED
|
@@ -490,140 +490,6 @@ declare function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, cur
|
|
|
490
490
|
currentSpeakerId?: string | undefined;
|
|
491
491
|
}): GetUpdatedDevicesResult;
|
|
492
492
|
|
|
493
|
-
declare class P2pRtcManager implements RtcManager {
|
|
494
|
-
_selfId: any;
|
|
495
|
-
_roomName: any;
|
|
496
|
-
_roomSessionId: any;
|
|
497
|
-
peerConnections: any;
|
|
498
|
-
localStreams: any;
|
|
499
|
-
enabledLocalStreamIds: any[];
|
|
500
|
-
_screenshareVideoTrackIds: any[];
|
|
501
|
-
_socketListenerDeregisterFunctions: any[];
|
|
502
|
-
_localStreamDeregisterFunction: any;
|
|
503
|
-
_emitter: any;
|
|
504
|
-
_serverSocket: any;
|
|
505
|
-
_webrtcProvider: any;
|
|
506
|
-
_features: any;
|
|
507
|
-
_isAudioOnlyMode: boolean;
|
|
508
|
-
offerOptions: {
|
|
509
|
-
offerToReceiveAudio: boolean;
|
|
510
|
-
offerToReceiveVideo: boolean;
|
|
511
|
-
};
|
|
512
|
-
_pendingActionsForConnectedPeerConnections: any[];
|
|
513
|
-
_audioTrackOnEnded: () => void;
|
|
514
|
-
_videoTrackOnEnded: () => void;
|
|
515
|
-
totalSessionsCreated: number;
|
|
516
|
-
_iceServers: any;
|
|
517
|
-
_turnServers: any;
|
|
518
|
-
_sfuServer: any;
|
|
519
|
-
_mediaserverConfigTtlSeconds: any;
|
|
520
|
-
_fetchMediaServersTimer: any;
|
|
521
|
-
_wasScreenSharing: any;
|
|
522
|
-
ipv6HostCandidateTeredoSeen: any;
|
|
523
|
-
ipv6HostCandidate6to4Seen: any;
|
|
524
|
-
mdnsHostCandidateSeen: any;
|
|
525
|
-
_stoppedVideoTrack: any;
|
|
526
|
-
icePublicIPGatheringTimeoutID: any;
|
|
527
|
-
_videoTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
528
|
-
_audioTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
529
|
-
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, }: {
|
|
530
|
-
selfId: any;
|
|
531
|
-
room: any;
|
|
532
|
-
emitter: any;
|
|
533
|
-
serverSocket: any;
|
|
534
|
-
webrtcProvider: any;
|
|
535
|
-
features: any;
|
|
536
|
-
});
|
|
537
|
-
numberOfPeerconnections(): number;
|
|
538
|
-
isInitializedWith({ selfId, roomName, isSfu }: {
|
|
539
|
-
selfId: any;
|
|
540
|
-
roomName: any;
|
|
541
|
-
isSfu: any;
|
|
542
|
-
}): boolean;
|
|
543
|
-
supportsScreenShareAudio(): boolean;
|
|
544
|
-
addNewStream(streamId: string, stream: MediaStream, audioPaused: boolean, videoPaused: boolean, beforeEffectTracks?: CustomMediaStreamTrack[]): void;
|
|
545
|
-
replaceTrack(oldTrack: CustomMediaStreamTrack | null, newTrack: CustomMediaStreamTrack): Promise<any[]>;
|
|
546
|
-
disconnectAll(): void;
|
|
547
|
-
fixChromeAudio(constraints: any): Promise<any[]> | undefined;
|
|
548
|
-
setupSocketListeners(): void;
|
|
549
|
-
sendAudioMutedStats(muted: boolean): void;
|
|
550
|
-
sendVideoMutedStats(muted: boolean): void;
|
|
551
|
-
sendStatsCustomEvent(eventName: string, data: any): void;
|
|
552
|
-
rtcStatsDisconnect(): void;
|
|
553
|
-
rtcStatsReconnect(): void;
|
|
554
|
-
setAudioOnly(audioOnly: any): void;
|
|
555
|
-
setRemoteScreenshareVideoTrackIds(remoteScreenshareVideoTrackIds?: never[]): void;
|
|
556
|
-
setRoomSessionId(roomSessionId: string): void;
|
|
557
|
-
_setConnectionStatus(session: any, newStatus: any, clientId: string): void;
|
|
558
|
-
_setJitterBufferTarget(pc: any): void;
|
|
559
|
-
_emitServerEvent(eventName: string, data?: any, callback?: any): void;
|
|
560
|
-
_emit(eventName: string, data?: any): void;
|
|
561
|
-
_addEnabledLocalStreamId(streamId: string): void;
|
|
562
|
-
_deleteEnabledLocalStreamId(streamId: string): void;
|
|
563
|
-
_getSession(peerConnectionId: string): any;
|
|
564
|
-
_getOrCreateSession(peerConnectionId: string, initialBandwidth: any): any;
|
|
565
|
-
_getLocalCameraStream(): any;
|
|
566
|
-
_getNonLocalCameraStreamIds(): string[];
|
|
567
|
-
_isScreensharingLocally(): boolean;
|
|
568
|
-
_getFirstLocalNonCameraStream(): any;
|
|
569
|
-
_transformIncomingSdp(original: any, _: any): {
|
|
570
|
-
type: any;
|
|
571
|
-
sdp: any;
|
|
572
|
-
};
|
|
573
|
-
_transformOutgoingSdp(original: any): {
|
|
574
|
-
type: any;
|
|
575
|
-
sdpU: any;
|
|
576
|
-
};
|
|
577
|
-
_createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, shouldAddLocalVideo, }: {
|
|
578
|
-
clientId: string;
|
|
579
|
-
initialBandwidth: any;
|
|
580
|
-
isOfferer: any;
|
|
581
|
-
peerConnectionId: string;
|
|
582
|
-
shouldAddLocalVideo: boolean;
|
|
583
|
-
}): any;
|
|
584
|
-
_cleanup(peerConnectionId: string): void;
|
|
585
|
-
_forEachPeerConnection(func: any): void;
|
|
586
|
-
_addStreamToPeerConnections(stream: any): void;
|
|
587
|
-
_addTrackToPeerConnections(track: any, stream?: any): void;
|
|
588
|
-
_replaceTrackToPeerConnections(oldTrack: any, newTrack: any): Promise<any[]>;
|
|
589
|
-
_removeStreamFromPeerConnections(stream: any): void;
|
|
590
|
-
_removeTrackFromPeerConnections(track: any): void;
|
|
591
|
-
_addLocalStream(streamId: string, stream: any): void;
|
|
592
|
-
_removeLocalStream(streamId: string): void;
|
|
593
|
-
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds }: any): void;
|
|
594
|
-
_clearMediaServersRefresh(): void;
|
|
595
|
-
_monitorAudioTrack(track: any): void;
|
|
596
|
-
_monitorVideoTrack(track: CustomMediaStreamTrack): void;
|
|
597
|
-
_connect(clientId: string): Promise<any>;
|
|
598
|
-
_maybeRestartIce(clientId: string, session: any): void;
|
|
599
|
-
_setCodecPreferences(pc: RTCPeerConnection): Promise<void>;
|
|
600
|
-
_negotiatePeerConnection(clientId: string, session: any, constraints?: any): void;
|
|
601
|
-
_withForcedRenegotiation(session: any, action: any): void;
|
|
602
|
-
_changeBandwidthForAllClients(isJoining: boolean): number;
|
|
603
|
-
_createP2pSession({ clientId, initialBandwidth, shouldAddLocalVideo, isOfferer, }: {
|
|
604
|
-
clientId: string;
|
|
605
|
-
initialBandwidth: number;
|
|
606
|
-
shouldAddLocalVideo: boolean;
|
|
607
|
-
isOfferer: boolean;
|
|
608
|
-
}): any;
|
|
609
|
-
acceptNewStream({ streamId, clientId, shouldAddLocalVideo, }: {
|
|
610
|
-
streamId: string;
|
|
611
|
-
clientId: string;
|
|
612
|
-
shouldAddLocalVideo?: boolean;
|
|
613
|
-
}): any;
|
|
614
|
-
disconnect(clientId: string): void;
|
|
615
|
-
updateStreamResolution(): void;
|
|
616
|
-
stopOrResumeAudio(): void;
|
|
617
|
-
_handleStopOrResumeVideo({ enable, track }: {
|
|
618
|
-
enable: boolean;
|
|
619
|
-
track: any;
|
|
620
|
-
}): void;
|
|
621
|
-
stopOrResumeVideo(localStream: any, enable: boolean): void;
|
|
622
|
-
_shareScreen(streamId: string, stream: any): void;
|
|
623
|
-
removeStream(streamId: string, stream: any, requestedByClientId: any): void;
|
|
624
|
-
hasClient(clientId: string): boolean;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
493
|
declare const assert: {
|
|
628
494
|
fail: (message?: string | Error) => void;
|
|
629
495
|
ok: (value: any, message?: string | Error) => void;
|
|
@@ -774,13 +640,12 @@ declare class ServerSocket {
|
|
|
774
640
|
noopKeepaliveInterval: any;
|
|
775
641
|
_wasConnectedUsingWebsocket?: boolean;
|
|
776
642
|
disconnectTimestamp: number | undefined;
|
|
643
|
+
joinRoomFinished: boolean;
|
|
777
644
|
constructor(hostName: string, optionsOverrides?: any, glitchFree?: boolean);
|
|
778
645
|
setRtcManager(rtcManager?: RtcManager): void;
|
|
779
646
|
connect(): void;
|
|
780
647
|
disconnect(): void;
|
|
781
|
-
disconnectOnConnect(): void;
|
|
782
648
|
emit(eventName: string, ...args: any[]): void;
|
|
783
|
-
emitIfConnected(eventName: string, data: any): void;
|
|
784
649
|
getTransport(): any;
|
|
785
650
|
getManager(): any;
|
|
786
651
|
isConnecting(): any;
|
|
@@ -1206,6 +1071,143 @@ declare function fromLocation({ host, protocol }?: {
|
|
|
1206
1071
|
subdomain: string;
|
|
1207
1072
|
};
|
|
1208
1073
|
|
|
1074
|
+
declare class P2pRtcManager implements RtcManager {
|
|
1075
|
+
_selfId: any;
|
|
1076
|
+
_roomName: any;
|
|
1077
|
+
_roomSessionId: any;
|
|
1078
|
+
peerConnections: any;
|
|
1079
|
+
localStreams: any;
|
|
1080
|
+
enabledLocalStreamIds: any[];
|
|
1081
|
+
_screenshareVideoTrackIds: any[];
|
|
1082
|
+
_socketListenerDeregisterFunctions: any[];
|
|
1083
|
+
_localStreamDeregisterFunction: any;
|
|
1084
|
+
_emitter: any;
|
|
1085
|
+
_serverSocket: ServerSocket;
|
|
1086
|
+
_webrtcProvider: any;
|
|
1087
|
+
_features: any;
|
|
1088
|
+
_isAudioOnlyMode: boolean;
|
|
1089
|
+
offerOptions: {
|
|
1090
|
+
offerToReceiveAudio: boolean;
|
|
1091
|
+
offerToReceiveVideo: boolean;
|
|
1092
|
+
};
|
|
1093
|
+
_pendingActionsForConnectedPeerConnections: any[];
|
|
1094
|
+
_audioTrackOnEnded: () => void;
|
|
1095
|
+
_videoTrackOnEnded: () => void;
|
|
1096
|
+
totalSessionsCreated: number;
|
|
1097
|
+
_iceServers: any;
|
|
1098
|
+
_turnServers: any;
|
|
1099
|
+
_sfuServer: any;
|
|
1100
|
+
_mediaserverConfigTtlSeconds: any;
|
|
1101
|
+
_fetchMediaServersTimer: any;
|
|
1102
|
+
_wasScreenSharing: any;
|
|
1103
|
+
ipv6HostCandidateTeredoSeen: any;
|
|
1104
|
+
ipv6HostCandidate6to4Seen: any;
|
|
1105
|
+
mdnsHostCandidateSeen: any;
|
|
1106
|
+
_stoppedVideoTrack: any;
|
|
1107
|
+
icePublicIPGatheringTimeoutID: any;
|
|
1108
|
+
_videoTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
1109
|
+
_audioTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
1110
|
+
_closed: boolean;
|
|
1111
|
+
skipEmittingServerMessageCount: number;
|
|
1112
|
+
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, }: {
|
|
1113
|
+
selfId: any;
|
|
1114
|
+
room: any;
|
|
1115
|
+
emitter: any;
|
|
1116
|
+
serverSocket: ServerSocket;
|
|
1117
|
+
webrtcProvider: any;
|
|
1118
|
+
features: any;
|
|
1119
|
+
});
|
|
1120
|
+
numberOfPeerconnections(): number;
|
|
1121
|
+
isInitializedWith({ selfId, roomName, isSfu }: {
|
|
1122
|
+
selfId: any;
|
|
1123
|
+
roomName: any;
|
|
1124
|
+
isSfu: any;
|
|
1125
|
+
}): boolean;
|
|
1126
|
+
supportsScreenShareAudio(): boolean;
|
|
1127
|
+
addNewStream(streamId: string, stream: MediaStream, audioPaused: boolean, videoPaused: boolean, beforeEffectTracks?: CustomMediaStreamTrack[]): void;
|
|
1128
|
+
replaceTrack(oldTrack: CustomMediaStreamTrack | null, newTrack: CustomMediaStreamTrack): Promise<any[]>;
|
|
1129
|
+
close(): void;
|
|
1130
|
+
disconnectAll(): void;
|
|
1131
|
+
fixChromeAudio(constraints: any): Promise<any[]> | undefined;
|
|
1132
|
+
setupSocketListeners(): void;
|
|
1133
|
+
sendAudioMutedStats(muted: boolean): void;
|
|
1134
|
+
sendVideoMutedStats(muted: boolean): void;
|
|
1135
|
+
sendStatsCustomEvent(eventName: string, data: any): void;
|
|
1136
|
+
rtcStatsDisconnect(): void;
|
|
1137
|
+
rtcStatsReconnect(): void;
|
|
1138
|
+
setAudioOnly(audioOnly: any): void;
|
|
1139
|
+
setRemoteScreenshareVideoTrackIds(remoteScreenshareVideoTrackIds?: never[]): void;
|
|
1140
|
+
setRoomSessionId(roomSessionId: string): void;
|
|
1141
|
+
_setConnectionStatus(session: any, newStatus: any, clientId: string): void;
|
|
1142
|
+
_setJitterBufferTarget(pc: any): void;
|
|
1143
|
+
_emitServerEvent(eventName: string, data?: any): void;
|
|
1144
|
+
_emit(eventName: string, data?: any): void;
|
|
1145
|
+
_addEnabledLocalStreamId(streamId: string): void;
|
|
1146
|
+
_deleteEnabledLocalStreamId(streamId: string): void;
|
|
1147
|
+
_getSession(peerConnectionId: string): any;
|
|
1148
|
+
_getOrCreateSession(peerConnectionId: string, initialBandwidth: any): any;
|
|
1149
|
+
_getLocalCameraStream(): any;
|
|
1150
|
+
_getNonLocalCameraStreamIds(): string[];
|
|
1151
|
+
_isScreensharingLocally(): boolean;
|
|
1152
|
+
_getFirstLocalNonCameraStream(): any;
|
|
1153
|
+
_transformIncomingSdp(original: any, _: any): {
|
|
1154
|
+
type: any;
|
|
1155
|
+
sdp: any;
|
|
1156
|
+
};
|
|
1157
|
+
_transformOutgoingSdp(original: any): {
|
|
1158
|
+
type: any;
|
|
1159
|
+
sdpU: any;
|
|
1160
|
+
};
|
|
1161
|
+
_createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, shouldAddLocalVideo, }: {
|
|
1162
|
+
clientId: string;
|
|
1163
|
+
initialBandwidth: any;
|
|
1164
|
+
isOfferer: any;
|
|
1165
|
+
peerConnectionId: string;
|
|
1166
|
+
shouldAddLocalVideo: boolean;
|
|
1167
|
+
}): any;
|
|
1168
|
+
_cleanup(peerConnectionId: string): void;
|
|
1169
|
+
_forEachPeerConnection(func: any): void;
|
|
1170
|
+
_addStreamToPeerConnections(stream: any): void;
|
|
1171
|
+
_addTrackToPeerConnections(track: any, stream?: any): void;
|
|
1172
|
+
_replaceTrackToPeerConnections(oldTrack: any, newTrack: any): Promise<any[]>;
|
|
1173
|
+
_removeStreamFromPeerConnections(stream: any): void;
|
|
1174
|
+
_removeTrackFromPeerConnections(track: any): void;
|
|
1175
|
+
_addLocalStream(streamId: string, stream: any): void;
|
|
1176
|
+
_removeLocalStream(streamId: string): void;
|
|
1177
|
+
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds }: any): void;
|
|
1178
|
+
_clearMediaServersRefresh(): void;
|
|
1179
|
+
_monitorAudioTrack(track: any): void;
|
|
1180
|
+
_monitorVideoTrack(track: CustomMediaStreamTrack): void;
|
|
1181
|
+
_connect(clientId: string): Promise<any>;
|
|
1182
|
+
_maybeRestartIce(clientId: string, session: any): void;
|
|
1183
|
+
_setCodecPreferences(pc: RTCPeerConnection): Promise<void>;
|
|
1184
|
+
_negotiatePeerConnection(clientId: string, session: any, constraints?: any): void;
|
|
1185
|
+
_withForcedRenegotiation(session: any, action: any): void;
|
|
1186
|
+
_changeBandwidthForAllClients(isJoining: boolean): number;
|
|
1187
|
+
_createP2pSession({ clientId, initialBandwidth, shouldAddLocalVideo, isOfferer, }: {
|
|
1188
|
+
clientId: string;
|
|
1189
|
+
initialBandwidth: number;
|
|
1190
|
+
shouldAddLocalVideo: boolean;
|
|
1191
|
+
isOfferer: boolean;
|
|
1192
|
+
}): any;
|
|
1193
|
+
acceptNewStream({ streamId, clientId, shouldAddLocalVideo, }: {
|
|
1194
|
+
streamId: string;
|
|
1195
|
+
clientId: string;
|
|
1196
|
+
shouldAddLocalVideo?: boolean;
|
|
1197
|
+
}): any;
|
|
1198
|
+
disconnect(clientId: string): void;
|
|
1199
|
+
updateStreamResolution(): void;
|
|
1200
|
+
stopOrResumeAudio(): void;
|
|
1201
|
+
_handleStopOrResumeVideo({ enable, track }: {
|
|
1202
|
+
enable: boolean;
|
|
1203
|
+
track: any;
|
|
1204
|
+
}): void;
|
|
1205
|
+
stopOrResumeVideo(localStream: any, enable: boolean): void;
|
|
1206
|
+
_shareScreen(streamId: string, stream: any): void;
|
|
1207
|
+
removeStream(streamId: string, stream: any, requestedByClientId: any): void;
|
|
1208
|
+
hasClient(clientId: string): boolean;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1209
1211
|
declare class RtcManagerDispatcher {
|
|
1210
1212
|
emitter: {
|
|
1211
1213
|
emit: <K extends keyof RtcEvents>(eventName: K, args?: RtcEvents[K]) => void;
|
|
@@ -1626,6 +1628,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1626
1628
|
width: number;
|
|
1627
1629
|
height: number;
|
|
1628
1630
|
}): void;
|
|
1631
|
+
close(): void;
|
|
1629
1632
|
disconnectAll(): void;
|
|
1630
1633
|
sendAudioMutedStats(muted: boolean): void;
|
|
1631
1634
|
sendVideoMutedStats(muted: boolean): void;
|
package/dist/index.d.mts
CHANGED
|
@@ -490,140 +490,6 @@ declare function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, cur
|
|
|
490
490
|
currentSpeakerId?: string | undefined;
|
|
491
491
|
}): GetUpdatedDevicesResult;
|
|
492
492
|
|
|
493
|
-
declare class P2pRtcManager implements RtcManager {
|
|
494
|
-
_selfId: any;
|
|
495
|
-
_roomName: any;
|
|
496
|
-
_roomSessionId: any;
|
|
497
|
-
peerConnections: any;
|
|
498
|
-
localStreams: any;
|
|
499
|
-
enabledLocalStreamIds: any[];
|
|
500
|
-
_screenshareVideoTrackIds: any[];
|
|
501
|
-
_socketListenerDeregisterFunctions: any[];
|
|
502
|
-
_localStreamDeregisterFunction: any;
|
|
503
|
-
_emitter: any;
|
|
504
|
-
_serverSocket: any;
|
|
505
|
-
_webrtcProvider: any;
|
|
506
|
-
_features: any;
|
|
507
|
-
_isAudioOnlyMode: boolean;
|
|
508
|
-
offerOptions: {
|
|
509
|
-
offerToReceiveAudio: boolean;
|
|
510
|
-
offerToReceiveVideo: boolean;
|
|
511
|
-
};
|
|
512
|
-
_pendingActionsForConnectedPeerConnections: any[];
|
|
513
|
-
_audioTrackOnEnded: () => void;
|
|
514
|
-
_videoTrackOnEnded: () => void;
|
|
515
|
-
totalSessionsCreated: number;
|
|
516
|
-
_iceServers: any;
|
|
517
|
-
_turnServers: any;
|
|
518
|
-
_sfuServer: any;
|
|
519
|
-
_mediaserverConfigTtlSeconds: any;
|
|
520
|
-
_fetchMediaServersTimer: any;
|
|
521
|
-
_wasScreenSharing: any;
|
|
522
|
-
ipv6HostCandidateTeredoSeen: any;
|
|
523
|
-
ipv6HostCandidate6to4Seen: any;
|
|
524
|
-
mdnsHostCandidateSeen: any;
|
|
525
|
-
_stoppedVideoTrack: any;
|
|
526
|
-
icePublicIPGatheringTimeoutID: any;
|
|
527
|
-
_videoTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
528
|
-
_audioTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
529
|
-
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, }: {
|
|
530
|
-
selfId: any;
|
|
531
|
-
room: any;
|
|
532
|
-
emitter: any;
|
|
533
|
-
serverSocket: any;
|
|
534
|
-
webrtcProvider: any;
|
|
535
|
-
features: any;
|
|
536
|
-
});
|
|
537
|
-
numberOfPeerconnections(): number;
|
|
538
|
-
isInitializedWith({ selfId, roomName, isSfu }: {
|
|
539
|
-
selfId: any;
|
|
540
|
-
roomName: any;
|
|
541
|
-
isSfu: any;
|
|
542
|
-
}): boolean;
|
|
543
|
-
supportsScreenShareAudio(): boolean;
|
|
544
|
-
addNewStream(streamId: string, stream: MediaStream, audioPaused: boolean, videoPaused: boolean, beforeEffectTracks?: CustomMediaStreamTrack[]): void;
|
|
545
|
-
replaceTrack(oldTrack: CustomMediaStreamTrack | null, newTrack: CustomMediaStreamTrack): Promise<any[]>;
|
|
546
|
-
disconnectAll(): void;
|
|
547
|
-
fixChromeAudio(constraints: any): Promise<any[]> | undefined;
|
|
548
|
-
setupSocketListeners(): void;
|
|
549
|
-
sendAudioMutedStats(muted: boolean): void;
|
|
550
|
-
sendVideoMutedStats(muted: boolean): void;
|
|
551
|
-
sendStatsCustomEvent(eventName: string, data: any): void;
|
|
552
|
-
rtcStatsDisconnect(): void;
|
|
553
|
-
rtcStatsReconnect(): void;
|
|
554
|
-
setAudioOnly(audioOnly: any): void;
|
|
555
|
-
setRemoteScreenshareVideoTrackIds(remoteScreenshareVideoTrackIds?: never[]): void;
|
|
556
|
-
setRoomSessionId(roomSessionId: string): void;
|
|
557
|
-
_setConnectionStatus(session: any, newStatus: any, clientId: string): void;
|
|
558
|
-
_setJitterBufferTarget(pc: any): void;
|
|
559
|
-
_emitServerEvent(eventName: string, data?: any, callback?: any): void;
|
|
560
|
-
_emit(eventName: string, data?: any): void;
|
|
561
|
-
_addEnabledLocalStreamId(streamId: string): void;
|
|
562
|
-
_deleteEnabledLocalStreamId(streamId: string): void;
|
|
563
|
-
_getSession(peerConnectionId: string): any;
|
|
564
|
-
_getOrCreateSession(peerConnectionId: string, initialBandwidth: any): any;
|
|
565
|
-
_getLocalCameraStream(): any;
|
|
566
|
-
_getNonLocalCameraStreamIds(): string[];
|
|
567
|
-
_isScreensharingLocally(): boolean;
|
|
568
|
-
_getFirstLocalNonCameraStream(): any;
|
|
569
|
-
_transformIncomingSdp(original: any, _: any): {
|
|
570
|
-
type: any;
|
|
571
|
-
sdp: any;
|
|
572
|
-
};
|
|
573
|
-
_transformOutgoingSdp(original: any): {
|
|
574
|
-
type: any;
|
|
575
|
-
sdpU: any;
|
|
576
|
-
};
|
|
577
|
-
_createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, shouldAddLocalVideo, }: {
|
|
578
|
-
clientId: string;
|
|
579
|
-
initialBandwidth: any;
|
|
580
|
-
isOfferer: any;
|
|
581
|
-
peerConnectionId: string;
|
|
582
|
-
shouldAddLocalVideo: boolean;
|
|
583
|
-
}): any;
|
|
584
|
-
_cleanup(peerConnectionId: string): void;
|
|
585
|
-
_forEachPeerConnection(func: any): void;
|
|
586
|
-
_addStreamToPeerConnections(stream: any): void;
|
|
587
|
-
_addTrackToPeerConnections(track: any, stream?: any): void;
|
|
588
|
-
_replaceTrackToPeerConnections(oldTrack: any, newTrack: any): Promise<any[]>;
|
|
589
|
-
_removeStreamFromPeerConnections(stream: any): void;
|
|
590
|
-
_removeTrackFromPeerConnections(track: any): void;
|
|
591
|
-
_addLocalStream(streamId: string, stream: any): void;
|
|
592
|
-
_removeLocalStream(streamId: string): void;
|
|
593
|
-
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds }: any): void;
|
|
594
|
-
_clearMediaServersRefresh(): void;
|
|
595
|
-
_monitorAudioTrack(track: any): void;
|
|
596
|
-
_monitorVideoTrack(track: CustomMediaStreamTrack): void;
|
|
597
|
-
_connect(clientId: string): Promise<any>;
|
|
598
|
-
_maybeRestartIce(clientId: string, session: any): void;
|
|
599
|
-
_setCodecPreferences(pc: RTCPeerConnection): Promise<void>;
|
|
600
|
-
_negotiatePeerConnection(clientId: string, session: any, constraints?: any): void;
|
|
601
|
-
_withForcedRenegotiation(session: any, action: any): void;
|
|
602
|
-
_changeBandwidthForAllClients(isJoining: boolean): number;
|
|
603
|
-
_createP2pSession({ clientId, initialBandwidth, shouldAddLocalVideo, isOfferer, }: {
|
|
604
|
-
clientId: string;
|
|
605
|
-
initialBandwidth: number;
|
|
606
|
-
shouldAddLocalVideo: boolean;
|
|
607
|
-
isOfferer: boolean;
|
|
608
|
-
}): any;
|
|
609
|
-
acceptNewStream({ streamId, clientId, shouldAddLocalVideo, }: {
|
|
610
|
-
streamId: string;
|
|
611
|
-
clientId: string;
|
|
612
|
-
shouldAddLocalVideo?: boolean;
|
|
613
|
-
}): any;
|
|
614
|
-
disconnect(clientId: string): void;
|
|
615
|
-
updateStreamResolution(): void;
|
|
616
|
-
stopOrResumeAudio(): void;
|
|
617
|
-
_handleStopOrResumeVideo({ enable, track }: {
|
|
618
|
-
enable: boolean;
|
|
619
|
-
track: any;
|
|
620
|
-
}): void;
|
|
621
|
-
stopOrResumeVideo(localStream: any, enable: boolean): void;
|
|
622
|
-
_shareScreen(streamId: string, stream: any): void;
|
|
623
|
-
removeStream(streamId: string, stream: any, requestedByClientId: any): void;
|
|
624
|
-
hasClient(clientId: string): boolean;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
493
|
declare const assert: {
|
|
628
494
|
fail: (message?: string | Error) => void;
|
|
629
495
|
ok: (value: any, message?: string | Error) => void;
|
|
@@ -774,13 +640,12 @@ declare class ServerSocket {
|
|
|
774
640
|
noopKeepaliveInterval: any;
|
|
775
641
|
_wasConnectedUsingWebsocket?: boolean;
|
|
776
642
|
disconnectTimestamp: number | undefined;
|
|
643
|
+
joinRoomFinished: boolean;
|
|
777
644
|
constructor(hostName: string, optionsOverrides?: any, glitchFree?: boolean);
|
|
778
645
|
setRtcManager(rtcManager?: RtcManager): void;
|
|
779
646
|
connect(): void;
|
|
780
647
|
disconnect(): void;
|
|
781
|
-
disconnectOnConnect(): void;
|
|
782
648
|
emit(eventName: string, ...args: any[]): void;
|
|
783
|
-
emitIfConnected(eventName: string, data: any): void;
|
|
784
649
|
getTransport(): any;
|
|
785
650
|
getManager(): any;
|
|
786
651
|
isConnecting(): any;
|
|
@@ -1206,6 +1071,143 @@ declare function fromLocation({ host, protocol }?: {
|
|
|
1206
1071
|
subdomain: string;
|
|
1207
1072
|
};
|
|
1208
1073
|
|
|
1074
|
+
declare class P2pRtcManager implements RtcManager {
|
|
1075
|
+
_selfId: any;
|
|
1076
|
+
_roomName: any;
|
|
1077
|
+
_roomSessionId: any;
|
|
1078
|
+
peerConnections: any;
|
|
1079
|
+
localStreams: any;
|
|
1080
|
+
enabledLocalStreamIds: any[];
|
|
1081
|
+
_screenshareVideoTrackIds: any[];
|
|
1082
|
+
_socketListenerDeregisterFunctions: any[];
|
|
1083
|
+
_localStreamDeregisterFunction: any;
|
|
1084
|
+
_emitter: any;
|
|
1085
|
+
_serverSocket: ServerSocket;
|
|
1086
|
+
_webrtcProvider: any;
|
|
1087
|
+
_features: any;
|
|
1088
|
+
_isAudioOnlyMode: boolean;
|
|
1089
|
+
offerOptions: {
|
|
1090
|
+
offerToReceiveAudio: boolean;
|
|
1091
|
+
offerToReceiveVideo: boolean;
|
|
1092
|
+
};
|
|
1093
|
+
_pendingActionsForConnectedPeerConnections: any[];
|
|
1094
|
+
_audioTrackOnEnded: () => void;
|
|
1095
|
+
_videoTrackOnEnded: () => void;
|
|
1096
|
+
totalSessionsCreated: number;
|
|
1097
|
+
_iceServers: any;
|
|
1098
|
+
_turnServers: any;
|
|
1099
|
+
_sfuServer: any;
|
|
1100
|
+
_mediaserverConfigTtlSeconds: any;
|
|
1101
|
+
_fetchMediaServersTimer: any;
|
|
1102
|
+
_wasScreenSharing: any;
|
|
1103
|
+
ipv6HostCandidateTeredoSeen: any;
|
|
1104
|
+
ipv6HostCandidate6to4Seen: any;
|
|
1105
|
+
mdnsHostCandidateSeen: any;
|
|
1106
|
+
_stoppedVideoTrack: any;
|
|
1107
|
+
icePublicIPGatheringTimeoutID: any;
|
|
1108
|
+
_videoTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
1109
|
+
_audioTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
1110
|
+
_closed: boolean;
|
|
1111
|
+
skipEmittingServerMessageCount: number;
|
|
1112
|
+
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, }: {
|
|
1113
|
+
selfId: any;
|
|
1114
|
+
room: any;
|
|
1115
|
+
emitter: any;
|
|
1116
|
+
serverSocket: ServerSocket;
|
|
1117
|
+
webrtcProvider: any;
|
|
1118
|
+
features: any;
|
|
1119
|
+
});
|
|
1120
|
+
numberOfPeerconnections(): number;
|
|
1121
|
+
isInitializedWith({ selfId, roomName, isSfu }: {
|
|
1122
|
+
selfId: any;
|
|
1123
|
+
roomName: any;
|
|
1124
|
+
isSfu: any;
|
|
1125
|
+
}): boolean;
|
|
1126
|
+
supportsScreenShareAudio(): boolean;
|
|
1127
|
+
addNewStream(streamId: string, stream: MediaStream, audioPaused: boolean, videoPaused: boolean, beforeEffectTracks?: CustomMediaStreamTrack[]): void;
|
|
1128
|
+
replaceTrack(oldTrack: CustomMediaStreamTrack | null, newTrack: CustomMediaStreamTrack): Promise<any[]>;
|
|
1129
|
+
close(): void;
|
|
1130
|
+
disconnectAll(): void;
|
|
1131
|
+
fixChromeAudio(constraints: any): Promise<any[]> | undefined;
|
|
1132
|
+
setupSocketListeners(): void;
|
|
1133
|
+
sendAudioMutedStats(muted: boolean): void;
|
|
1134
|
+
sendVideoMutedStats(muted: boolean): void;
|
|
1135
|
+
sendStatsCustomEvent(eventName: string, data: any): void;
|
|
1136
|
+
rtcStatsDisconnect(): void;
|
|
1137
|
+
rtcStatsReconnect(): void;
|
|
1138
|
+
setAudioOnly(audioOnly: any): void;
|
|
1139
|
+
setRemoteScreenshareVideoTrackIds(remoteScreenshareVideoTrackIds?: never[]): void;
|
|
1140
|
+
setRoomSessionId(roomSessionId: string): void;
|
|
1141
|
+
_setConnectionStatus(session: any, newStatus: any, clientId: string): void;
|
|
1142
|
+
_setJitterBufferTarget(pc: any): void;
|
|
1143
|
+
_emitServerEvent(eventName: string, data?: any): void;
|
|
1144
|
+
_emit(eventName: string, data?: any): void;
|
|
1145
|
+
_addEnabledLocalStreamId(streamId: string): void;
|
|
1146
|
+
_deleteEnabledLocalStreamId(streamId: string): void;
|
|
1147
|
+
_getSession(peerConnectionId: string): any;
|
|
1148
|
+
_getOrCreateSession(peerConnectionId: string, initialBandwidth: any): any;
|
|
1149
|
+
_getLocalCameraStream(): any;
|
|
1150
|
+
_getNonLocalCameraStreamIds(): string[];
|
|
1151
|
+
_isScreensharingLocally(): boolean;
|
|
1152
|
+
_getFirstLocalNonCameraStream(): any;
|
|
1153
|
+
_transformIncomingSdp(original: any, _: any): {
|
|
1154
|
+
type: any;
|
|
1155
|
+
sdp: any;
|
|
1156
|
+
};
|
|
1157
|
+
_transformOutgoingSdp(original: any): {
|
|
1158
|
+
type: any;
|
|
1159
|
+
sdpU: any;
|
|
1160
|
+
};
|
|
1161
|
+
_createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, shouldAddLocalVideo, }: {
|
|
1162
|
+
clientId: string;
|
|
1163
|
+
initialBandwidth: any;
|
|
1164
|
+
isOfferer: any;
|
|
1165
|
+
peerConnectionId: string;
|
|
1166
|
+
shouldAddLocalVideo: boolean;
|
|
1167
|
+
}): any;
|
|
1168
|
+
_cleanup(peerConnectionId: string): void;
|
|
1169
|
+
_forEachPeerConnection(func: any): void;
|
|
1170
|
+
_addStreamToPeerConnections(stream: any): void;
|
|
1171
|
+
_addTrackToPeerConnections(track: any, stream?: any): void;
|
|
1172
|
+
_replaceTrackToPeerConnections(oldTrack: any, newTrack: any): Promise<any[]>;
|
|
1173
|
+
_removeStreamFromPeerConnections(stream: any): void;
|
|
1174
|
+
_removeTrackFromPeerConnections(track: any): void;
|
|
1175
|
+
_addLocalStream(streamId: string, stream: any): void;
|
|
1176
|
+
_removeLocalStream(streamId: string): void;
|
|
1177
|
+
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds }: any): void;
|
|
1178
|
+
_clearMediaServersRefresh(): void;
|
|
1179
|
+
_monitorAudioTrack(track: any): void;
|
|
1180
|
+
_monitorVideoTrack(track: CustomMediaStreamTrack): void;
|
|
1181
|
+
_connect(clientId: string): Promise<any>;
|
|
1182
|
+
_maybeRestartIce(clientId: string, session: any): void;
|
|
1183
|
+
_setCodecPreferences(pc: RTCPeerConnection): Promise<void>;
|
|
1184
|
+
_negotiatePeerConnection(clientId: string, session: any, constraints?: any): void;
|
|
1185
|
+
_withForcedRenegotiation(session: any, action: any): void;
|
|
1186
|
+
_changeBandwidthForAllClients(isJoining: boolean): number;
|
|
1187
|
+
_createP2pSession({ clientId, initialBandwidth, shouldAddLocalVideo, isOfferer, }: {
|
|
1188
|
+
clientId: string;
|
|
1189
|
+
initialBandwidth: number;
|
|
1190
|
+
shouldAddLocalVideo: boolean;
|
|
1191
|
+
isOfferer: boolean;
|
|
1192
|
+
}): any;
|
|
1193
|
+
acceptNewStream({ streamId, clientId, shouldAddLocalVideo, }: {
|
|
1194
|
+
streamId: string;
|
|
1195
|
+
clientId: string;
|
|
1196
|
+
shouldAddLocalVideo?: boolean;
|
|
1197
|
+
}): any;
|
|
1198
|
+
disconnect(clientId: string): void;
|
|
1199
|
+
updateStreamResolution(): void;
|
|
1200
|
+
stopOrResumeAudio(): void;
|
|
1201
|
+
_handleStopOrResumeVideo({ enable, track }: {
|
|
1202
|
+
enable: boolean;
|
|
1203
|
+
track: any;
|
|
1204
|
+
}): void;
|
|
1205
|
+
stopOrResumeVideo(localStream: any, enable: boolean): void;
|
|
1206
|
+
_shareScreen(streamId: string, stream: any): void;
|
|
1207
|
+
removeStream(streamId: string, stream: any, requestedByClientId: any): void;
|
|
1208
|
+
hasClient(clientId: string): boolean;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1209
1211
|
declare class RtcManagerDispatcher {
|
|
1210
1212
|
emitter: {
|
|
1211
1213
|
emit: <K extends keyof RtcEvents>(eventName: K, args?: RtcEvents[K]) => void;
|
|
@@ -1626,6 +1628,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1626
1628
|
width: number;
|
|
1627
1629
|
height: number;
|
|
1628
1630
|
}): void;
|
|
1631
|
+
close(): void;
|
|
1629
1632
|
disconnectAll(): void;
|
|
1630
1633
|
sendAudioMutedStats(muted: boolean): void;
|
|
1631
1634
|
sendVideoMutedStats(muted: boolean): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -490,140 +490,6 @@ declare function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, cur
|
|
|
490
490
|
currentSpeakerId?: string | undefined;
|
|
491
491
|
}): GetUpdatedDevicesResult;
|
|
492
492
|
|
|
493
|
-
declare class P2pRtcManager implements RtcManager {
|
|
494
|
-
_selfId: any;
|
|
495
|
-
_roomName: any;
|
|
496
|
-
_roomSessionId: any;
|
|
497
|
-
peerConnections: any;
|
|
498
|
-
localStreams: any;
|
|
499
|
-
enabledLocalStreamIds: any[];
|
|
500
|
-
_screenshareVideoTrackIds: any[];
|
|
501
|
-
_socketListenerDeregisterFunctions: any[];
|
|
502
|
-
_localStreamDeregisterFunction: any;
|
|
503
|
-
_emitter: any;
|
|
504
|
-
_serverSocket: any;
|
|
505
|
-
_webrtcProvider: any;
|
|
506
|
-
_features: any;
|
|
507
|
-
_isAudioOnlyMode: boolean;
|
|
508
|
-
offerOptions: {
|
|
509
|
-
offerToReceiveAudio: boolean;
|
|
510
|
-
offerToReceiveVideo: boolean;
|
|
511
|
-
};
|
|
512
|
-
_pendingActionsForConnectedPeerConnections: any[];
|
|
513
|
-
_audioTrackOnEnded: () => void;
|
|
514
|
-
_videoTrackOnEnded: () => void;
|
|
515
|
-
totalSessionsCreated: number;
|
|
516
|
-
_iceServers: any;
|
|
517
|
-
_turnServers: any;
|
|
518
|
-
_sfuServer: any;
|
|
519
|
-
_mediaserverConfigTtlSeconds: any;
|
|
520
|
-
_fetchMediaServersTimer: any;
|
|
521
|
-
_wasScreenSharing: any;
|
|
522
|
-
ipv6HostCandidateTeredoSeen: any;
|
|
523
|
-
ipv6HostCandidate6to4Seen: any;
|
|
524
|
-
mdnsHostCandidateSeen: any;
|
|
525
|
-
_stoppedVideoTrack: any;
|
|
526
|
-
icePublicIPGatheringTimeoutID: any;
|
|
527
|
-
_videoTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
528
|
-
_audioTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
529
|
-
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, }: {
|
|
530
|
-
selfId: any;
|
|
531
|
-
room: any;
|
|
532
|
-
emitter: any;
|
|
533
|
-
serverSocket: any;
|
|
534
|
-
webrtcProvider: any;
|
|
535
|
-
features: any;
|
|
536
|
-
});
|
|
537
|
-
numberOfPeerconnections(): number;
|
|
538
|
-
isInitializedWith({ selfId, roomName, isSfu }: {
|
|
539
|
-
selfId: any;
|
|
540
|
-
roomName: any;
|
|
541
|
-
isSfu: any;
|
|
542
|
-
}): boolean;
|
|
543
|
-
supportsScreenShareAudio(): boolean;
|
|
544
|
-
addNewStream(streamId: string, stream: MediaStream, audioPaused: boolean, videoPaused: boolean, beforeEffectTracks?: CustomMediaStreamTrack[]): void;
|
|
545
|
-
replaceTrack(oldTrack: CustomMediaStreamTrack | null, newTrack: CustomMediaStreamTrack): Promise<any[]>;
|
|
546
|
-
disconnectAll(): void;
|
|
547
|
-
fixChromeAudio(constraints: any): Promise<any[]> | undefined;
|
|
548
|
-
setupSocketListeners(): void;
|
|
549
|
-
sendAudioMutedStats(muted: boolean): void;
|
|
550
|
-
sendVideoMutedStats(muted: boolean): void;
|
|
551
|
-
sendStatsCustomEvent(eventName: string, data: any): void;
|
|
552
|
-
rtcStatsDisconnect(): void;
|
|
553
|
-
rtcStatsReconnect(): void;
|
|
554
|
-
setAudioOnly(audioOnly: any): void;
|
|
555
|
-
setRemoteScreenshareVideoTrackIds(remoteScreenshareVideoTrackIds?: never[]): void;
|
|
556
|
-
setRoomSessionId(roomSessionId: string): void;
|
|
557
|
-
_setConnectionStatus(session: any, newStatus: any, clientId: string): void;
|
|
558
|
-
_setJitterBufferTarget(pc: any): void;
|
|
559
|
-
_emitServerEvent(eventName: string, data?: any, callback?: any): void;
|
|
560
|
-
_emit(eventName: string, data?: any): void;
|
|
561
|
-
_addEnabledLocalStreamId(streamId: string): void;
|
|
562
|
-
_deleteEnabledLocalStreamId(streamId: string): void;
|
|
563
|
-
_getSession(peerConnectionId: string): any;
|
|
564
|
-
_getOrCreateSession(peerConnectionId: string, initialBandwidth: any): any;
|
|
565
|
-
_getLocalCameraStream(): any;
|
|
566
|
-
_getNonLocalCameraStreamIds(): string[];
|
|
567
|
-
_isScreensharingLocally(): boolean;
|
|
568
|
-
_getFirstLocalNonCameraStream(): any;
|
|
569
|
-
_transformIncomingSdp(original: any, _: any): {
|
|
570
|
-
type: any;
|
|
571
|
-
sdp: any;
|
|
572
|
-
};
|
|
573
|
-
_transformOutgoingSdp(original: any): {
|
|
574
|
-
type: any;
|
|
575
|
-
sdpU: any;
|
|
576
|
-
};
|
|
577
|
-
_createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, shouldAddLocalVideo, }: {
|
|
578
|
-
clientId: string;
|
|
579
|
-
initialBandwidth: any;
|
|
580
|
-
isOfferer: any;
|
|
581
|
-
peerConnectionId: string;
|
|
582
|
-
shouldAddLocalVideo: boolean;
|
|
583
|
-
}): any;
|
|
584
|
-
_cleanup(peerConnectionId: string): void;
|
|
585
|
-
_forEachPeerConnection(func: any): void;
|
|
586
|
-
_addStreamToPeerConnections(stream: any): void;
|
|
587
|
-
_addTrackToPeerConnections(track: any, stream?: any): void;
|
|
588
|
-
_replaceTrackToPeerConnections(oldTrack: any, newTrack: any): Promise<any[]>;
|
|
589
|
-
_removeStreamFromPeerConnections(stream: any): void;
|
|
590
|
-
_removeTrackFromPeerConnections(track: any): void;
|
|
591
|
-
_addLocalStream(streamId: string, stream: any): void;
|
|
592
|
-
_removeLocalStream(streamId: string): void;
|
|
593
|
-
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds }: any): void;
|
|
594
|
-
_clearMediaServersRefresh(): void;
|
|
595
|
-
_monitorAudioTrack(track: any): void;
|
|
596
|
-
_monitorVideoTrack(track: CustomMediaStreamTrack): void;
|
|
597
|
-
_connect(clientId: string): Promise<any>;
|
|
598
|
-
_maybeRestartIce(clientId: string, session: any): void;
|
|
599
|
-
_setCodecPreferences(pc: RTCPeerConnection): Promise<void>;
|
|
600
|
-
_negotiatePeerConnection(clientId: string, session: any, constraints?: any): void;
|
|
601
|
-
_withForcedRenegotiation(session: any, action: any): void;
|
|
602
|
-
_changeBandwidthForAllClients(isJoining: boolean): number;
|
|
603
|
-
_createP2pSession({ clientId, initialBandwidth, shouldAddLocalVideo, isOfferer, }: {
|
|
604
|
-
clientId: string;
|
|
605
|
-
initialBandwidth: number;
|
|
606
|
-
shouldAddLocalVideo: boolean;
|
|
607
|
-
isOfferer: boolean;
|
|
608
|
-
}): any;
|
|
609
|
-
acceptNewStream({ streamId, clientId, shouldAddLocalVideo, }: {
|
|
610
|
-
streamId: string;
|
|
611
|
-
clientId: string;
|
|
612
|
-
shouldAddLocalVideo?: boolean;
|
|
613
|
-
}): any;
|
|
614
|
-
disconnect(clientId: string): void;
|
|
615
|
-
updateStreamResolution(): void;
|
|
616
|
-
stopOrResumeAudio(): void;
|
|
617
|
-
_handleStopOrResumeVideo({ enable, track }: {
|
|
618
|
-
enable: boolean;
|
|
619
|
-
track: any;
|
|
620
|
-
}): void;
|
|
621
|
-
stopOrResumeVideo(localStream: any, enable: boolean): void;
|
|
622
|
-
_shareScreen(streamId: string, stream: any): void;
|
|
623
|
-
removeStream(streamId: string, stream: any, requestedByClientId: any): void;
|
|
624
|
-
hasClient(clientId: string): boolean;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
493
|
declare const assert: {
|
|
628
494
|
fail: (message?: string | Error) => void;
|
|
629
495
|
ok: (value: any, message?: string | Error) => void;
|
|
@@ -774,13 +640,12 @@ declare class ServerSocket {
|
|
|
774
640
|
noopKeepaliveInterval: any;
|
|
775
641
|
_wasConnectedUsingWebsocket?: boolean;
|
|
776
642
|
disconnectTimestamp: number | undefined;
|
|
643
|
+
joinRoomFinished: boolean;
|
|
777
644
|
constructor(hostName: string, optionsOverrides?: any, glitchFree?: boolean);
|
|
778
645
|
setRtcManager(rtcManager?: RtcManager): void;
|
|
779
646
|
connect(): void;
|
|
780
647
|
disconnect(): void;
|
|
781
|
-
disconnectOnConnect(): void;
|
|
782
648
|
emit(eventName: string, ...args: any[]): void;
|
|
783
|
-
emitIfConnected(eventName: string, data: any): void;
|
|
784
649
|
getTransport(): any;
|
|
785
650
|
getManager(): any;
|
|
786
651
|
isConnecting(): any;
|
|
@@ -1206,6 +1071,143 @@ declare function fromLocation({ host, protocol }?: {
|
|
|
1206
1071
|
subdomain: string;
|
|
1207
1072
|
};
|
|
1208
1073
|
|
|
1074
|
+
declare class P2pRtcManager implements RtcManager {
|
|
1075
|
+
_selfId: any;
|
|
1076
|
+
_roomName: any;
|
|
1077
|
+
_roomSessionId: any;
|
|
1078
|
+
peerConnections: any;
|
|
1079
|
+
localStreams: any;
|
|
1080
|
+
enabledLocalStreamIds: any[];
|
|
1081
|
+
_screenshareVideoTrackIds: any[];
|
|
1082
|
+
_socketListenerDeregisterFunctions: any[];
|
|
1083
|
+
_localStreamDeregisterFunction: any;
|
|
1084
|
+
_emitter: any;
|
|
1085
|
+
_serverSocket: ServerSocket;
|
|
1086
|
+
_webrtcProvider: any;
|
|
1087
|
+
_features: any;
|
|
1088
|
+
_isAudioOnlyMode: boolean;
|
|
1089
|
+
offerOptions: {
|
|
1090
|
+
offerToReceiveAudio: boolean;
|
|
1091
|
+
offerToReceiveVideo: boolean;
|
|
1092
|
+
};
|
|
1093
|
+
_pendingActionsForConnectedPeerConnections: any[];
|
|
1094
|
+
_audioTrackOnEnded: () => void;
|
|
1095
|
+
_videoTrackOnEnded: () => void;
|
|
1096
|
+
totalSessionsCreated: number;
|
|
1097
|
+
_iceServers: any;
|
|
1098
|
+
_turnServers: any;
|
|
1099
|
+
_sfuServer: any;
|
|
1100
|
+
_mediaserverConfigTtlSeconds: any;
|
|
1101
|
+
_fetchMediaServersTimer: any;
|
|
1102
|
+
_wasScreenSharing: any;
|
|
1103
|
+
ipv6HostCandidateTeredoSeen: any;
|
|
1104
|
+
ipv6HostCandidate6to4Seen: any;
|
|
1105
|
+
mdnsHostCandidateSeen: any;
|
|
1106
|
+
_stoppedVideoTrack: any;
|
|
1107
|
+
icePublicIPGatheringTimeoutID: any;
|
|
1108
|
+
_videoTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
1109
|
+
_audioTrackBeingMonitored?: CustomMediaStreamTrack;
|
|
1110
|
+
_closed: boolean;
|
|
1111
|
+
skipEmittingServerMessageCount: number;
|
|
1112
|
+
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, }: {
|
|
1113
|
+
selfId: any;
|
|
1114
|
+
room: any;
|
|
1115
|
+
emitter: any;
|
|
1116
|
+
serverSocket: ServerSocket;
|
|
1117
|
+
webrtcProvider: any;
|
|
1118
|
+
features: any;
|
|
1119
|
+
});
|
|
1120
|
+
numberOfPeerconnections(): number;
|
|
1121
|
+
isInitializedWith({ selfId, roomName, isSfu }: {
|
|
1122
|
+
selfId: any;
|
|
1123
|
+
roomName: any;
|
|
1124
|
+
isSfu: any;
|
|
1125
|
+
}): boolean;
|
|
1126
|
+
supportsScreenShareAudio(): boolean;
|
|
1127
|
+
addNewStream(streamId: string, stream: MediaStream, audioPaused: boolean, videoPaused: boolean, beforeEffectTracks?: CustomMediaStreamTrack[]): void;
|
|
1128
|
+
replaceTrack(oldTrack: CustomMediaStreamTrack | null, newTrack: CustomMediaStreamTrack): Promise<any[]>;
|
|
1129
|
+
close(): void;
|
|
1130
|
+
disconnectAll(): void;
|
|
1131
|
+
fixChromeAudio(constraints: any): Promise<any[]> | undefined;
|
|
1132
|
+
setupSocketListeners(): void;
|
|
1133
|
+
sendAudioMutedStats(muted: boolean): void;
|
|
1134
|
+
sendVideoMutedStats(muted: boolean): void;
|
|
1135
|
+
sendStatsCustomEvent(eventName: string, data: any): void;
|
|
1136
|
+
rtcStatsDisconnect(): void;
|
|
1137
|
+
rtcStatsReconnect(): void;
|
|
1138
|
+
setAudioOnly(audioOnly: any): void;
|
|
1139
|
+
setRemoteScreenshareVideoTrackIds(remoteScreenshareVideoTrackIds?: never[]): void;
|
|
1140
|
+
setRoomSessionId(roomSessionId: string): void;
|
|
1141
|
+
_setConnectionStatus(session: any, newStatus: any, clientId: string): void;
|
|
1142
|
+
_setJitterBufferTarget(pc: any): void;
|
|
1143
|
+
_emitServerEvent(eventName: string, data?: any): void;
|
|
1144
|
+
_emit(eventName: string, data?: any): void;
|
|
1145
|
+
_addEnabledLocalStreamId(streamId: string): void;
|
|
1146
|
+
_deleteEnabledLocalStreamId(streamId: string): void;
|
|
1147
|
+
_getSession(peerConnectionId: string): any;
|
|
1148
|
+
_getOrCreateSession(peerConnectionId: string, initialBandwidth: any): any;
|
|
1149
|
+
_getLocalCameraStream(): any;
|
|
1150
|
+
_getNonLocalCameraStreamIds(): string[];
|
|
1151
|
+
_isScreensharingLocally(): boolean;
|
|
1152
|
+
_getFirstLocalNonCameraStream(): any;
|
|
1153
|
+
_transformIncomingSdp(original: any, _: any): {
|
|
1154
|
+
type: any;
|
|
1155
|
+
sdp: any;
|
|
1156
|
+
};
|
|
1157
|
+
_transformOutgoingSdp(original: any): {
|
|
1158
|
+
type: any;
|
|
1159
|
+
sdpU: any;
|
|
1160
|
+
};
|
|
1161
|
+
_createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, shouldAddLocalVideo, }: {
|
|
1162
|
+
clientId: string;
|
|
1163
|
+
initialBandwidth: any;
|
|
1164
|
+
isOfferer: any;
|
|
1165
|
+
peerConnectionId: string;
|
|
1166
|
+
shouldAddLocalVideo: boolean;
|
|
1167
|
+
}): any;
|
|
1168
|
+
_cleanup(peerConnectionId: string): void;
|
|
1169
|
+
_forEachPeerConnection(func: any): void;
|
|
1170
|
+
_addStreamToPeerConnections(stream: any): void;
|
|
1171
|
+
_addTrackToPeerConnections(track: any, stream?: any): void;
|
|
1172
|
+
_replaceTrackToPeerConnections(oldTrack: any, newTrack: any): Promise<any[]>;
|
|
1173
|
+
_removeStreamFromPeerConnections(stream: any): void;
|
|
1174
|
+
_removeTrackFromPeerConnections(track: any): void;
|
|
1175
|
+
_addLocalStream(streamId: string, stream: any): void;
|
|
1176
|
+
_removeLocalStream(streamId: string): void;
|
|
1177
|
+
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds }: any): void;
|
|
1178
|
+
_clearMediaServersRefresh(): void;
|
|
1179
|
+
_monitorAudioTrack(track: any): void;
|
|
1180
|
+
_monitorVideoTrack(track: CustomMediaStreamTrack): void;
|
|
1181
|
+
_connect(clientId: string): Promise<any>;
|
|
1182
|
+
_maybeRestartIce(clientId: string, session: any): void;
|
|
1183
|
+
_setCodecPreferences(pc: RTCPeerConnection): Promise<void>;
|
|
1184
|
+
_negotiatePeerConnection(clientId: string, session: any, constraints?: any): void;
|
|
1185
|
+
_withForcedRenegotiation(session: any, action: any): void;
|
|
1186
|
+
_changeBandwidthForAllClients(isJoining: boolean): number;
|
|
1187
|
+
_createP2pSession({ clientId, initialBandwidth, shouldAddLocalVideo, isOfferer, }: {
|
|
1188
|
+
clientId: string;
|
|
1189
|
+
initialBandwidth: number;
|
|
1190
|
+
shouldAddLocalVideo: boolean;
|
|
1191
|
+
isOfferer: boolean;
|
|
1192
|
+
}): any;
|
|
1193
|
+
acceptNewStream({ streamId, clientId, shouldAddLocalVideo, }: {
|
|
1194
|
+
streamId: string;
|
|
1195
|
+
clientId: string;
|
|
1196
|
+
shouldAddLocalVideo?: boolean;
|
|
1197
|
+
}): any;
|
|
1198
|
+
disconnect(clientId: string): void;
|
|
1199
|
+
updateStreamResolution(): void;
|
|
1200
|
+
stopOrResumeAudio(): void;
|
|
1201
|
+
_handleStopOrResumeVideo({ enable, track }: {
|
|
1202
|
+
enable: boolean;
|
|
1203
|
+
track: any;
|
|
1204
|
+
}): void;
|
|
1205
|
+
stopOrResumeVideo(localStream: any, enable: boolean): void;
|
|
1206
|
+
_shareScreen(streamId: string, stream: any): void;
|
|
1207
|
+
removeStream(streamId: string, stream: any, requestedByClientId: any): void;
|
|
1208
|
+
hasClient(clientId: string): boolean;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1209
1211
|
declare class RtcManagerDispatcher {
|
|
1210
1212
|
emitter: {
|
|
1211
1213
|
emit: <K extends keyof RtcEvents>(eventName: K, args?: RtcEvents[K]) => void;
|
|
@@ -1626,6 +1628,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1626
1628
|
width: number;
|
|
1627
1629
|
height: number;
|
|
1628
1630
|
}): void;
|
|
1631
|
+
close(): void;
|
|
1629
1632
|
disconnectAll(): void;
|
|
1630
1633
|
sendAudioMutedStats(muted: boolean): void;
|
|
1631
1634
|
sendVideoMutedStats(muted: boolean): void;
|
package/dist/index.mjs
CHANGED
|
@@ -1547,6 +1547,7 @@ class ServerSocket {
|
|
|
1547
1547
|
this._wasConnectedUsingWebsocket = false;
|
|
1548
1548
|
this._reconnectManager = null;
|
|
1549
1549
|
this._socket = io(hostName, Object.assign({ path: DEFAULT_SOCKET_PATH, randomizationFactor: 0.5, reconnectionDelay: 250, reconnectionDelayMax: 5000, timeout: 5000, transports: ["websocket"], withCredentials: true }, optionsOverrides));
|
|
1550
|
+
this.joinRoomFinished = false;
|
|
1550
1551
|
this._socket.io.on("reconnect", () => {
|
|
1551
1552
|
this._socket.sendBuffer = [];
|
|
1552
1553
|
});
|
|
@@ -1564,6 +1565,12 @@ class ServerSocket {
|
|
|
1564
1565
|
});
|
|
1565
1566
|
if (glitchFree)
|
|
1566
1567
|
this._reconnectManager = new ReconnectManager(this._socket);
|
|
1568
|
+
this._socket.on("room_joined", (payload) => {
|
|
1569
|
+
const { error } = payload;
|
|
1570
|
+
if (!error) {
|
|
1571
|
+
this.joinRoomFinished = true;
|
|
1572
|
+
}
|
|
1573
|
+
});
|
|
1567
1574
|
this._socket.on("connect", () => {
|
|
1568
1575
|
const transport = this.getTransport();
|
|
1569
1576
|
if (transport === "websocket") {
|
|
@@ -1580,6 +1587,7 @@ class ServerSocket {
|
|
|
1580
1587
|
}
|
|
1581
1588
|
});
|
|
1582
1589
|
this._socket.on("disconnect", () => {
|
|
1590
|
+
this.joinRoomFinished = false;
|
|
1583
1591
|
this.disconnectTimestamp = Date.now();
|
|
1584
1592
|
if (this.noopKeepaliveInterval) {
|
|
1585
1593
|
clearInterval(this.noopKeepaliveInterval);
|
|
@@ -1601,26 +1609,12 @@ class ServerSocket {
|
|
|
1601
1609
|
disconnect() {
|
|
1602
1610
|
this._socket.disconnect();
|
|
1603
1611
|
}
|
|
1604
|
-
disconnectOnConnect() {
|
|
1605
|
-
this._socket.once("connect", () => {
|
|
1606
|
-
this._socket.disconnect();
|
|
1607
|
-
});
|
|
1608
|
-
}
|
|
1609
1612
|
emit(eventName, ...args) {
|
|
1610
1613
|
this._socket.emit.apply(this._socket, arguments);
|
|
1611
1614
|
}
|
|
1612
|
-
emitIfConnected(eventName, data) {
|
|
1613
|
-
if (!this.isConnected()) {
|
|
1614
|
-
return;
|
|
1615
|
-
}
|
|
1616
|
-
this.emit(eventName, data);
|
|
1617
|
-
}
|
|
1618
1615
|
getTransport() {
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
this._socket.io.engine &&
|
|
1622
|
-
this._socket.io.engine.transport &&
|
|
1623
|
-
this._socket.io.engine.transport.name);
|
|
1616
|
+
var _a, _b, _c, _d;
|
|
1617
|
+
return (_d = (_c = (_b = (_a = this._socket) === null || _a === void 0 ? void 0 : _a.io) === null || _b === void 0 ? void 0 : _b.engine) === null || _c === void 0 ? void 0 : _c.transport) === null || _d === void 0 ? void 0 : _d.name;
|
|
1624
1618
|
}
|
|
1625
1619
|
getManager() {
|
|
1626
1620
|
return this._socket.io;
|
|
@@ -2582,6 +2576,8 @@ class P2pRtcManager {
|
|
|
2582
2576
|
this._webrtcProvider = webrtcProvider;
|
|
2583
2577
|
this._features = features || {};
|
|
2584
2578
|
this._isAudioOnlyMode = false;
|
|
2579
|
+
this._closed = false;
|
|
2580
|
+
this.skipEmittingServerMessageCount = 0;
|
|
2585
2581
|
this.offerOptions = { offerToReceiveAudio: true, offerToReceiveVideo: true };
|
|
2586
2582
|
this._pendingActionsForConnectedPeerConnections = [];
|
|
2587
2583
|
this._audioTrackOnEnded = () => {
|
|
@@ -2663,6 +2659,10 @@ class P2pRtcManager {
|
|
|
2663
2659
|
}
|
|
2664
2660
|
return this._replaceTrackToPeerConnections(oldTrack, newTrack);
|
|
2665
2661
|
}
|
|
2662
|
+
close() {
|
|
2663
|
+
this._closed = true;
|
|
2664
|
+
this.disconnectAll();
|
|
2665
|
+
}
|
|
2666
2666
|
disconnectAll() {
|
|
2667
2667
|
Object.keys(this.peerConnections).forEach((peerConnectionId) => {
|
|
2668
2668
|
this.disconnect(peerConnectionId);
|
|
@@ -2848,8 +2848,18 @@ class P2pRtcManager {
|
|
|
2848
2848
|
logger$6.error("Error during setting jitter buffer target:", error);
|
|
2849
2849
|
}
|
|
2850
2850
|
}
|
|
2851
|
-
_emitServerEvent(eventName, data
|
|
2852
|
-
this.
|
|
2851
|
+
_emitServerEvent(eventName, data) {
|
|
2852
|
+
if (this._closed) {
|
|
2853
|
+
logger$6.warn("RtcManager closed. Will not send event", eventName, data);
|
|
2854
|
+
return;
|
|
2855
|
+
}
|
|
2856
|
+
if (this._features.awaitJoinRoomFinished && !this._serverSocket.joinRoomFinished) {
|
|
2857
|
+
rtcStats.sendEvent("skip_emitting_server_message", { eventName });
|
|
2858
|
+
this.skipEmittingServerMessageCount++;
|
|
2859
|
+
}
|
|
2860
|
+
else {
|
|
2861
|
+
this._serverSocket.emit(eventName, data);
|
|
2862
|
+
}
|
|
2853
2863
|
}
|
|
2854
2864
|
_emit(eventName, data) {
|
|
2855
2865
|
this._emitter.emit(eventName, data);
|
|
@@ -5485,6 +5495,9 @@ class VegaRtcManager {
|
|
|
5485
5495
|
});
|
|
5486
5496
|
}
|
|
5487
5497
|
}
|
|
5498
|
+
close() {
|
|
5499
|
+
this.disconnectAll();
|
|
5500
|
+
}
|
|
5488
5501
|
disconnectAll() {
|
|
5489
5502
|
var _a, _b, _c, _d;
|
|
5490
5503
|
this._reconnect = false;
|
package/dist/legacy-esm.js
CHANGED
|
@@ -1547,6 +1547,7 @@ class ServerSocket {
|
|
|
1547
1547
|
this._wasConnectedUsingWebsocket = false;
|
|
1548
1548
|
this._reconnectManager = null;
|
|
1549
1549
|
this._socket = io(hostName, Object.assign({ path: DEFAULT_SOCKET_PATH, randomizationFactor: 0.5, reconnectionDelay: 250, reconnectionDelayMax: 5000, timeout: 5000, transports: ["websocket"], withCredentials: true }, optionsOverrides));
|
|
1550
|
+
this.joinRoomFinished = false;
|
|
1550
1551
|
this._socket.io.on("reconnect", () => {
|
|
1551
1552
|
this._socket.sendBuffer = [];
|
|
1552
1553
|
});
|
|
@@ -1564,6 +1565,12 @@ class ServerSocket {
|
|
|
1564
1565
|
});
|
|
1565
1566
|
if (glitchFree)
|
|
1566
1567
|
this._reconnectManager = new ReconnectManager(this._socket);
|
|
1568
|
+
this._socket.on("room_joined", (payload) => {
|
|
1569
|
+
const { error } = payload;
|
|
1570
|
+
if (!error) {
|
|
1571
|
+
this.joinRoomFinished = true;
|
|
1572
|
+
}
|
|
1573
|
+
});
|
|
1567
1574
|
this._socket.on("connect", () => {
|
|
1568
1575
|
const transport = this.getTransport();
|
|
1569
1576
|
if (transport === "websocket") {
|
|
@@ -1580,6 +1587,7 @@ class ServerSocket {
|
|
|
1580
1587
|
}
|
|
1581
1588
|
});
|
|
1582
1589
|
this._socket.on("disconnect", () => {
|
|
1590
|
+
this.joinRoomFinished = false;
|
|
1583
1591
|
this.disconnectTimestamp = Date.now();
|
|
1584
1592
|
if (this.noopKeepaliveInterval) {
|
|
1585
1593
|
clearInterval(this.noopKeepaliveInterval);
|
|
@@ -1601,26 +1609,12 @@ class ServerSocket {
|
|
|
1601
1609
|
disconnect() {
|
|
1602
1610
|
this._socket.disconnect();
|
|
1603
1611
|
}
|
|
1604
|
-
disconnectOnConnect() {
|
|
1605
|
-
this._socket.once("connect", () => {
|
|
1606
|
-
this._socket.disconnect();
|
|
1607
|
-
});
|
|
1608
|
-
}
|
|
1609
1612
|
emit(eventName, ...args) {
|
|
1610
1613
|
this._socket.emit.apply(this._socket, arguments);
|
|
1611
1614
|
}
|
|
1612
|
-
emitIfConnected(eventName, data) {
|
|
1613
|
-
if (!this.isConnected()) {
|
|
1614
|
-
return;
|
|
1615
|
-
}
|
|
1616
|
-
this.emit(eventName, data);
|
|
1617
|
-
}
|
|
1618
1615
|
getTransport() {
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
this._socket.io.engine &&
|
|
1622
|
-
this._socket.io.engine.transport &&
|
|
1623
|
-
this._socket.io.engine.transport.name);
|
|
1616
|
+
var _a, _b, _c, _d;
|
|
1617
|
+
return (_d = (_c = (_b = (_a = this._socket) === null || _a === void 0 ? void 0 : _a.io) === null || _b === void 0 ? void 0 : _b.engine) === null || _c === void 0 ? void 0 : _c.transport) === null || _d === void 0 ? void 0 : _d.name;
|
|
1624
1618
|
}
|
|
1625
1619
|
getManager() {
|
|
1626
1620
|
return this._socket.io;
|
|
@@ -2582,6 +2576,8 @@ class P2pRtcManager {
|
|
|
2582
2576
|
this._webrtcProvider = webrtcProvider;
|
|
2583
2577
|
this._features = features || {};
|
|
2584
2578
|
this._isAudioOnlyMode = false;
|
|
2579
|
+
this._closed = false;
|
|
2580
|
+
this.skipEmittingServerMessageCount = 0;
|
|
2585
2581
|
this.offerOptions = { offerToReceiveAudio: true, offerToReceiveVideo: true };
|
|
2586
2582
|
this._pendingActionsForConnectedPeerConnections = [];
|
|
2587
2583
|
this._audioTrackOnEnded = () => {
|
|
@@ -2663,6 +2659,10 @@ class P2pRtcManager {
|
|
|
2663
2659
|
}
|
|
2664
2660
|
return this._replaceTrackToPeerConnections(oldTrack, newTrack);
|
|
2665
2661
|
}
|
|
2662
|
+
close() {
|
|
2663
|
+
this._closed = true;
|
|
2664
|
+
this.disconnectAll();
|
|
2665
|
+
}
|
|
2666
2666
|
disconnectAll() {
|
|
2667
2667
|
Object.keys(this.peerConnections).forEach((peerConnectionId) => {
|
|
2668
2668
|
this.disconnect(peerConnectionId);
|
|
@@ -2848,8 +2848,18 @@ class P2pRtcManager {
|
|
|
2848
2848
|
logger$6.error("Error during setting jitter buffer target:", error);
|
|
2849
2849
|
}
|
|
2850
2850
|
}
|
|
2851
|
-
_emitServerEvent(eventName, data
|
|
2852
|
-
this.
|
|
2851
|
+
_emitServerEvent(eventName, data) {
|
|
2852
|
+
if (this._closed) {
|
|
2853
|
+
logger$6.warn("RtcManager closed. Will not send event", eventName, data);
|
|
2854
|
+
return;
|
|
2855
|
+
}
|
|
2856
|
+
if (this._features.awaitJoinRoomFinished && !this._serverSocket.joinRoomFinished) {
|
|
2857
|
+
rtcStats.sendEvent("skip_emitting_server_message", { eventName });
|
|
2858
|
+
this.skipEmittingServerMessageCount++;
|
|
2859
|
+
}
|
|
2860
|
+
else {
|
|
2861
|
+
this._serverSocket.emit(eventName, data);
|
|
2862
|
+
}
|
|
2853
2863
|
}
|
|
2854
2864
|
_emit(eventName, data) {
|
|
2855
2865
|
this._emitter.emit(eventName, data);
|
|
@@ -5485,6 +5495,9 @@ class VegaRtcManager {
|
|
|
5485
5495
|
});
|
|
5486
5496
|
}
|
|
5487
5497
|
}
|
|
5498
|
+
close() {
|
|
5499
|
+
this.disconnectAll();
|
|
5500
|
+
}
|
|
5488
5501
|
disconnectAll() {
|
|
5489
5502
|
var _a, _b, _c, _d;
|
|
5490
5503
|
this._reconnect = false;
|