@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.mjs
CHANGED
|
@@ -1629,8 +1629,7 @@ class ServerSocket {
|
|
|
1629
1629
|
if (this._serverSideDisconnectDurationLimitOn)
|
|
1630
1630
|
this._keepAliveManager = new KeepAliveManager(this);
|
|
1631
1631
|
this._socket.on("room_joined", (payload) => {
|
|
1632
|
-
|
|
1633
|
-
if (!error) {
|
|
1632
|
+
if (!("error" in payload)) {
|
|
1634
1633
|
this.joinRoomFinished = true;
|
|
1635
1634
|
}
|
|
1636
1635
|
});
|
|
@@ -2598,8 +2597,8 @@ if (browserName$1 === "chrome") {
|
|
|
2598
2597
|
});
|
|
2599
2598
|
}
|
|
2600
2599
|
class P2pRtcManager {
|
|
2601
|
-
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features
|
|
2602
|
-
const { name, session, iceServers, turnServers,
|
|
2600
|
+
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features }) {
|
|
2601
|
+
const { name, session, iceServers, turnServers, mediaserverConfigTtlSeconds } = room;
|
|
2603
2602
|
this._selfId = selfId;
|
|
2604
2603
|
this._roomName = name;
|
|
2605
2604
|
this._roomSessionId = session && session.id;
|
|
@@ -2629,7 +2628,6 @@ class P2pRtcManager {
|
|
|
2629
2628
|
this.analytics.camTrackEndedCount++;
|
|
2630
2629
|
};
|
|
2631
2630
|
this._updateAndScheduleMediaServersRefresh({
|
|
2632
|
-
sfuServer,
|
|
2633
2631
|
iceServers: (iceServers === null || iceServers === void 0 ? void 0 : iceServers.iceServers) || [],
|
|
2634
2632
|
turnServers: turnServers || [],
|
|
2635
2633
|
mediaserverConfigTtlSeconds,
|
|
@@ -2670,7 +2668,7 @@ class P2pRtcManager {
|
|
|
2670
2668
|
return Object.keys(this.peerConnections).length;
|
|
2671
2669
|
}
|
|
2672
2670
|
isInitializedWith({ selfId, roomName, isSfu }) {
|
|
2673
|
-
return this._selfId === selfId && this._roomName === roomName && isSfu
|
|
2671
|
+
return this._selfId === selfId && this._roomName === roomName && !isSfu;
|
|
2674
2672
|
}
|
|
2675
2673
|
supportsScreenShareAudio() {
|
|
2676
2674
|
return true;
|
|
@@ -2810,8 +2808,7 @@ class P2pRtcManager {
|
|
|
2810
2808
|
});
|
|
2811
2809
|
}),
|
|
2812
2810
|
this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (payload) => {
|
|
2813
|
-
|
|
2814
|
-
if (error || !this._wasScreenSharing) {
|
|
2811
|
+
if ("error" in payload || !this._wasScreenSharing) {
|
|
2815
2812
|
return;
|
|
2816
2813
|
}
|
|
2817
2814
|
const screenShareStreamId = Object.keys(this.localStreams).find((id) => id !== CAMERA_STREAM_ID);
|
|
@@ -2886,9 +2883,6 @@ class P2pRtcManager {
|
|
|
2886
2883
|
if (previousStatus === newStatus) {
|
|
2887
2884
|
return;
|
|
2888
2885
|
}
|
|
2889
|
-
if (session.peerConnectionId === this._selfId) {
|
|
2890
|
-
return;
|
|
2891
|
-
}
|
|
2892
2886
|
if (previousStatus === TYPES.CONNECTION_DISCONNECTED &&
|
|
2893
2887
|
newStatus === TYPES.CONNECTING) {
|
|
2894
2888
|
return;
|
|
@@ -3228,10 +3222,9 @@ class P2pRtcManager {
|
|
|
3228
3222
|
delete this.localStreams[streamId];
|
|
3229
3223
|
this._deleteEnabledLocalStreamId(streamId);
|
|
3230
3224
|
}
|
|
3231
|
-
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers,
|
|
3225
|
+
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, mediaserverConfigTtlSeconds, }) {
|
|
3232
3226
|
this._iceServers = iceServers;
|
|
3233
3227
|
this._turnServers = turnServers;
|
|
3234
|
-
this._sfuServer = sfuServer;
|
|
3235
3228
|
this._mediaserverConfigTtlSeconds = mediaserverConfigTtlSeconds;
|
|
3236
3229
|
this._clearMediaServersRefresh();
|
|
3237
3230
|
if (!mediaserverConfigTtlSeconds) {
|
|
@@ -4500,8 +4493,8 @@ const OUTBOUND_SCREEN_OUTBOUND_STREAM_ID = v4$1();
|
|
|
4500
4493
|
if (browserName === "chrome")
|
|
4501
4494
|
window.document.addEventListener("beforeunload", () => (unloading = true));
|
|
4502
4495
|
class VegaRtcManager {
|
|
4503
|
-
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, eventClaim
|
|
4504
|
-
const { session, iceServers, turnServers, sfuServer,
|
|
4496
|
+
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, eventClaim }) {
|
|
4497
|
+
const { session, iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds } = room;
|
|
4505
4498
|
this._selfId = selfId;
|
|
4506
4499
|
this._room = room;
|
|
4507
4500
|
this._roomSessionId = session === null || session === void 0 ? void 0 : session.id;
|
|
@@ -4555,7 +4548,6 @@ class VegaRtcManager {
|
|
|
4555
4548
|
};
|
|
4556
4549
|
this._updateAndScheduleMediaServersRefresh({
|
|
4557
4550
|
sfuServer,
|
|
4558
|
-
sfuServers,
|
|
4559
4551
|
iceServers: (iceServers === null || iceServers === void 0 ? void 0 : iceServers.iceServers) || [],
|
|
4560
4552
|
turnServers: turnServers || [],
|
|
4561
4553
|
mediaserverConfigTtlSeconds,
|
|
@@ -4582,13 +4574,14 @@ class VegaRtcManager {
|
|
|
4582
4574
|
camTrackEndedCount: 0,
|
|
4583
4575
|
};
|
|
4584
4576
|
}
|
|
4585
|
-
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer,
|
|
4586
|
-
var _a, _b, _c;
|
|
4577
|
+
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds, }) {
|
|
4578
|
+
var _a, _b, _c, _d;
|
|
4587
4579
|
this._iceServers = iceServers;
|
|
4588
4580
|
this._turnServers = turnServers;
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4581
|
+
if (sfuServer) {
|
|
4582
|
+
this._sfuServer = sfuServer;
|
|
4583
|
+
}
|
|
4584
|
+
if (sfuServer === null || sfuServer === void 0 ? void 0 : sfuServer.fallbackServers) {
|
|
4592
4585
|
this._sfuServers = sfuServer.fallbackServers.map((entry) => ({
|
|
4593
4586
|
host: entry.host || entry.fqdn,
|
|
4594
4587
|
dc: entry.dc,
|
|
@@ -4598,14 +4591,14 @@ class VegaRtcManager {
|
|
|
4598
4591
|
(_a = this._vegaConnectionManager) === null || _a === void 0 ? void 0 : _a.updateHostList(this._features.sfuServersOverride ||
|
|
4599
4592
|
this._sfuServers ||
|
|
4600
4593
|
this._features.sfuServerOverrideHost ||
|
|
4601
|
-
|
|
4594
|
+
((_b = this._sfuServer) === null || _b === void 0 ? void 0 : _b.url));
|
|
4602
4595
|
const iceServersList = {
|
|
4603
4596
|
iceServers: this._features.turnServersOn ? this._turnServers : this._iceServers,
|
|
4604
4597
|
};
|
|
4605
4598
|
iceServersList.iceServers = turnServerOverride(iceServersList.iceServers, this._features.turnServerOverrideHost);
|
|
4606
4599
|
if (browserName !== "firefox") {
|
|
4607
|
-
(
|
|
4608
|
-
(
|
|
4600
|
+
(_c = this._sendTransport) === null || _c === void 0 ? void 0 : _c.updateIceServers(iceServersList);
|
|
4601
|
+
(_d = this._receiveTransport) === null || _d === void 0 ? void 0 : _d.updateIceServers(iceServersList);
|
|
4609
4602
|
}
|
|
4610
4603
|
this._clearMediaServersRefresh();
|
|
4611
4604
|
if (!mediaserverConfigTtlSeconds) {
|
|
@@ -4659,6 +4652,7 @@ class VegaRtcManager {
|
|
|
4659
4652
|
});
|
|
4660
4653
|
}
|
|
4661
4654
|
_connect() {
|
|
4655
|
+
var _a;
|
|
4662
4656
|
if (this._isConnectingOrConnected)
|
|
4663
4657
|
return;
|
|
4664
4658
|
if (!this._serverSocket.isConnected()) {
|
|
@@ -4674,7 +4668,7 @@ class VegaRtcManager {
|
|
|
4674
4668
|
const hostList = this._features.sfuServersOverride ||
|
|
4675
4669
|
this._sfuServers ||
|
|
4676
4670
|
this._features.sfuServerOverrideHost ||
|
|
4677
|
-
this._sfuServer.url;
|
|
4671
|
+
((_a = this._sfuServer) === null || _a === void 0 ? void 0 : _a.url);
|
|
4678
4672
|
this._vegaConnectionManager = createVegaConnectionManager({
|
|
4679
4673
|
initialHostList: hostList,
|
|
4680
4674
|
getUrlForHost: (host) => {
|
|
@@ -5984,9 +5978,10 @@ class RtcManagerDispatcher {
|
|
|
5984
5978
|
constructor({ emitter, serverSocket, webrtcProvider, features, }) {
|
|
5985
5979
|
this.emitter = emitter;
|
|
5986
5980
|
this.currentManager = null;
|
|
5987
|
-
serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (
|
|
5988
|
-
if (error)
|
|
5981
|
+
serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (payload) => {
|
|
5982
|
+
if ("error" in payload)
|
|
5989
5983
|
return;
|
|
5984
|
+
const { room, selfId, eventClaim } = payload;
|
|
5990
5985
|
const config = {
|
|
5991
5986
|
selfId,
|
|
5992
5987
|
room,
|
package/dist/legacy-esm.js
CHANGED
|
@@ -1629,8 +1629,7 @@ class ServerSocket {
|
|
|
1629
1629
|
if (this._serverSideDisconnectDurationLimitOn)
|
|
1630
1630
|
this._keepAliveManager = new KeepAliveManager(this);
|
|
1631
1631
|
this._socket.on("room_joined", (payload) => {
|
|
1632
|
-
|
|
1633
|
-
if (!error) {
|
|
1632
|
+
if (!("error" in payload)) {
|
|
1634
1633
|
this.joinRoomFinished = true;
|
|
1635
1634
|
}
|
|
1636
1635
|
});
|
|
@@ -2598,8 +2597,8 @@ if (browserName$1 === "chrome") {
|
|
|
2598
2597
|
});
|
|
2599
2598
|
}
|
|
2600
2599
|
class P2pRtcManager {
|
|
2601
|
-
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features
|
|
2602
|
-
const { name, session, iceServers, turnServers,
|
|
2600
|
+
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features }) {
|
|
2601
|
+
const { name, session, iceServers, turnServers, mediaserverConfigTtlSeconds } = room;
|
|
2603
2602
|
this._selfId = selfId;
|
|
2604
2603
|
this._roomName = name;
|
|
2605
2604
|
this._roomSessionId = session && session.id;
|
|
@@ -2629,7 +2628,6 @@ class P2pRtcManager {
|
|
|
2629
2628
|
this.analytics.camTrackEndedCount++;
|
|
2630
2629
|
};
|
|
2631
2630
|
this._updateAndScheduleMediaServersRefresh({
|
|
2632
|
-
sfuServer,
|
|
2633
2631
|
iceServers: (iceServers === null || iceServers === void 0 ? void 0 : iceServers.iceServers) || [],
|
|
2634
2632
|
turnServers: turnServers || [],
|
|
2635
2633
|
mediaserverConfigTtlSeconds,
|
|
@@ -2670,7 +2668,7 @@ class P2pRtcManager {
|
|
|
2670
2668
|
return Object.keys(this.peerConnections).length;
|
|
2671
2669
|
}
|
|
2672
2670
|
isInitializedWith({ selfId, roomName, isSfu }) {
|
|
2673
|
-
return this._selfId === selfId && this._roomName === roomName && isSfu
|
|
2671
|
+
return this._selfId === selfId && this._roomName === roomName && !isSfu;
|
|
2674
2672
|
}
|
|
2675
2673
|
supportsScreenShareAudio() {
|
|
2676
2674
|
return true;
|
|
@@ -2810,8 +2808,7 @@ class P2pRtcManager {
|
|
|
2810
2808
|
});
|
|
2811
2809
|
}),
|
|
2812
2810
|
this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (payload) => {
|
|
2813
|
-
|
|
2814
|
-
if (error || !this._wasScreenSharing) {
|
|
2811
|
+
if ("error" in payload || !this._wasScreenSharing) {
|
|
2815
2812
|
return;
|
|
2816
2813
|
}
|
|
2817
2814
|
const screenShareStreamId = Object.keys(this.localStreams).find((id) => id !== CAMERA_STREAM_ID);
|
|
@@ -2886,9 +2883,6 @@ class P2pRtcManager {
|
|
|
2886
2883
|
if (previousStatus === newStatus) {
|
|
2887
2884
|
return;
|
|
2888
2885
|
}
|
|
2889
|
-
if (session.peerConnectionId === this._selfId) {
|
|
2890
|
-
return;
|
|
2891
|
-
}
|
|
2892
2886
|
if (previousStatus === TYPES.CONNECTION_DISCONNECTED &&
|
|
2893
2887
|
newStatus === TYPES.CONNECTING) {
|
|
2894
2888
|
return;
|
|
@@ -3228,10 +3222,9 @@ class P2pRtcManager {
|
|
|
3228
3222
|
delete this.localStreams[streamId];
|
|
3229
3223
|
this._deleteEnabledLocalStreamId(streamId);
|
|
3230
3224
|
}
|
|
3231
|
-
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers,
|
|
3225
|
+
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, mediaserverConfigTtlSeconds, }) {
|
|
3232
3226
|
this._iceServers = iceServers;
|
|
3233
3227
|
this._turnServers = turnServers;
|
|
3234
|
-
this._sfuServer = sfuServer;
|
|
3235
3228
|
this._mediaserverConfigTtlSeconds = mediaserverConfigTtlSeconds;
|
|
3236
3229
|
this._clearMediaServersRefresh();
|
|
3237
3230
|
if (!mediaserverConfigTtlSeconds) {
|
|
@@ -4500,8 +4493,8 @@ const OUTBOUND_SCREEN_OUTBOUND_STREAM_ID = v4$1();
|
|
|
4500
4493
|
if (browserName === "chrome")
|
|
4501
4494
|
window.document.addEventListener("beforeunload", () => (unloading = true));
|
|
4502
4495
|
class VegaRtcManager {
|
|
4503
|
-
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, eventClaim
|
|
4504
|
-
const { session, iceServers, turnServers, sfuServer,
|
|
4496
|
+
constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, eventClaim }) {
|
|
4497
|
+
const { session, iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds } = room;
|
|
4505
4498
|
this._selfId = selfId;
|
|
4506
4499
|
this._room = room;
|
|
4507
4500
|
this._roomSessionId = session === null || session === void 0 ? void 0 : session.id;
|
|
@@ -4555,7 +4548,6 @@ class VegaRtcManager {
|
|
|
4555
4548
|
};
|
|
4556
4549
|
this._updateAndScheduleMediaServersRefresh({
|
|
4557
4550
|
sfuServer,
|
|
4558
|
-
sfuServers,
|
|
4559
4551
|
iceServers: (iceServers === null || iceServers === void 0 ? void 0 : iceServers.iceServers) || [],
|
|
4560
4552
|
turnServers: turnServers || [],
|
|
4561
4553
|
mediaserverConfigTtlSeconds,
|
|
@@ -4582,13 +4574,14 @@ class VegaRtcManager {
|
|
|
4582
4574
|
camTrackEndedCount: 0,
|
|
4583
4575
|
};
|
|
4584
4576
|
}
|
|
4585
|
-
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer,
|
|
4586
|
-
var _a, _b, _c;
|
|
4577
|
+
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds, }) {
|
|
4578
|
+
var _a, _b, _c, _d;
|
|
4587
4579
|
this._iceServers = iceServers;
|
|
4588
4580
|
this._turnServers = turnServers;
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4581
|
+
if (sfuServer) {
|
|
4582
|
+
this._sfuServer = sfuServer;
|
|
4583
|
+
}
|
|
4584
|
+
if (sfuServer === null || sfuServer === void 0 ? void 0 : sfuServer.fallbackServers) {
|
|
4592
4585
|
this._sfuServers = sfuServer.fallbackServers.map((entry) => ({
|
|
4593
4586
|
host: entry.host || entry.fqdn,
|
|
4594
4587
|
dc: entry.dc,
|
|
@@ -4598,14 +4591,14 @@ class VegaRtcManager {
|
|
|
4598
4591
|
(_a = this._vegaConnectionManager) === null || _a === void 0 ? void 0 : _a.updateHostList(this._features.sfuServersOverride ||
|
|
4599
4592
|
this._sfuServers ||
|
|
4600
4593
|
this._features.sfuServerOverrideHost ||
|
|
4601
|
-
|
|
4594
|
+
((_b = this._sfuServer) === null || _b === void 0 ? void 0 : _b.url));
|
|
4602
4595
|
const iceServersList = {
|
|
4603
4596
|
iceServers: this._features.turnServersOn ? this._turnServers : this._iceServers,
|
|
4604
4597
|
};
|
|
4605
4598
|
iceServersList.iceServers = turnServerOverride(iceServersList.iceServers, this._features.turnServerOverrideHost);
|
|
4606
4599
|
if (browserName !== "firefox") {
|
|
4607
|
-
(
|
|
4608
|
-
(
|
|
4600
|
+
(_c = this._sendTransport) === null || _c === void 0 ? void 0 : _c.updateIceServers(iceServersList);
|
|
4601
|
+
(_d = this._receiveTransport) === null || _d === void 0 ? void 0 : _d.updateIceServers(iceServersList);
|
|
4609
4602
|
}
|
|
4610
4603
|
this._clearMediaServersRefresh();
|
|
4611
4604
|
if (!mediaserverConfigTtlSeconds) {
|
|
@@ -4659,6 +4652,7 @@ class VegaRtcManager {
|
|
|
4659
4652
|
});
|
|
4660
4653
|
}
|
|
4661
4654
|
_connect() {
|
|
4655
|
+
var _a;
|
|
4662
4656
|
if (this._isConnectingOrConnected)
|
|
4663
4657
|
return;
|
|
4664
4658
|
if (!this._serverSocket.isConnected()) {
|
|
@@ -4674,7 +4668,7 @@ class VegaRtcManager {
|
|
|
4674
4668
|
const hostList = this._features.sfuServersOverride ||
|
|
4675
4669
|
this._sfuServers ||
|
|
4676
4670
|
this._features.sfuServerOverrideHost ||
|
|
4677
|
-
this._sfuServer.url;
|
|
4671
|
+
((_a = this._sfuServer) === null || _a === void 0 ? void 0 : _a.url);
|
|
4678
4672
|
this._vegaConnectionManager = createVegaConnectionManager({
|
|
4679
4673
|
initialHostList: hostList,
|
|
4680
4674
|
getUrlForHost: (host) => {
|
|
@@ -5984,9 +5978,10 @@ class RtcManagerDispatcher {
|
|
|
5984
5978
|
constructor({ emitter, serverSocket, webrtcProvider, features, }) {
|
|
5985
5979
|
this.emitter = emitter;
|
|
5986
5980
|
this.currentManager = null;
|
|
5987
|
-
serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (
|
|
5988
|
-
if (error)
|
|
5981
|
+
serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (payload) => {
|
|
5982
|
+
if ("error" in payload)
|
|
5989
5983
|
return;
|
|
5984
|
+
const { room, selfId, eventClaim } = payload;
|
|
5990
5985
|
const config = {
|
|
5991
5986
|
selfId,
|
|
5992
5987
|
room,
|