@whereby.com/media 2.8.3 → 2.8.4
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 +22 -27
- package/dist/index.d.cts +315 -292
- package/dist/index.d.mts +315 -292
- package/dist/index.d.ts +315 -292
- package/dist/index.mjs +22 -27
- package/dist/legacy-esm.js +22 -27
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1650,8 +1650,7 @@ class ServerSocket {
|
|
|
1650
1650
|
if (this._serverSideDisconnectDurationLimitOn)
|
|
1651
1651
|
this._keepAliveManager = new KeepAliveManager(this);
|
|
1652
1652
|
this._socket.on("room_joined", (payload) => {
|
|
1653
|
-
|
|
1654
|
-
if (!error) {
|
|
1653
|
+
if (!("error" in payload)) {
|
|
1655
1654
|
this.joinRoomFinished = true;
|
|
1656
1655
|
}
|
|
1657
1656
|
});
|
|
@@ -2619,8 +2618,8 @@ if (browserName$1 === "chrome") {
|
|
|
2619
2618
|
});
|
|
2620
2619
|
}
|
|
2621
2620
|
class P2pRtcManager {
|
|
2622
|
-
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features
|
|
2623
|
-
const { name, session, iceServers, turnServers,
|
|
2621
|
+
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features }) {
|
|
2622
|
+
const { name, session, iceServers, turnServers, mediaserverConfigTtlSeconds } = room;
|
|
2624
2623
|
this._selfId = selfId;
|
|
2625
2624
|
this._roomName = name;
|
|
2626
2625
|
this._roomSessionId = session && session.id;
|
|
@@ -2650,7 +2649,6 @@ class P2pRtcManager {
|
|
|
2650
2649
|
this.analytics.camTrackEndedCount++;
|
|
2651
2650
|
};
|
|
2652
2651
|
this._updateAndScheduleMediaServersRefresh({
|
|
2653
|
-
sfuServer,
|
|
2654
2652
|
iceServers: (iceServers === null || iceServers === void 0 ? void 0 : iceServers.iceServers) || [],
|
|
2655
2653
|
turnServers: turnServers || [],
|
|
2656
2654
|
mediaserverConfigTtlSeconds,
|
|
@@ -2691,7 +2689,7 @@ class P2pRtcManager {
|
|
|
2691
2689
|
return Object.keys(this.peerConnections).length;
|
|
2692
2690
|
}
|
|
2693
2691
|
isInitializedWith({ selfId, roomName, isSfu }) {
|
|
2694
|
-
return this._selfId === selfId && this._roomName === roomName && isSfu
|
|
2692
|
+
return this._selfId === selfId && this._roomName === roomName && !isSfu;
|
|
2695
2693
|
}
|
|
2696
2694
|
supportsScreenShareAudio() {
|
|
2697
2695
|
return true;
|
|
@@ -2831,8 +2829,7 @@ class P2pRtcManager {
|
|
|
2831
2829
|
});
|
|
2832
2830
|
}),
|
|
2833
2831
|
this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (payload) => {
|
|
2834
|
-
|
|
2835
|
-
if (error || !this._wasScreenSharing) {
|
|
2832
|
+
if ("error" in payload || !this._wasScreenSharing) {
|
|
2836
2833
|
return;
|
|
2837
2834
|
}
|
|
2838
2835
|
const screenShareStreamId = Object.keys(this.localStreams).find((id) => id !== CAMERA_STREAM_ID);
|
|
@@ -2907,9 +2904,6 @@ class P2pRtcManager {
|
|
|
2907
2904
|
if (previousStatus === newStatus) {
|
|
2908
2905
|
return;
|
|
2909
2906
|
}
|
|
2910
|
-
if (session.peerConnectionId === this._selfId) {
|
|
2911
|
-
return;
|
|
2912
|
-
}
|
|
2913
2907
|
if (previousStatus === TYPES.CONNECTION_DISCONNECTED &&
|
|
2914
2908
|
newStatus === TYPES.CONNECTING) {
|
|
2915
2909
|
return;
|
|
@@ -3249,10 +3243,9 @@ class P2pRtcManager {
|
|
|
3249
3243
|
delete this.localStreams[streamId];
|
|
3250
3244
|
this._deleteEnabledLocalStreamId(streamId);
|
|
3251
3245
|
}
|
|
3252
|
-
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers,
|
|
3246
|
+
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, mediaserverConfigTtlSeconds, }) {
|
|
3253
3247
|
this._iceServers = iceServers;
|
|
3254
3248
|
this._turnServers = turnServers;
|
|
3255
|
-
this._sfuServer = sfuServer;
|
|
3256
3249
|
this._mediaserverConfigTtlSeconds = mediaserverConfigTtlSeconds;
|
|
3257
3250
|
this._clearMediaServersRefresh();
|
|
3258
3251
|
if (!mediaserverConfigTtlSeconds) {
|
|
@@ -4521,8 +4514,8 @@ const OUTBOUND_SCREEN_OUTBOUND_STREAM_ID = uuid.v4();
|
|
|
4521
4514
|
if (browserName === "chrome")
|
|
4522
4515
|
window.document.addEventListener("beforeunload", () => (unloading = true));
|
|
4523
4516
|
class VegaRtcManager {
|
|
4524
|
-
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, eventClaim
|
|
4525
|
-
const { session, iceServers, turnServers, sfuServer,
|
|
4517
|
+
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, eventClaim }) {
|
|
4518
|
+
const { session, iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds } = room;
|
|
4526
4519
|
this._selfId = selfId;
|
|
4527
4520
|
this._room = room;
|
|
4528
4521
|
this._roomSessionId = session === null || session === void 0 ? void 0 : session.id;
|
|
@@ -4576,7 +4569,6 @@ class VegaRtcManager {
|
|
|
4576
4569
|
};
|
|
4577
4570
|
this._updateAndScheduleMediaServersRefresh({
|
|
4578
4571
|
sfuServer,
|
|
4579
|
-
sfuServers,
|
|
4580
4572
|
iceServers: (iceServers === null || iceServers === void 0 ? void 0 : iceServers.iceServers) || [],
|
|
4581
4573
|
turnServers: turnServers || [],
|
|
4582
4574
|
mediaserverConfigTtlSeconds,
|
|
@@ -4603,13 +4595,14 @@ class VegaRtcManager {
|
|
|
4603
4595
|
camTrackEndedCount: 0,
|
|
4604
4596
|
};
|
|
4605
4597
|
}
|
|
4606
|
-
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer,
|
|
4607
|
-
var _a, _b, _c;
|
|
4598
|
+
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds, }) {
|
|
4599
|
+
var _a, _b, _c, _d;
|
|
4608
4600
|
this._iceServers = iceServers;
|
|
4609
4601
|
this._turnServers = turnServers;
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4602
|
+
if (sfuServer) {
|
|
4603
|
+
this._sfuServer = sfuServer;
|
|
4604
|
+
}
|
|
4605
|
+
if (sfuServer === null || sfuServer === void 0 ? void 0 : sfuServer.fallbackServers) {
|
|
4613
4606
|
this._sfuServers = sfuServer.fallbackServers.map((entry) => ({
|
|
4614
4607
|
host: entry.host || entry.fqdn,
|
|
4615
4608
|
dc: entry.dc,
|
|
@@ -4619,14 +4612,14 @@ class VegaRtcManager {
|
|
|
4619
4612
|
(_a = this._vegaConnectionManager) === null || _a === void 0 ? void 0 : _a.updateHostList(this._features.sfuServersOverride ||
|
|
4620
4613
|
this._sfuServers ||
|
|
4621
4614
|
this._features.sfuServerOverrideHost ||
|
|
4622
|
-
|
|
4615
|
+
((_b = this._sfuServer) === null || _b === void 0 ? void 0 : _b.url));
|
|
4623
4616
|
const iceServersList = {
|
|
4624
4617
|
iceServers: this._features.turnServersOn ? this._turnServers : this._iceServers,
|
|
4625
4618
|
};
|
|
4626
4619
|
iceServersList.iceServers = turnServerOverride(iceServersList.iceServers, this._features.turnServerOverrideHost);
|
|
4627
4620
|
if (browserName !== "firefox") {
|
|
4628
|
-
(
|
|
4629
|
-
(
|
|
4621
|
+
(_c = this._sendTransport) === null || _c === void 0 ? void 0 : _c.updateIceServers(iceServersList);
|
|
4622
|
+
(_d = this._receiveTransport) === null || _d === void 0 ? void 0 : _d.updateIceServers(iceServersList);
|
|
4630
4623
|
}
|
|
4631
4624
|
this._clearMediaServersRefresh();
|
|
4632
4625
|
if (!mediaserverConfigTtlSeconds) {
|
|
@@ -4680,6 +4673,7 @@ class VegaRtcManager {
|
|
|
4680
4673
|
});
|
|
4681
4674
|
}
|
|
4682
4675
|
_connect() {
|
|
4676
|
+
var _a;
|
|
4683
4677
|
if (this._isConnectingOrConnected)
|
|
4684
4678
|
return;
|
|
4685
4679
|
if (!this._serverSocket.isConnected()) {
|
|
@@ -4695,7 +4689,7 @@ class VegaRtcManager {
|
|
|
4695
4689
|
const hostList = this._features.sfuServersOverride ||
|
|
4696
4690
|
this._sfuServers ||
|
|
4697
4691
|
this._features.sfuServerOverrideHost ||
|
|
4698
|
-
this._sfuServer.url;
|
|
4692
|
+
((_a = this._sfuServer) === null || _a === void 0 ? void 0 : _a.url);
|
|
4699
4693
|
this._vegaConnectionManager = createVegaConnectionManager({
|
|
4700
4694
|
initialHostList: hostList,
|
|
4701
4695
|
getUrlForHost: (host) => {
|
|
@@ -6005,9 +5999,10 @@ class RtcManagerDispatcher {
|
|
|
6005
5999
|
constructor({ emitter, serverSocket, webrtcProvider, features, }) {
|
|
6006
6000
|
this.emitter = emitter;
|
|
6007
6001
|
this.currentManager = null;
|
|
6008
|
-
serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (
|
|
6009
|
-
if (error)
|
|
6002
|
+
serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (payload) => {
|
|
6003
|
+
if ("error" in payload)
|
|
6010
6004
|
return;
|
|
6005
|
+
const { room, selfId, eventClaim } = payload;
|
|
6011
6006
|
const config = {
|
|
6012
6007
|
selfId,
|
|
6013
6008
|
room,
|