@webex/web-client-media-engine 3.11.5 → 3.11.7
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 +85 -19
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +85 -20
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +5 -2
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -340,12 +340,12 @@ Logger$2.useDefaults({
|
|
|
340
340
|
},
|
|
341
341
|
});
|
|
342
342
|
|
|
343
|
-
var DeviceKind;
|
|
343
|
+
var DeviceKind$1;
|
|
344
344
|
(function (DeviceKind) {
|
|
345
345
|
DeviceKind["AudioInput"] = "audioinput";
|
|
346
346
|
DeviceKind["AudioOutput"] = "audiooutput";
|
|
347
347
|
DeviceKind["VideoInput"] = "videoinput";
|
|
348
|
-
})(DeviceKind || (DeviceKind = {}));
|
|
348
|
+
})(DeviceKind$1 || (DeviceKind$1 = {}));
|
|
349
349
|
/**
|
|
350
350
|
* Prompts the user for permission to use a media input which produces a MediaStream with tracks
|
|
351
351
|
* containing the requested types of media.
|
|
@@ -404,10 +404,10 @@ function setOnDeviceChangeHandler$1(handler) {
|
|
|
404
404
|
function checkNavigatorPermissions(deviceKinds) {
|
|
405
405
|
return __awaiter$2(this, void 0, void 0, function* () {
|
|
406
406
|
const permissionRequests = [];
|
|
407
|
-
if (deviceKinds.includes(DeviceKind.VideoInput)) {
|
|
407
|
+
if (deviceKinds.includes(DeviceKind$1.VideoInput)) {
|
|
408
408
|
permissionRequests.push(navigator.permissions.query({ name: 'camera' }));
|
|
409
409
|
}
|
|
410
|
-
if (deviceKinds.includes(DeviceKind.AudioInput)) {
|
|
410
|
+
if (deviceKinds.includes(DeviceKind$1.AudioInput)) {
|
|
411
411
|
permissionRequests.push(navigator.permissions.query({ name: 'microphone' }));
|
|
412
412
|
}
|
|
413
413
|
return Promise.all(permissionRequests);
|
|
@@ -455,8 +455,8 @@ function ensureDevicePermissions(deviceKinds, callback) {
|
|
|
455
455
|
const hasDevicePermissions = yield checkDevicePermissions(deviceKinds);
|
|
456
456
|
if (!hasDevicePermissions) {
|
|
457
457
|
const stream = yield getUserMedia({
|
|
458
|
-
audio: deviceKinds.includes(DeviceKind.AudioInput),
|
|
459
|
-
video: deviceKinds.includes(DeviceKind.VideoInput),
|
|
458
|
+
audio: deviceKinds.includes(DeviceKind$1.AudioInput),
|
|
459
|
+
video: deviceKinds.includes(DeviceKind$1.VideoInput),
|
|
460
460
|
});
|
|
461
461
|
// Callback is here to call a function while an active capture exists, so that the browser
|
|
462
462
|
// (Firefox) will allow the user to access device information.
|
|
@@ -477,7 +477,7 @@ function ensureDevicePermissions(deviceKinds, callback) {
|
|
|
477
477
|
|
|
478
478
|
var media = /*#__PURE__*/Object.freeze({
|
|
479
479
|
__proto__: null,
|
|
480
|
-
get DeviceKind () { return DeviceKind; },
|
|
480
|
+
get DeviceKind () { return DeviceKind$1; },
|
|
481
481
|
getUserMedia: getUserMedia,
|
|
482
482
|
getDisplayMedia: getDisplayMedia,
|
|
483
483
|
enumerateDevices: enumerateDevices,
|
|
@@ -614,7 +614,7 @@ function getDevices(deviceKind) {
|
|
|
614
614
|
return __awaiter$2(this, void 0, void 0, function* () {
|
|
615
615
|
let devices;
|
|
616
616
|
try {
|
|
617
|
-
devices = yield ensureDevicePermissions([DeviceKind.AudioInput, DeviceKind.VideoInput], enumerateDevices);
|
|
617
|
+
devices = yield ensureDevicePermissions([DeviceKind$1.AudioInput, DeviceKind$1.VideoInput], enumerateDevices);
|
|
618
618
|
}
|
|
619
619
|
catch (error) {
|
|
620
620
|
throw new WebrtcCoreError(exports.WebrtcCoreErrorType.DEVICE_PERMISSION_DENIED, 'Failed to ensure device permissions');
|
|
@@ -629,7 +629,7 @@ function getDevices(deviceKind) {
|
|
|
629
629
|
*/
|
|
630
630
|
function getAudioInputDevices() {
|
|
631
631
|
return __awaiter$2(this, void 0, void 0, function* () {
|
|
632
|
-
return getDevices(DeviceKind.AudioInput);
|
|
632
|
+
return getDevices(DeviceKind$1.AudioInput);
|
|
633
633
|
});
|
|
634
634
|
}
|
|
635
635
|
/**
|
|
@@ -639,7 +639,7 @@ function getAudioInputDevices() {
|
|
|
639
639
|
*/
|
|
640
640
|
function getAudioOutputDevices() {
|
|
641
641
|
return __awaiter$2(this, void 0, void 0, function* () {
|
|
642
|
-
return getDevices(DeviceKind.AudioOutput);
|
|
642
|
+
return getDevices(DeviceKind$1.AudioOutput);
|
|
643
643
|
});
|
|
644
644
|
}
|
|
645
645
|
/**
|
|
@@ -649,7 +649,7 @@ function getAudioOutputDevices() {
|
|
|
649
649
|
*/
|
|
650
650
|
function getVideoInputDevices() {
|
|
651
651
|
return __awaiter$2(this, void 0, void 0, function* () {
|
|
652
|
-
return getDevices(DeviceKind.VideoInput);
|
|
652
|
+
return getDevices(DeviceKind$1.VideoInput);
|
|
653
653
|
});
|
|
654
654
|
}
|
|
655
655
|
/**
|
|
@@ -1490,6 +1490,36 @@ class _LocalStream extends Stream {
|
|
|
1490
1490
|
getEffects() {
|
|
1491
1491
|
return this.effects;
|
|
1492
1492
|
}
|
|
1493
|
+
/**
|
|
1494
|
+
* Method to serialize data about input, output streams
|
|
1495
|
+
* and also effects from LocalStream.
|
|
1496
|
+
*
|
|
1497
|
+
* @returns - A JSON-compatible object representation with data from LocalStream.
|
|
1498
|
+
*/
|
|
1499
|
+
toJSON() {
|
|
1500
|
+
return {
|
|
1501
|
+
muted: this.muted,
|
|
1502
|
+
label: this.label,
|
|
1503
|
+
readyState: this.readyState,
|
|
1504
|
+
inputStream: {
|
|
1505
|
+
active: this.inputStream.active,
|
|
1506
|
+
id: this.inputStream.id,
|
|
1507
|
+
enabled: this.inputTrack.enabled,
|
|
1508
|
+
muted: this.inputTrack.muted,
|
|
1509
|
+
},
|
|
1510
|
+
outputStream: {
|
|
1511
|
+
active: this.outputStream.active,
|
|
1512
|
+
id: this.outputStream.id,
|
|
1513
|
+
},
|
|
1514
|
+
effects: this.effects.map((effect) => {
|
|
1515
|
+
return {
|
|
1516
|
+
id: effect.id,
|
|
1517
|
+
kind: effect.kind,
|
|
1518
|
+
isEnabled: effect.isEnabled,
|
|
1519
|
+
};
|
|
1520
|
+
}),
|
|
1521
|
+
};
|
|
1522
|
+
}
|
|
1493
1523
|
/**
|
|
1494
1524
|
* Cleanup the local effects.
|
|
1495
1525
|
*/
|
|
@@ -6565,6 +6595,27 @@ function isValidSourceAdvertisementMsg(msg) {
|
|
|
6565
6595
|
return Boolean(maybeSourceAdvertisementMsg.seqNum &&
|
|
6566
6596
|
truthyOrZero(maybeSourceAdvertisementMsg.numTotalSources) &&
|
|
6567
6597
|
truthyOrZero(maybeSourceAdvertisementMsg.numLiveSources));
|
|
6598
|
+
}
|
|
6599
|
+
function compareNamedMediaGroupArrays(namedMediaGroups1, namedMediaGroups2) {
|
|
6600
|
+
var _a, _b;
|
|
6601
|
+
if (namedMediaGroups1.length !== namedMediaGroups2.length) {
|
|
6602
|
+
return false;
|
|
6603
|
+
}
|
|
6604
|
+
for (let i = 0; i < namedMediaGroups1.length; i += 1) {
|
|
6605
|
+
if (namedMediaGroups1[i].type !== namedMediaGroups2[i].type) {
|
|
6606
|
+
return false;
|
|
6607
|
+
}
|
|
6608
|
+
if (((_a = namedMediaGroups1[i]) === null || _a === void 0 ? void 0 : _a.value) !== ((_b = namedMediaGroups2[i]) === null || _b === void 0 ? void 0 : _b.value)) {
|
|
6609
|
+
return false;
|
|
6610
|
+
}
|
|
6611
|
+
}
|
|
6612
|
+
return true;
|
|
6613
|
+
}
|
|
6614
|
+
function compareSourceAdvertisementMsgs(sourceAdvertisementMsg1, sourceAdvertisementMsg2) {
|
|
6615
|
+
return (sourceAdvertisementMsg1.numLiveSources === sourceAdvertisementMsg2.numLiveSources &&
|
|
6616
|
+
sourceAdvertisementMsg1.numTotalSources === sourceAdvertisementMsg2.numTotalSources &&
|
|
6617
|
+
compareNamedMediaGroupArrays(sourceAdvertisementMsg1.namedMediaGroups || [], sourceAdvertisementMsg2.namedMediaGroups || []) &&
|
|
6618
|
+
sourceAdvertisementMsg1.videoContentHint === sourceAdvertisementMsg2.videoContentHint);
|
|
6568
6619
|
}
|
|
6569
6620
|
|
|
6570
6621
|
class SourceAdvertisementAckMsg {
|
|
@@ -6721,14 +6772,23 @@ class JmpSession extends events$3.EventEmitter {
|
|
|
6721
6772
|
}
|
|
6722
6773
|
}
|
|
6723
6774
|
sendSourceAdvertisement(numTotalSources, numLiveSources, namedMediaGroups, videoContentHint) {
|
|
6724
|
-
|
|
6725
|
-
this.
|
|
6726
|
-
|
|
6727
|
-
this.
|
|
6775
|
+
var _a;
|
|
6776
|
+
const sourceAdvertisementMsg = new SourceAdvertisementMsg(this.currSourceAdvertisementSeqNum, numTotalSources, numLiveSources, namedMediaGroups, videoContentHint);
|
|
6777
|
+
if (!this.lastSentSourceAdvertisement ||
|
|
6778
|
+
!compareSourceAdvertisementMsgs(this.lastSentSourceAdvertisement.msg, sourceAdvertisementMsg)) {
|
|
6728
6779
|
this.sendJmpMsg(JmpMsgType.SourceAdvertisement, sourceAdvertisementMsg);
|
|
6729
|
-
|
|
6730
|
-
this.
|
|
6731
|
-
|
|
6780
|
+
(_a = this.lastSentSourceAdvertisement) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
6781
|
+
this.lastSentSourceAdvertisement = new RetransmitHandler(sourceAdvertisementMsg, this.maxNumRetransmits, this.retransmitIntervalMs, () => {
|
|
6782
|
+
this.logger.info(`Retransmitting previously sent SourceAdvertisement...`);
|
|
6783
|
+
this.sendJmpMsg(JmpMsgType.SourceAdvertisement, sourceAdvertisementMsg);
|
|
6784
|
+
}, (expiredMsg) => {
|
|
6785
|
+
this.logger.warn(`Retransmits for message expired: `, expiredMsg);
|
|
6786
|
+
});
|
|
6787
|
+
this.currSourceAdvertisementSeqNum++;
|
|
6788
|
+
}
|
|
6789
|
+
else {
|
|
6790
|
+
this.logger.info(`Duplicate SourceAdvertisement detected and will not be sent: `, sourceAdvertisementMsg);
|
|
6791
|
+
}
|
|
6732
6792
|
}
|
|
6733
6793
|
sendMediaRequestStatus(streamStates) {
|
|
6734
6794
|
var _a, _b;
|
|
@@ -6824,9 +6884,11 @@ class JmpSession extends events$3.EventEmitter {
|
|
|
6824
6884
|
this.txCallback = callback;
|
|
6825
6885
|
}
|
|
6826
6886
|
close() {
|
|
6827
|
-
var _a;
|
|
6887
|
+
var _a, _b, _c;
|
|
6828
6888
|
this.logger.info(`closing`);
|
|
6829
6889
|
(_a = this.lastSentMediaRequest) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
6890
|
+
(_b = this.lastSentMediaRequestStatus) === null || _b === void 0 ? void 0 : _b.cancel();
|
|
6891
|
+
(_c = this.lastSentSourceAdvertisement) === null || _c === void 0 ? void 0 : _c.cancel();
|
|
6830
6892
|
}
|
|
6831
6893
|
sendJmpMsg(msgType, payload) {
|
|
6832
6894
|
var _a;
|
|
@@ -14590,6 +14652,7 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14590
14652
|
this.recvTransceivers.forEach((recvTransceivers) => {
|
|
14591
14653
|
recvTransceivers.forEach((t) => t.close());
|
|
14592
14654
|
});
|
|
14655
|
+
this.jmpSessions.forEach((jmpSession) => jmpSession.close());
|
|
14593
14656
|
this.pc.close();
|
|
14594
14657
|
}
|
|
14595
14658
|
sendMediaRequestStatus(mediaType) {
|
|
@@ -15060,8 +15123,11 @@ class StreamRequest {
|
|
|
15060
15123
|
}
|
|
15061
15124
|
}
|
|
15062
15125
|
|
|
15126
|
+
const { DeviceKind } = media;
|
|
15127
|
+
|
|
15063
15128
|
exports.ActiveSpeakerInfo = ActiveSpeakerInfo;
|
|
15064
15129
|
exports.CodecInfo = CodecInfo$1;
|
|
15130
|
+
exports.DeviceKind = DeviceKind;
|
|
15065
15131
|
exports.H264Codec = H264Codec;
|
|
15066
15132
|
exports.JMPLogger = Logger$1;
|
|
15067
15133
|
exports.LocalCameraStream = LocalCameraStream;
|