@whereby.com/media 10.0.1 → 11.1.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 +25 -30
- package/dist/index.d.cts +6 -10
- package/dist/index.d.mts +6 -10
- package/dist/index.d.ts +6 -10
- package/dist/index.mjs +25 -30
- package/dist/legacy-esm.js +25 -30
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -244,12 +244,6 @@ const rtcStats = {
|
|
|
244
244
|
value,
|
|
245
245
|
});
|
|
246
246
|
},
|
|
247
|
-
sendAudioMuted: (muted) => {
|
|
248
|
-
rtcStats.sendEvent("audio_muted", { muted });
|
|
249
|
-
},
|
|
250
|
-
sendVideoMuted: (muted) => {
|
|
251
|
-
rtcStats.sendEvent("video_muted", { muted });
|
|
252
|
-
},
|
|
253
247
|
server,
|
|
254
248
|
};
|
|
255
249
|
|
|
@@ -2676,12 +2670,6 @@ class P2pRtcManager {
|
|
|
2676
2670
|
}),
|
|
2677
2671
|
];
|
|
2678
2672
|
}
|
|
2679
|
-
sendAudioMutedStats(muted) {
|
|
2680
|
-
rtcStats.sendEvent("audio_muted", { muted });
|
|
2681
|
-
}
|
|
2682
|
-
sendVideoMutedStats(muted) {
|
|
2683
|
-
rtcStats.sendEvent("video_muted", { muted });
|
|
2684
|
-
}
|
|
2685
2673
|
sendStatsCustomEvent(eventName, data) {
|
|
2686
2674
|
rtcStats.sendEvent(eventName, data);
|
|
2687
2675
|
}
|
|
@@ -3936,7 +3924,7 @@ class VegaConnection extends EventEmitter.EventEmitter {
|
|
|
3936
3924
|
this.socket.onclose = this._onClose.bind(this);
|
|
3937
3925
|
this.socket.onerror = this._onError.bind(this);
|
|
3938
3926
|
}
|
|
3939
|
-
_tearDown() {
|
|
3927
|
+
_tearDown(event) {
|
|
3940
3928
|
if (this.socket === null)
|
|
3941
3929
|
return;
|
|
3942
3930
|
this.socket.onopen = null;
|
|
@@ -3945,7 +3933,7 @@ class VegaConnection extends EventEmitter.EventEmitter {
|
|
|
3945
3933
|
this.socket.onerror = null;
|
|
3946
3934
|
this.socket = null;
|
|
3947
3935
|
this.sents.forEach((sent) => sent.close());
|
|
3948
|
-
this.emit("close");
|
|
3936
|
+
this.emit("close", event);
|
|
3949
3937
|
}
|
|
3950
3938
|
close() {
|
|
3951
3939
|
var _a;
|
|
@@ -3965,9 +3953,9 @@ class VegaConnection extends EventEmitter.EventEmitter {
|
|
|
3965
3953
|
this.emit("message", socketMessage);
|
|
3966
3954
|
}
|
|
3967
3955
|
}
|
|
3968
|
-
_onClose() {
|
|
3956
|
+
_onClose(event) {
|
|
3969
3957
|
logger$3.info("Disconnected");
|
|
3970
|
-
this._tearDown();
|
|
3958
|
+
this._tearDown(event);
|
|
3971
3959
|
}
|
|
3972
3960
|
_onError(error) {
|
|
3973
3961
|
logger$3.info("Error", error);
|
|
@@ -5475,12 +5463,6 @@ class VegaRtcManager {
|
|
|
5475
5463
|
this._mediasoupDeviceInitializedAsync = Promise.resolve(null);
|
|
5476
5464
|
this._qualityMonitor.close();
|
|
5477
5465
|
}
|
|
5478
|
-
sendAudioMutedStats(muted) {
|
|
5479
|
-
rtcStats.sendEvent("audio_muted", { muted });
|
|
5480
|
-
}
|
|
5481
|
-
sendVideoMutedStats(muted) {
|
|
5482
|
-
rtcStats.sendEvent("video_muted", { muted });
|
|
5483
|
-
}
|
|
5484
5466
|
sendStatsCustomEvent(eventName, data) {
|
|
5485
5467
|
rtcStats.sendEvent(eventName, data);
|
|
5486
5468
|
}
|
|
@@ -6639,10 +6621,12 @@ function startPerformanceMonitor({ onMetricsUpdated, onTerminated, isHidden, })
|
|
|
6639
6621
|
}
|
|
6640
6622
|
|
|
6641
6623
|
const logger$1 = new Logger();
|
|
6624
|
+
const SFU_BASE_URL = "wss://any.sfu.svc.whereby.com";
|
|
6642
6625
|
class BandwidthTester extends EventEmitter {
|
|
6643
|
-
constructor({ features }
|
|
6626
|
+
constructor({ token, features }) {
|
|
6644
6627
|
super();
|
|
6645
6628
|
this.closed = false;
|
|
6629
|
+
this._token = token;
|
|
6646
6630
|
this._features = features || {};
|
|
6647
6631
|
this._vegaConnection = null;
|
|
6648
6632
|
this._mediasoupDeviceInitializedAsync = getMediasoupDeviceAsync(this._features);
|
|
@@ -6672,22 +6656,33 @@ class BandwidthTester extends EventEmitter {
|
|
|
6672
6656
|
timeout: true,
|
|
6673
6657
|
},
|
|
6674
6658
|
});
|
|
6675
|
-
|
|
6659
|
+
this.close();
|
|
6660
|
+
return;
|
|
6676
6661
|
}
|
|
6677
6662
|
this._runTime = runTime;
|
|
6678
6663
|
this._startTime = Date.now();
|
|
6679
|
-
const host = this._features.sfuServerOverrideHost
|
|
6680
|
-
|
|
6681
|
-
|
|
6664
|
+
const host = this._features.sfuServerOverrideHost && !this._features.sfuServerOverrideHost.startsWith("wss://")
|
|
6665
|
+
? `wss://${this._features.sfuServerOverrideHost}`
|
|
6666
|
+
: this._features.sfuServerOverrideHost || SFU_BASE_URL;
|
|
6667
|
+
const wsUrl = `${host}?bandwidthTestClaim=${this._token}`;
|
|
6668
|
+
this._vegaConnection = new VegaConnection(wsUrl, {
|
|
6669
|
+
protocol: "whereby-sfu#bw-test-v1",
|
|
6670
|
+
});
|
|
6682
6671
|
this._vegaConnection.on("open", () => this._start());
|
|
6683
|
-
this._vegaConnection.on("close", () => this.close(true));
|
|
6672
|
+
this._vegaConnection.on("close", (event) => this.close(true, event));
|
|
6684
6673
|
this._vegaConnection.on("message", (message) => this._onMessage(message));
|
|
6685
6674
|
this._startTimeout();
|
|
6686
6675
|
}
|
|
6687
|
-
close(vegaConnectionClosed) {
|
|
6676
|
+
close(vegaConnectionClosed, event) {
|
|
6688
6677
|
logger$1.info("close()");
|
|
6689
6678
|
this.closed = true;
|
|
6690
|
-
if (
|
|
6679
|
+
if ((event === null || event === void 0 ? void 0 : event.code) === 1008) {
|
|
6680
|
+
this.emit("result", {
|
|
6681
|
+
error: true,
|
|
6682
|
+
details: Object.assign(Object.assign({}, ((event === null || event === void 0 ? void 0 : event.reason) === "invalidClaim" && { invalidClaim: true })), ((event === null || event === void 0 ? void 0 : event.reason) === "connectionTimeout" && { timeout: true })),
|
|
6683
|
+
});
|
|
6684
|
+
}
|
|
6685
|
+
else if (!!this._timeout || Date.now() - this._startTime < 750) {
|
|
6691
6686
|
this.emit("result", {
|
|
6692
6687
|
error: true,
|
|
6693
6688
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1325,6 +1325,7 @@ declare function trackAnnotations(o: MediaStreamTrack): TrackAnnotation;
|
|
|
1325
1325
|
|
|
1326
1326
|
declare class BandwidthTester extends EventEmitter {
|
|
1327
1327
|
closed: boolean;
|
|
1328
|
+
_token: string;
|
|
1328
1329
|
_features: any;
|
|
1329
1330
|
_vegaConnection: any;
|
|
1330
1331
|
_mediasoupDeviceInitializedAsync: Promise<Device | null>;
|
|
@@ -1342,11 +1343,12 @@ declare class BandwidthTester extends EventEmitter {
|
|
|
1342
1343
|
_canvas: any;
|
|
1343
1344
|
_drawInterval: any;
|
|
1344
1345
|
_resultTimeout: ClearableTimeout | null;
|
|
1345
|
-
constructor({ features }
|
|
1346
|
+
constructor({ token, features }: {
|
|
1347
|
+
token: string;
|
|
1346
1348
|
features?: any;
|
|
1347
1349
|
});
|
|
1348
1350
|
start(runTime?: number): void;
|
|
1349
|
-
close(vegaConnectionClosed?: boolean): void;
|
|
1351
|
+
close(vegaConnectionClosed?: boolean, event?: any): void;
|
|
1350
1352
|
_start(): Promise<void>;
|
|
1351
1353
|
_createTransport(send: any): Promise<void>;
|
|
1352
1354
|
_getTestTrack(): any;
|
|
@@ -1702,8 +1704,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1702
1704
|
close(): void;
|
|
1703
1705
|
disconnectAll(): void;
|
|
1704
1706
|
setupSocketListeners(): void;
|
|
1705
|
-
sendAudioMutedStats(muted: boolean): void;
|
|
1706
|
-
sendVideoMutedStats(muted: boolean): void;
|
|
1707
1707
|
sendStatsCustomEvent(eventName: string, data: any): void;
|
|
1708
1708
|
rtcStatsConnect(): void;
|
|
1709
1709
|
rtcStatsDisconnect(): void;
|
|
@@ -1785,8 +1785,6 @@ declare function setVideoBandwidthUsingSetParameters(pc: RTCPeerConnection, band
|
|
|
1785
1785
|
|
|
1786
1786
|
declare const rtcStats: {
|
|
1787
1787
|
sendEvent: (type: any, value: any) => void;
|
|
1788
|
-
sendAudioMuted: (muted: boolean) => void;
|
|
1789
|
-
sendVideoMuted: (muted: boolean) => void;
|
|
1790
1788
|
server: {
|
|
1791
1789
|
connected: boolean;
|
|
1792
1790
|
attemptedConnectedAtLeastOnce: boolean;
|
|
@@ -1852,11 +1850,11 @@ declare class VegaConnection extends EventEmitter$1 {
|
|
|
1852
1850
|
incrementAnalyticMetric?: VegaIncrementAnalyticMetric;
|
|
1853
1851
|
constructor(wsUrl: string, { protocol, incrementAnalyticMetric }: VegaConnectionOptions);
|
|
1854
1852
|
_setupSocket(): void;
|
|
1855
|
-
_tearDown(): void;
|
|
1853
|
+
_tearDown(event?: CloseEvent): void;
|
|
1856
1854
|
close(): void;
|
|
1857
1855
|
_onOpen(): void;
|
|
1858
1856
|
_onMessage(event: MessageEvent): void;
|
|
1859
|
-
_onClose(): void;
|
|
1857
|
+
_onClose(event?: CloseEvent): void;
|
|
1860
1858
|
_onError(error: any): void;
|
|
1861
1859
|
_handleResponse(socketMessage: any): void;
|
|
1862
1860
|
send(message: any): void;
|
|
@@ -2104,8 +2102,6 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2104
2102
|
}): void;
|
|
2105
2103
|
close(): void;
|
|
2106
2104
|
disconnectAll(): void;
|
|
2107
|
-
sendAudioMutedStats(muted: boolean): void;
|
|
2108
|
-
sendVideoMutedStats(muted: boolean): void;
|
|
2109
2105
|
sendStatsCustomEvent(eventName: string, data?: any): void;
|
|
2110
2106
|
rtcStatsConnect(): void;
|
|
2111
2107
|
rtcStatsDisconnect(): void;
|
package/dist/index.d.mts
CHANGED
|
@@ -1325,6 +1325,7 @@ declare function trackAnnotations(o: MediaStreamTrack): TrackAnnotation;
|
|
|
1325
1325
|
|
|
1326
1326
|
declare class BandwidthTester extends EventEmitter {
|
|
1327
1327
|
closed: boolean;
|
|
1328
|
+
_token: string;
|
|
1328
1329
|
_features: any;
|
|
1329
1330
|
_vegaConnection: any;
|
|
1330
1331
|
_mediasoupDeviceInitializedAsync: Promise<Device | null>;
|
|
@@ -1342,11 +1343,12 @@ declare class BandwidthTester extends EventEmitter {
|
|
|
1342
1343
|
_canvas: any;
|
|
1343
1344
|
_drawInterval: any;
|
|
1344
1345
|
_resultTimeout: ClearableTimeout | null;
|
|
1345
|
-
constructor({ features }
|
|
1346
|
+
constructor({ token, features }: {
|
|
1347
|
+
token: string;
|
|
1346
1348
|
features?: any;
|
|
1347
1349
|
});
|
|
1348
1350
|
start(runTime?: number): void;
|
|
1349
|
-
close(vegaConnectionClosed?: boolean): void;
|
|
1351
|
+
close(vegaConnectionClosed?: boolean, event?: any): void;
|
|
1350
1352
|
_start(): Promise<void>;
|
|
1351
1353
|
_createTransport(send: any): Promise<void>;
|
|
1352
1354
|
_getTestTrack(): any;
|
|
@@ -1702,8 +1704,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1702
1704
|
close(): void;
|
|
1703
1705
|
disconnectAll(): void;
|
|
1704
1706
|
setupSocketListeners(): void;
|
|
1705
|
-
sendAudioMutedStats(muted: boolean): void;
|
|
1706
|
-
sendVideoMutedStats(muted: boolean): void;
|
|
1707
1707
|
sendStatsCustomEvent(eventName: string, data: any): void;
|
|
1708
1708
|
rtcStatsConnect(): void;
|
|
1709
1709
|
rtcStatsDisconnect(): void;
|
|
@@ -1785,8 +1785,6 @@ declare function setVideoBandwidthUsingSetParameters(pc: RTCPeerConnection, band
|
|
|
1785
1785
|
|
|
1786
1786
|
declare const rtcStats: {
|
|
1787
1787
|
sendEvent: (type: any, value: any) => void;
|
|
1788
|
-
sendAudioMuted: (muted: boolean) => void;
|
|
1789
|
-
sendVideoMuted: (muted: boolean) => void;
|
|
1790
1788
|
server: {
|
|
1791
1789
|
connected: boolean;
|
|
1792
1790
|
attemptedConnectedAtLeastOnce: boolean;
|
|
@@ -1852,11 +1850,11 @@ declare class VegaConnection extends EventEmitter$1 {
|
|
|
1852
1850
|
incrementAnalyticMetric?: VegaIncrementAnalyticMetric;
|
|
1853
1851
|
constructor(wsUrl: string, { protocol, incrementAnalyticMetric }: VegaConnectionOptions);
|
|
1854
1852
|
_setupSocket(): void;
|
|
1855
|
-
_tearDown(): void;
|
|
1853
|
+
_tearDown(event?: CloseEvent): void;
|
|
1856
1854
|
close(): void;
|
|
1857
1855
|
_onOpen(): void;
|
|
1858
1856
|
_onMessage(event: MessageEvent): void;
|
|
1859
|
-
_onClose(): void;
|
|
1857
|
+
_onClose(event?: CloseEvent): void;
|
|
1860
1858
|
_onError(error: any): void;
|
|
1861
1859
|
_handleResponse(socketMessage: any): void;
|
|
1862
1860
|
send(message: any): void;
|
|
@@ -2104,8 +2102,6 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2104
2102
|
}): void;
|
|
2105
2103
|
close(): void;
|
|
2106
2104
|
disconnectAll(): void;
|
|
2107
|
-
sendAudioMutedStats(muted: boolean): void;
|
|
2108
|
-
sendVideoMutedStats(muted: boolean): void;
|
|
2109
2105
|
sendStatsCustomEvent(eventName: string, data?: any): void;
|
|
2110
2106
|
rtcStatsConnect(): void;
|
|
2111
2107
|
rtcStatsDisconnect(): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1325,6 +1325,7 @@ declare function trackAnnotations(o: MediaStreamTrack): TrackAnnotation;
|
|
|
1325
1325
|
|
|
1326
1326
|
declare class BandwidthTester extends EventEmitter {
|
|
1327
1327
|
closed: boolean;
|
|
1328
|
+
_token: string;
|
|
1328
1329
|
_features: any;
|
|
1329
1330
|
_vegaConnection: any;
|
|
1330
1331
|
_mediasoupDeviceInitializedAsync: Promise<Device | null>;
|
|
@@ -1342,11 +1343,12 @@ declare class BandwidthTester extends EventEmitter {
|
|
|
1342
1343
|
_canvas: any;
|
|
1343
1344
|
_drawInterval: any;
|
|
1344
1345
|
_resultTimeout: ClearableTimeout | null;
|
|
1345
|
-
constructor({ features }
|
|
1346
|
+
constructor({ token, features }: {
|
|
1347
|
+
token: string;
|
|
1346
1348
|
features?: any;
|
|
1347
1349
|
});
|
|
1348
1350
|
start(runTime?: number): void;
|
|
1349
|
-
close(vegaConnectionClosed?: boolean): void;
|
|
1351
|
+
close(vegaConnectionClosed?: boolean, event?: any): void;
|
|
1350
1352
|
_start(): Promise<void>;
|
|
1351
1353
|
_createTransport(send: any): Promise<void>;
|
|
1352
1354
|
_getTestTrack(): any;
|
|
@@ -1702,8 +1704,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1702
1704
|
close(): void;
|
|
1703
1705
|
disconnectAll(): void;
|
|
1704
1706
|
setupSocketListeners(): void;
|
|
1705
|
-
sendAudioMutedStats(muted: boolean): void;
|
|
1706
|
-
sendVideoMutedStats(muted: boolean): void;
|
|
1707
1707
|
sendStatsCustomEvent(eventName: string, data: any): void;
|
|
1708
1708
|
rtcStatsConnect(): void;
|
|
1709
1709
|
rtcStatsDisconnect(): void;
|
|
@@ -1785,8 +1785,6 @@ declare function setVideoBandwidthUsingSetParameters(pc: RTCPeerConnection, band
|
|
|
1785
1785
|
|
|
1786
1786
|
declare const rtcStats: {
|
|
1787
1787
|
sendEvent: (type: any, value: any) => void;
|
|
1788
|
-
sendAudioMuted: (muted: boolean) => void;
|
|
1789
|
-
sendVideoMuted: (muted: boolean) => void;
|
|
1790
1788
|
server: {
|
|
1791
1789
|
connected: boolean;
|
|
1792
1790
|
attemptedConnectedAtLeastOnce: boolean;
|
|
@@ -1852,11 +1850,11 @@ declare class VegaConnection extends EventEmitter$1 {
|
|
|
1852
1850
|
incrementAnalyticMetric?: VegaIncrementAnalyticMetric;
|
|
1853
1851
|
constructor(wsUrl: string, { protocol, incrementAnalyticMetric }: VegaConnectionOptions);
|
|
1854
1852
|
_setupSocket(): void;
|
|
1855
|
-
_tearDown(): void;
|
|
1853
|
+
_tearDown(event?: CloseEvent): void;
|
|
1856
1854
|
close(): void;
|
|
1857
1855
|
_onOpen(): void;
|
|
1858
1856
|
_onMessage(event: MessageEvent): void;
|
|
1859
|
-
_onClose(): void;
|
|
1857
|
+
_onClose(event?: CloseEvent): void;
|
|
1860
1858
|
_onError(error: any): void;
|
|
1861
1859
|
_handleResponse(socketMessage: any): void;
|
|
1862
1860
|
send(message: any): void;
|
|
@@ -2104,8 +2102,6 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2104
2102
|
}): void;
|
|
2105
2103
|
close(): void;
|
|
2106
2104
|
disconnectAll(): void;
|
|
2107
|
-
sendAudioMutedStats(muted: boolean): void;
|
|
2108
|
-
sendVideoMutedStats(muted: boolean): void;
|
|
2109
2105
|
sendStatsCustomEvent(eventName: string, data?: any): void;
|
|
2110
2106
|
rtcStatsConnect(): void;
|
|
2111
2107
|
rtcStatsDisconnect(): void;
|
package/dist/index.mjs
CHANGED
|
@@ -224,12 +224,6 @@ const rtcStats = {
|
|
|
224
224
|
value,
|
|
225
225
|
});
|
|
226
226
|
},
|
|
227
|
-
sendAudioMuted: (muted) => {
|
|
228
|
-
rtcStats.sendEvent("audio_muted", { muted });
|
|
229
|
-
},
|
|
230
|
-
sendVideoMuted: (muted) => {
|
|
231
|
-
rtcStats.sendEvent("video_muted", { muted });
|
|
232
|
-
},
|
|
233
227
|
server,
|
|
234
228
|
};
|
|
235
229
|
|
|
@@ -2656,12 +2650,6 @@ class P2pRtcManager {
|
|
|
2656
2650
|
}),
|
|
2657
2651
|
];
|
|
2658
2652
|
}
|
|
2659
|
-
sendAudioMutedStats(muted) {
|
|
2660
|
-
rtcStats.sendEvent("audio_muted", { muted });
|
|
2661
|
-
}
|
|
2662
|
-
sendVideoMutedStats(muted) {
|
|
2663
|
-
rtcStats.sendEvent("video_muted", { muted });
|
|
2664
|
-
}
|
|
2665
2653
|
sendStatsCustomEvent(eventName, data) {
|
|
2666
2654
|
rtcStats.sendEvent(eventName, data);
|
|
2667
2655
|
}
|
|
@@ -3916,7 +3904,7 @@ class VegaConnection extends EventEmitter$1 {
|
|
|
3916
3904
|
this.socket.onclose = this._onClose.bind(this);
|
|
3917
3905
|
this.socket.onerror = this._onError.bind(this);
|
|
3918
3906
|
}
|
|
3919
|
-
_tearDown() {
|
|
3907
|
+
_tearDown(event) {
|
|
3920
3908
|
if (this.socket === null)
|
|
3921
3909
|
return;
|
|
3922
3910
|
this.socket.onopen = null;
|
|
@@ -3925,7 +3913,7 @@ class VegaConnection extends EventEmitter$1 {
|
|
|
3925
3913
|
this.socket.onerror = null;
|
|
3926
3914
|
this.socket = null;
|
|
3927
3915
|
this.sents.forEach((sent) => sent.close());
|
|
3928
|
-
this.emit("close");
|
|
3916
|
+
this.emit("close", event);
|
|
3929
3917
|
}
|
|
3930
3918
|
close() {
|
|
3931
3919
|
var _a;
|
|
@@ -3945,9 +3933,9 @@ class VegaConnection extends EventEmitter$1 {
|
|
|
3945
3933
|
this.emit("message", socketMessage);
|
|
3946
3934
|
}
|
|
3947
3935
|
}
|
|
3948
|
-
_onClose() {
|
|
3936
|
+
_onClose(event) {
|
|
3949
3937
|
logger$3.info("Disconnected");
|
|
3950
|
-
this._tearDown();
|
|
3938
|
+
this._tearDown(event);
|
|
3951
3939
|
}
|
|
3952
3940
|
_onError(error) {
|
|
3953
3941
|
logger$3.info("Error", error);
|
|
@@ -5455,12 +5443,6 @@ class VegaRtcManager {
|
|
|
5455
5443
|
this._mediasoupDeviceInitializedAsync = Promise.resolve(null);
|
|
5456
5444
|
this._qualityMonitor.close();
|
|
5457
5445
|
}
|
|
5458
|
-
sendAudioMutedStats(muted) {
|
|
5459
|
-
rtcStats.sendEvent("audio_muted", { muted });
|
|
5460
|
-
}
|
|
5461
|
-
sendVideoMutedStats(muted) {
|
|
5462
|
-
rtcStats.sendEvent("video_muted", { muted });
|
|
5463
|
-
}
|
|
5464
5446
|
sendStatsCustomEvent(eventName, data) {
|
|
5465
5447
|
rtcStats.sendEvent(eventName, data);
|
|
5466
5448
|
}
|
|
@@ -6619,10 +6601,12 @@ function startPerformanceMonitor({ onMetricsUpdated, onTerminated, isHidden, })
|
|
|
6619
6601
|
}
|
|
6620
6602
|
|
|
6621
6603
|
const logger$1 = new Logger();
|
|
6604
|
+
const SFU_BASE_URL = "wss://any.sfu.svc.whereby.com";
|
|
6622
6605
|
class BandwidthTester extends EventEmitter {
|
|
6623
|
-
constructor({ features }
|
|
6606
|
+
constructor({ token, features }) {
|
|
6624
6607
|
super();
|
|
6625
6608
|
this.closed = false;
|
|
6609
|
+
this._token = token;
|
|
6626
6610
|
this._features = features || {};
|
|
6627
6611
|
this._vegaConnection = null;
|
|
6628
6612
|
this._mediasoupDeviceInitializedAsync = getMediasoupDeviceAsync(this._features);
|
|
@@ -6652,22 +6636,33 @@ class BandwidthTester extends EventEmitter {
|
|
|
6652
6636
|
timeout: true,
|
|
6653
6637
|
},
|
|
6654
6638
|
});
|
|
6655
|
-
|
|
6639
|
+
this.close();
|
|
6640
|
+
return;
|
|
6656
6641
|
}
|
|
6657
6642
|
this._runTime = runTime;
|
|
6658
6643
|
this._startTime = Date.now();
|
|
6659
|
-
const host = this._features.sfuServerOverrideHost
|
|
6660
|
-
|
|
6661
|
-
|
|
6644
|
+
const host = this._features.sfuServerOverrideHost && !this._features.sfuServerOverrideHost.startsWith("wss://")
|
|
6645
|
+
? `wss://${this._features.sfuServerOverrideHost}`
|
|
6646
|
+
: this._features.sfuServerOverrideHost || SFU_BASE_URL;
|
|
6647
|
+
const wsUrl = `${host}?bandwidthTestClaim=${this._token}`;
|
|
6648
|
+
this._vegaConnection = new VegaConnection(wsUrl, {
|
|
6649
|
+
protocol: "whereby-sfu#bw-test-v1",
|
|
6650
|
+
});
|
|
6662
6651
|
this._vegaConnection.on("open", () => this._start());
|
|
6663
|
-
this._vegaConnection.on("close", () => this.close(true));
|
|
6652
|
+
this._vegaConnection.on("close", (event) => this.close(true, event));
|
|
6664
6653
|
this._vegaConnection.on("message", (message) => this._onMessage(message));
|
|
6665
6654
|
this._startTimeout();
|
|
6666
6655
|
}
|
|
6667
|
-
close(vegaConnectionClosed) {
|
|
6656
|
+
close(vegaConnectionClosed, event) {
|
|
6668
6657
|
logger$1.info("close()");
|
|
6669
6658
|
this.closed = true;
|
|
6670
|
-
if (
|
|
6659
|
+
if ((event === null || event === void 0 ? void 0 : event.code) === 1008) {
|
|
6660
|
+
this.emit("result", {
|
|
6661
|
+
error: true,
|
|
6662
|
+
details: Object.assign(Object.assign({}, ((event === null || event === void 0 ? void 0 : event.reason) === "invalidClaim" && { invalidClaim: true })), ((event === null || event === void 0 ? void 0 : event.reason) === "connectionTimeout" && { timeout: true })),
|
|
6663
|
+
});
|
|
6664
|
+
}
|
|
6665
|
+
else if (!!this._timeout || Date.now() - this._startTime < 750) {
|
|
6671
6666
|
this.emit("result", {
|
|
6672
6667
|
error: true,
|
|
6673
6668
|
});
|
package/dist/legacy-esm.js
CHANGED
|
@@ -224,12 +224,6 @@ const rtcStats = {
|
|
|
224
224
|
value,
|
|
225
225
|
});
|
|
226
226
|
},
|
|
227
|
-
sendAudioMuted: (muted) => {
|
|
228
|
-
rtcStats.sendEvent("audio_muted", { muted });
|
|
229
|
-
},
|
|
230
|
-
sendVideoMuted: (muted) => {
|
|
231
|
-
rtcStats.sendEvent("video_muted", { muted });
|
|
232
|
-
},
|
|
233
227
|
server,
|
|
234
228
|
};
|
|
235
229
|
|
|
@@ -2656,12 +2650,6 @@ class P2pRtcManager {
|
|
|
2656
2650
|
}),
|
|
2657
2651
|
];
|
|
2658
2652
|
}
|
|
2659
|
-
sendAudioMutedStats(muted) {
|
|
2660
|
-
rtcStats.sendEvent("audio_muted", { muted });
|
|
2661
|
-
}
|
|
2662
|
-
sendVideoMutedStats(muted) {
|
|
2663
|
-
rtcStats.sendEvent("video_muted", { muted });
|
|
2664
|
-
}
|
|
2665
2653
|
sendStatsCustomEvent(eventName, data) {
|
|
2666
2654
|
rtcStats.sendEvent(eventName, data);
|
|
2667
2655
|
}
|
|
@@ -3916,7 +3904,7 @@ class VegaConnection extends EventEmitter$1 {
|
|
|
3916
3904
|
this.socket.onclose = this._onClose.bind(this);
|
|
3917
3905
|
this.socket.onerror = this._onError.bind(this);
|
|
3918
3906
|
}
|
|
3919
|
-
_tearDown() {
|
|
3907
|
+
_tearDown(event) {
|
|
3920
3908
|
if (this.socket === null)
|
|
3921
3909
|
return;
|
|
3922
3910
|
this.socket.onopen = null;
|
|
@@ -3925,7 +3913,7 @@ class VegaConnection extends EventEmitter$1 {
|
|
|
3925
3913
|
this.socket.onerror = null;
|
|
3926
3914
|
this.socket = null;
|
|
3927
3915
|
this.sents.forEach((sent) => sent.close());
|
|
3928
|
-
this.emit("close");
|
|
3916
|
+
this.emit("close", event);
|
|
3929
3917
|
}
|
|
3930
3918
|
close() {
|
|
3931
3919
|
var _a;
|
|
@@ -3945,9 +3933,9 @@ class VegaConnection extends EventEmitter$1 {
|
|
|
3945
3933
|
this.emit("message", socketMessage);
|
|
3946
3934
|
}
|
|
3947
3935
|
}
|
|
3948
|
-
_onClose() {
|
|
3936
|
+
_onClose(event) {
|
|
3949
3937
|
logger$3.info("Disconnected");
|
|
3950
|
-
this._tearDown();
|
|
3938
|
+
this._tearDown(event);
|
|
3951
3939
|
}
|
|
3952
3940
|
_onError(error) {
|
|
3953
3941
|
logger$3.info("Error", error);
|
|
@@ -5455,12 +5443,6 @@ class VegaRtcManager {
|
|
|
5455
5443
|
this._mediasoupDeviceInitializedAsync = Promise.resolve(null);
|
|
5456
5444
|
this._qualityMonitor.close();
|
|
5457
5445
|
}
|
|
5458
|
-
sendAudioMutedStats(muted) {
|
|
5459
|
-
rtcStats.sendEvent("audio_muted", { muted });
|
|
5460
|
-
}
|
|
5461
|
-
sendVideoMutedStats(muted) {
|
|
5462
|
-
rtcStats.sendEvent("video_muted", { muted });
|
|
5463
|
-
}
|
|
5464
5446
|
sendStatsCustomEvent(eventName, data) {
|
|
5465
5447
|
rtcStats.sendEvent(eventName, data);
|
|
5466
5448
|
}
|
|
@@ -6619,10 +6601,12 @@ function startPerformanceMonitor({ onMetricsUpdated, onTerminated, isHidden, })
|
|
|
6619
6601
|
}
|
|
6620
6602
|
|
|
6621
6603
|
const logger$1 = new Logger();
|
|
6604
|
+
const SFU_BASE_URL = "wss://any.sfu.svc.whereby.com";
|
|
6622
6605
|
class BandwidthTester extends EventEmitter {
|
|
6623
|
-
constructor({ features }
|
|
6606
|
+
constructor({ token, features }) {
|
|
6624
6607
|
super();
|
|
6625
6608
|
this.closed = false;
|
|
6609
|
+
this._token = token;
|
|
6626
6610
|
this._features = features || {};
|
|
6627
6611
|
this._vegaConnection = null;
|
|
6628
6612
|
this._mediasoupDeviceInitializedAsync = getMediasoupDeviceAsync(this._features);
|
|
@@ -6652,22 +6636,33 @@ class BandwidthTester extends EventEmitter {
|
|
|
6652
6636
|
timeout: true,
|
|
6653
6637
|
},
|
|
6654
6638
|
});
|
|
6655
|
-
|
|
6639
|
+
this.close();
|
|
6640
|
+
return;
|
|
6656
6641
|
}
|
|
6657
6642
|
this._runTime = runTime;
|
|
6658
6643
|
this._startTime = Date.now();
|
|
6659
|
-
const host = this._features.sfuServerOverrideHost
|
|
6660
|
-
|
|
6661
|
-
|
|
6644
|
+
const host = this._features.sfuServerOverrideHost && !this._features.sfuServerOverrideHost.startsWith("wss://")
|
|
6645
|
+
? `wss://${this._features.sfuServerOverrideHost}`
|
|
6646
|
+
: this._features.sfuServerOverrideHost || SFU_BASE_URL;
|
|
6647
|
+
const wsUrl = `${host}?bandwidthTestClaim=${this._token}`;
|
|
6648
|
+
this._vegaConnection = new VegaConnection(wsUrl, {
|
|
6649
|
+
protocol: "whereby-sfu#bw-test-v1",
|
|
6650
|
+
});
|
|
6662
6651
|
this._vegaConnection.on("open", () => this._start());
|
|
6663
|
-
this._vegaConnection.on("close", () => this.close(true));
|
|
6652
|
+
this._vegaConnection.on("close", (event) => this.close(true, event));
|
|
6664
6653
|
this._vegaConnection.on("message", (message) => this._onMessage(message));
|
|
6665
6654
|
this._startTimeout();
|
|
6666
6655
|
}
|
|
6667
|
-
close(vegaConnectionClosed) {
|
|
6656
|
+
close(vegaConnectionClosed, event) {
|
|
6668
6657
|
logger$1.info("close()");
|
|
6669
6658
|
this.closed = true;
|
|
6670
|
-
if (
|
|
6659
|
+
if ((event === null || event === void 0 ? void 0 : event.code) === 1008) {
|
|
6660
|
+
this.emit("result", {
|
|
6661
|
+
error: true,
|
|
6662
|
+
details: Object.assign(Object.assign({}, ((event === null || event === void 0 ? void 0 : event.reason) === "invalidClaim" && { invalidClaim: true })), ((event === null || event === void 0 ? void 0 : event.reason) === "connectionTimeout" && { timeout: true })),
|
|
6663
|
+
});
|
|
6664
|
+
}
|
|
6665
|
+
else if (!!this._timeout || Date.now() - this._startTime < 750) {
|
|
6671
6666
|
this.emit("result", {
|
|
6672
6667
|
error: true,
|
|
6673
6668
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whereby.com/media",
|
|
3
3
|
"description": "Media library for Whereby",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "11.1.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/whereby/sdk",
|
|
7
7
|
"repository": {
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"prettier": "^3.5.3",
|
|
63
63
|
"process": "^0.11.10",
|
|
64
64
|
"typescript": "^5.8.3",
|
|
65
|
+
"@whereby.com/eslint-config": "0.1.0",
|
|
65
66
|
"@whereby.com/jest-config": "0.1.0",
|
|
66
|
-
"@whereby.com/rollup-config": "0.1.1",
|
|
67
67
|
"@whereby.com/prettier-config": "0.1.0",
|
|
68
|
-
"@whereby.com/
|
|
68
|
+
"@whereby.com/rollup-config": "0.1.1",
|
|
69
69
|
"@whereby.com/tsconfig": "0.1.0"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|