@webex/web-client-media-engine 3.8.3 → 3.8.5
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 +38 -27
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +38 -27
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -13836,11 +13836,25 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
13836
13836
|
this.munger = munger;
|
|
13837
13837
|
this.mediaType = mediaType;
|
|
13838
13838
|
}
|
|
13839
|
+
replaceSenderSource(stream) {
|
|
13840
|
+
var _a, _b;
|
|
13841
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13842
|
+
const trackOrNull = (_a = stream === null || stream === void 0 ? void 0 : stream.outputStream.getTracks()[0]) !== null && _a !== void 0 ? _a : null;
|
|
13843
|
+
if (((_b = this.sender.track) === null || _b === void 0 ? void 0 : _b.id) !== (trackOrNull === null || trackOrNull === void 0 ? void 0 : trackOrNull.id)) {
|
|
13844
|
+
yield this.sender.replaceTrack(trackOrNull);
|
|
13845
|
+
if (trackOrNull) {
|
|
13846
|
+
logger.log(`Sender source for ${this.mediaType} replaced with track ID ${trackOrNull.id}`);
|
|
13847
|
+
}
|
|
13848
|
+
else {
|
|
13849
|
+
logger.log(`Sender source for ${this.mediaType} set to null, sender stopped`);
|
|
13850
|
+
}
|
|
13851
|
+
}
|
|
13852
|
+
});
|
|
13853
|
+
}
|
|
13839
13854
|
handleTrackChange() {
|
|
13840
|
-
var _a;
|
|
13841
13855
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13842
13856
|
if (this.requested) {
|
|
13843
|
-
yield this.
|
|
13857
|
+
yield this.replaceSenderSource(this.publishedStream);
|
|
13844
13858
|
}
|
|
13845
13859
|
});
|
|
13846
13860
|
}
|
|
@@ -13859,12 +13873,11 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
13859
13873
|
const _super = Object.create(null, {
|
|
13860
13874
|
replaceTransceiver: { get: () => super.replaceTransceiver }
|
|
13861
13875
|
});
|
|
13862
|
-
var _a;
|
|
13863
13876
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13864
13877
|
_super.replaceTransceiver.call(this, newRtcRtpTransceiver);
|
|
13865
13878
|
newRtcRtpTransceiver.direction = this.direction;
|
|
13866
13879
|
if (this.requested) {
|
|
13867
|
-
yield this.
|
|
13880
|
+
yield this.replaceSenderSource(this.publishedStream);
|
|
13868
13881
|
}
|
|
13869
13882
|
});
|
|
13870
13883
|
}
|
|
@@ -13875,7 +13888,7 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
13875
13888
|
oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(LocalStreamEventNames.ConstraintsChange, this.handleStreamConstraintsChange);
|
|
13876
13889
|
oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(StreamEventNames.MuteStateChange, this.handleStreamMuteStateChange);
|
|
13877
13890
|
if (this.requested) {
|
|
13878
|
-
yield this.
|
|
13891
|
+
yield this.replaceSenderSource(newStream);
|
|
13879
13892
|
}
|
|
13880
13893
|
this.publishedStream = newStream;
|
|
13881
13894
|
newStream === null || newStream === void 0 ? void 0 : newStream.on(LocalStreamEventNames.OutputTrackChange, this.handleTrackChange);
|
|
@@ -13919,29 +13932,27 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
13919
13932
|
updateSendParameters(requestedIdEncodingParamsMap) {
|
|
13920
13933
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13921
13934
|
return this.updateSendParametersQueue.push(() => __awaiter(this, void 0, void 0, function* () {
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
13925
|
-
this.sender.replaceTrack(requested ? this.publishedStream.outputStream.getTracks()[0] || null : null);
|
|
13926
|
-
}
|
|
13927
|
-
const sendParameters = this.sender.getParameters();
|
|
13928
|
-
sendParameters.encodings.forEach((encoding, index) => {
|
|
13929
|
-
var _a, _b;
|
|
13930
|
-
const encodingParams = requestedIdEncodingParamsMap.get(index);
|
|
13931
|
-
encoding.active = !!encodingParams;
|
|
13932
|
-
if (encodingParams) {
|
|
13933
|
-
const { maxPayloadBitsPerSecond, maxFs, maxWidth, maxHeight } = encodingParams;
|
|
13934
|
-
const scaleDownRatio = getScaleDownRatio((_a = this.publishedStream) === null || _a === void 0 ? void 0 : _a.getSettings().width, (_b = this.publishedStream) === null || _b === void 0 ? void 0 : _b.getSettings().height, maxFs, maxWidth, maxHeight);
|
|
13935
|
-
if (maxPayloadBitsPerSecond !== undefined && maxPayloadBitsPerSecond >= 0) {
|
|
13936
|
-
encoding.maxBitrate = maxPayloadBitsPerSecond;
|
|
13937
|
-
}
|
|
13938
|
-
if (scaleDownRatio !== undefined && scaleDownRatio >= 1.0) {
|
|
13939
|
-
encoding.scaleResolutionDownBy = scaleDownRatio;
|
|
13940
|
-
}
|
|
13941
|
-
}
|
|
13942
|
-
});
|
|
13943
|
-
yield this.sender.setParameters(sendParameters);
|
|
13935
|
+
const requested = requestedIdEncodingParamsMap.size > 0;
|
|
13936
|
+
if (this.requested !== requested) {
|
|
13937
|
+
yield this.replaceSenderSource(requested ? this.publishedStream : null);
|
|
13944
13938
|
}
|
|
13939
|
+
const sendParameters = this.sender.getParameters();
|
|
13940
|
+
sendParameters.encodings.forEach((encoding, index) => {
|
|
13941
|
+
var _a, _b;
|
|
13942
|
+
const encodingParams = requestedIdEncodingParamsMap.get(index);
|
|
13943
|
+
encoding.active = !!encodingParams;
|
|
13944
|
+
if (encodingParams) {
|
|
13945
|
+
const { maxPayloadBitsPerSecond, maxFs, maxWidth, maxHeight } = encodingParams;
|
|
13946
|
+
const scaleDownRatio = getScaleDownRatio((_a = this.publishedStream) === null || _a === void 0 ? void 0 : _a.getSettings().width, (_b = this.publishedStream) === null || _b === void 0 ? void 0 : _b.getSettings().height, maxFs, maxWidth, maxHeight);
|
|
13947
|
+
if (maxPayloadBitsPerSecond !== undefined && maxPayloadBitsPerSecond >= 0) {
|
|
13948
|
+
encoding.maxBitrate = maxPayloadBitsPerSecond;
|
|
13949
|
+
}
|
|
13950
|
+
if (scaleDownRatio !== undefined && scaleDownRatio >= 1.0) {
|
|
13951
|
+
encoding.scaleResolutionDownBy = scaleDownRatio;
|
|
13952
|
+
}
|
|
13953
|
+
}
|
|
13954
|
+
});
|
|
13955
|
+
yield this.sender.setParameters(sendParameters);
|
|
13945
13956
|
this.requestedIdEncodingParamsMap = requestedIdEncodingParamsMap;
|
|
13946
13957
|
}));
|
|
13947
13958
|
});
|