@webex/web-client-media-engine 3.5.0 → 3.5.2
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/README.md +29 -14
- package/dist/cjs/index.js +156 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +156 -11
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -6552,15 +6552,15 @@ class JmpSession extends EventEmitter$5 {
|
|
|
6552
6552
|
}
|
|
6553
6553
|
receive(jmpMsg) {
|
|
6554
6554
|
if (jmpMsg.mediaContent !== this.mediaContent || jmpMsg.mediaFamily !== this.mediaFamily) {
|
|
6555
|
-
this.logger.error(`JmpMsg ${jmpMsg} sent to incorrect JmpSession`);
|
|
6555
|
+
this.logger.error(`JmpMsg ${JSON.stringify(jmpMsg)} sent to incorrect JmpSession`);
|
|
6556
6556
|
return;
|
|
6557
6557
|
}
|
|
6558
|
-
this.logger.debug(`Received JmpMsg`, jmpMsg);
|
|
6558
|
+
this.logger.debug(`Received JmpMsg`, JSON.stringify(jmpMsg));
|
|
6559
6559
|
const { payload } = jmpMsg;
|
|
6560
6560
|
if (payload.msgType === JmpMsgType.MediaRequest) {
|
|
6561
6561
|
const mediaRequestMsg = payload.payload;
|
|
6562
6562
|
if (!isValidMediaRequestMsg(mediaRequestMsg)) {
|
|
6563
|
-
this.logger.error(`Received invalid MediaRequest:`, mediaRequestMsg);
|
|
6563
|
+
this.logger.error(`Received invalid MediaRequest:`, JSON.stringify(mediaRequestMsg));
|
|
6564
6564
|
return;
|
|
6565
6565
|
}
|
|
6566
6566
|
this.handleIncomingMediaRequest(mediaRequestMsg);
|
|
@@ -6568,7 +6568,7 @@ class JmpSession extends EventEmitter$5 {
|
|
|
6568
6568
|
else if (payload.msgType === JmpMsgType.MediaRequestAck) {
|
|
6569
6569
|
const mediaRequestAckMsg = payload.payload;
|
|
6570
6570
|
if (!isValidMediaRequestAckMsg(mediaRequestAckMsg)) {
|
|
6571
|
-
this.logger.error(`Received invalid MediaRequest ACK:`, mediaRequestAckMsg);
|
|
6571
|
+
this.logger.error(`Received invalid MediaRequest ACK:`, JSON.stringify(mediaRequestAckMsg));
|
|
6572
6572
|
return;
|
|
6573
6573
|
}
|
|
6574
6574
|
this.handleIncomingMediaRequestAck(mediaRequestAckMsg);
|
|
@@ -6576,7 +6576,7 @@ class JmpSession extends EventEmitter$5 {
|
|
|
6576
6576
|
else if (payload.msgType === JmpMsgType.ActiveSpeakerNotification) {
|
|
6577
6577
|
const activeSpeakerNotification = payload.payload;
|
|
6578
6578
|
if (!isValidActiveSpeakerNotificationMsg(activeSpeakerNotification)) {
|
|
6579
|
-
this.logger.info(`Received invalid Active Speaker Notification:`, activeSpeakerNotification);
|
|
6579
|
+
this.logger.info(`Received invalid Active Speaker Notification:`, JSON.stringify(activeSpeakerNotification));
|
|
6580
6580
|
return;
|
|
6581
6581
|
}
|
|
6582
6582
|
this.handleIncomingActiveSpeakerNotification(activeSpeakerNotification);
|
|
@@ -6584,7 +6584,7 @@ class JmpSession extends EventEmitter$5 {
|
|
|
6584
6584
|
else if (payload.msgType === JmpMsgType.SourceAdvertisement) {
|
|
6585
6585
|
const sourceAdvertisement = payload.payload;
|
|
6586
6586
|
if (!isValidSourceAdvertisementMsg(sourceAdvertisement)) {
|
|
6587
|
-
this.logger.error(`Received invalid SourceAdvertisementMsg
|
|
6587
|
+
this.logger.error(`Received invalid SourceAdvertisementMsg:`, JSON.stringify(sourceAdvertisement));
|
|
6588
6588
|
return;
|
|
6589
6589
|
}
|
|
6590
6590
|
this.handleIncomingSourceAdvertisement(sourceAdvertisement);
|
|
@@ -6592,7 +6592,7 @@ class JmpSession extends EventEmitter$5 {
|
|
|
6592
6592
|
else if (payload.msgType === JmpMsgType.SourceAdvertisementAck) {
|
|
6593
6593
|
const sourceAdvertisementAck = payload.payload;
|
|
6594
6594
|
if (!isValidSourceAdvertisementAckMsg(sourceAdvertisementAck)) {
|
|
6595
|
-
this.logger.error(`Received invalid SourceAdvertisementAckMsg
|
|
6595
|
+
this.logger.error(`Received invalid SourceAdvertisementAckMsg:`, JSON.stringify(sourceAdvertisementAck));
|
|
6596
6596
|
return;
|
|
6597
6597
|
}
|
|
6598
6598
|
this.handleIncomingSourceAdvertisementAck(sourceAdvertisementAck);
|
|
@@ -6600,7 +6600,7 @@ class JmpSession extends EventEmitter$5 {
|
|
|
6600
6600
|
else if (payload.msgType === JmpMsgType.MediaRequestStatus) {
|
|
6601
6601
|
const mediaRequestStatus = payload.payload;
|
|
6602
6602
|
if (!isValidMediaRequestStatusMsg(mediaRequestStatus)) {
|
|
6603
|
-
this.logger.error(`Received invalid MediaRequestStatusMsg
|
|
6603
|
+
this.logger.error(`Received invalid MediaRequestStatusMsg:`, JSON.stringify(mediaRequestStatus));
|
|
6604
6604
|
return;
|
|
6605
6605
|
}
|
|
6606
6606
|
this.handleIncomingMediaRequestStatus(mediaRequestStatus);
|
|
@@ -6608,7 +6608,7 @@ class JmpSession extends EventEmitter$5 {
|
|
|
6608
6608
|
else if (payload.msgType === JmpMsgType.MediaRequestStatusAck) {
|
|
6609
6609
|
const mediaRequestStatusAck = payload.payload;
|
|
6610
6610
|
if (!isValidMediaRequestStatusAckMsg(mediaRequestStatusAck)) {
|
|
6611
|
-
this.logger.error(`Received invalid MediaRequestStatusAckMsg
|
|
6611
|
+
this.logger.error(`Received invalid MediaRequestStatusAckMsg:`, JSON.stringify(mediaRequestStatusAck));
|
|
6612
6612
|
return;
|
|
6613
6613
|
}
|
|
6614
6614
|
this.handleIncomingMediaRequestStatusAck(mediaRequestStatusAck);
|
|
@@ -6938,6 +6938,17 @@ var map2obj = function (report) {
|
|
|
6938
6938
|
});
|
|
6939
6939
|
return o;
|
|
6940
6940
|
};
|
|
6941
|
+
var dumpStream = function (stream) { return ({
|
|
6942
|
+
id: stream.id,
|
|
6943
|
+
tracks: stream.getTracks().map(function (track) { return ({
|
|
6944
|
+
id: track.id,
|
|
6945
|
+
kind: track.kind,
|
|
6946
|
+
label: track.label,
|
|
6947
|
+
enabled: track.enabled,
|
|
6948
|
+
muted: track.muted,
|
|
6949
|
+
readyState: track.readyState
|
|
6950
|
+
}); })
|
|
6951
|
+
}); };
|
|
6941
6952
|
var persistedKeys = ['type', 'id', 'timestamp'];
|
|
6942
6953
|
/**
|
|
6943
6954
|
* Check to see if the report consists of more than just the persisted metadata.
|
|
@@ -7032,6 +7043,7 @@ var rtcStats = function (pc, logger, intervalTime, statsPreProcessor) {
|
|
|
7032
7043
|
var trace = function (name, payload, timestamp) {
|
|
7033
7044
|
logger({ timestamp: timestamp ? Math.round(timestamp) : Date.now(), name: name, payload: payload });
|
|
7034
7045
|
};
|
|
7046
|
+
var origPeerConnection = window.RTCPeerConnection;
|
|
7035
7047
|
pc.addEventListener('icecandidate', function (e) {
|
|
7036
7048
|
if (e.candidate) {
|
|
7037
7049
|
trace('onicecandidate', makeEvent(JSON.stringify(e.candidate)));
|
|
@@ -7064,6 +7076,139 @@ var rtcStats = function (pc, logger, intervalTime, statsPreProcessor) {
|
|
|
7064
7076
|
pc.addEventListener('datachannel', function (event) {
|
|
7065
7077
|
trace('ondatachannel', makeEvent("".concat(event.channel.id, ": ").concat(event.channel.label)));
|
|
7066
7078
|
});
|
|
7079
|
+
['createDataChannel', 'close'].forEach(function (method) {
|
|
7080
|
+
var nativeMethod = origPeerConnection.prototype[method];
|
|
7081
|
+
if (nativeMethod) {
|
|
7082
|
+
origPeerConnection.prototype[method] = function () {
|
|
7083
|
+
trace(method, makeEvent(method));
|
|
7084
|
+
return nativeMethod.apply(this, arguments);
|
|
7085
|
+
};
|
|
7086
|
+
}
|
|
7087
|
+
});
|
|
7088
|
+
['addStream', 'removeStream'].forEach(function (method) {
|
|
7089
|
+
var nativeMethod = origPeerConnection.prototype[method];
|
|
7090
|
+
if (nativeMethod) {
|
|
7091
|
+
origPeerConnection.prototype[method] = function () {
|
|
7092
|
+
var stream = arguments[0];
|
|
7093
|
+
var streamInfo = stream
|
|
7094
|
+
.getTracks()
|
|
7095
|
+
.map(function (t) { return "".concat(t.kind, ":").concat(t.id); })
|
|
7096
|
+
.join(',');
|
|
7097
|
+
trace(method, makeEvent("".concat(stream.id, " ").concat(streamInfo)));
|
|
7098
|
+
return nativeMethod.apply(this, arguments);
|
|
7099
|
+
};
|
|
7100
|
+
}
|
|
7101
|
+
});
|
|
7102
|
+
['addTrack'].forEach(function (method) {
|
|
7103
|
+
var nativeMethod = origPeerConnection.prototype[method];
|
|
7104
|
+
if (nativeMethod) {
|
|
7105
|
+
origPeerConnection.prototype[method] = function () {
|
|
7106
|
+
var track = arguments[0];
|
|
7107
|
+
var streams = [].slice.call(arguments, 1);
|
|
7108
|
+
trace(method, makeEvent("".concat(track.kind, ":").concat(track.id, " ").concat(streams.map(function (s) { return "stream:".concat(s.id); }).join(';') || '-')));
|
|
7109
|
+
return nativeMethod.apply(this, arguments);
|
|
7110
|
+
};
|
|
7111
|
+
}
|
|
7112
|
+
});
|
|
7113
|
+
['removeTrack'].forEach(function (method) {
|
|
7114
|
+
var nativeMethod = origPeerConnection.prototype[method];
|
|
7115
|
+
if (nativeMethod) {
|
|
7116
|
+
origPeerConnection.prototype[method] = function () {
|
|
7117
|
+
var track = arguments[0].track;
|
|
7118
|
+
trace(method, makeEvent(track ? "".concat(track.kind, ":").concat(track.id) : 'null'));
|
|
7119
|
+
return nativeMethod.apply(this, arguments);
|
|
7120
|
+
};
|
|
7121
|
+
}
|
|
7122
|
+
});
|
|
7123
|
+
['createOffer', 'createAnswer'].forEach(function (method) {
|
|
7124
|
+
var nativeMethod = origPeerConnection.prototype[method];
|
|
7125
|
+
if (nativeMethod) {
|
|
7126
|
+
origPeerConnection.prototype[method] = function () {
|
|
7127
|
+
var opts;
|
|
7128
|
+
var args = arguments;
|
|
7129
|
+
if (arguments.length === 1 && typeof arguments[0] === 'object') {
|
|
7130
|
+
// eslint-disable-next-line prefer-destructuring
|
|
7131
|
+
opts = arguments[0];
|
|
7132
|
+
}
|
|
7133
|
+
else if (arguments.length === 3 && typeof arguments[2] === 'object') {
|
|
7134
|
+
// eslint-disable-next-line prefer-destructuring
|
|
7135
|
+
opts = arguments[2];
|
|
7136
|
+
}
|
|
7137
|
+
trace(method, makeEvent(opts || ''));
|
|
7138
|
+
return nativeMethod.apply(this, opts ? [opts] : undefined).then(function (description) {
|
|
7139
|
+
trace("".concat(method, "OnSuccess"), makeEvent(description.sdp));
|
|
7140
|
+
if (args.length > 0 && typeof args[0] === 'function') {
|
|
7141
|
+
args[0].apply(null, [description]);
|
|
7142
|
+
return undefined;
|
|
7143
|
+
}
|
|
7144
|
+
return description;
|
|
7145
|
+
}, function (err) {
|
|
7146
|
+
trace("".concat(method, "OnFailure"), makeEvent(err.toString()));
|
|
7147
|
+
if (args.length > 1 && typeof args[1] === 'function') {
|
|
7148
|
+
args[1].apply(null, [err]);
|
|
7149
|
+
return;
|
|
7150
|
+
}
|
|
7151
|
+
throw err;
|
|
7152
|
+
});
|
|
7153
|
+
};
|
|
7154
|
+
}
|
|
7155
|
+
});
|
|
7156
|
+
['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'].forEach(function (method) {
|
|
7157
|
+
var nativeMethod = origPeerConnection.prototype[method];
|
|
7158
|
+
if (nativeMethod) {
|
|
7159
|
+
origPeerConnection.prototype[method] = function () {
|
|
7160
|
+
var args = arguments;
|
|
7161
|
+
trace(method, makeEvent(method === 'addIceCandidate' ? arguments[0] : arguments[0].sdp));
|
|
7162
|
+
return nativeMethod.apply(this, [arguments[0]]).then(function () {
|
|
7163
|
+
trace("".concat(method, "OnSuccess"), makeEvent('success'));
|
|
7164
|
+
if (args.length >= 2 && typeof args[1] === 'function') {
|
|
7165
|
+
args[1].apply(null, []);
|
|
7166
|
+
return undefined;
|
|
7167
|
+
}
|
|
7168
|
+
return undefined;
|
|
7169
|
+
}, function (err) {
|
|
7170
|
+
trace("".concat(method, "OnFailure"), makeEvent(err.toString()));
|
|
7171
|
+
if (args.length >= 3 && typeof args[2] === 'function') {
|
|
7172
|
+
args[2].apply(null, [err]);
|
|
7173
|
+
return undefined;
|
|
7174
|
+
}
|
|
7175
|
+
throw err;
|
|
7176
|
+
});
|
|
7177
|
+
};
|
|
7178
|
+
}
|
|
7179
|
+
});
|
|
7180
|
+
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
|
|
7181
|
+
var origGetUserMedia_1 = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);
|
|
7182
|
+
var gum = function () {
|
|
7183
|
+
trace('navigator.mediaDevices.getUserMedia', makeEvent(JSON.stringify(arguments[0])));
|
|
7184
|
+
return origGetUserMedia_1
|
|
7185
|
+
.apply(navigator.mediaDevices, arguments)
|
|
7186
|
+
.then(function (stream) {
|
|
7187
|
+
trace('navigator.mediaDevices.getUserMediaOnSuccess', makeEvent(JSON.stringify(dumpStream(stream))));
|
|
7188
|
+
return stream;
|
|
7189
|
+
}, function (err) {
|
|
7190
|
+
trace('navigator.mediaDevices.getUserMediaOnFailure', makeEvent(err.name));
|
|
7191
|
+
return Promise.reject(err);
|
|
7192
|
+
});
|
|
7193
|
+
};
|
|
7194
|
+
navigator.mediaDevices.getUserMedia = gum.bind(navigator.mediaDevices);
|
|
7195
|
+
}
|
|
7196
|
+
if (navigator.mediaDevices && navigator.mediaDevices.getDisplayMedia) {
|
|
7197
|
+
var origGetDisplayMedia_1 = navigator.mediaDevices.getDisplayMedia.bind(navigator.mediaDevices);
|
|
7198
|
+
var gdm = function () {
|
|
7199
|
+
trace('navigator.mediaDevices.getDisplayMedia', makeEvent(JSON.stringify(arguments[0])));
|
|
7200
|
+
return origGetDisplayMedia_1
|
|
7201
|
+
.apply(navigator.mediaDevices, arguments)
|
|
7202
|
+
.then(function (stream) {
|
|
7203
|
+
trace('navigator.mediaDevices.getDisplayMediaOnSuccess', makeEvent(JSON.stringify(dumpStream(stream))));
|
|
7204
|
+
return stream;
|
|
7205
|
+
}, function (err) {
|
|
7206
|
+
trace('navigator.mediaDevices.getDisplayMediaOnFailure', makeEvent(err.name));
|
|
7207
|
+
return Promise.reject(err);
|
|
7208
|
+
});
|
|
7209
|
+
};
|
|
7210
|
+
navigator.mediaDevices.getDisplayMedia = gdm.bind(navigator.mediaDevices);
|
|
7211
|
+
}
|
|
7067
7212
|
var interval = window.setInterval(function () {
|
|
7068
7213
|
if (pc.signalingState === 'closed') {
|
|
7069
7214
|
window.clearInterval(interval);
|
|
@@ -14006,7 +14151,7 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14006
14151
|
logger.error(`Error parsing datachannel JSON: ${err}`);
|
|
14007
14152
|
return;
|
|
14008
14153
|
}
|
|
14009
|
-
logger.debug('DataChannel got msg:
|
|
14154
|
+
logger.debug('DataChannel got msg:', e.data);
|
|
14010
14155
|
const homerMsg = HomerMsg.fromJson(parsed);
|
|
14011
14156
|
if (!homerMsg) {
|
|
14012
14157
|
logger.error(`Received invalid datachannel message: ${e}`);
|
|
@@ -14014,7 +14159,7 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14014
14159
|
}
|
|
14015
14160
|
const jmpMsg = homerMsg.payload;
|
|
14016
14161
|
if (!isValidJmpMsg(jmpMsg)) {
|
|
14017
|
-
logger.error(`Received invalid JMP msg: ${jmpMsg}`);
|
|
14162
|
+
logger.error(`Received invalid JMP msg: ${JSON.stringify(jmpMsg)}`);
|
|
14018
14163
|
return;
|
|
14019
14164
|
}
|
|
14020
14165
|
const mediaType = getMediaType(jmpMsg.mediaFamily, jmpMsg.mediaContent);
|