@webex/web-client-media-engine 3.31.4 → 3.31.6
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 +39 -12
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +39 -12
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -5922,6 +5922,7 @@ class PeerConnection extends EventEmitter$4 {
|
|
|
5922
5922
|
*/
|
|
5923
5923
|
constructor(configuration) {
|
|
5924
5924
|
super();
|
|
5925
|
+
this.iceCandidates = [];
|
|
5925
5926
|
logger$3.log('PeerConnection init');
|
|
5926
5927
|
this.pc = createRTCPeerConnection(configuration);
|
|
5927
5928
|
this.connectionStateHandler = new ConnectionStateHandler(() => {
|
|
@@ -5948,6 +5949,9 @@ class PeerConnection extends EventEmitter$4 {
|
|
|
5948
5949
|
};
|
|
5949
5950
|
/* eslint-disable jsdoc/require-jsdoc */
|
|
5950
5951
|
this.pc.onicecandidate = (ev) => {
|
|
5952
|
+
if (ev.candidate) {
|
|
5953
|
+
this.iceCandidates.push(ev.candidate);
|
|
5954
|
+
}
|
|
5951
5955
|
this.emit(PeerConnection.Events.IceCandidate, ev);
|
|
5952
5956
|
};
|
|
5953
5957
|
this.pc.onicecandidateerror = (ev) => {
|
|
@@ -5986,6 +5990,14 @@ class PeerConnection extends EventEmitter$4 {
|
|
|
5986
5990
|
getIceConnectionState() {
|
|
5987
5991
|
return this.connectionStateHandler.getIceConnectionState();
|
|
5988
5992
|
}
|
|
5993
|
+
/**
|
|
5994
|
+
* Gets the list of ICE candidates that have been gathered.
|
|
5995
|
+
*
|
|
5996
|
+
* @returns An array of RTCIceCandidate objects representing the ICE candidates.
|
|
5997
|
+
*/
|
|
5998
|
+
getIceCandidates() {
|
|
5999
|
+
return this.iceCandidates;
|
|
6000
|
+
}
|
|
5989
6001
|
/**
|
|
5990
6002
|
* Adds a new media track to the set of tracks which will be transmitted to the other peer.
|
|
5991
6003
|
*
|
|
@@ -14510,6 +14522,7 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
14510
14522
|
this.rtxEnabled = false;
|
|
14511
14523
|
this.dtxDisabled = true;
|
|
14512
14524
|
this.streamMuteStateChange = new TypedEvent();
|
|
14525
|
+
this.streamReadyStateChanged = new TypedEvent();
|
|
14513
14526
|
this.streamPublishStateChange = new TypedEvent();
|
|
14514
14527
|
this.negotiationNeeded = new TypedEvent();
|
|
14515
14528
|
this.namedMediaGroupsChange = new TypedEvent();
|
|
@@ -14523,6 +14536,7 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
14523
14536
|
this.handleTrackChange = this.handleTrackChange.bind(this);
|
|
14524
14537
|
this.handleStreamConstraintsChange = this.handleStreamConstraintsChange.bind(this);
|
|
14525
14538
|
this.handleStreamMuteStateChange = this.handleStreamMuteStateChange.bind(this);
|
|
14539
|
+
this.handleStreamEnded = this.handleStreamEnded.bind(this);
|
|
14526
14540
|
}
|
|
14527
14541
|
replaceSenderSource(stream) {
|
|
14528
14542
|
var _a, _b;
|
|
@@ -14554,6 +14568,9 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
14554
14568
|
handleStreamMuteStateChange() {
|
|
14555
14569
|
this.streamMuteStateChange.emit();
|
|
14556
14570
|
}
|
|
14571
|
+
handleStreamEnded() {
|
|
14572
|
+
this.streamReadyStateChanged.emit();
|
|
14573
|
+
}
|
|
14557
14574
|
get requested() {
|
|
14558
14575
|
return this.requestedIdEncodingParamsMap.size > 0;
|
|
14559
14576
|
}
|
|
@@ -14576,6 +14593,7 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
14576
14593
|
oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(LocalStreamEventNames.ConstraintsChange, this.handleStreamConstraintsChange);
|
|
14577
14594
|
oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(LocalStreamEventNames.UserMuteStateChange, this.handleStreamMuteStateChange);
|
|
14578
14595
|
oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(LocalStreamEventNames.SystemMuteStateChange, this.handleStreamMuteStateChange);
|
|
14596
|
+
oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(StreamEventNames.Ended, this.handleStreamEnded);
|
|
14579
14597
|
if (this.requested) {
|
|
14580
14598
|
yield this.replaceSenderSource(newStream);
|
|
14581
14599
|
}
|
|
@@ -14584,12 +14602,17 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
14584
14602
|
newStream === null || newStream === void 0 ? void 0 : newStream.on(LocalStreamEventNames.ConstraintsChange, this.handleStreamConstraintsChange);
|
|
14585
14603
|
newStream === null || newStream === void 0 ? void 0 : newStream.on(LocalStreamEventNames.UserMuteStateChange, this.handleStreamMuteStateChange);
|
|
14586
14604
|
newStream === null || newStream === void 0 ? void 0 : newStream.on(LocalStreamEventNames.SystemMuteStateChange, this.handleStreamMuteStateChange);
|
|
14587
|
-
|
|
14588
|
-
|
|
14605
|
+
newStream === null || newStream === void 0 ? void 0 : newStream.on(StreamEventNames.Ended, this.handleStreamEnded);
|
|
14606
|
+
if ((!oldStream && newStream) || (oldStream && !newStream)) {
|
|
14589
14607
|
this.streamPublishStateChange.emit();
|
|
14590
14608
|
}
|
|
14591
|
-
|
|
14592
|
-
|
|
14609
|
+
if (oldStream && newStream) {
|
|
14610
|
+
if (oldStream.muted !== newStream.muted) {
|
|
14611
|
+
this.streamMuteStateChange.emit();
|
|
14612
|
+
}
|
|
14613
|
+
if (oldStream.readyState !== newStream.readyState) {
|
|
14614
|
+
this.streamReadyStateChanged.emit();
|
|
14615
|
+
}
|
|
14593
14616
|
}
|
|
14594
14617
|
});
|
|
14595
14618
|
}
|
|
@@ -14951,7 +14974,6 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14951
14974
|
this.midPredictor = new MidPredictor();
|
|
14952
14975
|
this.offerAnswerQueue = new AsyncQueue();
|
|
14953
14976
|
this.currentCreateOfferId = 0;
|
|
14954
|
-
this.iceCandidates = [];
|
|
14955
14977
|
this.metadata = { isMediaBypassEdge: false };
|
|
14956
14978
|
this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
|
|
14957
14979
|
logger.info(`Creating multistream connection with options ${JSON.stringify(this.options)}`);
|
|
@@ -15002,9 +15024,6 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
15002
15024
|
this.emit(MultistreamConnectionEventNames.IceGatheringStateUpdate, this.getIceGatheringState());
|
|
15003
15025
|
});
|
|
15004
15026
|
this.pc.on(PeerConnection.Events.IceCandidate, (candidate) => {
|
|
15005
|
-
if (candidate.candidate) {
|
|
15006
|
-
this.iceCandidates.push(candidate.candidate);
|
|
15007
|
-
}
|
|
15008
15027
|
this.emit(MultistreamConnectionEventNames.IceCandidate, candidate);
|
|
15009
15028
|
});
|
|
15010
15029
|
this.pc.on(PeerConnection.Events.IceCandidateError, (error) => {
|
|
@@ -15079,6 +15098,10 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
15079
15098
|
this.sendSourceAdvertisement(mediaType);
|
|
15080
15099
|
this.sendMediaRequestStatus(mediaType);
|
|
15081
15100
|
});
|
|
15101
|
+
transceiver.streamReadyStateChanged.on(() => {
|
|
15102
|
+
this.sendSourceAdvertisement(mediaType);
|
|
15103
|
+
this.sendMediaRequestStatus(mediaType);
|
|
15104
|
+
});
|
|
15082
15105
|
transceiver.negotiationNeeded.on((offerAnswerType) => {
|
|
15083
15106
|
if (offerAnswerType === OfferAnswerType.Remote) {
|
|
15084
15107
|
this.emit(MultistreamConnectionEventNames.NegotiationNeeded);
|
|
@@ -15312,9 +15335,12 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
15312
15335
|
}
|
|
15313
15336
|
}
|
|
15314
15337
|
sendSourceAdvertisement(mediaType) {
|
|
15315
|
-
var _a, _b;
|
|
15338
|
+
var _a, _b, _c;
|
|
15316
15339
|
const transceiver = this.getSendTransceiverOrThrow(mediaType);
|
|
15317
|
-
const numLiveSources = ((_a = transceiver.publishedStream) === null || _a === void 0 ? void 0 : _a.muted) === false
|
|
15340
|
+
const numLiveSources = ((_a = transceiver.publishedStream) === null || _a === void 0 ? void 0 : _a.muted) === false &&
|
|
15341
|
+
((_b = transceiver.publishedStream) === null || _b === void 0 ? void 0 : _b.readyState) === 'live'
|
|
15342
|
+
? 1
|
|
15343
|
+
: 0;
|
|
15318
15344
|
let task;
|
|
15319
15345
|
if (getMediaFamily(mediaType) === MediaFamily.Video) {
|
|
15320
15346
|
const sources = this.getVideoStreamStates(mediaType);
|
|
@@ -15338,7 +15364,7 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
15338
15364
|
.get(mediaType)) === null || _a === void 0 ? void 0 : _a.sendSourceAdvertisement(1, numLiveSources, mediaType === MediaType.AudioMain ? transceiver.namedMediaGroups : []);
|
|
15339
15365
|
};
|
|
15340
15366
|
}
|
|
15341
|
-
if (((
|
|
15367
|
+
if (((_c = this.dataChannel) === null || _c === void 0 ? void 0 : _c.readyState) === 'open') {
|
|
15342
15368
|
task();
|
|
15343
15369
|
}
|
|
15344
15370
|
else {
|
|
@@ -15611,9 +15637,10 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
15611
15637
|
});
|
|
15612
15638
|
}
|
|
15613
15639
|
if (BrowserInfo.isFirefox() && this.options.doFullIce) {
|
|
15640
|
+
const iceCandidates = this.pc.getIceCandidates();
|
|
15614
15641
|
parsedOffer.media.forEach((media) => {
|
|
15615
15642
|
media.iceInfo.candidates = [];
|
|
15616
|
-
|
|
15643
|
+
iceCandidates.forEach((iceCandidate) => {
|
|
15617
15644
|
const candidateLine = CandidateLine.fromSdpLine(iceCandidate.candidate.toString());
|
|
15618
15645
|
if (candidateLine) {
|
|
15619
15646
|
media.addLine(candidateLine);
|