@webex/web-client-media-engine 3.20.4 → 3.21.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/cjs/index.js +67 -23
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +67 -23
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +9 -4
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -2361,7 +2361,8 @@ var ConnectionState;
|
|
|
2361
2361
|
})(ConnectionState || (ConnectionState = {}));
|
|
2362
2362
|
var ConnectionStateEvents;
|
|
2363
2363
|
(function (ConnectionStateEvents) {
|
|
2364
|
-
ConnectionStateEvents["
|
|
2364
|
+
ConnectionStateEvents["PeerConnectionStateChanged"] = "PeerConnectionStateChanged";
|
|
2365
|
+
ConnectionStateEvents["IceConnectionStateChanged"] = "IceConnectionStateChanged";
|
|
2365
2366
|
})(ConnectionStateEvents || (ConnectionStateEvents = {}));
|
|
2366
2367
|
/**
|
|
2367
2368
|
* Listens on the connection's ICE and DTLS state changes and emits a single
|
|
@@ -2377,29 +2378,20 @@ class ConnectionStateHandler extends EventEmitter$4 {
|
|
|
2377
2378
|
constructor(getCurrentStatesCallback) {
|
|
2378
2379
|
super();
|
|
2379
2380
|
this.getCurrentStatesCallback = getCurrentStatesCallback;
|
|
2380
|
-
this.mediaConnectionState = this.evaluateMediaConnectionState();
|
|
2381
2381
|
}
|
|
2382
2382
|
/**
|
|
2383
2383
|
* Handler for connection state change.
|
|
2384
2384
|
*/
|
|
2385
|
-
|
|
2386
|
-
this.
|
|
2385
|
+
onPeerConnectionStateChange() {
|
|
2386
|
+
const state = this.getPeerConnectionState();
|
|
2387
|
+
this.emit(ConnectionStateEvents.PeerConnectionStateChanged, state);
|
|
2387
2388
|
}
|
|
2388
2389
|
/**
|
|
2389
2390
|
* Handler for ice connection state change.
|
|
2390
2391
|
*/
|
|
2391
2392
|
onIceConnectionStateChange() {
|
|
2392
|
-
this.
|
|
2393
|
-
|
|
2394
|
-
/**
|
|
2395
|
-
* Method to be called whenever ice connection or dtls connection state is changed.
|
|
2396
|
-
*/
|
|
2397
|
-
handleAnyConnectionStateChange() {
|
|
2398
|
-
const newConnectionState = this.evaluateMediaConnectionState();
|
|
2399
|
-
if (newConnectionState !== this.mediaConnectionState) {
|
|
2400
|
-
this.mediaConnectionState = newConnectionState;
|
|
2401
|
-
this.emit(ConnectionStateEvents.ConnectionStateChanged, this.mediaConnectionState);
|
|
2402
|
-
}
|
|
2393
|
+
const state = this.getIceConnectionState();
|
|
2394
|
+
this.emit(ConnectionStateEvents.IceConnectionStateChanged, state);
|
|
2403
2395
|
}
|
|
2404
2396
|
/**
|
|
2405
2397
|
* Evaluates the overall connection state based on peer connection's
|
|
@@ -2437,8 +2429,26 @@ class ConnectionStateHandler extends EventEmitter$4 {
|
|
|
2437
2429
|
*
|
|
2438
2430
|
* @returns Current connection state.
|
|
2439
2431
|
*/
|
|
2432
|
+
getPeerConnectionState() {
|
|
2433
|
+
const { connectionState } = this.getCurrentStatesCallback();
|
|
2434
|
+
return connectionState;
|
|
2435
|
+
}
|
|
2436
|
+
/**
|
|
2437
|
+
* Gets current ice connection state.
|
|
2438
|
+
*
|
|
2439
|
+
* @returns Current ice connection state.
|
|
2440
|
+
*/
|
|
2441
|
+
getIceConnectionState() {
|
|
2442
|
+
const { iceState } = this.getCurrentStatesCallback();
|
|
2443
|
+
return iceState;
|
|
2444
|
+
}
|
|
2445
|
+
/**
|
|
2446
|
+
* Gets current overall connection state.
|
|
2447
|
+
*
|
|
2448
|
+
* @returns Current overall connection state.
|
|
2449
|
+
*/
|
|
2440
2450
|
getConnectionState() {
|
|
2441
|
-
return this.
|
|
2451
|
+
return this.evaluateMediaConnectionState();
|
|
2442
2452
|
}
|
|
2443
2453
|
}
|
|
2444
2454
|
ConnectionStateHandler.Events = ConnectionStateEvents;
|
|
@@ -5820,7 +5830,8 @@ var PeerConnectionEvents;
|
|
|
5820
5830
|
(function (PeerConnectionEvents) {
|
|
5821
5831
|
PeerConnectionEvents["IceGatheringStateChange"] = "icegatheringstatechange";
|
|
5822
5832
|
PeerConnectionEvents["IceCandidate"] = "icecandidate";
|
|
5823
|
-
PeerConnectionEvents["
|
|
5833
|
+
PeerConnectionEvents["PeerConnectionStateChange"] = "peerconnectionstatechange";
|
|
5834
|
+
PeerConnectionEvents["IceConnectionStateChange"] = "iceconnectionstatechange";
|
|
5824
5835
|
PeerConnectionEvents["CreateOfferOnSuccess"] = "createofferonsuccess";
|
|
5825
5836
|
PeerConnectionEvents["CreateAnswerOnSuccess"] = "createansweronsuccess";
|
|
5826
5837
|
PeerConnectionEvents["SetLocalDescriptionOnSuccess"] = "setlocaldescriptiononsuccess";
|
|
@@ -5845,19 +5856,23 @@ class PeerConnection extends EventEmitter$4 {
|
|
|
5845
5856
|
iceState: this.pc.iceConnectionState,
|
|
5846
5857
|
};
|
|
5847
5858
|
});
|
|
5848
|
-
this.connectionStateHandler.on(ConnectionStateHandler.Events.
|
|
5849
|
-
this.emit(PeerConnection.Events.
|
|
5859
|
+
this.connectionStateHandler.on(ConnectionStateHandler.Events.PeerConnectionStateChanged, (state) => {
|
|
5860
|
+
this.emit(PeerConnection.Events.PeerConnectionStateChange, state);
|
|
5861
|
+
});
|
|
5862
|
+
this.connectionStateHandler.on(ConnectionStateHandler.Events.IceConnectionStateChanged, (state) => {
|
|
5863
|
+
this.emit(PeerConnection.Events.IceConnectionStateChange, state);
|
|
5850
5864
|
});
|
|
5851
5865
|
// Forward the connection state related events to connection state handler
|
|
5852
5866
|
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
5853
5867
|
this.pc.oniceconnectionstatechange = () => this.connectionStateHandler.onIceConnectionStateChange();
|
|
5854
5868
|
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
5855
|
-
this.pc.onconnectionstatechange = () => this.connectionStateHandler.
|
|
5869
|
+
this.pc.onconnectionstatechange = () => this.connectionStateHandler.onPeerConnectionStateChange();
|
|
5856
5870
|
// Subscribe to underlying PeerConnection events and emit them via the EventEmitter
|
|
5857
5871
|
/* eslint-disable jsdoc/require-jsdoc */
|
|
5858
5872
|
this.pc.onicegatheringstatechange = (ev) => {
|
|
5859
5873
|
this.emit(PeerConnection.Events.IceGatheringStateChange, ev);
|
|
5860
5874
|
};
|
|
5875
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
5861
5876
|
this.pc.onicecandidate = (ev) => {
|
|
5862
5877
|
this.emit(PeerConnection.Events.IceCandidate, ev);
|
|
5863
5878
|
};
|
|
@@ -5878,6 +5893,22 @@ class PeerConnection extends EventEmitter$4 {
|
|
|
5878
5893
|
getConnectionState() {
|
|
5879
5894
|
return this.connectionStateHandler.getConnectionState();
|
|
5880
5895
|
}
|
|
5896
|
+
/**
|
|
5897
|
+
* Gets the connection state of the underlying RTCPeerConnection.
|
|
5898
|
+
*
|
|
5899
|
+
* @returns The underlying RTCPeerConnection connection state.
|
|
5900
|
+
*/
|
|
5901
|
+
getPeerConnectionState() {
|
|
5902
|
+
return this.connectionStateHandler.getPeerConnectionState();
|
|
5903
|
+
}
|
|
5904
|
+
/**
|
|
5905
|
+
* Gets the ICE connection state of the underlying RTCPeerConnection.
|
|
5906
|
+
*
|
|
5907
|
+
* @returns The underlying RTCPeerConnection ICE connection state.
|
|
5908
|
+
*/
|
|
5909
|
+
getIceConnectionState() {
|
|
5910
|
+
return this.connectionStateHandler.getIceConnectionState();
|
|
5911
|
+
}
|
|
5881
5912
|
/**
|
|
5882
5913
|
* Adds a new media track to the set of tracks which will be transmitted to the other peer.
|
|
5883
5914
|
*
|
|
@@ -14698,7 +14729,8 @@ var MultistreamConnectionEventNames;
|
|
|
14698
14729
|
MultistreamConnectionEventNames["VideoSourceCountUpdate"] = "video-source-count-update";
|
|
14699
14730
|
MultistreamConnectionEventNames["AudioSourceCountUpdate"] = "audio-source-count-update";
|
|
14700
14731
|
MultistreamConnectionEventNames["ActiveSpeakerNotification"] = "active-speaker-notification";
|
|
14701
|
-
MultistreamConnectionEventNames["
|
|
14732
|
+
MultistreamConnectionEventNames["PeerConnectionStateUpdate"] = "peer-connection-state-update";
|
|
14733
|
+
MultistreamConnectionEventNames["IceConnectionStateUpdate"] = "ice-connection-state-update";
|
|
14702
14734
|
MultistreamConnectionEventNames["IceGatheringStateUpdate"] = "ice-gathering-state-update";
|
|
14703
14735
|
MultistreamConnectionEventNames["NegotiationNeeded"] = "negotiation-needed";
|
|
14704
14736
|
MultistreamConnectionEventNames["CreateOfferOnSuccess"] = "createofferonsuccess";
|
|
@@ -14752,8 +14784,11 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14752
14784
|
this.createDataChannel();
|
|
14753
14785
|
}
|
|
14754
14786
|
propagatePeerConnectionEvents() {
|
|
14755
|
-
this.pc.on(PeerConnection.Events.
|
|
14756
|
-
this.emit(MultistreamConnectionEventNames.
|
|
14787
|
+
this.pc.on(PeerConnection.Events.PeerConnectionStateChange, (state) => {
|
|
14788
|
+
this.emit(MultistreamConnectionEventNames.PeerConnectionStateUpdate, state);
|
|
14789
|
+
});
|
|
14790
|
+
this.pc.on(PeerConnection.Events.IceConnectionStateChange, (state) => {
|
|
14791
|
+
this.emit(MultistreamConnectionEventNames.IceConnectionStateUpdate, state);
|
|
14757
14792
|
});
|
|
14758
14793
|
this.pc.on(PeerConnection.Events.CreateOfferOnSuccess, (description) => {
|
|
14759
14794
|
this.emit(MultistreamConnectionEventNames.CreateOfferOnSuccess, description);
|
|
@@ -14774,6 +14809,15 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14774
14809
|
getConnectionState() {
|
|
14775
14810
|
return this.pc.getConnectionState();
|
|
14776
14811
|
}
|
|
14812
|
+
getPeerConnectionState() {
|
|
14813
|
+
return this.pc.getPeerConnectionState();
|
|
14814
|
+
}
|
|
14815
|
+
getIceConnectionState() {
|
|
14816
|
+
return this.pc.getIceConnectionState();
|
|
14817
|
+
}
|
|
14818
|
+
getCurrentConnectionType() {
|
|
14819
|
+
return this.pc.getCurrentConnectionType();
|
|
14820
|
+
}
|
|
14777
14821
|
getIceGatheringState() {
|
|
14778
14822
|
return this.pc.iceGatheringState;
|
|
14779
14823
|
}
|