@whereby.com/media 8.2.7 → 8.3.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 +19 -5
- package/dist/index.d.cts +37 -8
- package/dist/index.d.mts +37 -8
- package/dist/index.d.ts +37 -8
- package/dist/index.mjs +19 -5
- package/dist/legacy-esm.js +19 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1473,7 +1473,7 @@ if (window.RTCPeerConnection) {
|
|
|
1473
1473
|
PatchedRTCPeerConnection.prototype = OriginalRTCPeerConnection.prototype;
|
|
1474
1474
|
window.RTCPeerConnection = PatchedRTCPeerConnection;
|
|
1475
1475
|
}
|
|
1476
|
-
const getCurrentPeerConnections = () => peerConnections;
|
|
1476
|
+
const getCurrentPeerConnections = () => peerConnections.filter((p) => p.connectionState !== "closed");
|
|
1477
1477
|
const getPeerConnectionIndex = (pc) => { var _a; return (_a = peerConnectionData.get(pc)) === null || _a === void 0 ? void 0 : _a.index; };
|
|
1478
1478
|
const setPeerConnectionsForTests = (pcs) => (peerConnections = pcs);
|
|
1479
1479
|
|
|
@@ -1517,7 +1517,7 @@ const getPeerConnectionsWithStatsReports = (pcDataByPc = PC_DATA_BY_PC) => Promi
|
|
|
1517
1517
|
}
|
|
1518
1518
|
});
|
|
1519
1519
|
if (missingSsrcs) {
|
|
1520
|
-
const sendersAndReceivers = [...pc.getSenders(), ...pc.getReceivers()];
|
|
1520
|
+
const sendersAndReceivers = [...pc.getSenders(), ...pc.getReceivers()].filter((o) => o.track);
|
|
1521
1521
|
const reports = yield Promise.all(sendersAndReceivers.map((o) => o.getStats()));
|
|
1522
1522
|
reports.forEach((tReport, index) => {
|
|
1523
1523
|
tReport.forEach((stats) => {
|
|
@@ -1527,8 +1527,8 @@ const getPeerConnectionsWithStatsReports = (pcDataByPc = PC_DATA_BY_PC) => Promi
|
|
|
1527
1527
|
});
|
|
1528
1528
|
});
|
|
1529
1529
|
missingSsrcs.forEach((ssrc) => {
|
|
1530
|
-
numMissingTrackSsrcLookups++;
|
|
1531
1530
|
if (!pcData.ssrcToTrackId[ssrc]) {
|
|
1531
|
+
numMissingTrackSsrcLookups++;
|
|
1532
1532
|
pcData.ssrcToTrackId[ssrc] = "?" + ssrc;
|
|
1533
1533
|
}
|
|
1534
1534
|
});
|
|
@@ -4781,7 +4781,9 @@ class VegaRtcManager {
|
|
|
4781
4781
|
}
|
|
4782
4782
|
const { iceRestartStarted } = transport.appData;
|
|
4783
4783
|
const now = Date.now();
|
|
4784
|
-
if (
|
|
4784
|
+
if (iceRestartStarted &&
|
|
4785
|
+
Number.isFinite(iceRestartStarted) &&
|
|
4786
|
+
now - iceRestartStarted < RESTARTICE_ERROR_RETRY_THRESHOLD_IN_MS) {
|
|
4785
4787
|
return;
|
|
4786
4788
|
}
|
|
4787
4789
|
transport.appData.iceRestartStarted = now;
|
|
@@ -4889,6 +4891,9 @@ class VegaRtcManager {
|
|
|
4889
4891
|
this._micScoreProducerPromise = null;
|
|
4890
4892
|
return;
|
|
4891
4893
|
}
|
|
4894
|
+
if (!this._sendTransport) {
|
|
4895
|
+
throw new Error("No send transport when attempting to create data producer");
|
|
4896
|
+
}
|
|
4892
4897
|
const producer = yield this._sendTransport.produceData({
|
|
4893
4898
|
ordered: false,
|
|
4894
4899
|
maxPacketLifeTime: 3000,
|
|
@@ -5026,6 +5031,9 @@ class VegaRtcManager {
|
|
|
5026
5031
|
var _a;
|
|
5027
5032
|
try {
|
|
5028
5033
|
const currentPaused = this._webcamPaused;
|
|
5034
|
+
if (!this._sendTransport) {
|
|
5035
|
+
throw new Error("No send transport when attempting to create producer");
|
|
5036
|
+
}
|
|
5029
5037
|
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._webcamTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5030
5038
|
streamId: OUTBOUND_CAM_OUTBOUND_STREAM_ID,
|
|
5031
5039
|
sourceClientId: this._selfId,
|
|
@@ -5654,6 +5662,9 @@ class VegaRtcManager {
|
|
|
5654
5662
|
logger$2.info("_onConsumerReady()", { id: options.id, producerId: options.producerId });
|
|
5655
5663
|
let consumer;
|
|
5656
5664
|
try {
|
|
5665
|
+
if (!this._receiveTransport) {
|
|
5666
|
+
throw new Error("No receive transport when attempting to create consumer");
|
|
5667
|
+
}
|
|
5657
5668
|
consumer = yield this._receiveTransport.consume(options);
|
|
5658
5669
|
}
|
|
5659
5670
|
catch (error) {
|
|
@@ -5750,7 +5761,10 @@ class VegaRtcManager {
|
|
|
5750
5761
|
}
|
|
5751
5762
|
_onDataConsumerReady(options) {
|
|
5752
5763
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5753
|
-
logger$2.info("_onDataConsumerReady()", { id: options.id,
|
|
5764
|
+
logger$2.info("_onDataConsumerReady()", { id: options.id, dataProducerId: options.dataProducerId });
|
|
5765
|
+
if (!this._receiveTransport) {
|
|
5766
|
+
throw new Error("No receive transport when attempting to create data consumer");
|
|
5767
|
+
}
|
|
5754
5768
|
const consumer = yield this._receiveTransport.consumeData(options);
|
|
5755
5769
|
this._dataConsumers.set(consumer.id, consumer);
|
|
5756
5770
|
consumer.once("close", () => {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Device } from 'mediasoup-client';
|
|
2
2
|
import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
|
|
3
3
|
import { RtpCapabilities } from 'mediasoup-client/lib/RtpParameters';
|
|
4
|
+
import { Transport, Producer, ConsumerOptions, DataConsumerOptions, Consumer } from 'mediasoup-client/lib/types';
|
|
4
5
|
|
|
5
6
|
interface MediaStreamTrackWithDenoiserContext extends MediaStreamTrack {
|
|
6
7
|
_denoiserCtx?: AudioContext;
|
|
@@ -385,6 +386,34 @@ declare function sortCodecs(codecs: Codec[], features: {
|
|
|
385
386
|
|
|
386
387
|
type VegaTransportDirection = "send" | "recv";
|
|
387
388
|
|
|
389
|
+
type TransportAppData = {
|
|
390
|
+
localClosed: boolean;
|
|
391
|
+
iceRestartStarted?: number;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
type VegaMediaSourceType = "mic" | "webcam" | "screenvideo" | "screenaudio";
|
|
395
|
+
|
|
396
|
+
type ConsumerAppData = {
|
|
397
|
+
sourceClientId: string;
|
|
398
|
+
screenShare: boolean;
|
|
399
|
+
streamId: string;
|
|
400
|
+
paused: boolean;
|
|
401
|
+
localPaused: boolean;
|
|
402
|
+
localClosed: boolean;
|
|
403
|
+
spatialLayer: number;
|
|
404
|
+
temporalLayer?: number;
|
|
405
|
+
source: VegaMediaSourceType;
|
|
406
|
+
screenshare: boolean;
|
|
407
|
+
colocation?: string;
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
type DataConsumerAppData = {
|
|
411
|
+
clientId: string;
|
|
412
|
+
producerId: string;
|
|
413
|
+
colocation?: string;
|
|
414
|
+
localClosed: boolean;
|
|
415
|
+
};
|
|
416
|
+
|
|
388
417
|
type VegaAnalytics = {
|
|
389
418
|
vegaUnknownResponse: number;
|
|
390
419
|
vegaRequestTimeout: number;
|
|
@@ -1648,7 +1677,7 @@ declare function createVegaConnectionManager(config: {
|
|
|
1648
1677
|
};
|
|
1649
1678
|
|
|
1650
1679
|
declare class VegaRtcManager implements RtcManager {
|
|
1651
|
-
_selfId:
|
|
1680
|
+
_selfId: string;
|
|
1652
1681
|
_room: any;
|
|
1653
1682
|
_roomSessionId: any;
|
|
1654
1683
|
_emitter: any;
|
|
@@ -1661,8 +1690,8 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1661
1690
|
_micAnalyserDebugger: any;
|
|
1662
1691
|
_mediasoupDeviceInitializedAsync: Promise<Device | null>;
|
|
1663
1692
|
_routerRtpCapabilities: RtpCapabilities | null;
|
|
1664
|
-
_sendTransport
|
|
1665
|
-
_receiveTransport
|
|
1693
|
+
_sendTransport?: null | Transport<TransportAppData>;
|
|
1694
|
+
_receiveTransport?: null | Transport<TransportAppData>;
|
|
1666
1695
|
_clientStates: Map<string, ClientState>;
|
|
1667
1696
|
_streamIdToVideoConsumerId: any;
|
|
1668
1697
|
_streamIdToVideoResolution: Map<string, {
|
|
@@ -1721,7 +1750,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1721
1750
|
_connect(): void;
|
|
1722
1751
|
_onClose(): void;
|
|
1723
1752
|
_join(): Promise<void>;
|
|
1724
|
-
_createTransport(send:
|
|
1753
|
+
_createTransport(send: boolean): Promise<void>;
|
|
1725
1754
|
_restartIce(direction: VegaTransportDirection, transportId: string, retried?: number): Promise<void>;
|
|
1726
1755
|
_internalSendMic(): Promise<void>;
|
|
1727
1756
|
_internalSetupMicScore(): Promise<void>;
|
|
@@ -1741,7 +1770,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1741
1770
|
_internalSendScreenAudio(): Promise<void>;
|
|
1742
1771
|
_replaceScreenAudioTrack(): Promise<void>;
|
|
1743
1772
|
_sendScreenAudio(track: MediaStreamTrack): Promise<void>;
|
|
1744
|
-
_stopProducer(producer:
|
|
1773
|
+
_stopProducer(producer: Producer): void;
|
|
1745
1774
|
_getAreTooManyAlreadyPresenting(): boolean;
|
|
1746
1775
|
isInitializedWith({ selfId, roomName, isSfu }: {
|
|
1747
1776
|
selfId: string;
|
|
@@ -1788,7 +1817,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1788
1817
|
_monitorAudioTrack(track: any): void;
|
|
1789
1818
|
_monitorVideoTrack(track: MediaStreamTrack): void;
|
|
1790
1819
|
_onMessage(message: any): Promise<void>;
|
|
1791
|
-
_onConsumerReady(options:
|
|
1820
|
+
_onConsumerReady(options: ConsumerOptions<ConsumerAppData>): Promise<void>;
|
|
1792
1821
|
_onConsumerClosed({ consumerId, reason }: {
|
|
1793
1822
|
consumerId: string;
|
|
1794
1823
|
reason: string;
|
|
@@ -1809,7 +1838,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1809
1838
|
kind: string;
|
|
1810
1839
|
score: number;
|
|
1811
1840
|
}): void;
|
|
1812
|
-
_onDataConsumerReady(options:
|
|
1841
|
+
_onDataConsumerReady(options: DataConsumerOptions<DataConsumerAppData>): Promise<void>;
|
|
1813
1842
|
_onDataConsumerClosed({ dataConsumerId, reason }: {
|
|
1814
1843
|
dataConsumerId: string;
|
|
1815
1844
|
reason: string;
|
|
@@ -1817,7 +1846,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1817
1846
|
_onDominantSpeaker({ consumerId }: {
|
|
1818
1847
|
consumerId: string;
|
|
1819
1848
|
}): void;
|
|
1820
|
-
_consumerClosedCleanup(consumer:
|
|
1849
|
+
_consumerClosedCleanup(consumer: Consumer<ConsumerAppData>): void;
|
|
1821
1850
|
_syncIncomingStreamsWithPWA(clientId: string): void;
|
|
1822
1851
|
_getOrCreateClientState(clientId: string): ClientState;
|
|
1823
1852
|
_emitToPWA(eventName: string, data?: any): void;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Device } from 'mediasoup-client';
|
|
2
2
|
import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
|
|
3
3
|
import { RtpCapabilities } from 'mediasoup-client/lib/RtpParameters';
|
|
4
|
+
import { Transport, Producer, ConsumerOptions, DataConsumerOptions, Consumer } from 'mediasoup-client/lib/types';
|
|
4
5
|
|
|
5
6
|
interface MediaStreamTrackWithDenoiserContext extends MediaStreamTrack {
|
|
6
7
|
_denoiserCtx?: AudioContext;
|
|
@@ -385,6 +386,34 @@ declare function sortCodecs(codecs: Codec[], features: {
|
|
|
385
386
|
|
|
386
387
|
type VegaTransportDirection = "send" | "recv";
|
|
387
388
|
|
|
389
|
+
type TransportAppData = {
|
|
390
|
+
localClosed: boolean;
|
|
391
|
+
iceRestartStarted?: number;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
type VegaMediaSourceType = "mic" | "webcam" | "screenvideo" | "screenaudio";
|
|
395
|
+
|
|
396
|
+
type ConsumerAppData = {
|
|
397
|
+
sourceClientId: string;
|
|
398
|
+
screenShare: boolean;
|
|
399
|
+
streamId: string;
|
|
400
|
+
paused: boolean;
|
|
401
|
+
localPaused: boolean;
|
|
402
|
+
localClosed: boolean;
|
|
403
|
+
spatialLayer: number;
|
|
404
|
+
temporalLayer?: number;
|
|
405
|
+
source: VegaMediaSourceType;
|
|
406
|
+
screenshare: boolean;
|
|
407
|
+
colocation?: string;
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
type DataConsumerAppData = {
|
|
411
|
+
clientId: string;
|
|
412
|
+
producerId: string;
|
|
413
|
+
colocation?: string;
|
|
414
|
+
localClosed: boolean;
|
|
415
|
+
};
|
|
416
|
+
|
|
388
417
|
type VegaAnalytics = {
|
|
389
418
|
vegaUnknownResponse: number;
|
|
390
419
|
vegaRequestTimeout: number;
|
|
@@ -1648,7 +1677,7 @@ declare function createVegaConnectionManager(config: {
|
|
|
1648
1677
|
};
|
|
1649
1678
|
|
|
1650
1679
|
declare class VegaRtcManager implements RtcManager {
|
|
1651
|
-
_selfId:
|
|
1680
|
+
_selfId: string;
|
|
1652
1681
|
_room: any;
|
|
1653
1682
|
_roomSessionId: any;
|
|
1654
1683
|
_emitter: any;
|
|
@@ -1661,8 +1690,8 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1661
1690
|
_micAnalyserDebugger: any;
|
|
1662
1691
|
_mediasoupDeviceInitializedAsync: Promise<Device | null>;
|
|
1663
1692
|
_routerRtpCapabilities: RtpCapabilities | null;
|
|
1664
|
-
_sendTransport
|
|
1665
|
-
_receiveTransport
|
|
1693
|
+
_sendTransport?: null | Transport<TransportAppData>;
|
|
1694
|
+
_receiveTransport?: null | Transport<TransportAppData>;
|
|
1666
1695
|
_clientStates: Map<string, ClientState>;
|
|
1667
1696
|
_streamIdToVideoConsumerId: any;
|
|
1668
1697
|
_streamIdToVideoResolution: Map<string, {
|
|
@@ -1721,7 +1750,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1721
1750
|
_connect(): void;
|
|
1722
1751
|
_onClose(): void;
|
|
1723
1752
|
_join(): Promise<void>;
|
|
1724
|
-
_createTransport(send:
|
|
1753
|
+
_createTransport(send: boolean): Promise<void>;
|
|
1725
1754
|
_restartIce(direction: VegaTransportDirection, transportId: string, retried?: number): Promise<void>;
|
|
1726
1755
|
_internalSendMic(): Promise<void>;
|
|
1727
1756
|
_internalSetupMicScore(): Promise<void>;
|
|
@@ -1741,7 +1770,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1741
1770
|
_internalSendScreenAudio(): Promise<void>;
|
|
1742
1771
|
_replaceScreenAudioTrack(): Promise<void>;
|
|
1743
1772
|
_sendScreenAudio(track: MediaStreamTrack): Promise<void>;
|
|
1744
|
-
_stopProducer(producer:
|
|
1773
|
+
_stopProducer(producer: Producer): void;
|
|
1745
1774
|
_getAreTooManyAlreadyPresenting(): boolean;
|
|
1746
1775
|
isInitializedWith({ selfId, roomName, isSfu }: {
|
|
1747
1776
|
selfId: string;
|
|
@@ -1788,7 +1817,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1788
1817
|
_monitorAudioTrack(track: any): void;
|
|
1789
1818
|
_monitorVideoTrack(track: MediaStreamTrack): void;
|
|
1790
1819
|
_onMessage(message: any): Promise<void>;
|
|
1791
|
-
_onConsumerReady(options:
|
|
1820
|
+
_onConsumerReady(options: ConsumerOptions<ConsumerAppData>): Promise<void>;
|
|
1792
1821
|
_onConsumerClosed({ consumerId, reason }: {
|
|
1793
1822
|
consumerId: string;
|
|
1794
1823
|
reason: string;
|
|
@@ -1809,7 +1838,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1809
1838
|
kind: string;
|
|
1810
1839
|
score: number;
|
|
1811
1840
|
}): void;
|
|
1812
|
-
_onDataConsumerReady(options:
|
|
1841
|
+
_onDataConsumerReady(options: DataConsumerOptions<DataConsumerAppData>): Promise<void>;
|
|
1813
1842
|
_onDataConsumerClosed({ dataConsumerId, reason }: {
|
|
1814
1843
|
dataConsumerId: string;
|
|
1815
1844
|
reason: string;
|
|
@@ -1817,7 +1846,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1817
1846
|
_onDominantSpeaker({ consumerId }: {
|
|
1818
1847
|
consumerId: string;
|
|
1819
1848
|
}): void;
|
|
1820
|
-
_consumerClosedCleanup(consumer:
|
|
1849
|
+
_consumerClosedCleanup(consumer: Consumer<ConsumerAppData>): void;
|
|
1821
1850
|
_syncIncomingStreamsWithPWA(clientId: string): void;
|
|
1822
1851
|
_getOrCreateClientState(clientId: string): ClientState;
|
|
1823
1852
|
_emitToPWA(eventName: string, data?: any): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Device } from 'mediasoup-client';
|
|
2
2
|
import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
|
|
3
3
|
import { RtpCapabilities } from 'mediasoup-client/lib/RtpParameters';
|
|
4
|
+
import { Transport, Producer, ConsumerOptions, DataConsumerOptions, Consumer } from 'mediasoup-client/lib/types';
|
|
4
5
|
|
|
5
6
|
interface MediaStreamTrackWithDenoiserContext extends MediaStreamTrack {
|
|
6
7
|
_denoiserCtx?: AudioContext;
|
|
@@ -385,6 +386,34 @@ declare function sortCodecs(codecs: Codec[], features: {
|
|
|
385
386
|
|
|
386
387
|
type VegaTransportDirection = "send" | "recv";
|
|
387
388
|
|
|
389
|
+
type TransportAppData = {
|
|
390
|
+
localClosed: boolean;
|
|
391
|
+
iceRestartStarted?: number;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
type VegaMediaSourceType = "mic" | "webcam" | "screenvideo" | "screenaudio";
|
|
395
|
+
|
|
396
|
+
type ConsumerAppData = {
|
|
397
|
+
sourceClientId: string;
|
|
398
|
+
screenShare: boolean;
|
|
399
|
+
streamId: string;
|
|
400
|
+
paused: boolean;
|
|
401
|
+
localPaused: boolean;
|
|
402
|
+
localClosed: boolean;
|
|
403
|
+
spatialLayer: number;
|
|
404
|
+
temporalLayer?: number;
|
|
405
|
+
source: VegaMediaSourceType;
|
|
406
|
+
screenshare: boolean;
|
|
407
|
+
colocation?: string;
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
type DataConsumerAppData = {
|
|
411
|
+
clientId: string;
|
|
412
|
+
producerId: string;
|
|
413
|
+
colocation?: string;
|
|
414
|
+
localClosed: boolean;
|
|
415
|
+
};
|
|
416
|
+
|
|
388
417
|
type VegaAnalytics = {
|
|
389
418
|
vegaUnknownResponse: number;
|
|
390
419
|
vegaRequestTimeout: number;
|
|
@@ -1648,7 +1677,7 @@ declare function createVegaConnectionManager(config: {
|
|
|
1648
1677
|
};
|
|
1649
1678
|
|
|
1650
1679
|
declare class VegaRtcManager implements RtcManager {
|
|
1651
|
-
_selfId:
|
|
1680
|
+
_selfId: string;
|
|
1652
1681
|
_room: any;
|
|
1653
1682
|
_roomSessionId: any;
|
|
1654
1683
|
_emitter: any;
|
|
@@ -1661,8 +1690,8 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1661
1690
|
_micAnalyserDebugger: any;
|
|
1662
1691
|
_mediasoupDeviceInitializedAsync: Promise<Device | null>;
|
|
1663
1692
|
_routerRtpCapabilities: RtpCapabilities | null;
|
|
1664
|
-
_sendTransport
|
|
1665
|
-
_receiveTransport
|
|
1693
|
+
_sendTransport?: null | Transport<TransportAppData>;
|
|
1694
|
+
_receiveTransport?: null | Transport<TransportAppData>;
|
|
1666
1695
|
_clientStates: Map<string, ClientState>;
|
|
1667
1696
|
_streamIdToVideoConsumerId: any;
|
|
1668
1697
|
_streamIdToVideoResolution: Map<string, {
|
|
@@ -1721,7 +1750,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1721
1750
|
_connect(): void;
|
|
1722
1751
|
_onClose(): void;
|
|
1723
1752
|
_join(): Promise<void>;
|
|
1724
|
-
_createTransport(send:
|
|
1753
|
+
_createTransport(send: boolean): Promise<void>;
|
|
1725
1754
|
_restartIce(direction: VegaTransportDirection, transportId: string, retried?: number): Promise<void>;
|
|
1726
1755
|
_internalSendMic(): Promise<void>;
|
|
1727
1756
|
_internalSetupMicScore(): Promise<void>;
|
|
@@ -1741,7 +1770,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1741
1770
|
_internalSendScreenAudio(): Promise<void>;
|
|
1742
1771
|
_replaceScreenAudioTrack(): Promise<void>;
|
|
1743
1772
|
_sendScreenAudio(track: MediaStreamTrack): Promise<void>;
|
|
1744
|
-
_stopProducer(producer:
|
|
1773
|
+
_stopProducer(producer: Producer): void;
|
|
1745
1774
|
_getAreTooManyAlreadyPresenting(): boolean;
|
|
1746
1775
|
isInitializedWith({ selfId, roomName, isSfu }: {
|
|
1747
1776
|
selfId: string;
|
|
@@ -1788,7 +1817,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1788
1817
|
_monitorAudioTrack(track: any): void;
|
|
1789
1818
|
_monitorVideoTrack(track: MediaStreamTrack): void;
|
|
1790
1819
|
_onMessage(message: any): Promise<void>;
|
|
1791
|
-
_onConsumerReady(options:
|
|
1820
|
+
_onConsumerReady(options: ConsumerOptions<ConsumerAppData>): Promise<void>;
|
|
1792
1821
|
_onConsumerClosed({ consumerId, reason }: {
|
|
1793
1822
|
consumerId: string;
|
|
1794
1823
|
reason: string;
|
|
@@ -1809,7 +1838,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1809
1838
|
kind: string;
|
|
1810
1839
|
score: number;
|
|
1811
1840
|
}): void;
|
|
1812
|
-
_onDataConsumerReady(options:
|
|
1841
|
+
_onDataConsumerReady(options: DataConsumerOptions<DataConsumerAppData>): Promise<void>;
|
|
1813
1842
|
_onDataConsumerClosed({ dataConsumerId, reason }: {
|
|
1814
1843
|
dataConsumerId: string;
|
|
1815
1844
|
reason: string;
|
|
@@ -1817,7 +1846,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1817
1846
|
_onDominantSpeaker({ consumerId }: {
|
|
1818
1847
|
consumerId: string;
|
|
1819
1848
|
}): void;
|
|
1820
|
-
_consumerClosedCleanup(consumer:
|
|
1849
|
+
_consumerClosedCleanup(consumer: Consumer<ConsumerAppData>): void;
|
|
1821
1850
|
_syncIncomingStreamsWithPWA(clientId: string): void;
|
|
1822
1851
|
_getOrCreateClientState(clientId: string): ClientState;
|
|
1823
1852
|
_emitToPWA(eventName: string, data?: any): void;
|
package/dist/index.mjs
CHANGED
|
@@ -1452,7 +1452,7 @@ if (window.RTCPeerConnection) {
|
|
|
1452
1452
|
PatchedRTCPeerConnection.prototype = OriginalRTCPeerConnection.prototype;
|
|
1453
1453
|
window.RTCPeerConnection = PatchedRTCPeerConnection;
|
|
1454
1454
|
}
|
|
1455
|
-
const getCurrentPeerConnections = () => peerConnections;
|
|
1455
|
+
const getCurrentPeerConnections = () => peerConnections.filter((p) => p.connectionState !== "closed");
|
|
1456
1456
|
const getPeerConnectionIndex = (pc) => { var _a; return (_a = peerConnectionData.get(pc)) === null || _a === void 0 ? void 0 : _a.index; };
|
|
1457
1457
|
const setPeerConnectionsForTests = (pcs) => (peerConnections = pcs);
|
|
1458
1458
|
|
|
@@ -1496,7 +1496,7 @@ const getPeerConnectionsWithStatsReports = (pcDataByPc = PC_DATA_BY_PC) => Promi
|
|
|
1496
1496
|
}
|
|
1497
1497
|
});
|
|
1498
1498
|
if (missingSsrcs) {
|
|
1499
|
-
const sendersAndReceivers = [...pc.getSenders(), ...pc.getReceivers()];
|
|
1499
|
+
const sendersAndReceivers = [...pc.getSenders(), ...pc.getReceivers()].filter((o) => o.track);
|
|
1500
1500
|
const reports = yield Promise.all(sendersAndReceivers.map((o) => o.getStats()));
|
|
1501
1501
|
reports.forEach((tReport, index) => {
|
|
1502
1502
|
tReport.forEach((stats) => {
|
|
@@ -1506,8 +1506,8 @@ const getPeerConnectionsWithStatsReports = (pcDataByPc = PC_DATA_BY_PC) => Promi
|
|
|
1506
1506
|
});
|
|
1507
1507
|
});
|
|
1508
1508
|
missingSsrcs.forEach((ssrc) => {
|
|
1509
|
-
numMissingTrackSsrcLookups++;
|
|
1510
1509
|
if (!pcData.ssrcToTrackId[ssrc]) {
|
|
1510
|
+
numMissingTrackSsrcLookups++;
|
|
1511
1511
|
pcData.ssrcToTrackId[ssrc] = "?" + ssrc;
|
|
1512
1512
|
}
|
|
1513
1513
|
});
|
|
@@ -4760,7 +4760,9 @@ class VegaRtcManager {
|
|
|
4760
4760
|
}
|
|
4761
4761
|
const { iceRestartStarted } = transport.appData;
|
|
4762
4762
|
const now = Date.now();
|
|
4763
|
-
if (
|
|
4763
|
+
if (iceRestartStarted &&
|
|
4764
|
+
Number.isFinite(iceRestartStarted) &&
|
|
4765
|
+
now - iceRestartStarted < RESTARTICE_ERROR_RETRY_THRESHOLD_IN_MS) {
|
|
4764
4766
|
return;
|
|
4765
4767
|
}
|
|
4766
4768
|
transport.appData.iceRestartStarted = now;
|
|
@@ -4868,6 +4870,9 @@ class VegaRtcManager {
|
|
|
4868
4870
|
this._micScoreProducerPromise = null;
|
|
4869
4871
|
return;
|
|
4870
4872
|
}
|
|
4873
|
+
if (!this._sendTransport) {
|
|
4874
|
+
throw new Error("No send transport when attempting to create data producer");
|
|
4875
|
+
}
|
|
4871
4876
|
const producer = yield this._sendTransport.produceData({
|
|
4872
4877
|
ordered: false,
|
|
4873
4878
|
maxPacketLifeTime: 3000,
|
|
@@ -5005,6 +5010,9 @@ class VegaRtcManager {
|
|
|
5005
5010
|
var _a;
|
|
5006
5011
|
try {
|
|
5007
5012
|
const currentPaused = this._webcamPaused;
|
|
5013
|
+
if (!this._sendTransport) {
|
|
5014
|
+
throw new Error("No send transport when attempting to create producer");
|
|
5015
|
+
}
|
|
5008
5016
|
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._webcamTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5009
5017
|
streamId: OUTBOUND_CAM_OUTBOUND_STREAM_ID,
|
|
5010
5018
|
sourceClientId: this._selfId,
|
|
@@ -5633,6 +5641,9 @@ class VegaRtcManager {
|
|
|
5633
5641
|
logger$2.info("_onConsumerReady()", { id: options.id, producerId: options.producerId });
|
|
5634
5642
|
let consumer;
|
|
5635
5643
|
try {
|
|
5644
|
+
if (!this._receiveTransport) {
|
|
5645
|
+
throw new Error("No receive transport when attempting to create consumer");
|
|
5646
|
+
}
|
|
5636
5647
|
consumer = yield this._receiveTransport.consume(options);
|
|
5637
5648
|
}
|
|
5638
5649
|
catch (error) {
|
|
@@ -5729,7 +5740,10 @@ class VegaRtcManager {
|
|
|
5729
5740
|
}
|
|
5730
5741
|
_onDataConsumerReady(options) {
|
|
5731
5742
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5732
|
-
logger$2.info("_onDataConsumerReady()", { id: options.id,
|
|
5743
|
+
logger$2.info("_onDataConsumerReady()", { id: options.id, dataProducerId: options.dataProducerId });
|
|
5744
|
+
if (!this._receiveTransport) {
|
|
5745
|
+
throw new Error("No receive transport when attempting to create data consumer");
|
|
5746
|
+
}
|
|
5733
5747
|
const consumer = yield this._receiveTransport.consumeData(options);
|
|
5734
5748
|
this._dataConsumers.set(consumer.id, consumer);
|
|
5735
5749
|
consumer.once("close", () => {
|
package/dist/legacy-esm.js
CHANGED
|
@@ -1452,7 +1452,7 @@ if (window.RTCPeerConnection) {
|
|
|
1452
1452
|
PatchedRTCPeerConnection.prototype = OriginalRTCPeerConnection.prototype;
|
|
1453
1453
|
window.RTCPeerConnection = PatchedRTCPeerConnection;
|
|
1454
1454
|
}
|
|
1455
|
-
const getCurrentPeerConnections = () => peerConnections;
|
|
1455
|
+
const getCurrentPeerConnections = () => peerConnections.filter((p) => p.connectionState !== "closed");
|
|
1456
1456
|
const getPeerConnectionIndex = (pc) => { var _a; return (_a = peerConnectionData.get(pc)) === null || _a === void 0 ? void 0 : _a.index; };
|
|
1457
1457
|
const setPeerConnectionsForTests = (pcs) => (peerConnections = pcs);
|
|
1458
1458
|
|
|
@@ -1496,7 +1496,7 @@ const getPeerConnectionsWithStatsReports = (pcDataByPc = PC_DATA_BY_PC) => Promi
|
|
|
1496
1496
|
}
|
|
1497
1497
|
});
|
|
1498
1498
|
if (missingSsrcs) {
|
|
1499
|
-
const sendersAndReceivers = [...pc.getSenders(), ...pc.getReceivers()];
|
|
1499
|
+
const sendersAndReceivers = [...pc.getSenders(), ...pc.getReceivers()].filter((o) => o.track);
|
|
1500
1500
|
const reports = yield Promise.all(sendersAndReceivers.map((o) => o.getStats()));
|
|
1501
1501
|
reports.forEach((tReport, index) => {
|
|
1502
1502
|
tReport.forEach((stats) => {
|
|
@@ -1506,8 +1506,8 @@ const getPeerConnectionsWithStatsReports = (pcDataByPc = PC_DATA_BY_PC) => Promi
|
|
|
1506
1506
|
});
|
|
1507
1507
|
});
|
|
1508
1508
|
missingSsrcs.forEach((ssrc) => {
|
|
1509
|
-
numMissingTrackSsrcLookups++;
|
|
1510
1509
|
if (!pcData.ssrcToTrackId[ssrc]) {
|
|
1510
|
+
numMissingTrackSsrcLookups++;
|
|
1511
1511
|
pcData.ssrcToTrackId[ssrc] = "?" + ssrc;
|
|
1512
1512
|
}
|
|
1513
1513
|
});
|
|
@@ -4760,7 +4760,9 @@ class VegaRtcManager {
|
|
|
4760
4760
|
}
|
|
4761
4761
|
const { iceRestartStarted } = transport.appData;
|
|
4762
4762
|
const now = Date.now();
|
|
4763
|
-
if (
|
|
4763
|
+
if (iceRestartStarted &&
|
|
4764
|
+
Number.isFinite(iceRestartStarted) &&
|
|
4765
|
+
now - iceRestartStarted < RESTARTICE_ERROR_RETRY_THRESHOLD_IN_MS) {
|
|
4764
4766
|
return;
|
|
4765
4767
|
}
|
|
4766
4768
|
transport.appData.iceRestartStarted = now;
|
|
@@ -4868,6 +4870,9 @@ class VegaRtcManager {
|
|
|
4868
4870
|
this._micScoreProducerPromise = null;
|
|
4869
4871
|
return;
|
|
4870
4872
|
}
|
|
4873
|
+
if (!this._sendTransport) {
|
|
4874
|
+
throw new Error("No send transport when attempting to create data producer");
|
|
4875
|
+
}
|
|
4871
4876
|
const producer = yield this._sendTransport.produceData({
|
|
4872
4877
|
ordered: false,
|
|
4873
4878
|
maxPacketLifeTime: 3000,
|
|
@@ -5005,6 +5010,9 @@ class VegaRtcManager {
|
|
|
5005
5010
|
var _a;
|
|
5006
5011
|
try {
|
|
5007
5012
|
const currentPaused = this._webcamPaused;
|
|
5013
|
+
if (!this._sendTransport) {
|
|
5014
|
+
throw new Error("No send transport when attempting to create producer");
|
|
5015
|
+
}
|
|
5008
5016
|
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._webcamTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5009
5017
|
streamId: OUTBOUND_CAM_OUTBOUND_STREAM_ID,
|
|
5010
5018
|
sourceClientId: this._selfId,
|
|
@@ -5633,6 +5641,9 @@ class VegaRtcManager {
|
|
|
5633
5641
|
logger$2.info("_onConsumerReady()", { id: options.id, producerId: options.producerId });
|
|
5634
5642
|
let consumer;
|
|
5635
5643
|
try {
|
|
5644
|
+
if (!this._receiveTransport) {
|
|
5645
|
+
throw new Error("No receive transport when attempting to create consumer");
|
|
5646
|
+
}
|
|
5636
5647
|
consumer = yield this._receiveTransport.consume(options);
|
|
5637
5648
|
}
|
|
5638
5649
|
catch (error) {
|
|
@@ -5729,7 +5740,10 @@ class VegaRtcManager {
|
|
|
5729
5740
|
}
|
|
5730
5741
|
_onDataConsumerReady(options) {
|
|
5731
5742
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5732
|
-
logger$2.info("_onDataConsumerReady()", { id: options.id,
|
|
5743
|
+
logger$2.info("_onDataConsumerReady()", { id: options.id, dataProducerId: options.dataProducerId });
|
|
5744
|
+
if (!this._receiveTransport) {
|
|
5745
|
+
throw new Error("No receive transport when attempting to create data consumer");
|
|
5746
|
+
}
|
|
5733
5747
|
const consumer = yield this._receiveTransport.consumeData(options);
|
|
5734
5748
|
this._dataConsumers.set(consumer.id, consumer);
|
|
5735
5749
|
consumer.once("close", () => {
|