@opentok/client 2.28.4-alpha.12 → 2.28.4-alpha.13
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/js/opentok.js +775 -728
- package/dist/js/opentok.js.map +1 -1
- package/dist/js/opentok.min.js +4 -4
- package/dist/js/opentok.min.js.map +1 -1
- package/package.json +1 -1
package/dist/js/opentok.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license OpenTok.js 2.28.4
|
|
2
|
+
* @license OpenTok.js 2.28.4 ea9efa6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2010-2024 TokBox, Inc.
|
|
5
5
|
* Subject to the applicable Software Development Kit (SDK) License Agreement:
|
|
6
6
|
* https://www.vonage.com/legal/communications-apis/terms-of-use/
|
|
7
7
|
*
|
|
8
|
-
* Date: Fri, 25 Oct 2024
|
|
8
|
+
* Date: Fri, 25 Oct 2024 23:11:30 GMT
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
@@ -8070,7 +8070,7 @@ const logging = (0, _log.default)('StaticConfig');
|
|
|
8070
8070
|
*/
|
|
8071
8071
|
|
|
8072
8072
|
/** @type builtInConfig */
|
|
8073
|
-
const builtInConfig = (0, _cloneDeep.default)({"version":"v2.28.4","buildHash":"
|
|
8073
|
+
const builtInConfig = (0, _cloneDeep.default)({"version":"v2.28.4","buildHash":"ea9efa6","minimumVersion":{"firefox":52,"chrome":49},"debug":false,"websiteURL":"http://www.tokbox.com","configURL":"https://config.opentok.com","ipWhitelistConfigURL":"","cdnURL":"","loggingURL":"https://hlg.tokbox.com/prod","apiURL":"https://anvil.opentok.com"});
|
|
8074
8074
|
const whitelistAllowedRuntimeProperties = (0, _pick.default)(['apiURL', 'assetURL', 'cdnURL', 'sessionInfoOverrides', 'loggingURL']);
|
|
8075
8075
|
const liveConfigMap = {
|
|
8076
8076
|
apiUrl: 'apiURL',
|
|
@@ -17851,12 +17851,12 @@ function PublisherFactory(_ref) {
|
|
|
17851
17851
|
});
|
|
17852
17852
|
};
|
|
17853
17853
|
const onIceConnectionStateChange = /*#__PURE__*/function () {
|
|
17854
|
-
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
17855
|
-
var isAdaptiveEnabled, sourceStreamId, _yield$getMantisPeerC, _yield$getP2pPeerConn, isMantisConnected, isP2PConnected, isSocketReconnecting, socket, isSocketConnected;
|
|
17856
|
-
return _regenerator.default.wrap(function
|
|
17857
|
-
while (1) switch (
|
|
17854
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(newState, peerConnection) {
|
|
17855
|
+
var _this$session$session, isAdaptiveEnabled, p2pEnabled, sourceStreamId, _yield$getMantisPeerC, _yield$getP2pPeerConn, isMantisConnected, isP2PConnected, isSocketReconnecting, socket, isSocketConnected, destroyStream, _getPeerConnectionMet6, remoteSubscriberId, arePeerConnectionsAlive;
|
|
17856
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
17857
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
17858
17858
|
case 0:
|
|
17859
|
-
|
|
17859
|
+
_this$session$session = _this.session.sessionInfo, isAdaptiveEnabled = _this$session$session.isAdaptiveEnabled, p2pEnabled = _this$session$session.p2pEnabled;
|
|
17860
17860
|
sourceStreamId = peerConnection.getSourceStreamId();
|
|
17861
17861
|
lastIceConnectionStates[sourceStreamId] = newState;
|
|
17862
17862
|
if (newState === 'disconnected') {
|
|
@@ -17875,78 +17875,125 @@ function PublisherFactory(_ref) {
|
|
|
17875
17875
|
}, 2000);
|
|
17876
17876
|
}
|
|
17877
17877
|
if (!(newState === 'connected')) {
|
|
17878
|
-
|
|
17878
|
+
_context6.next = 26;
|
|
17879
17879
|
break;
|
|
17880
17880
|
}
|
|
17881
17881
|
clearTimeout(_streamDestroyTimeout);
|
|
17882
17882
|
if (!isAdaptiveEnabled) {
|
|
17883
|
-
|
|
17883
|
+
_context6.next = 26;
|
|
17884
17884
|
break;
|
|
17885
17885
|
}
|
|
17886
|
-
|
|
17886
|
+
_context6.next = 9;
|
|
17887
17887
|
return getMantisPeerConnection();
|
|
17888
17888
|
case 9:
|
|
17889
|
-
|
|
17890
|
-
if (!(
|
|
17891
|
-
|
|
17889
|
+
_context6.t0 = _yield$getMantisPeerC = _context6.sent;
|
|
17890
|
+
if (!(_context6.t0 == null)) {
|
|
17891
|
+
_context6.next = 14;
|
|
17892
17892
|
break;
|
|
17893
17893
|
}
|
|
17894
|
-
|
|
17895
|
-
|
|
17894
|
+
_context6.t1 = void 0;
|
|
17895
|
+
_context6.next = 15;
|
|
17896
17896
|
break;
|
|
17897
17897
|
case 14:
|
|
17898
|
-
|
|
17898
|
+
_context6.t1 = _yield$getMantisPeerC.iceConnectionStateIsConnected();
|
|
17899
17899
|
case 15:
|
|
17900
|
-
isMantisConnected =
|
|
17901
|
-
|
|
17900
|
+
isMantisConnected = _context6.t1;
|
|
17901
|
+
_context6.next = 18;
|
|
17902
17902
|
return getP2pPeerConnection();
|
|
17903
17903
|
case 18:
|
|
17904
|
-
|
|
17905
|
-
if (!(
|
|
17906
|
-
|
|
17904
|
+
_context6.t2 = _yield$getP2pPeerConn = _context6.sent;
|
|
17905
|
+
if (!(_context6.t2 == null)) {
|
|
17906
|
+
_context6.next = 23;
|
|
17907
17907
|
break;
|
|
17908
17908
|
}
|
|
17909
|
-
|
|
17910
|
-
|
|
17909
|
+
_context6.t3 = void 0;
|
|
17910
|
+
_context6.next = 24;
|
|
17911
17911
|
break;
|
|
17912
17912
|
case 23:
|
|
17913
|
-
|
|
17913
|
+
_context6.t3 = _yield$getP2pPeerConn.iceConnectionStateIsConnected();
|
|
17914
17914
|
case 24:
|
|
17915
|
-
isP2PConnected =
|
|
17915
|
+
isP2PConnected = _context6.t3;
|
|
17916
17916
|
if (isMantisConnected && isP2PConnected) {
|
|
17917
17917
|
_stopSendingRtpToMantis();
|
|
17918
17918
|
}
|
|
17919
17919
|
case 26:
|
|
17920
17920
|
if (!(newState === 'failed')) {
|
|
17921
|
-
|
|
17921
|
+
_context6.next = 34;
|
|
17922
17922
|
break;
|
|
17923
17923
|
}
|
|
17924
17924
|
isSocketReconnecting = _this.session._.isSocketReconnecting;
|
|
17925
17925
|
socket = _this.session._.getSocket();
|
|
17926
17926
|
isSocketConnected = socket.is('connected') && !isSocketReconnecting();
|
|
17927
|
-
if (isSocketConnected) {
|
|
17928
|
-
|
|
17927
|
+
if (!(!isSocketConnected || sourceStreamId !== activeSourceStreamId)) {
|
|
17928
|
+
_context6.next = 32;
|
|
17929
17929
|
break;
|
|
17930
17930
|
}
|
|
17931
|
-
return
|
|
17931
|
+
return _context6.abrupt("return");
|
|
17932
17932
|
case 32:
|
|
17933
|
-
// If PC has failed and the socket is connected we will either transition to Mantis
|
|
17934
|
-
// if adaptive and P2P leg or destroy the publisher in all other cases
|
|
17935
17933
|
// Instead of destroying the publisher straight away, we will destroy it after 5 secs
|
|
17936
17934
|
// in order to avoid a race condition where we just got the socket connected at the
|
|
17937
17935
|
// same moment PC transition to failed
|
|
17938
|
-
|
|
17936
|
+
destroyStream = function destroyStream(arePeerConnectionsAlive) {
|
|
17937
|
+
if (arePeerConnectionsAlive === void 0) {
|
|
17938
|
+
arePeerConnectionsAlive = () => Promise.resolve(false);
|
|
17939
|
+
}
|
|
17940
|
+
_streamDestroyTimeout = setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
17941
|
+
var pendingPeerConnections;
|
|
17942
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
17943
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
17944
|
+
case 0:
|
|
17945
|
+
_context4.next = 2;
|
|
17946
|
+
return arePeerConnectionsAlive();
|
|
17947
|
+
case 2:
|
|
17948
|
+
pendingPeerConnections = _context4.sent;
|
|
17949
|
+
if (!pendingPeerConnections) {
|
|
17950
|
+
_this.session._.streamDestroy(_this.streamId, sourceStreamId);
|
|
17951
|
+
}
|
|
17952
|
+
case 4:
|
|
17953
|
+
case "end":
|
|
17954
|
+
return _context4.stop();
|
|
17955
|
+
}
|
|
17956
|
+
}, _callee4);
|
|
17957
|
+
})), STREAM_DESTROY_DELAY);
|
|
17958
|
+
};
|
|
17959
|
+
if (p2pEnabled) {
|
|
17960
|
+
// In P2P destroy the Publisher if there are no subscribers to it.
|
|
17961
|
+
_getPeerConnectionMet6 = getPeerConnectionMeta(peerConnection), remoteSubscriberId = _getPeerConnectionMet6.remoteSubscriberId;
|
|
17962
|
+
_this._removeSubscriber(remoteSubscriberId);
|
|
17963
|
+
arePeerConnectionsAlive = /*#__PURE__*/function () {
|
|
17964
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
17965
|
+
var peerConnections;
|
|
17966
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
17967
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
17968
|
+
case 0:
|
|
17969
|
+
_context5.next = 2;
|
|
17970
|
+
return getAllPeerConnections();
|
|
17971
|
+
case 2:
|
|
17972
|
+
peerConnections = _context5.sent;
|
|
17973
|
+
return _context5.abrupt("return", peerConnections.length !== 0);
|
|
17974
|
+
case 4:
|
|
17975
|
+
case "end":
|
|
17976
|
+
return _context5.stop();
|
|
17977
|
+
}
|
|
17978
|
+
}, _callee5);
|
|
17979
|
+
}));
|
|
17980
|
+
return function arePeerConnectionsAlive() {
|
|
17981
|
+
return _ref12.apply(this, arguments);
|
|
17982
|
+
};
|
|
17983
|
+
}();
|
|
17984
|
+
destroyStream(arePeerConnectionsAlive);
|
|
17985
|
+
} else if (isAdaptiveEnabled && sourceStreamId === 'P2P') {
|
|
17986
|
+
// In adaptive if P2P PC has failed and the socket is connected we will transition to Mantis
|
|
17939
17987
|
_this._.startRelayedToRoutedTransition();
|
|
17940
17988
|
} else {
|
|
17941
|
-
|
|
17942
|
-
|
|
17943
|
-
}, STREAM_DESTROY_DELAY);
|
|
17989
|
+
// If Mantis PC fails, then nothing else to do.
|
|
17990
|
+
destroyStream();
|
|
17944
17991
|
}
|
|
17945
|
-
case
|
|
17992
|
+
case 34:
|
|
17946
17993
|
case "end":
|
|
17947
|
-
return
|
|
17994
|
+
return _context6.stop();
|
|
17948
17995
|
}
|
|
17949
|
-
},
|
|
17996
|
+
}, _callee6);
|
|
17950
17997
|
}));
|
|
17951
17998
|
return function onIceConnectionStateChange(_x4, _x5) {
|
|
17952
17999
|
return _ref10.apply(this, arguments);
|
|
@@ -17996,12 +18043,12 @@ function PublisherFactory(_ref) {
|
|
|
17996
18043
|
* @param {string} configuration.peerConnectionId
|
|
17997
18044
|
* @returns {Promise<Error, PublisherPeerConnection>}
|
|
17998
18045
|
*/
|
|
17999
|
-
const createPeerConnection =
|
|
18000
|
-
let peerConnectionId =
|
|
18001
|
-
send =
|
|
18002
|
-
log =
|
|
18003
|
-
logQoS =
|
|
18004
|
-
sourceStreamId =
|
|
18046
|
+
const createPeerConnection = _ref13 => {
|
|
18047
|
+
let peerConnectionId = _ref13.peerConnectionId,
|
|
18048
|
+
send = _ref13.send,
|
|
18049
|
+
log = _ref13.log,
|
|
18050
|
+
logQoS = _ref13.logQoS,
|
|
18051
|
+
sourceStreamId = _ref13.sourceStreamId;
|
|
18005
18052
|
if (getPeerConnectionById(peerConnectionId)) {
|
|
18006
18053
|
return Promise.reject(new Error('PeerConnection already exists'));
|
|
18007
18054
|
}
|
|
@@ -18018,9 +18065,9 @@ function PublisherFactory(_ref) {
|
|
|
18018
18065
|
capableSimulcastScreenshare: properties.capableSimulcastScreenshare,
|
|
18019
18066
|
scalableVideo: properties.scalableVideo
|
|
18020
18067
|
});
|
|
18021
|
-
peerConnectionsAsync[peerConnectionId] = Promise.all([this.session._.getIceConfig(), this.session._.getVideoCodecsCompatible(webRTCStream)]).then(
|
|
18022
|
-
let iceConfig =
|
|
18023
|
-
videoCodecsCompatible =
|
|
18068
|
+
peerConnectionsAsync[peerConnectionId] = Promise.all([this.session._.getIceConfig(), this.session._.getVideoCodecsCompatible(webRTCStream)]).then(_ref14 => {
|
|
18069
|
+
let iceConfig = _ref14[0],
|
|
18070
|
+
videoCodecsCompatible = _ref14[1];
|
|
18024
18071
|
let pcStream = webRTCStream;
|
|
18025
18072
|
if (!videoCodecsCompatible) {
|
|
18026
18073
|
pcStream = webRTCStream.clone();
|
|
@@ -18072,9 +18119,9 @@ function PublisherFactory(_ref) {
|
|
|
18072
18119
|
});
|
|
18073
18120
|
peerConnection.on({
|
|
18074
18121
|
disconnected: () => onPeerDisconnected(peerConnection),
|
|
18075
|
-
error:
|
|
18076
|
-
let reason =
|
|
18077
|
-
prefix =
|
|
18122
|
+
error: _ref15 => {
|
|
18123
|
+
let reason = _ref15.reason,
|
|
18124
|
+
prefix = _ref15.prefix;
|
|
18078
18125
|
return onPeerConnectionFailure(peerConnection, {
|
|
18079
18126
|
reason,
|
|
18080
18127
|
prefix
|
|
@@ -18255,12 +18302,12 @@ function PublisherFactory(_ref) {
|
|
|
18255
18302
|
}))))).then(pcsAndStats => {
|
|
18256
18303
|
// @todo this publishStartTime is going to be so wrong in P2P
|
|
18257
18304
|
const startTimestamp = publishStartTime ? publishStartTime.getTime() : Date.now();
|
|
18258
|
-
const results = pcsAndStats.map(
|
|
18259
|
-
let pc =
|
|
18260
|
-
stats =
|
|
18261
|
-
const
|
|
18262
|
-
remoteConnectionId =
|
|
18263
|
-
remoteSubscriberId =
|
|
18305
|
+
const results = pcsAndStats.map(_ref16 => {
|
|
18306
|
+
let pc = _ref16.pc,
|
|
18307
|
+
stats = _ref16.stats;
|
|
18308
|
+
const _getPeerConnectionMet7 = getPeerConnectionMeta(pc),
|
|
18309
|
+
remoteConnectionId = _getPeerConnectionMet7.remoteConnectionId,
|
|
18310
|
+
remoteSubscriberId = _getPeerConnectionMet7.remoteSubscriberId;
|
|
18264
18311
|
return (0, _assign.default)(remoteConnectionId.match(/^symphony\./) ? {} : {
|
|
18265
18312
|
subscriberId: remoteSubscriberId,
|
|
18266
18313
|
connectionId: remoteConnectionId
|
|
@@ -18292,18 +18339,18 @@ function PublisherFactory(_ref) {
|
|
|
18292
18339
|
this.session._.streamCreate(streamOptions, completionHandler);
|
|
18293
18340
|
};
|
|
18294
18341
|
const _stopSendingRtpToMantis = /*#__PURE__*/function () {
|
|
18295
|
-
var
|
|
18342
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
18296
18343
|
var peerConnection;
|
|
18297
|
-
return _regenerator.default.wrap(function
|
|
18298
|
-
while (1) switch (
|
|
18344
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
18345
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
18299
18346
|
case 0:
|
|
18300
18347
|
_restartSendingRtpToMantisCalled = false;
|
|
18301
|
-
|
|
18348
|
+
_context7.next = 3;
|
|
18302
18349
|
return getMantisPeerConnection();
|
|
18303
18350
|
case 3:
|
|
18304
|
-
peerConnection =
|
|
18351
|
+
peerConnection = _context7.sent;
|
|
18305
18352
|
if (!peerConnection) {
|
|
18306
|
-
|
|
18353
|
+
_context7.next = 18;
|
|
18307
18354
|
break;
|
|
18308
18355
|
}
|
|
18309
18356
|
_this.trigger('sourceStreamIdChanged', 'P2P');
|
|
@@ -18314,55 +18361,55 @@ function PublisherFactory(_ref) {
|
|
|
18314
18361
|
|
|
18315
18362
|
// We add this delay before stopping media to prevent MANTIS to consider this stream
|
|
18316
18363
|
// as inactive after a reconnection and then destroy it.
|
|
18317
|
-
|
|
18364
|
+
_context7.next = 9;
|
|
18318
18365
|
return (0, _promiseDelay.default)(KEEP_SENDING_MEDIA_AFTER_TRANSITIONED);
|
|
18319
18366
|
case 9:
|
|
18320
18367
|
if (!_restartSendingRtpToMantisCalled) {
|
|
18321
|
-
|
|
18368
|
+
_context7.next = 12;
|
|
18322
18369
|
break;
|
|
18323
18370
|
}
|
|
18324
18371
|
logging.debug('Cancelling stop sending RTP to MANTIS.');
|
|
18325
|
-
return
|
|
18372
|
+
return _context7.abrupt("return");
|
|
18326
18373
|
case 12:
|
|
18327
18374
|
// Audio is muted and video is set to inactive
|
|
18328
18375
|
amrAudioTrackProcessor.muteAudioInPeerConnection(webRTCStream, peerConnection);
|
|
18329
|
-
|
|
18376
|
+
_context7.next = 15;
|
|
18330
18377
|
return peerConnection.changeMediaDirectionToInactive();
|
|
18331
18378
|
case 15:
|
|
18332
18379
|
if (!(OTHelpers.env.isFirefox && OTHelpers.env.version < 96)) {
|
|
18333
|
-
|
|
18380
|
+
_context7.next = 18;
|
|
18334
18381
|
break;
|
|
18335
18382
|
}
|
|
18336
|
-
|
|
18383
|
+
_context7.next = 18;
|
|
18337
18384
|
return _keepSendingRtcpToMantis();
|
|
18338
18385
|
case 18:
|
|
18339
18386
|
case "end":
|
|
18340
|
-
return
|
|
18387
|
+
return _context7.stop();
|
|
18341
18388
|
}
|
|
18342
|
-
},
|
|
18389
|
+
}, _callee7);
|
|
18343
18390
|
}));
|
|
18344
18391
|
return function _stopSendingRtpToMantis() {
|
|
18345
|
-
return
|
|
18392
|
+
return _ref17.apply(this, arguments);
|
|
18346
18393
|
};
|
|
18347
18394
|
}();
|
|
18348
18395
|
const _restartSendingRtpToMantis = /*#__PURE__*/function () {
|
|
18349
|
-
var
|
|
18396
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
18350
18397
|
var peerConnection, _yield$getP2pPeerConn2;
|
|
18351
|
-
return _regenerator.default.wrap(function
|
|
18352
|
-
while (1) switch (
|
|
18398
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
18399
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
18353
18400
|
case 0:
|
|
18354
18401
|
_restartSendingRtpToMantisCalled = true;
|
|
18355
|
-
|
|
18402
|
+
_context8.next = 3;
|
|
18356
18403
|
return getMantisPeerConnection();
|
|
18357
18404
|
case 3:
|
|
18358
|
-
peerConnection =
|
|
18405
|
+
peerConnection = _context8.sent;
|
|
18359
18406
|
if (!peerConnection) {
|
|
18360
|
-
|
|
18407
|
+
_context8.next = 22;
|
|
18361
18408
|
break;
|
|
18362
18409
|
}
|
|
18363
18410
|
// Audio is unmuted and video is set to recvonly
|
|
18364
18411
|
amrAudioTrackProcessor.unmuteAudioInPeerConnection(webRTCStream, peerConnection);
|
|
18365
|
-
|
|
18412
|
+
_context8.next = 8;
|
|
18366
18413
|
return peerConnection.changeMediaDirectionToRecvOnly();
|
|
18367
18414
|
case 8:
|
|
18368
18415
|
if (_keepSendingRtcpToMantisTimeout) {
|
|
@@ -18370,81 +18417,81 @@ function PublisherFactory(_ref) {
|
|
|
18370
18417
|
}
|
|
18371
18418
|
_this.trigger('sourceStreamIdChanged', 'MANTIS');
|
|
18372
18419
|
if (!properties.publisherAudioFallbackEnabled) {
|
|
18373
|
-
|
|
18420
|
+
_context8.next = 22;
|
|
18374
18421
|
break;
|
|
18375
18422
|
}
|
|
18376
|
-
|
|
18377
|
-
|
|
18423
|
+
_context8.t0 = peerConnection;
|
|
18424
|
+
_context8.next = 14;
|
|
18378
18425
|
return getP2pPeerConnection();
|
|
18379
18426
|
case 14:
|
|
18380
|
-
|
|
18381
|
-
if (!(
|
|
18382
|
-
|
|
18427
|
+
_context8.t1 = _yield$getP2pPeerConn2 = _context8.sent;
|
|
18428
|
+
if (!(_context8.t1 == null)) {
|
|
18429
|
+
_context8.next = 19;
|
|
18383
18430
|
break;
|
|
18384
18431
|
}
|
|
18385
|
-
|
|
18386
|
-
|
|
18432
|
+
_context8.t2 = void 0;
|
|
18433
|
+
_context8.next = 20;
|
|
18387
18434
|
break;
|
|
18388
18435
|
case 19:
|
|
18389
|
-
|
|
18436
|
+
_context8.t2 = _yield$getP2pPeerConn2.getAudioFallbackState();
|
|
18390
18437
|
case 20:
|
|
18391
|
-
|
|
18392
|
-
|
|
18438
|
+
_context8.t3 = _context8.t2;
|
|
18439
|
+
_context8.t0.enableCongestionLevelEstimation.call(_context8.t0, _context8.t3);
|
|
18393
18440
|
case 22:
|
|
18394
18441
|
case "end":
|
|
18395
|
-
return
|
|
18442
|
+
return _context8.stop();
|
|
18396
18443
|
}
|
|
18397
|
-
},
|
|
18444
|
+
}, _callee8);
|
|
18398
18445
|
}));
|
|
18399
18446
|
return function _restartSendingRtpToMantis() {
|
|
18400
|
-
return
|
|
18447
|
+
return _ref18.apply(this, arguments);
|
|
18401
18448
|
};
|
|
18402
18449
|
}();
|
|
18403
18450
|
const _keepSendingRtcpToMantis = /*#__PURE__*/function () {
|
|
18404
|
-
var
|
|
18451
|
+
var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
18405
18452
|
var peerConnection;
|
|
18406
|
-
return _regenerator.default.wrap(function
|
|
18407
|
-
while (1) switch (
|
|
18453
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
18454
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
18408
18455
|
case 0:
|
|
18409
|
-
|
|
18456
|
+
_context10.next = 2;
|
|
18410
18457
|
return getMantisPeerConnection();
|
|
18411
18458
|
case 2:
|
|
18412
|
-
peerConnection =
|
|
18459
|
+
peerConnection = _context10.sent;
|
|
18413
18460
|
if (peerConnection) {
|
|
18414
|
-
_keepSendingRtcpToMantisTimeout = setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
18415
|
-
return _regenerator.default.wrap(function
|
|
18416
|
-
while (1) switch (
|
|
18461
|
+
_keepSendingRtcpToMantisTimeout = setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
18462
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
18463
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
18417
18464
|
case 0:
|
|
18418
18465
|
if (!(activeSourceStreamId === 'P2P')) {
|
|
18419
|
-
|
|
18466
|
+
_context9.next = 9;
|
|
18420
18467
|
break;
|
|
18421
18468
|
}
|
|
18422
|
-
|
|
18469
|
+
_context9.next = 3;
|
|
18423
18470
|
return peerConnection.changeMediaDirectionToRecvOnly();
|
|
18424
18471
|
case 3:
|
|
18425
|
-
|
|
18472
|
+
_context9.next = 5;
|
|
18426
18473
|
return (0, _promiseDelay.default)(KEEP_SENDING_MEDIA_TO_KEEP_ALIVE);
|
|
18427
18474
|
case 5:
|
|
18428
|
-
|
|
18475
|
+
_context9.next = 7;
|
|
18429
18476
|
return peerConnection.changeMediaDirectionToInactive();
|
|
18430
18477
|
case 7:
|
|
18431
|
-
|
|
18478
|
+
_context9.next = 9;
|
|
18432
18479
|
return _keepSendingRtcpToMantis();
|
|
18433
18480
|
case 9:
|
|
18434
18481
|
case "end":
|
|
18435
|
-
return
|
|
18482
|
+
return _context9.stop();
|
|
18436
18483
|
}
|
|
18437
|
-
},
|
|
18484
|
+
}, _callee9);
|
|
18438
18485
|
})), KEEP_SENDING_RTCP_DELAY);
|
|
18439
18486
|
}
|
|
18440
18487
|
case 4:
|
|
18441
18488
|
case "end":
|
|
18442
|
-
return
|
|
18489
|
+
return _context10.stop();
|
|
18443
18490
|
}
|
|
18444
|
-
},
|
|
18491
|
+
}, _callee10);
|
|
18445
18492
|
}));
|
|
18446
18493
|
return function _keepSendingRtcpToMantis() {
|
|
18447
|
-
return
|
|
18494
|
+
return _ref19.apply(this, arguments);
|
|
18448
18495
|
};
|
|
18449
18496
|
}();
|
|
18450
18497
|
const _transitionRoutedToRelayed = () => {
|
|
@@ -18480,55 +18527,55 @@ function PublisherFactory(_ref) {
|
|
|
18480
18527
|
});
|
|
18481
18528
|
};
|
|
18482
18529
|
const _transitionRelayedToRouted = /*#__PURE__*/function () {
|
|
18483
|
-
var
|
|
18484
|
-
return _regenerator.default.wrap(function
|
|
18485
|
-
while (1) switch (
|
|
18530
|
+
var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
18531
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
18532
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
18486
18533
|
case 0:
|
|
18487
18534
|
if (!(activeSourceStreamId !== 'P2P')) {
|
|
18488
|
-
|
|
18535
|
+
_context11.next = 2;
|
|
18489
18536
|
break;
|
|
18490
18537
|
}
|
|
18491
|
-
return
|
|
18538
|
+
return _context11.abrupt("return");
|
|
18492
18539
|
case 2:
|
|
18493
18540
|
logRelayedToRoutedTransition('Attempt');
|
|
18494
18541
|
if (_this.session) {
|
|
18495
|
-
|
|
18542
|
+
_context11.next = 6;
|
|
18496
18543
|
break;
|
|
18497
18544
|
}
|
|
18498
18545
|
logRelayedToRoutedTransition('Failure', {
|
|
18499
18546
|
reason: 'Not connected to the session.'
|
|
18500
18547
|
});
|
|
18501
|
-
return
|
|
18548
|
+
return _context11.abrupt("return");
|
|
18502
18549
|
case 6:
|
|
18503
18550
|
if (_this.streamId) {
|
|
18504
|
-
|
|
18551
|
+
_context11.next = 9;
|
|
18505
18552
|
break;
|
|
18506
18553
|
}
|
|
18507
18554
|
logRelayedToRoutedTransition('Failure', {
|
|
18508
18555
|
reason: 'No streamId available'
|
|
18509
18556
|
});
|
|
18510
|
-
return
|
|
18557
|
+
return _context11.abrupt("return");
|
|
18511
18558
|
case 9:
|
|
18512
|
-
|
|
18559
|
+
_context11.next = 11;
|
|
18513
18560
|
return _restartSendingRtpToMantis();
|
|
18514
18561
|
case 11:
|
|
18515
18562
|
_this.session._.streamDestroy(_this.streamId, 'P2P');
|
|
18516
|
-
|
|
18517
|
-
|
|
18563
|
+
_context11.t0 = _this;
|
|
18564
|
+
_context11.next = 15;
|
|
18518
18565
|
return getP2pPeerConnection();
|
|
18519
18566
|
case 15:
|
|
18520
|
-
|
|
18521
|
-
|
|
18567
|
+
_context11.t1 = _context11.sent;
|
|
18568
|
+
_context11.t0._removePeerConnection.call(_context11.t0, _context11.t1);
|
|
18522
18569
|
logRelayedToRoutedTransition('Success');
|
|
18523
18570
|
_this.trigger('streamDestroyForP2PComplete');
|
|
18524
18571
|
case 19:
|
|
18525
18572
|
case "end":
|
|
18526
|
-
return
|
|
18573
|
+
return _context11.stop();
|
|
18527
18574
|
}
|
|
18528
|
-
},
|
|
18575
|
+
}, _callee11);
|
|
18529
18576
|
}));
|
|
18530
18577
|
return function _transitionRelayedToRouted() {
|
|
18531
|
-
return
|
|
18578
|
+
return _ref21.apply(this, arguments);
|
|
18532
18579
|
};
|
|
18533
18580
|
}();
|
|
18534
18581
|
this.publish = targetElement => {
|
|
@@ -18611,11 +18658,11 @@ function PublisherFactory(_ref) {
|
|
|
18611
18658
|
this.dispatchEvent(event);
|
|
18612
18659
|
});
|
|
18613
18660
|
getUserMedia().catch(userMediaError).then( /*#__PURE__*/function () {
|
|
18614
|
-
var
|
|
18661
|
+
var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(stream) {
|
|
18615
18662
|
var _audioDevices, _videoDevices;
|
|
18616
18663
|
var hasVideoFilter, hasAudioVideoDevices;
|
|
18617
|
-
return _regenerator.default.wrap(function
|
|
18618
|
-
while (1) switch (
|
|
18664
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
18665
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
18619
18666
|
case 0:
|
|
18620
18667
|
// this comes from deviceHelpers.shouldAskForDevices in a round-about way
|
|
18621
18668
|
audioDevices = processedOptions.audioDevices;
|
|
@@ -18626,7 +18673,7 @@ function PublisherFactory(_ref) {
|
|
|
18626
18673
|
removeDeviceChangeListener = addAudioInputDevicesChangeListener(_this);
|
|
18627
18674
|
}
|
|
18628
18675
|
hasAudioVideoDevices = ((_audioDevices = audioDevices) == null ? void 0 : _audioDevices.length) > 0 || ((_videoDevices = videoDevices) == null ? void 0 : _videoDevices.length) > 0;
|
|
18629
|
-
|
|
18676
|
+
_context12.next = 7;
|
|
18630
18677
|
return (0, _permissionListener.default)(hasAudioVideoDevices).then(listener => {
|
|
18631
18678
|
listener.on('accessDenied', device => {
|
|
18632
18679
|
_this.accessAllowed = false;
|
|
@@ -18639,7 +18686,7 @@ function PublisherFactory(_ref) {
|
|
|
18639
18686
|
// else the wrong device will be returned/nonsensical
|
|
18640
18687
|
currentDeviceId = (0, _getDeviceIdFromStream.default)(stream, videoDevices);
|
|
18641
18688
|
}
|
|
18642
|
-
|
|
18689
|
+
_context12.next = 10;
|
|
18643
18690
|
return onStreamAvailable(stream);
|
|
18644
18691
|
case 10:
|
|
18645
18692
|
if (!properties.publishVideo) {
|
|
@@ -18654,7 +18701,7 @@ function PublisherFactory(_ref) {
|
|
|
18654
18701
|
setCurrentTrackDeviceId(currentDeviceId);
|
|
18655
18702
|
}
|
|
18656
18703
|
}
|
|
18657
|
-
return
|
|
18704
|
+
return _context12.abrupt("return", bindVideo().catch(error => {
|
|
18658
18705
|
if (error instanceof _cancel.CancellationError) {
|
|
18659
18706
|
// If we get a CancellationError, it means something newer tried
|
|
18660
18707
|
// to bindVideo before the old one succeeded, perhaps they called
|
|
@@ -18675,118 +18722,118 @@ function PublisherFactory(_ref) {
|
|
|
18675
18722
|
}));
|
|
18676
18723
|
case 13:
|
|
18677
18724
|
case "end":
|
|
18678
|
-
return
|
|
18725
|
+
return _context12.stop();
|
|
18679
18726
|
}
|
|
18680
|
-
},
|
|
18727
|
+
}, _callee12);
|
|
18681
18728
|
}));
|
|
18682
18729
|
return function (_x6) {
|
|
18683
|
-
return
|
|
18730
|
+
return _ref22.apply(this, arguments);
|
|
18684
18731
|
};
|
|
18685
18732
|
}());
|
|
18686
18733
|
});
|
|
18687
18734
|
return this;
|
|
18688
18735
|
};
|
|
18689
|
-
this._getVideoSenders = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
18690
|
-
return _regenerator.default.wrap(function
|
|
18691
|
-
while (1) switch (
|
|
18736
|
+
this._getVideoSenders = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
18737
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
18738
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
18692
18739
|
case 0:
|
|
18693
|
-
return
|
|
18694
|
-
let kind =
|
|
18740
|
+
return _context13.abrupt("return", getAllPeerConnections().then(peerConnections => peerConnections[0].getSenders().filter(_ref24 => {
|
|
18741
|
+
let kind = _ref24.track.kind;
|
|
18695
18742
|
return kind === 'video';
|
|
18696
18743
|
})));
|
|
18697
18744
|
case 1:
|
|
18698
18745
|
case "end":
|
|
18699
|
-
return
|
|
18746
|
+
return _context13.stop();
|
|
18700
18747
|
}
|
|
18701
|
-
},
|
|
18748
|
+
}, _callee13);
|
|
18702
18749
|
}));
|
|
18703
18750
|
this._setScalableValues = /*#__PURE__*/function () {
|
|
18704
|
-
var
|
|
18751
|
+
var _ref25 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(scalableParam, scalableValues) {
|
|
18705
18752
|
var senders, sender, sendParameters;
|
|
18706
|
-
return _regenerator.default.wrap(function
|
|
18707
|
-
while (1) switch (
|
|
18753
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
18754
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
18708
18755
|
case 0:
|
|
18709
|
-
|
|
18756
|
+
_context14.next = 2;
|
|
18710
18757
|
return _this._getVideoSenders();
|
|
18711
18758
|
case 2:
|
|
18712
|
-
senders =
|
|
18759
|
+
senders = _context14.sent;
|
|
18713
18760
|
sender = senders[0];
|
|
18714
18761
|
sendParameters = sender.getParameters();
|
|
18715
18762
|
sendParameters.encodings.forEach((encoding, index) => {
|
|
18716
18763
|
encoding[scalableParam] = scalableValues[index]; // eslint-disable-line no-param-reassign
|
|
18717
18764
|
});
|
|
18718
|
-
|
|
18765
|
+
_context14.next = 8;
|
|
18719
18766
|
return sender.setParameters(sendParameters);
|
|
18720
18767
|
case 8:
|
|
18721
18768
|
case "end":
|
|
18722
|
-
return
|
|
18769
|
+
return _context14.stop();
|
|
18723
18770
|
}
|
|
18724
|
-
},
|
|
18771
|
+
}, _callee14);
|
|
18725
18772
|
}));
|
|
18726
18773
|
return function (_x7, _x8) {
|
|
18727
|
-
return
|
|
18774
|
+
return _ref25.apply(this, arguments);
|
|
18728
18775
|
};
|
|
18729
18776
|
}();
|
|
18730
18777
|
this._setScalabilityMode = /*#__PURE__*/function () {
|
|
18731
|
-
var
|
|
18732
|
-
return _regenerator.default.wrap(function
|
|
18733
|
-
while (1) switch (
|
|
18778
|
+
var _ref26 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(scalabilityMode) {
|
|
18779
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
18780
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
18734
18781
|
case 0:
|
|
18735
|
-
return
|
|
18782
|
+
return _context15.abrupt("return", setScalabilityMode(scalabilityMode, _this));
|
|
18736
18783
|
case 1:
|
|
18737
18784
|
case "end":
|
|
18738
|
-
return
|
|
18785
|
+
return _context15.stop();
|
|
18739
18786
|
}
|
|
18740
|
-
},
|
|
18787
|
+
}, _callee15);
|
|
18741
18788
|
}));
|
|
18742
18789
|
return function (_x9) {
|
|
18743
|
-
return
|
|
18790
|
+
return _ref26.apply(this, arguments);
|
|
18744
18791
|
};
|
|
18745
18792
|
}();
|
|
18746
18793
|
this._setScalableFramerates = /*#__PURE__*/function () {
|
|
18747
|
-
var
|
|
18794
|
+
var _ref27 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(frameRates) {
|
|
18748
18795
|
var framerateValues;
|
|
18749
|
-
return _regenerator.default.wrap(function
|
|
18750
|
-
while (1) switch (
|
|
18796
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
18797
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
18751
18798
|
case 0:
|
|
18752
18799
|
framerateValues = normalizeScalableValues(frameRates);
|
|
18753
18800
|
if (!(framerateValues && areValidFramerates(framerateValues))) {
|
|
18754
|
-
|
|
18801
|
+
_context16.next = 4;
|
|
18755
18802
|
break;
|
|
18756
18803
|
}
|
|
18757
|
-
|
|
18804
|
+
_context16.next = 4;
|
|
18758
18805
|
return _this._setScalableValues('maxFramerate', framerateValues);
|
|
18759
18806
|
case 4:
|
|
18760
18807
|
case "end":
|
|
18761
|
-
return
|
|
18808
|
+
return _context16.stop();
|
|
18762
18809
|
}
|
|
18763
|
-
},
|
|
18810
|
+
}, _callee16);
|
|
18764
18811
|
}));
|
|
18765
18812
|
return function (_x10) {
|
|
18766
|
-
return
|
|
18813
|
+
return _ref27.apply(this, arguments);
|
|
18767
18814
|
};
|
|
18768
18815
|
}();
|
|
18769
18816
|
this._setScalableVideoLayers = /*#__PURE__*/function () {
|
|
18770
|
-
var
|
|
18817
|
+
var _ref28 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(videoLayers) {
|
|
18771
18818
|
var videoLayerValues;
|
|
18772
|
-
return _regenerator.default.wrap(function
|
|
18773
|
-
while (1) switch (
|
|
18819
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
18820
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
18774
18821
|
case 0:
|
|
18775
18822
|
videoLayerValues = normalizeScalableValues(videoLayers);
|
|
18776
18823
|
if (!(videoLayerValues && areValidResolutionScales(videoLayerValues))) {
|
|
18777
|
-
|
|
18824
|
+
_context17.next = 4;
|
|
18778
18825
|
break;
|
|
18779
18826
|
}
|
|
18780
|
-
|
|
18827
|
+
_context17.next = 4;
|
|
18781
18828
|
return _this._setScalableValues('scaleResolutionDownBy', videoLayerValues);
|
|
18782
18829
|
case 4:
|
|
18783
18830
|
case "end":
|
|
18784
|
-
return
|
|
18831
|
+
return _context17.stop();
|
|
18785
18832
|
}
|
|
18786
|
-
},
|
|
18833
|
+
}, _callee17);
|
|
18787
18834
|
}));
|
|
18788
18835
|
return function (_x11) {
|
|
18789
|
-
return
|
|
18836
|
+
return _ref28.apply(this, arguments);
|
|
18790
18837
|
};
|
|
18791
18838
|
}();
|
|
18792
18839
|
const areValidFramerates = framerates => {
|
|
@@ -18927,20 +18974,20 @@ function PublisherFactory(_ref) {
|
|
|
18927
18974
|
const updateVideo = () => {
|
|
18928
18975
|
const shouldSendVideo = haveWorkingTracks('video') && properties.publishVideo;
|
|
18929
18976
|
if (_env.default.name === 'Chrome' && _env.default.version >= 69) {
|
|
18930
|
-
(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
18977
|
+
(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
18931
18978
|
var executionSentinel, peerConnections;
|
|
18932
|
-
return _regenerator.default.wrap(function
|
|
18933
|
-
while (1) switch (
|
|
18979
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
18980
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
18934
18981
|
case 0:
|
|
18935
18982
|
if (updateVideoSenderParametersSentinel) {
|
|
18936
18983
|
updateVideoSenderParametersSentinel.cancel();
|
|
18937
18984
|
}
|
|
18938
18985
|
updateVideoSenderParametersSentinel = new _cancel.default();
|
|
18939
18986
|
executionSentinel = updateVideoSenderParametersSentinel;
|
|
18940
|
-
|
|
18987
|
+
_context18.next = 5;
|
|
18941
18988
|
return getAllPeerConnections();
|
|
18942
18989
|
case 5:
|
|
18943
|
-
peerConnections =
|
|
18990
|
+
peerConnections = _context18.sent;
|
|
18944
18991
|
if (!executionSentinel.isCanceled()) {
|
|
18945
18992
|
// only proceed if we weren't canceled during the async operation above
|
|
18946
18993
|
peerConnections.forEach(peerConnection => {
|
|
@@ -18949,9 +18996,9 @@ function PublisherFactory(_ref) {
|
|
|
18949
18996
|
}
|
|
18950
18997
|
case 7:
|
|
18951
18998
|
case "end":
|
|
18952
|
-
return
|
|
18999
|
+
return _context18.stop();
|
|
18953
19000
|
}
|
|
18954
|
-
},
|
|
19001
|
+
}, _callee18);
|
|
18955
19002
|
}))();
|
|
18956
19003
|
}
|
|
18957
19004
|
if (isCustomVideoTrack && mediaProcessor) {
|
|
@@ -18978,25 +19025,25 @@ function PublisherFactory(_ref) {
|
|
|
18978
19025
|
refreshAudioVideoUI();
|
|
18979
19026
|
};
|
|
18980
19027
|
const destroyMediaProcessor = /*#__PURE__*/function () {
|
|
18981
|
-
var
|
|
19028
|
+
var _ref30 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
18982
19029
|
var videoTrack;
|
|
18983
|
-
return _regenerator.default.wrap(function
|
|
18984
|
-
while (1) switch (
|
|
19030
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
19031
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
18985
19032
|
case 0:
|
|
18986
19033
|
// We need to cache this since calling the method below will
|
|
18987
19034
|
// clear this value.
|
|
18988
19035
|
videoTrack = mediaProcessor.getOriginalVideoTrack(); // Note: this needs to be called before the `stop` method below. Reversing
|
|
18989
19036
|
// the order may cause race conditions with the MP worker.
|
|
18990
|
-
|
|
18991
|
-
|
|
19037
|
+
_context19.prev = 1;
|
|
19038
|
+
_context19.next = 4;
|
|
18992
19039
|
return mediaProcessor.destroy();
|
|
18993
19040
|
case 4:
|
|
18994
|
-
|
|
19041
|
+
_context19.next = 9;
|
|
18995
19042
|
break;
|
|
18996
19043
|
case 6:
|
|
18997
|
-
|
|
18998
|
-
|
|
18999
|
-
logging.warn(`Error cleaning up mediaProcessor: ${
|
|
19044
|
+
_context19.prev = 6;
|
|
19045
|
+
_context19.t0 = _context19["catch"](1);
|
|
19046
|
+
logging.warn(`Error cleaning up mediaProcessor: ${_context19.t0}`);
|
|
19000
19047
|
case 9:
|
|
19001
19048
|
// Since no filtering is being applied, we perform some cleanup. We
|
|
19002
19049
|
// stop the original video track here since it's not being used
|
|
@@ -19004,12 +19051,12 @@ function PublisherFactory(_ref) {
|
|
|
19004
19051
|
videoTrack.stop();
|
|
19005
19052
|
case 10:
|
|
19006
19053
|
case "end":
|
|
19007
|
-
return
|
|
19054
|
+
return _context19.stop();
|
|
19008
19055
|
}
|
|
19009
|
-
},
|
|
19056
|
+
}, _callee19, null, [[1, 6]]);
|
|
19010
19057
|
}));
|
|
19011
19058
|
return function destroyMediaProcessor() {
|
|
19012
|
-
return
|
|
19059
|
+
return _ref30.apply(this, arguments);
|
|
19013
19060
|
};
|
|
19014
19061
|
}();
|
|
19015
19062
|
const hasTrackFromDevice = deviceId =>
|
|
@@ -19037,25 +19084,25 @@ function PublisherFactory(_ref) {
|
|
|
19037
19084
|
let currentVideoFilter;
|
|
19038
19085
|
let currentAudioFilter;
|
|
19039
19086
|
this._toggleVideo = (0, _blockCallsUntilComplete.default)( /*#__PURE__*/function () {
|
|
19040
|
-
var
|
|
19087
|
+
var _ref31 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(shouldHaveVideo, videoDimensions) {
|
|
19041
19088
|
var _vidDevices$find;
|
|
19042
19089
|
var vidDevices, oldTrack, oldTrackDeviceId, newTrack, videoFilter, originalVideoTrack, _originalVideoTrack;
|
|
19043
|
-
return _regenerator.default.wrap(function
|
|
19044
|
-
while (1) switch (
|
|
19090
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
19091
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
19045
19092
|
case 0:
|
|
19046
19093
|
if (!(isScreenSharing || isCustomVideoTrack || isTrackManuallyStopped)) {
|
|
19047
|
-
|
|
19094
|
+
_context20.next = 2;
|
|
19048
19095
|
break;
|
|
19049
19096
|
}
|
|
19050
|
-
return
|
|
19097
|
+
return _context20.abrupt("return");
|
|
19051
19098
|
case 2:
|
|
19052
|
-
|
|
19099
|
+
_context20.next = 4;
|
|
19053
19100
|
return getVideoDevices();
|
|
19054
19101
|
case 4:
|
|
19055
|
-
vidDevices =
|
|
19102
|
+
vidDevices = _context20.sent;
|
|
19056
19103
|
oldTrack = getCurrentTrack();
|
|
19057
19104
|
if (oldTrack) {
|
|
19058
|
-
|
|
19105
|
+
_context20.next = 8;
|
|
19059
19106
|
break;
|
|
19060
19107
|
}
|
|
19061
19108
|
throw otError(Errors.NOT_SUPPORTED, new Error('Publisher._toggleVideo cannot toggleVideo when you have no video source.'));
|
|
@@ -19063,17 +19110,17 @@ function PublisherFactory(_ref) {
|
|
|
19063
19110
|
// oldTrackDeviceId is undefined when it comes from a canvasTracks, i.e.: it is currently muted
|
|
19064
19111
|
oldTrackDeviceId = (_vidDevices$find = vidDevices.find(device => device.label === oldTrack.label)) == null ? void 0 : _vidDevices$find.deviceId;
|
|
19065
19112
|
if (isNewTrackNeeded(shouldHaveVideo, oldTrackDeviceId)) {
|
|
19066
|
-
|
|
19113
|
+
_context20.next = 11;
|
|
19067
19114
|
break;
|
|
19068
19115
|
}
|
|
19069
|
-
return
|
|
19116
|
+
return _context20.abrupt("return");
|
|
19070
19117
|
case 11:
|
|
19071
19118
|
if (!(oldTrack.readyState === 'ended')) {
|
|
19072
|
-
|
|
19119
|
+
_context20.next = 14;
|
|
19073
19120
|
break;
|
|
19074
19121
|
}
|
|
19075
19122
|
isTrackManuallyStopped = true;
|
|
19076
|
-
return
|
|
19123
|
+
return _context20.abrupt("return");
|
|
19077
19124
|
case 14:
|
|
19078
19125
|
if (shouldHaveVideo && OTHelpers.env.isAndroid && OTHelpers.env.isChrome) {
|
|
19079
19126
|
// On Chrome on Android you need to stop the previous video track OPENTOK-37206
|
|
@@ -19082,17 +19129,17 @@ function PublisherFactory(_ref) {
|
|
|
19082
19129
|
}
|
|
19083
19130
|
}
|
|
19084
19131
|
if (shouldHaveVideo) {
|
|
19085
|
-
|
|
19132
|
+
_context20.next = 31;
|
|
19086
19133
|
break;
|
|
19087
19134
|
}
|
|
19088
|
-
|
|
19135
|
+
_context20.prev = 16;
|
|
19089
19136
|
newTrack = (0, _createCanvasVideoTrack.default)(videoDimensions);
|
|
19090
|
-
|
|
19137
|
+
_context20.next = 23;
|
|
19091
19138
|
break;
|
|
19092
19139
|
case 20:
|
|
19093
|
-
|
|
19094
|
-
|
|
19095
|
-
return
|
|
19140
|
+
_context20.prev = 20;
|
|
19141
|
+
_context20.t0 = _context20["catch"](16);
|
|
19142
|
+
return _context20.abrupt("return");
|
|
19096
19143
|
case 23:
|
|
19097
19144
|
if (oldTrackDeviceId) {
|
|
19098
19145
|
// store the current deviceId to reacquire the video later
|
|
@@ -19101,13 +19148,13 @@ function PublisherFactory(_ref) {
|
|
|
19101
19148
|
setCurrentTrackDeviceId(newTrack.label);
|
|
19102
19149
|
videoFilter = mediaProcessor.getVideoFilter();
|
|
19103
19150
|
if (!videoFilter) {
|
|
19104
|
-
|
|
19151
|
+
_context20.next = 30;
|
|
19105
19152
|
break;
|
|
19106
19153
|
}
|
|
19107
19154
|
// Save the current video filter because we want to make sure it
|
|
19108
19155
|
// gets enabled when the user publishes video again
|
|
19109
19156
|
currentVideoFilter = videoFilter;
|
|
19110
|
-
|
|
19157
|
+
_context20.next = 30;
|
|
19111
19158
|
return destroyMediaProcessor();
|
|
19112
19159
|
case 30:
|
|
19113
19160
|
if (_videoMediaProcessorConnector) {
|
|
@@ -19116,102 +19163,102 @@ function PublisherFactory(_ref) {
|
|
|
19116
19163
|
}
|
|
19117
19164
|
case 31:
|
|
19118
19165
|
if (!(currentDeviceId && vidDevices.findIndex(device => device.deviceId === currentDeviceId) === -1)) {
|
|
19119
|
-
|
|
19166
|
+
_context20.next = 33;
|
|
19120
19167
|
break;
|
|
19121
19168
|
}
|
|
19122
19169
|
throw otError(Errors.NO_DEVICES_FOUND, new Error('Previous device no longer available - deviceId not found'));
|
|
19123
19170
|
case 33:
|
|
19124
19171
|
privateEvents.emit('streamDestroy');
|
|
19125
19172
|
if (!shouldHaveVideo) {
|
|
19126
|
-
|
|
19173
|
+
_context20.next = 64;
|
|
19127
19174
|
break;
|
|
19128
19175
|
}
|
|
19129
19176
|
if (!hasTrackFromDevice(currentDeviceId)) {
|
|
19130
|
-
|
|
19177
|
+
_context20.next = 37;
|
|
19131
19178
|
break;
|
|
19132
19179
|
}
|
|
19133
|
-
return
|
|
19180
|
+
return _context20.abrupt("return");
|
|
19134
19181
|
case 37:
|
|
19135
|
-
|
|
19136
|
-
|
|
19182
|
+
_context20.prev = 37;
|
|
19183
|
+
_context20.next = 40;
|
|
19137
19184
|
return getTrackFromDeviceId(currentDeviceId);
|
|
19138
19185
|
case 40:
|
|
19139
|
-
newTrack =
|
|
19140
|
-
|
|
19186
|
+
newTrack = _context20.sent;
|
|
19187
|
+
_context20.next = 47;
|
|
19141
19188
|
break;
|
|
19142
19189
|
case 43:
|
|
19143
|
-
|
|
19144
|
-
|
|
19145
|
-
logging.error(`Error getting new track for current device(${currentDeviceId}): ${
|
|
19146
|
-
throw
|
|
19190
|
+
_context20.prev = 43;
|
|
19191
|
+
_context20.t1 = _context20["catch"](37);
|
|
19192
|
+
logging.error(`Error getting new track for current device(${currentDeviceId}): ${_context20.t1}`);
|
|
19193
|
+
throw _context20.t1;
|
|
19147
19194
|
case 47:
|
|
19148
19195
|
if (newTrack) {
|
|
19149
|
-
|
|
19196
|
+
_context20.next = 50;
|
|
19150
19197
|
break;
|
|
19151
19198
|
}
|
|
19152
19199
|
logging.error('Failed to enable video. It was not possible to get a new track from the camera');
|
|
19153
|
-
return
|
|
19200
|
+
return _context20.abrupt("return");
|
|
19154
19201
|
case 50:
|
|
19155
19202
|
if (!currentVideoFilter) {
|
|
19156
|
-
|
|
19203
|
+
_context20.next = 59;
|
|
19157
19204
|
break;
|
|
19158
19205
|
}
|
|
19159
19206
|
originalVideoTrack = mediaProcessor.getOriginalVideoTrack();
|
|
19160
|
-
|
|
19207
|
+
_context20.next = 54;
|
|
19161
19208
|
return mediaProcessor.setVideoFilter(currentVideoFilter);
|
|
19162
19209
|
case 54:
|
|
19163
|
-
|
|
19210
|
+
_context20.next = 56;
|
|
19164
19211
|
return mediaProcessor.setMediaStream(webRTCStream);
|
|
19165
19212
|
case 56:
|
|
19166
|
-
|
|
19213
|
+
_context20.next = 58;
|
|
19167
19214
|
return mediaProcessor.setVideoTrack(newTrack);
|
|
19168
19215
|
case 58:
|
|
19169
|
-
newTrack =
|
|
19216
|
+
newTrack = _context20.sent;
|
|
19170
19217
|
case 59:
|
|
19171
19218
|
if (!_videoMediaProcessorConnector) {
|
|
19172
|
-
|
|
19219
|
+
_context20.next = 64;
|
|
19173
19220
|
break;
|
|
19174
19221
|
}
|
|
19175
19222
|
originalVideoTrack = _videoMediaProcessorConnector.originalTrack;
|
|
19176
|
-
|
|
19223
|
+
_context20.next = 63;
|
|
19177
19224
|
return _videoMediaProcessorConnector.setTrack(newTrack);
|
|
19178
19225
|
case 63:
|
|
19179
|
-
newTrack =
|
|
19226
|
+
newTrack = _context20.sent;
|
|
19180
19227
|
case 64:
|
|
19181
|
-
|
|
19182
|
-
|
|
19228
|
+
_context20.prev = 64;
|
|
19229
|
+
_context20.next = 67;
|
|
19183
19230
|
return replaceTrackAndUpdate(oldTrack, newTrack);
|
|
19184
19231
|
case 67:
|
|
19185
19232
|
// We stop the original track as a final step because whatever effects
|
|
19186
19233
|
// were applied to it should remain in effect until the new track is
|
|
19187
19234
|
// set
|
|
19188
19235
|
(_originalVideoTrack = originalVideoTrack) == null ? void 0 : _originalVideoTrack.stop();
|
|
19189
|
-
|
|
19236
|
+
_context20.next = 73;
|
|
19190
19237
|
break;
|
|
19191
19238
|
case 70:
|
|
19192
|
-
|
|
19193
|
-
|
|
19194
|
-
throw
|
|
19239
|
+
_context20.prev = 70;
|
|
19240
|
+
_context20.t2 = _context20["catch"](64);
|
|
19241
|
+
throw _context20.t2;
|
|
19195
19242
|
case 73:
|
|
19196
19243
|
case "end":
|
|
19197
|
-
return
|
|
19244
|
+
return _context20.stop();
|
|
19198
19245
|
}
|
|
19199
|
-
},
|
|
19246
|
+
}, _callee20, null, [[16, 20], [37, 43], [64, 70]]);
|
|
19200
19247
|
}));
|
|
19201
19248
|
return function (_x12, _x13) {
|
|
19202
|
-
return
|
|
19249
|
+
return _ref31.apply(this, arguments);
|
|
19203
19250
|
};
|
|
19204
19251
|
}());
|
|
19205
19252
|
const resetAudioFallbackStateOnPeerConnection = (0, _cancellation.callWithCancellation)( /*#__PURE__*/function () {
|
|
19206
|
-
var
|
|
19253
|
+
var _ref32 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(isActive, cancellation) {
|
|
19207
19254
|
var peerConnections;
|
|
19208
|
-
return _regenerator.default.wrap(function
|
|
19209
|
-
while (1) switch (
|
|
19255
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
19256
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
19210
19257
|
case 0:
|
|
19211
|
-
|
|
19258
|
+
_context21.next = 2;
|
|
19212
19259
|
return getAllPeerConnections();
|
|
19213
19260
|
case 2:
|
|
19214
|
-
peerConnections =
|
|
19261
|
+
peerConnections = _context21.sent;
|
|
19215
19262
|
if (!cancellation.isCanceled()) {
|
|
19216
19263
|
peerConnections.forEach(peerConnection => {
|
|
19217
19264
|
if (isActive) {
|
|
@@ -19223,12 +19270,12 @@ function PublisherFactory(_ref) {
|
|
|
19223
19270
|
}
|
|
19224
19271
|
case 4:
|
|
19225
19272
|
case "end":
|
|
19226
|
-
return
|
|
19273
|
+
return _context21.stop();
|
|
19227
19274
|
}
|
|
19228
|
-
},
|
|
19275
|
+
}, _callee21);
|
|
19229
19276
|
}));
|
|
19230
19277
|
return function (_x14, _x15) {
|
|
19231
|
-
return
|
|
19278
|
+
return _ref32.apply(this, arguments);
|
|
19232
19279
|
};
|
|
19233
19280
|
}());
|
|
19234
19281
|
const resetAudioFallbackState = () => {
|
|
@@ -19238,10 +19285,10 @@ function PublisherFactory(_ref) {
|
|
|
19238
19285
|
(_chromeMixin2 = chromeMixin) == null ? void 0 : _chromeMixin2.videoDisabledIndicator.setWarning(false);
|
|
19239
19286
|
};
|
|
19240
19287
|
const onAudioFallbackActiveVideo = /*#__PURE__*/function () {
|
|
19241
|
-
var
|
|
19288
|
+
var _ref33 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(previousState) {
|
|
19242
19289
|
var _chromeMixin3, _chromeMixin4;
|
|
19243
|
-
return _regenerator.default.wrap(function
|
|
19244
|
-
while (1) switch (
|
|
19290
|
+
return _regenerator.default.wrap(function _callee22$(_context22) {
|
|
19291
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
19245
19292
|
case 0:
|
|
19246
19293
|
(_chromeMixin3 = chromeMixin) == null ? void 0 : _chromeMixin3.videoDisabledIndicator.disableVideo(false);
|
|
19247
19294
|
(_chromeMixin4 = chromeMixin) == null ? void 0 : _chromeMixin4.videoDisabledIndicator.setWarning(false);
|
|
@@ -19254,12 +19301,12 @@ function PublisherFactory(_ref) {
|
|
|
19254
19301
|
}
|
|
19255
19302
|
case 3:
|
|
19256
19303
|
case "end":
|
|
19257
|
-
return
|
|
19304
|
+
return _context22.stop();
|
|
19258
19305
|
}
|
|
19259
|
-
},
|
|
19306
|
+
}, _callee22);
|
|
19260
19307
|
}));
|
|
19261
19308
|
return function onAudioFallbackActiveVideo(_x16) {
|
|
19262
|
-
return
|
|
19309
|
+
return _ref33.apply(this, arguments);
|
|
19263
19310
|
};
|
|
19264
19311
|
}();
|
|
19265
19312
|
const onAudioFallbackActiveVideoWithWarning = () => {
|
|
@@ -19270,10 +19317,10 @@ function PublisherFactory(_ref) {
|
|
|
19270
19317
|
this.trigger('videoDisableWarning');
|
|
19271
19318
|
};
|
|
19272
19319
|
const onAudioFallbackSuspendedVideo = /*#__PURE__*/function () {
|
|
19273
|
-
var
|
|
19320
|
+
var _ref34 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
19274
19321
|
var _chromeMixin6;
|
|
19275
|
-
return _regenerator.default.wrap(function
|
|
19276
|
-
while (1) switch (
|
|
19322
|
+
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
19323
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
19277
19324
|
case 0:
|
|
19278
19325
|
if (properties.publishVideo) {
|
|
19279
19326
|
(_chromeMixin6 = chromeMixin) == null ? void 0 : _chromeMixin6.videoDisabledIndicator.disableVideo(true);
|
|
@@ -19283,12 +19330,12 @@ function PublisherFactory(_ref) {
|
|
|
19283
19330
|
});
|
|
19284
19331
|
case 2:
|
|
19285
19332
|
case "end":
|
|
19286
|
-
return
|
|
19333
|
+
return _context23.stop();
|
|
19287
19334
|
}
|
|
19288
|
-
},
|
|
19335
|
+
}, _callee23);
|
|
19289
19336
|
}));
|
|
19290
19337
|
return function onAudioFallbackSuspendedVideo() {
|
|
19291
|
-
return
|
|
19338
|
+
return _ref34.apply(this, arguments);
|
|
19292
19339
|
};
|
|
19293
19340
|
}();
|
|
19294
19341
|
let audioFallbackCoordinator;
|
|
@@ -19301,9 +19348,9 @@ function PublisherFactory(_ref) {
|
|
|
19301
19348
|
[_audioFallbackVideoStates.default.ACTIVE_VIDEO_WITH_WARNING]: onAudioFallbackActiveVideoWithWarning,
|
|
19302
19349
|
[_audioFallbackVideoStates.default.SUSPENDED_VIDEO]: onAudioFallbackSuspendedVideo
|
|
19303
19350
|
};
|
|
19304
|
-
audioFallbackCoordinator.on('stateChange',
|
|
19305
|
-
let previousState =
|
|
19306
|
-
audioFallbackVideoState =
|
|
19351
|
+
audioFallbackCoordinator.on('stateChange', _ref35 => {
|
|
19352
|
+
let previousState = _ref35.previousState,
|
|
19353
|
+
audioFallbackVideoState = _ref35.state;
|
|
19307
19354
|
try {
|
|
19308
19355
|
audioFallbackStateHandlers[audioFallbackVideoState](previousState);
|
|
19309
19356
|
} catch (err) {
|
|
@@ -19392,10 +19439,10 @@ function PublisherFactory(_ref) {
|
|
|
19392
19439
|
return this;
|
|
19393
19440
|
};
|
|
19394
19441
|
this._publishVideo = /*#__PURE__*/function () {
|
|
19395
|
-
var
|
|
19442
|
+
var _ref36 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24(value) {
|
|
19396
19443
|
var videoDimensions;
|
|
19397
|
-
return _regenerator.default.wrap(function
|
|
19398
|
-
while (1) switch (
|
|
19444
|
+
return _regenerator.default.wrap(function _callee24$(_context24) {
|
|
19445
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
19399
19446
|
case 0:
|
|
19400
19447
|
// Save videoDimensions to not alter video size between mute states.
|
|
19401
19448
|
videoDimensions = getVideoDimensions();
|
|
@@ -19409,16 +19456,16 @@ function PublisherFactory(_ref) {
|
|
|
19409
19456
|
resetAudioFallbackState();
|
|
19410
19457
|
}
|
|
19411
19458
|
}
|
|
19412
|
-
|
|
19459
|
+
_context24.next = 5;
|
|
19413
19460
|
return Promise.all([_this._toggleVideo(properties.publishVideo, videoDimensions), updateVideo()]);
|
|
19414
19461
|
case 5:
|
|
19415
19462
|
case "end":
|
|
19416
|
-
return
|
|
19463
|
+
return _context24.stop();
|
|
19417
19464
|
}
|
|
19418
|
-
},
|
|
19465
|
+
}, _callee24);
|
|
19419
19466
|
}));
|
|
19420
19467
|
return function (_x17) {
|
|
19421
|
-
return
|
|
19468
|
+
return _ref36.apply(this, arguments);
|
|
19422
19469
|
};
|
|
19423
19470
|
}();
|
|
19424
19471
|
|
|
@@ -19687,42 +19734,42 @@ function PublisherFactory(_ref) {
|
|
|
19687
19734
|
{
|
|
19688
19735
|
let videoIndex = 0;
|
|
19689
19736
|
const cycleVideo = /*#__PURE__*/function () {
|
|
19690
|
-
var
|
|
19737
|
+
var _ref37 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
19691
19738
|
var oldTrack, vidDevices, hasOtherVideoDevices, newVideoDevice, deviceId;
|
|
19692
|
-
return _regenerator.default.wrap(function
|
|
19693
|
-
while (1) switch (
|
|
19739
|
+
return _regenerator.default.wrap(function _callee25$(_context25) {
|
|
19740
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
19694
19741
|
case 0:
|
|
19695
19742
|
if (!(OTHelpers.env.isLegacyEdge || !windowMock.RTCRtpSender || typeof windowMock.RTCRtpSender.prototype.replaceTrack !== 'function')) {
|
|
19696
|
-
|
|
19743
|
+
_context25.next = 2;
|
|
19697
19744
|
break;
|
|
19698
19745
|
}
|
|
19699
19746
|
throw otError(Errors.UNSUPPORTED_BROWSER, new Error('Publisher#cycleVideo is not supported in your browser.'), ExceptionCodes.UNABLE_TO_PUBLISH);
|
|
19700
19747
|
case 2:
|
|
19701
19748
|
if (!(isCustomVideoTrack || isScreenSharing)) {
|
|
19702
|
-
|
|
19749
|
+
_context25.next = 4;
|
|
19703
19750
|
break;
|
|
19704
19751
|
}
|
|
19705
19752
|
throw otError(Errors.NOT_SUPPORTED, new Error('Publisher#cycleVideo: The publisher is not using a camera video source'));
|
|
19706
19753
|
case 4:
|
|
19707
19754
|
oldTrack = getCurrentTrack();
|
|
19708
19755
|
if (oldTrack) {
|
|
19709
|
-
|
|
19756
|
+
_context25.next = 7;
|
|
19710
19757
|
break;
|
|
19711
19758
|
}
|
|
19712
19759
|
throw otError(Errors.NOT_SUPPORTED, new Error('Publisher#cycleVideo cannot cycleVideo when you have no video source.'));
|
|
19713
19760
|
case 7:
|
|
19714
19761
|
videoIndex += 1;
|
|
19715
|
-
|
|
19762
|
+
_context25.next = 10;
|
|
19716
19763
|
return getVideoDevices();
|
|
19717
19764
|
case 10:
|
|
19718
|
-
vidDevices =
|
|
19765
|
+
vidDevices = _context25.sent;
|
|
19719
19766
|
// different devices return the cameras in different orders
|
|
19720
19767
|
hasOtherVideoDevices = vidDevices.filter(device => device.deviceId !== currentDeviceId).length > 0;
|
|
19721
19768
|
if (hasOtherVideoDevices) {
|
|
19722
|
-
|
|
19769
|
+
_context25.next = 14;
|
|
19723
19770
|
break;
|
|
19724
19771
|
}
|
|
19725
|
-
return
|
|
19772
|
+
return _context25.abrupt("return", currentDeviceId);
|
|
19726
19773
|
case 14:
|
|
19727
19774
|
while (vidDevices[videoIndex % vidDevices.length].deviceId === currentDeviceId) {
|
|
19728
19775
|
videoIndex += 1;
|
|
@@ -19730,18 +19777,18 @@ function PublisherFactory(_ref) {
|
|
|
19730
19777
|
privateEvents.emit('streamDestroy');
|
|
19731
19778
|
newVideoDevice = vidDevices[videoIndex % vidDevices.length];
|
|
19732
19779
|
deviceId = newVideoDevice.deviceId;
|
|
19733
|
-
|
|
19780
|
+
_context25.next = 20;
|
|
19734
19781
|
return attemptToSetVideoTrack(deviceId);
|
|
19735
19782
|
case 20:
|
|
19736
|
-
return
|
|
19783
|
+
return _context25.abrupt("return", currentDeviceId);
|
|
19737
19784
|
case 21:
|
|
19738
19785
|
case "end":
|
|
19739
|
-
return
|
|
19786
|
+
return _context25.stop();
|
|
19740
19787
|
}
|
|
19741
|
-
},
|
|
19788
|
+
}, _callee25);
|
|
19742
19789
|
}));
|
|
19743
19790
|
return function cycleVideo() {
|
|
19744
|
-
return
|
|
19791
|
+
return _ref37.apply(this, arguments);
|
|
19745
19792
|
};
|
|
19746
19793
|
}();
|
|
19747
19794
|
|
|
@@ -19786,62 +19833,62 @@ function PublisherFactory(_ref) {
|
|
|
19786
19833
|
*
|
|
19787
19834
|
* @see <a href="#setVideoSource">Publisher.setVideoSource()</a>
|
|
19788
19835
|
*/
|
|
19789
|
-
this.cycleVideo = (0, _blockCallsUntilComplete.default)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
19836
|
+
this.cycleVideo = (0, _blockCallsUntilComplete.default)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
19790
19837
|
var deviceId;
|
|
19791
|
-
return _regenerator.default.wrap(function
|
|
19792
|
-
while (1) switch (
|
|
19838
|
+
return _regenerator.default.wrap(function _callee26$(_context26) {
|
|
19839
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
19793
19840
|
case 0:
|
|
19794
|
-
|
|
19795
|
-
|
|
19841
|
+
_context26.prev = 0;
|
|
19842
|
+
_context26.next = 3;
|
|
19796
19843
|
return cycleVideo();
|
|
19797
19844
|
case 3:
|
|
19798
|
-
deviceId =
|
|
19799
|
-
|
|
19845
|
+
deviceId = _context26.sent;
|
|
19846
|
+
_context26.next = 10;
|
|
19800
19847
|
break;
|
|
19801
19848
|
case 6:
|
|
19802
|
-
|
|
19803
|
-
|
|
19804
|
-
logging.error(`Publisher#cycleVideo: could not cycle video: ${
|
|
19805
|
-
throw
|
|
19849
|
+
_context26.prev = 6;
|
|
19850
|
+
_context26.t0 = _context26["catch"](0);
|
|
19851
|
+
logging.error(`Publisher#cycleVideo: could not cycle video: ${_context26.t0}`);
|
|
19852
|
+
throw _context26.t0;
|
|
19806
19853
|
case 10:
|
|
19807
|
-
return
|
|
19854
|
+
return _context26.abrupt("return", {
|
|
19808
19855
|
deviceId
|
|
19809
19856
|
});
|
|
19810
19857
|
case 11:
|
|
19811
19858
|
case "end":
|
|
19812
|
-
return
|
|
19859
|
+
return _context26.stop();
|
|
19813
19860
|
}
|
|
19814
|
-
},
|
|
19861
|
+
}, _callee26, null, [[0, 6]]);
|
|
19815
19862
|
})));
|
|
19816
19863
|
}
|
|
19817
19864
|
const replaceTrackAndUpdate = /*#__PURE__*/function () {
|
|
19818
|
-
var
|
|
19865
|
+
var _ref39 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28(oldTrack, newTrack) {
|
|
19819
19866
|
var pcs, isNewTrackFiltered, video;
|
|
19820
|
-
return _regenerator.default.wrap(function
|
|
19821
|
-
while (1) switch (
|
|
19867
|
+
return _regenerator.default.wrap(function _callee28$(_context28) {
|
|
19868
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
19822
19869
|
case 0:
|
|
19823
|
-
|
|
19870
|
+
_context28.next = 2;
|
|
19824
19871
|
return getAllPeerConnections();
|
|
19825
19872
|
case 2:
|
|
19826
|
-
pcs =
|
|
19827
|
-
|
|
19873
|
+
pcs = _context28.sent;
|
|
19874
|
+
_context28.next = 5;
|
|
19828
19875
|
return Promise.all(pcs.map( /*#__PURE__*/function () {
|
|
19829
|
-
var
|
|
19830
|
-
return _regenerator.default.wrap(function
|
|
19831
|
-
while (1) switch (
|
|
19876
|
+
var _ref40 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27(pc) {
|
|
19877
|
+
return _regenerator.default.wrap(function _callee27$(_context27) {
|
|
19878
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
19832
19879
|
case 0:
|
|
19833
|
-
|
|
19880
|
+
_context27.next = 2;
|
|
19834
19881
|
return pc.findAndReplaceTrack(oldTrack, newTrack);
|
|
19835
19882
|
case 2:
|
|
19836
19883
|
pc.setP2PMaxBitrate();
|
|
19837
19884
|
case 3:
|
|
19838
19885
|
case "end":
|
|
19839
|
-
return
|
|
19886
|
+
return _context27.stop();
|
|
19840
19887
|
}
|
|
19841
|
-
},
|
|
19888
|
+
}, _callee27);
|
|
19842
19889
|
}));
|
|
19843
19890
|
return function (_x20) {
|
|
19844
|
-
return
|
|
19891
|
+
return _ref40.apply(this, arguments);
|
|
19845
19892
|
};
|
|
19846
19893
|
}()));
|
|
19847
19894
|
case 5:
|
|
@@ -19877,20 +19924,20 @@ function PublisherFactory(_ref) {
|
|
|
19877
19924
|
updateVideo();
|
|
19878
19925
|
case 13:
|
|
19879
19926
|
case "end":
|
|
19880
|
-
return
|
|
19927
|
+
return _context28.stop();
|
|
19881
19928
|
}
|
|
19882
|
-
},
|
|
19929
|
+
}, _callee28);
|
|
19883
19930
|
}));
|
|
19884
19931
|
return function replaceTrackAndUpdate(_x18, _x19) {
|
|
19885
|
-
return
|
|
19932
|
+
return _ref39.apply(this, arguments);
|
|
19886
19933
|
};
|
|
19887
19934
|
}();
|
|
19888
19935
|
const getTrackFromDeviceId = /*#__PURE__*/function () {
|
|
19889
|
-
var
|
|
19936
|
+
var _ref41 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29(deviceId) {
|
|
19890
19937
|
var _newVideoStream;
|
|
19891
19938
|
var oldTrackDeviceId, newOptions, _processedOptions2, getUserMediaHelper, newVideoStream, _newVideoStream$getVi, track;
|
|
19892
|
-
return _regenerator.default.wrap(function
|
|
19893
|
-
while (1) switch (
|
|
19939
|
+
return _regenerator.default.wrap(function _callee29$(_context29) {
|
|
19940
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
19894
19941
|
case 0:
|
|
19895
19942
|
oldTrackDeviceId = getCurrentTrackDeviceId();
|
|
19896
19943
|
setCurrentTrackDeviceId(deviceId);
|
|
@@ -19903,32 +19950,32 @@ function PublisherFactory(_ref) {
|
|
|
19903
19950
|
accessDialogClosed: onAccessDialogClosed
|
|
19904
19951
|
});
|
|
19905
19952
|
_processedOptions2 = processedOptions, getUserMediaHelper = _processedOptions2.getUserMedia;
|
|
19906
|
-
|
|
19907
|
-
|
|
19953
|
+
_context29.prev = 8;
|
|
19954
|
+
_context29.next = 11;
|
|
19908
19955
|
return getUserMediaHelper();
|
|
19909
19956
|
case 11:
|
|
19910
|
-
newVideoStream =
|
|
19911
|
-
|
|
19957
|
+
newVideoStream = _context29.sent;
|
|
19958
|
+
_context29.next = 18;
|
|
19912
19959
|
break;
|
|
19913
19960
|
case 14:
|
|
19914
|
-
|
|
19915
|
-
|
|
19916
|
-
logging.error(
|
|
19917
|
-
throw
|
|
19961
|
+
_context29.prev = 14;
|
|
19962
|
+
_context29.t0 = _context29["catch"](8);
|
|
19963
|
+
logging.error(_context29.t0);
|
|
19964
|
+
throw _context29.t0;
|
|
19918
19965
|
case 18:
|
|
19919
19966
|
_newVideoStream$getVi = (_newVideoStream = newVideoStream) == null ? void 0 : _newVideoStream.getVideoTracks(), track = _newVideoStream$getVi[0];
|
|
19920
19967
|
if (!track) {
|
|
19921
19968
|
setCurrentTrackDeviceId(oldTrackDeviceId);
|
|
19922
19969
|
}
|
|
19923
|
-
return
|
|
19970
|
+
return _context29.abrupt("return", track);
|
|
19924
19971
|
case 21:
|
|
19925
19972
|
case "end":
|
|
19926
|
-
return
|
|
19973
|
+
return _context29.stop();
|
|
19927
19974
|
}
|
|
19928
|
-
},
|
|
19975
|
+
}, _callee29, null, [[8, 14]]);
|
|
19929
19976
|
}));
|
|
19930
19977
|
return function getTrackFromDeviceId(_x21) {
|
|
19931
|
-
return
|
|
19978
|
+
return _ref41.apply(this, arguments);
|
|
19932
19979
|
};
|
|
19933
19980
|
}();
|
|
19934
19981
|
const getCurrentTrack = () => {
|
|
@@ -19945,102 +19992,102 @@ function PublisherFactory(_ref) {
|
|
|
19945
19992
|
_currentTrackDeviceId = deviceId;
|
|
19946
19993
|
};
|
|
19947
19994
|
const getVideoDevices = /*#__PURE__*/function () {
|
|
19948
|
-
var
|
|
19995
|
+
var _ref42 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
19949
19996
|
var devices, vidDevices;
|
|
19950
|
-
return _regenerator.default.wrap(function
|
|
19951
|
-
while (1) switch (
|
|
19997
|
+
return _regenerator.default.wrap(function _callee30$(_context30) {
|
|
19998
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
19952
19999
|
case 0:
|
|
19953
|
-
|
|
20000
|
+
_context30.next = 2;
|
|
19954
20001
|
return deviceHelpers.shouldAskForDevices();
|
|
19955
20002
|
case 2:
|
|
19956
|
-
devices =
|
|
20003
|
+
devices = _context30.sent;
|
|
19957
20004
|
vidDevices = devices.videoDevices;
|
|
19958
20005
|
if (!(!devices.video || !vidDevices || !vidDevices.length)) {
|
|
19959
|
-
|
|
20006
|
+
_context30.next = 6;
|
|
19960
20007
|
break;
|
|
19961
20008
|
}
|
|
19962
20009
|
throw otError(Errors.NO_DEVICES_FOUND, new Error('No video devices available'), ExceptionCodes.UNABLE_TO_PUBLISH);
|
|
19963
20010
|
case 6:
|
|
19964
|
-
return
|
|
20011
|
+
return _context30.abrupt("return", vidDevices);
|
|
19965
20012
|
case 7:
|
|
19966
20013
|
case "end":
|
|
19967
|
-
return
|
|
20014
|
+
return _context30.stop();
|
|
19968
20015
|
}
|
|
19969
|
-
},
|
|
20016
|
+
}, _callee30);
|
|
19970
20017
|
}));
|
|
19971
20018
|
return function getVideoDevices() {
|
|
19972
|
-
return
|
|
20019
|
+
return _ref42.apply(this, arguments);
|
|
19973
20020
|
};
|
|
19974
20021
|
}();
|
|
19975
20022
|
const replaceAudioTrackInPeerConnections = /*#__PURE__*/function () {
|
|
19976
|
-
var
|
|
20023
|
+
var _ref43 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31(oldTrack, newTrack) {
|
|
19977
20024
|
var isAdaptiveEnabled, activePeerConnection, inactivePeerConnection, pcs;
|
|
19978
|
-
return _regenerator.default.wrap(function
|
|
19979
|
-
while (1) switch (
|
|
20025
|
+
return _regenerator.default.wrap(function _callee31$(_context31) {
|
|
20026
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
19980
20027
|
case 0:
|
|
19981
20028
|
if (_this.session) {
|
|
19982
|
-
|
|
20029
|
+
_context31.next = 2;
|
|
19983
20030
|
break;
|
|
19984
20031
|
}
|
|
19985
|
-
return
|
|
20032
|
+
return _context31.abrupt("return");
|
|
19986
20033
|
case 2:
|
|
19987
20034
|
isAdaptiveEnabled = _this.session.sessionInfo.isAdaptiveEnabled; // If we are in an AMR session and a P2P PC, we need to change the track in the P2P PC
|
|
19988
20035
|
// and check the Mantis PC, if we need to add the new track to the muted Mantis audio tracks and replace it.
|
|
19989
20036
|
// activeSourceStreamId may be undefined if we haven't finished publishing yet
|
|
19990
20037
|
if (!(activeSourceStreamId && isAdaptiveEnabled)) {
|
|
19991
|
-
|
|
20038
|
+
_context31.next = 17;
|
|
19992
20039
|
break;
|
|
19993
20040
|
}
|
|
19994
|
-
|
|
20041
|
+
_context31.next = 6;
|
|
19995
20042
|
return getPeerConnectionBySourceStreamId(activeSourceStreamId);
|
|
19996
20043
|
case 6:
|
|
19997
|
-
activePeerConnection =
|
|
19998
|
-
|
|
20044
|
+
activePeerConnection = _context31.sent;
|
|
20045
|
+
_context31.next = 9;
|
|
19999
20046
|
return activePeerConnection == null ? void 0 : activePeerConnection.findAndReplaceTrack(oldTrack, newTrack);
|
|
20000
20047
|
case 9:
|
|
20001
20048
|
if (!(activeSourceStreamId === 'P2P')) {
|
|
20002
|
-
|
|
20049
|
+
_context31.next = 15;
|
|
20003
20050
|
break;
|
|
20004
20051
|
}
|
|
20005
|
-
|
|
20052
|
+
_context31.next = 12;
|
|
20006
20053
|
return getMantisPeerConnection();
|
|
20007
20054
|
case 12:
|
|
20008
|
-
inactivePeerConnection =
|
|
20009
|
-
|
|
20055
|
+
inactivePeerConnection = _context31.sent;
|
|
20056
|
+
_context31.next = 15;
|
|
20010
20057
|
return amrAudioTrackProcessor.replaceTrackInMutedAudioTracks(inactivePeerConnection, oldTrack, newTrack);
|
|
20011
20058
|
case 15:
|
|
20012
|
-
|
|
20059
|
+
_context31.next = 22;
|
|
20013
20060
|
break;
|
|
20014
20061
|
case 17:
|
|
20015
|
-
|
|
20062
|
+
_context31.next = 19;
|
|
20016
20063
|
return getAllPeerConnections();
|
|
20017
20064
|
case 19:
|
|
20018
|
-
pcs =
|
|
20019
|
-
|
|
20065
|
+
pcs = _context31.sent;
|
|
20066
|
+
_context31.next = 22;
|
|
20020
20067
|
return Promise.all(pcs.map(pc => pc.findAndReplaceTrack(oldTrack, newTrack)));
|
|
20021
20068
|
case 22:
|
|
20022
20069
|
case "end":
|
|
20023
|
-
return
|
|
20070
|
+
return _context31.stop();
|
|
20024
20071
|
}
|
|
20025
|
-
},
|
|
20072
|
+
}, _callee31);
|
|
20026
20073
|
}));
|
|
20027
20074
|
return function replaceAudioTrackInPeerConnections(_x22, _x23) {
|
|
20028
|
-
return
|
|
20075
|
+
return _ref43.apply(this, arguments);
|
|
20029
20076
|
};
|
|
20030
20077
|
}();
|
|
20031
20078
|
const replaceAudioTrack = /*#__PURE__*/function () {
|
|
20032
|
-
var
|
|
20079
|
+
var _ref44 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32(oldTrack, newTrack) {
|
|
20033
20080
|
var video, isFilteredTrack;
|
|
20034
|
-
return _regenerator.default.wrap(function
|
|
20035
|
-
while (1) switch (
|
|
20081
|
+
return _regenerator.default.wrap(function _callee32$(_context32) {
|
|
20082
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
20036
20083
|
case 0:
|
|
20037
20084
|
if (!(oldTrack === newTrack)) {
|
|
20038
|
-
|
|
20085
|
+
_context32.next = 2;
|
|
20039
20086
|
break;
|
|
20040
20087
|
}
|
|
20041
|
-
return
|
|
20088
|
+
return _context32.abrupt("return");
|
|
20042
20089
|
case 2:
|
|
20043
|
-
|
|
20090
|
+
_context32.next = 4;
|
|
20044
20091
|
return replaceAudioTrackInPeerConnections(oldTrack, newTrack);
|
|
20045
20092
|
case 4:
|
|
20046
20093
|
if (newTrack) {
|
|
@@ -20082,23 +20129,23 @@ function PublisherFactory(_ref) {
|
|
|
20082
20129
|
refreshAudioVideoUI();
|
|
20083
20130
|
case 14:
|
|
20084
20131
|
case "end":
|
|
20085
|
-
return
|
|
20132
|
+
return _context32.stop();
|
|
20086
20133
|
}
|
|
20087
|
-
},
|
|
20134
|
+
}, _callee32);
|
|
20088
20135
|
}));
|
|
20089
20136
|
return function replaceAudioTrack(_x24, _x25) {
|
|
20090
|
-
return
|
|
20137
|
+
return _ref44.apply(this, arguments);
|
|
20091
20138
|
};
|
|
20092
20139
|
}();
|
|
20093
20140
|
const resetAudioSource = /*#__PURE__*/function () {
|
|
20094
|
-
var
|
|
20141
|
+
var _ref45 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33(audioTrack) {
|
|
20095
20142
|
var audioDeviceId, newAudioTrack;
|
|
20096
|
-
return _regenerator.default.wrap(function
|
|
20097
|
-
while (1) switch (
|
|
20143
|
+
return _regenerator.default.wrap(function _callee33$(_context33) {
|
|
20144
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
20098
20145
|
case 0:
|
|
20099
20146
|
audioDeviceId = audioTrack.getSettings().deviceId;
|
|
20100
|
-
|
|
20101
|
-
|
|
20147
|
+
_context33.prev = 1;
|
|
20148
|
+
_context33.next = 4;
|
|
20102
20149
|
return _this.setAudioSource(audioDeviceId);
|
|
20103
20150
|
case 4:
|
|
20104
20151
|
// We need to add the onmute listener to the new audio track.
|
|
@@ -20107,20 +20154,20 @@ function PublisherFactory(_ref) {
|
|
|
20107
20154
|
newAudioTrack.onmute = () => handleBuggedMutedLocalAudioTrack(newAudioTrack);
|
|
20108
20155
|
newAudioTrack.onunmute = () => handleBuggedUnMutedLocalAudioTrack(newAudioTrack);
|
|
20109
20156
|
}
|
|
20110
|
-
|
|
20157
|
+
_context33.next = 11;
|
|
20111
20158
|
break;
|
|
20112
20159
|
case 8:
|
|
20113
|
-
|
|
20114
|
-
|
|
20115
|
-
logging.error(
|
|
20160
|
+
_context33.prev = 8;
|
|
20161
|
+
_context33.t0 = _context33["catch"](1);
|
|
20162
|
+
logging.error(_context33.t0);
|
|
20116
20163
|
case 11:
|
|
20117
20164
|
case "end":
|
|
20118
|
-
return
|
|
20165
|
+
return _context33.stop();
|
|
20119
20166
|
}
|
|
20120
|
-
},
|
|
20167
|
+
}, _callee33, null, [[1, 8]]);
|
|
20121
20168
|
}));
|
|
20122
20169
|
return function resetAudioSource(_x26) {
|
|
20123
|
-
return
|
|
20170
|
+
return _ref45.apply(this, arguments);
|
|
20124
20171
|
};
|
|
20125
20172
|
}();
|
|
20126
20173
|
|
|
@@ -20134,15 +20181,15 @@ function PublisherFactory(_ref) {
|
|
|
20134
20181
|
}
|
|
20135
20182
|
// trigger the handler onVisibilityChange
|
|
20136
20183
|
const visibilityHandler = /*#__PURE__*/function () {
|
|
20137
|
-
var
|
|
20138
|
-
return _regenerator.default.wrap(function
|
|
20139
|
-
while (1) switch (
|
|
20184
|
+
var _ref46 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34() {
|
|
20185
|
+
return _regenerator.default.wrap(function _callee34$(_context34) {
|
|
20186
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
20140
20187
|
case 0:
|
|
20141
20188
|
if (document.hidden) {
|
|
20142
|
-
|
|
20189
|
+
_context34.next = 5;
|
|
20143
20190
|
break;
|
|
20144
20191
|
}
|
|
20145
|
-
|
|
20192
|
+
_context34.next = 3;
|
|
20146
20193
|
return resetAudioSource(audioTrack);
|
|
20147
20194
|
case 3:
|
|
20148
20195
|
if (shouldRePublishVideo) {
|
|
@@ -20151,12 +20198,12 @@ function PublisherFactory(_ref) {
|
|
|
20151
20198
|
document.removeEventListener('visibilitychange', visibilityHandler);
|
|
20152
20199
|
case 5:
|
|
20153
20200
|
case "end":
|
|
20154
|
-
return
|
|
20201
|
+
return _context34.stop();
|
|
20155
20202
|
}
|
|
20156
|
-
},
|
|
20203
|
+
}, _callee34);
|
|
20157
20204
|
}));
|
|
20158
20205
|
return function visibilityHandler() {
|
|
20159
|
-
return
|
|
20206
|
+
return _ref46.apply(this, arguments);
|
|
20160
20207
|
};
|
|
20161
20208
|
}();
|
|
20162
20209
|
document.addEventListener('visibilitychange', visibilityHandler);
|
|
@@ -20236,80 +20283,80 @@ function PublisherFactory(_ref) {
|
|
|
20236
20283
|
return cancelPreviousSetAudioSourceSentinel;
|
|
20237
20284
|
};
|
|
20238
20285
|
const setAudioSource = /*#__PURE__*/function () {
|
|
20239
|
-
var
|
|
20286
|
+
var _ref47 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36(audioSource) {
|
|
20240
20287
|
var currentCancelSentinel, setStreamIfNotCancelled, prevAudioSource, newTrack, newOptions, prevLabel, prevDeviceId, _processedOptions3, getUserMediaHelper, prevOptions, previousDevice, stream;
|
|
20241
|
-
return _regenerator.default.wrap(function
|
|
20242
|
-
while (1) switch (
|
|
20288
|
+
return _regenerator.default.wrap(function _callee36$(_context36) {
|
|
20289
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
20243
20290
|
case 0:
|
|
20244
20291
|
if (isSetAudioSourceSupported) {
|
|
20245
|
-
|
|
20292
|
+
_context36.next = 2;
|
|
20246
20293
|
break;
|
|
20247
20294
|
}
|
|
20248
20295
|
throw setAudioSourceNotSupportedError();
|
|
20249
20296
|
case 2:
|
|
20250
20297
|
currentCancelSentinel = getSetAudioSourceCancellationSentinel();
|
|
20251
20298
|
setStreamIfNotCancelled = /*#__PURE__*/function () {
|
|
20252
|
-
var
|
|
20253
|
-
return _regenerator.default.wrap(function
|
|
20254
|
-
while (1) switch (
|
|
20299
|
+
var _ref48 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35(stream) {
|
|
20300
|
+
return _regenerator.default.wrap(function _callee35$(_context35) {
|
|
20301
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
20255
20302
|
case 0:
|
|
20256
20303
|
if (!currentCancelSentinel.isCanceled()) {
|
|
20257
|
-
|
|
20304
|
+
_context35.next = 3;
|
|
20258
20305
|
break;
|
|
20259
20306
|
}
|
|
20260
20307
|
stream.getTracks(track => track.stop());
|
|
20261
20308
|
throw setAudioSourceCancellationError();
|
|
20262
20309
|
case 3:
|
|
20263
|
-
return
|
|
20310
|
+
return _context35.abrupt("return", setAudioSource(stream.getAudioTracks()[0]));
|
|
20264
20311
|
case 4:
|
|
20265
20312
|
case "end":
|
|
20266
|
-
return
|
|
20313
|
+
return _context35.stop();
|
|
20267
20314
|
}
|
|
20268
|
-
},
|
|
20315
|
+
}, _callee35);
|
|
20269
20316
|
}));
|
|
20270
20317
|
return function setStreamIfNotCancelled(_x28) {
|
|
20271
|
-
return
|
|
20318
|
+
return _ref48.apply(this, arguments);
|
|
20272
20319
|
};
|
|
20273
20320
|
}();
|
|
20274
20321
|
prevAudioSource = _this.getAudioSource();
|
|
20275
20322
|
if (prevAudioSource) {
|
|
20276
|
-
|
|
20323
|
+
_context36.next = 7;
|
|
20277
20324
|
break;
|
|
20278
20325
|
}
|
|
20279
20326
|
throw otError(Errors.NOT_SUPPORTED, new Error('Publisher#setAudioSource cannot add an audio source when you started without one.'));
|
|
20280
20327
|
case 7:
|
|
20281
20328
|
if (!(audioSource instanceof MediaStreamTrack)) {
|
|
20282
|
-
|
|
20329
|
+
_context36.next = 26;
|
|
20283
20330
|
break;
|
|
20284
20331
|
}
|
|
20285
20332
|
if (!currentCancelSentinel.isCanceled()) {
|
|
20286
|
-
|
|
20333
|
+
_context36.next = 10;
|
|
20287
20334
|
break;
|
|
20288
20335
|
}
|
|
20289
20336
|
throw setAudioSourceCancellationError();
|
|
20290
20337
|
case 10:
|
|
20291
20338
|
if (!_audioMediaProcessorConnector) {
|
|
20292
|
-
|
|
20339
|
+
_context36.next = 23;
|
|
20293
20340
|
break;
|
|
20294
20341
|
}
|
|
20295
|
-
|
|
20296
|
-
|
|
20342
|
+
_context36.prev = 11;
|
|
20343
|
+
_context36.next = 14;
|
|
20297
20344
|
return _audioMediaProcessorConnector.setTrack(audioSource);
|
|
20298
20345
|
case 14:
|
|
20299
|
-
newTrack =
|
|
20300
|
-
|
|
20346
|
+
newTrack = _context36.sent;
|
|
20347
|
+
_context36.next = 17;
|
|
20301
20348
|
return replaceAudioTrack(prevAudioSource, newTrack);
|
|
20302
20349
|
case 17:
|
|
20303
|
-
return
|
|
20350
|
+
return _context36.abrupt("return", _context36.sent);
|
|
20304
20351
|
case 20:
|
|
20305
|
-
|
|
20306
|
-
|
|
20307
|
-
logging.error(`Error setting track on audioMediaProcessorConnector: ${
|
|
20352
|
+
_context36.prev = 20;
|
|
20353
|
+
_context36.t0 = _context36["catch"](11);
|
|
20354
|
+
logging.error(`Error setting track on audioMediaProcessorConnector: ${_context36.t0}`);
|
|
20308
20355
|
case 23:
|
|
20309
|
-
return
|
|
20356
|
+
return _context36.abrupt("return", replaceAudioTrack(prevAudioSource, audioSource));
|
|
20310
20357
|
case 26:
|
|
20311
20358
|
if (!(typeof audioSource === 'string')) {
|
|
20312
|
-
|
|
20359
|
+
_context36.next = 73;
|
|
20313
20360
|
break;
|
|
20314
20361
|
}
|
|
20315
20362
|
// Must be a deviceId, call getUserMedia and get the MediaStreamTrack
|
|
@@ -20327,21 +20374,21 @@ function PublisherFactory(_ref) {
|
|
|
20327
20374
|
prevAudioSource.stop();
|
|
20328
20375
|
}
|
|
20329
20376
|
_processedOptions3 = processedOptions, getUserMediaHelper = _processedOptions3.getUserMedia;
|
|
20330
|
-
|
|
20331
|
-
|
|
20332
|
-
|
|
20377
|
+
_context36.prev = 36;
|
|
20378
|
+
_context36.t1 = setStreamIfNotCancelled;
|
|
20379
|
+
_context36.next = 40;
|
|
20333
20380
|
return getUserMediaHelper();
|
|
20334
20381
|
case 40:
|
|
20335
|
-
|
|
20336
|
-
|
|
20337
|
-
return (0,
|
|
20382
|
+
_context36.t2 = _context36.sent;
|
|
20383
|
+
_context36.next = 43;
|
|
20384
|
+
return (0, _context36.t1)(_context36.t2);
|
|
20338
20385
|
case 43:
|
|
20339
|
-
return
|
|
20386
|
+
return _context36.abrupt("return", _context36.sent);
|
|
20340
20387
|
case 46:
|
|
20341
|
-
|
|
20342
|
-
|
|
20388
|
+
_context36.prev = 46;
|
|
20389
|
+
_context36.t3 = _context36["catch"](36);
|
|
20343
20390
|
if (!currentCancelSentinel.isCanceled()) {
|
|
20344
|
-
|
|
20391
|
+
_context36.next = 50;
|
|
20345
20392
|
break;
|
|
20346
20393
|
}
|
|
20347
20394
|
throw setAudioSourceCancellationError();
|
|
@@ -20350,15 +20397,15 @@ function PublisherFactory(_ref) {
|
|
|
20350
20397
|
prevOptions.videoSource = null;
|
|
20351
20398
|
prevOptions.audioSource = prevDeviceId;
|
|
20352
20399
|
if (!(!prevOptions.audioSource && prevLabel)) {
|
|
20353
|
-
|
|
20400
|
+
_context36.next = 60;
|
|
20354
20401
|
break;
|
|
20355
20402
|
}
|
|
20356
|
-
|
|
20403
|
+
_context36.next = 56;
|
|
20357
20404
|
return getInputMediaDevices();
|
|
20358
20405
|
case 56:
|
|
20359
|
-
previousDevice =
|
|
20406
|
+
previousDevice = _context36.sent.find(x => x.label === prevLabel);
|
|
20360
20407
|
if (!currentCancelSentinel.isCanceled()) {
|
|
20361
|
-
|
|
20408
|
+
_context36.next = 59;
|
|
20362
20409
|
break;
|
|
20363
20410
|
}
|
|
20364
20411
|
throw setAudioSourceCancellationError();
|
|
@@ -20368,39 +20415,39 @@ function PublisherFactory(_ref) {
|
|
|
20368
20415
|
}
|
|
20369
20416
|
case 60:
|
|
20370
20417
|
if (prevOptions.audioSource) {
|
|
20371
|
-
|
|
20418
|
+
_context36.next = 63;
|
|
20372
20419
|
break;
|
|
20373
20420
|
}
|
|
20374
|
-
|
|
20375
|
-
throw otError(Errors.NOT_FOUND,
|
|
20421
|
+
_context36.t3.message += ' (could not determine previous audio device)';
|
|
20422
|
+
throw otError(Errors.NOT_FOUND, _context36.t3);
|
|
20376
20423
|
case 63:
|
|
20377
20424
|
processedOptions = processPubOptions(prevOptions, 'OT.Publisher.setAudioSource', () => currentCancelSentinel.isCanceled() || state && state.isDestroyed());
|
|
20378
|
-
|
|
20425
|
+
_context36.next = 66;
|
|
20379
20426
|
return processedOptions.getUserMedia().catch(error => {
|
|
20380
20427
|
// eslint-disable-next-line no-param-reassign
|
|
20381
20428
|
error.message += ' (could not obtain previous audio device)';
|
|
20382
20429
|
throw error;
|
|
20383
20430
|
});
|
|
20384
20431
|
case 66:
|
|
20385
|
-
stream =
|
|
20386
|
-
|
|
20432
|
+
stream = _context36.sent;
|
|
20433
|
+
_context36.next = 69;
|
|
20387
20434
|
return setStreamIfNotCancelled(stream);
|
|
20388
20435
|
case 69:
|
|
20389
|
-
|
|
20390
|
-
throw
|
|
20436
|
+
_context36.t3.message += ' (reverted to previous audio device)';
|
|
20437
|
+
throw _context36.t3;
|
|
20391
20438
|
case 71:
|
|
20392
|
-
|
|
20439
|
+
_context36.next = 74;
|
|
20393
20440
|
break;
|
|
20394
20441
|
case 73:
|
|
20395
20442
|
throw otError(Errors.INVALID_PARAMETER, new Error('Invalid parameter passed to OT.Publisher.setAudioSource(). Expected string or MediaStreamTrack.'));
|
|
20396
20443
|
case 74:
|
|
20397
20444
|
case "end":
|
|
20398
|
-
return
|
|
20445
|
+
return _context36.stop();
|
|
20399
20446
|
}
|
|
20400
|
-
},
|
|
20447
|
+
}, _callee36, null, [[11, 20], [36, 46]]);
|
|
20401
20448
|
}));
|
|
20402
20449
|
return function setAudioSource(_x27) {
|
|
20403
|
-
return
|
|
20450
|
+
return _ref47.apply(this, arguments);
|
|
20404
20451
|
};
|
|
20405
20452
|
}();
|
|
20406
20453
|
this.setAudioSource = setAudioSource;
|
|
@@ -20454,21 +20501,21 @@ function PublisherFactory(_ref) {
|
|
|
20454
20501
|
* completes successfully. If there is an error, the promise is rejected.
|
|
20455
20502
|
*/
|
|
20456
20503
|
const setVideoSource = /*#__PURE__*/function () {
|
|
20457
|
-
var _setVideoSource = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
20504
|
+
var _setVideoSource = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37(videoSourceId) {
|
|
20458
20505
|
var invalidVideoSourceOtError, setVideoSourceOtError, isAudioOnly, deviceList, isValidVideoDeviceId;
|
|
20459
|
-
return _regenerator.default.wrap(function
|
|
20460
|
-
while (1) switch (
|
|
20506
|
+
return _regenerator.default.wrap(function _callee37$(_context37) {
|
|
20507
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
20461
20508
|
case 0:
|
|
20462
20509
|
invalidVideoSourceOtError = otError(Errors.INVALID_VIDEO_SOURCE, new Error('Invalid video source. Video source must be a valid video input deviceId'), 1041);
|
|
20463
20510
|
setVideoSourceOtError = otError(Errors.SET_VIDEO_SOURCE_FAILURE, new Error('You cannot reset the video source on a publisher that does not currently use a camera source.'), 1040);
|
|
20464
20511
|
if (!(OTHelpers.env.isLegacyEdge || !windowMock.RTCRtpSender || typeof windowMock.RTCRtpSender.prototype.replaceTrack !== 'function')) {
|
|
20465
|
-
|
|
20512
|
+
_context37.next = 4;
|
|
20466
20513
|
break;
|
|
20467
20514
|
}
|
|
20468
20515
|
throw otError(Errors.UNSUPPORTED_BROWSER, new Error('setVideoSource is not supported in your browser.'), ExceptionCodes.UNABLE_TO_PUBLISH);
|
|
20469
20516
|
case 4:
|
|
20470
20517
|
if (!(typeof videoSourceId !== 'string')) {
|
|
20471
|
-
|
|
20518
|
+
_context37.next = 6;
|
|
20472
20519
|
break;
|
|
20473
20520
|
}
|
|
20474
20521
|
throw invalidVideoSourceOtError;
|
|
@@ -20476,29 +20523,29 @@ function PublisherFactory(_ref) {
|
|
|
20476
20523
|
// we can't use hasVideo because that only checks if the video is
|
|
20477
20524
|
isAudioOnly = !webRTCStream || webRTCStream.getVideoTracks().length === 0;
|
|
20478
20525
|
if (!(isCustomVideoTrack || isScreenSharing || isAudioOnly)) {
|
|
20479
|
-
|
|
20526
|
+
_context37.next = 9;
|
|
20480
20527
|
break;
|
|
20481
20528
|
}
|
|
20482
20529
|
throw setVideoSourceOtError;
|
|
20483
20530
|
case 9:
|
|
20484
|
-
|
|
20531
|
+
_context37.next = 11;
|
|
20485
20532
|
return getInputMediaDevices();
|
|
20486
20533
|
case 11:
|
|
20487
|
-
deviceList =
|
|
20534
|
+
deviceList = _context37.sent;
|
|
20488
20535
|
isValidVideoDeviceId = deviceList.find(device => device.kind === 'videoInput' && device.deviceId === videoSourceId);
|
|
20489
20536
|
if (isValidVideoDeviceId) {
|
|
20490
|
-
|
|
20537
|
+
_context37.next = 15;
|
|
20491
20538
|
break;
|
|
20492
20539
|
}
|
|
20493
20540
|
throw invalidVideoSourceOtError;
|
|
20494
20541
|
case 15:
|
|
20495
|
-
|
|
20542
|
+
_context37.next = 17;
|
|
20496
20543
|
return attemptToSetVideoTrack(videoSourceId);
|
|
20497
20544
|
case 17:
|
|
20498
20545
|
case "end":
|
|
20499
|
-
return
|
|
20546
|
+
return _context37.stop();
|
|
20500
20547
|
}
|
|
20501
|
-
},
|
|
20548
|
+
}, _callee37);
|
|
20502
20549
|
}));
|
|
20503
20550
|
function setVideoSource(_x29) {
|
|
20504
20551
|
return _setVideoSource.apply(this, arguments);
|
|
@@ -20507,39 +20554,39 @@ function PublisherFactory(_ref) {
|
|
|
20507
20554
|
}();
|
|
20508
20555
|
this.setVideoSource = setVideoSource;
|
|
20509
20556
|
const attemptToSetVideoTrack = /*#__PURE__*/function () {
|
|
20510
|
-
var
|
|
20557
|
+
var _ref49 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38(newVideoDeviceId) {
|
|
20511
20558
|
var _originalVideoTrack2;
|
|
20512
20559
|
var oldDeviceID, oldTrack, videoFilterToReapplyOnAndroid, newVideoTrack, originalVideoTrack;
|
|
20513
|
-
return _regenerator.default.wrap(function
|
|
20514
|
-
while (1) switch (
|
|
20560
|
+
return _regenerator.default.wrap(function _callee38$(_context38) {
|
|
20561
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
20515
20562
|
case 0:
|
|
20516
20563
|
oldDeviceID = currentDeviceId;
|
|
20517
20564
|
currentDeviceId = newVideoDeviceId;
|
|
20518
20565
|
|
|
20519
20566
|
// We shouldn't replace the track unless the video is on
|
|
20520
20567
|
if (properties.publishVideo) {
|
|
20521
|
-
|
|
20568
|
+
_context38.next = 4;
|
|
20522
20569
|
break;
|
|
20523
20570
|
}
|
|
20524
|
-
return
|
|
20571
|
+
return _context38.abrupt("return");
|
|
20525
20572
|
case 4:
|
|
20526
20573
|
if (!hasTrackFromDevice(newVideoDeviceId)) {
|
|
20527
|
-
|
|
20574
|
+
_context38.next = 6;
|
|
20528
20575
|
break;
|
|
20529
20576
|
}
|
|
20530
|
-
return
|
|
20577
|
+
return _context38.abrupt("return");
|
|
20531
20578
|
case 6:
|
|
20532
20579
|
oldTrack = getCurrentTrack();
|
|
20533
20580
|
if (!(properties.publishVideo && OTHelpers.env.isAndroid && (OTHelpers.env.isChrome || OTHelpers.env.isFirefox))) {
|
|
20534
|
-
|
|
20581
|
+
_context38.next = 14;
|
|
20535
20582
|
break;
|
|
20536
20583
|
}
|
|
20537
20584
|
if (!currentVideoFilter) {
|
|
20538
|
-
|
|
20585
|
+
_context38.next = 13;
|
|
20539
20586
|
break;
|
|
20540
20587
|
}
|
|
20541
20588
|
videoFilterToReapplyOnAndroid = currentVideoFilter;
|
|
20542
|
-
|
|
20589
|
+
_context38.next = 12;
|
|
20543
20590
|
return destroyMediaProcessor();
|
|
20544
20591
|
case 12:
|
|
20545
20592
|
currentVideoFilter = null;
|
|
@@ -20548,55 +20595,55 @@ function PublisherFactory(_ref) {
|
|
|
20548
20595
|
oldTrack.stop();
|
|
20549
20596
|
}
|
|
20550
20597
|
case 14:
|
|
20551
|
-
|
|
20552
|
-
|
|
20598
|
+
_context38.prev = 14;
|
|
20599
|
+
_context38.next = 17;
|
|
20553
20600
|
return getTrackFromDeviceId(newVideoDeviceId);
|
|
20554
20601
|
case 17:
|
|
20555
|
-
newVideoTrack =
|
|
20556
|
-
|
|
20602
|
+
newVideoTrack = _context38.sent;
|
|
20603
|
+
_context38.next = 25;
|
|
20557
20604
|
break;
|
|
20558
20605
|
case 20:
|
|
20559
|
-
|
|
20560
|
-
|
|
20606
|
+
_context38.prev = 20;
|
|
20607
|
+
_context38.t0 = _context38["catch"](14);
|
|
20561
20608
|
currentDeviceId = oldDeviceID;
|
|
20562
|
-
logging.error(
|
|
20563
|
-
throw
|
|
20609
|
+
logging.error(_context38.t0);
|
|
20610
|
+
throw _context38.t0;
|
|
20564
20611
|
case 25:
|
|
20565
20612
|
if (newVideoTrack) {
|
|
20566
|
-
|
|
20613
|
+
_context38.next = 28;
|
|
20567
20614
|
break;
|
|
20568
20615
|
}
|
|
20569
20616
|
logging.warn('Unable to aquire video track. Moving to next device.');
|
|
20570
|
-
return
|
|
20617
|
+
return _context38.abrupt("return");
|
|
20571
20618
|
case 28:
|
|
20572
20619
|
if (!currentVideoFilter) {
|
|
20573
|
-
|
|
20620
|
+
_context38.next = 33;
|
|
20574
20621
|
break;
|
|
20575
20622
|
}
|
|
20576
20623
|
originalVideoTrack = mediaProcessor.getOriginalVideoTrack();
|
|
20577
|
-
|
|
20624
|
+
_context38.next = 32;
|
|
20578
20625
|
return mediaProcessor.setVideoTrack(newVideoTrack);
|
|
20579
20626
|
case 32:
|
|
20580
|
-
newVideoTrack =
|
|
20627
|
+
newVideoTrack = _context38.sent;
|
|
20581
20628
|
case 33:
|
|
20582
20629
|
if (!_videoMediaProcessorConnector) {
|
|
20583
|
-
|
|
20630
|
+
_context38.next = 38;
|
|
20584
20631
|
break;
|
|
20585
20632
|
}
|
|
20586
20633
|
originalVideoTrack = _videoMediaProcessorConnector.originalTrack;
|
|
20587
|
-
|
|
20634
|
+
_context38.next = 37;
|
|
20588
20635
|
return _videoMediaProcessorConnector.setTrack(newVideoTrack);
|
|
20589
20636
|
case 37:
|
|
20590
|
-
newVideoTrack =
|
|
20637
|
+
newVideoTrack = _context38.sent;
|
|
20591
20638
|
case 38:
|
|
20592
|
-
|
|
20639
|
+
_context38.next = 40;
|
|
20593
20640
|
return replaceTrackAndUpdate(oldTrack, newVideoTrack);
|
|
20594
20641
|
case 40:
|
|
20595
20642
|
if (!videoFilterToReapplyOnAndroid) {
|
|
20596
|
-
|
|
20643
|
+
_context38.next = 43;
|
|
20597
20644
|
break;
|
|
20598
20645
|
}
|
|
20599
|
-
|
|
20646
|
+
_context38.next = 43;
|
|
20600
20647
|
return _this.applyVideoFilter(videoFilterToReapplyOnAndroid);
|
|
20601
20648
|
case 43:
|
|
20602
20649
|
// We stop the original track as a final step because whatever effects
|
|
@@ -20608,12 +20655,12 @@ function PublisherFactory(_ref) {
|
|
|
20608
20655
|
}
|
|
20609
20656
|
case 45:
|
|
20610
20657
|
case "end":
|
|
20611
|
-
return
|
|
20658
|
+
return _context38.stop();
|
|
20612
20659
|
}
|
|
20613
|
-
},
|
|
20660
|
+
}, _callee38, null, [[14, 20]]);
|
|
20614
20661
|
}));
|
|
20615
20662
|
return function attemptToSetVideoTrack(_x30) {
|
|
20616
|
-
return
|
|
20663
|
+
return _ref49.apply(this, arguments);
|
|
20617
20664
|
};
|
|
20618
20665
|
}();
|
|
20619
20666
|
|
|
@@ -20663,21 +20710,21 @@ function PublisherFactory(_ref) {
|
|
|
20663
20710
|
this._ = {
|
|
20664
20711
|
privateEvents,
|
|
20665
20712
|
setIceConfig(newIceConfig) {
|
|
20666
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
20713
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39() {
|
|
20667
20714
|
var pcs;
|
|
20668
|
-
return _regenerator.default.wrap(function
|
|
20669
|
-
while (1) switch (
|
|
20715
|
+
return _regenerator.default.wrap(function _callee39$(_context39) {
|
|
20716
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
20670
20717
|
case 0:
|
|
20671
|
-
|
|
20718
|
+
_context39.next = 2;
|
|
20672
20719
|
return getAllPeerConnections();
|
|
20673
20720
|
case 2:
|
|
20674
|
-
pcs =
|
|
20721
|
+
pcs = _context39.sent;
|
|
20675
20722
|
pcs.forEach(pc => pc.setIceConfig(newIceConfig));
|
|
20676
20723
|
case 4:
|
|
20677
20724
|
case "end":
|
|
20678
|
-
return
|
|
20725
|
+
return _context39.stop();
|
|
20679
20726
|
}
|
|
20680
|
-
},
|
|
20727
|
+
}, _callee39);
|
|
20681
20728
|
}))();
|
|
20682
20729
|
},
|
|
20683
20730
|
publishToSession: (session, analyticsReplacement) => {
|
|
@@ -20707,8 +20754,8 @@ function PublisherFactory(_ref) {
|
|
|
20707
20754
|
return;
|
|
20708
20755
|
}
|
|
20709
20756
|
this.once('initSuccess', resolve);
|
|
20710
|
-
this.once('destroyed',
|
|
20711
|
-
let reason =
|
|
20757
|
+
this.once('destroyed', _ref50 => {
|
|
20758
|
+
let reason = _ref50.reason;
|
|
20712
20759
|
let reasonDescription = '';
|
|
20713
20760
|
if (reason) {
|
|
20714
20761
|
reasonDescription = ` Reason: ${reason}`;
|
|
@@ -20949,55 +20996,55 @@ function PublisherFactory(_ref) {
|
|
|
20949
20996
|
return webRTCStream;
|
|
20950
20997
|
},
|
|
20951
20998
|
switchTracks() {
|
|
20952
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
20999
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40() {
|
|
20953
21000
|
var stream;
|
|
20954
|
-
return _regenerator.default.wrap(function
|
|
20955
|
-
while (1) switch (
|
|
21001
|
+
return _regenerator.default.wrap(function _callee40$(_context40) {
|
|
21002
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
20956
21003
|
case 0:
|
|
20957
|
-
|
|
20958
|
-
|
|
21004
|
+
_context40.prev = 0;
|
|
21005
|
+
_context40.next = 3;
|
|
20959
21006
|
return getUserMedia().catch(userMediaError);
|
|
20960
21007
|
case 3:
|
|
20961
|
-
stream =
|
|
20962
|
-
|
|
21008
|
+
stream = _context40.sent;
|
|
21009
|
+
_context40.next = 10;
|
|
20963
21010
|
break;
|
|
20964
21011
|
case 6:
|
|
20965
|
-
|
|
20966
|
-
|
|
20967
|
-
logging.error(`OT.Publisher.switchTracks failed to getUserMedia: ${
|
|
20968
|
-
throw
|
|
21012
|
+
_context40.prev = 6;
|
|
21013
|
+
_context40.t0 = _context40["catch"](0);
|
|
21014
|
+
logging.error(`OT.Publisher.switchTracks failed to getUserMedia: ${_context40.t0}`);
|
|
21015
|
+
throw _context40.t0;
|
|
20969
21016
|
case 10:
|
|
20970
21017
|
setNewStream(stream);
|
|
20971
|
-
|
|
21018
|
+
_context40.prev = 11;
|
|
20972
21019
|
bindVideo();
|
|
20973
|
-
|
|
21020
|
+
_context40.next = 21;
|
|
20974
21021
|
break;
|
|
20975
21022
|
case 15:
|
|
20976
|
-
|
|
20977
|
-
|
|
20978
|
-
if (!(
|
|
20979
|
-
|
|
21023
|
+
_context40.prev = 15;
|
|
21024
|
+
_context40.t1 = _context40["catch"](11);
|
|
21025
|
+
if (!(_context40.t1 instanceof _cancel.CancellationError)) {
|
|
21026
|
+
_context40.next = 19;
|
|
20980
21027
|
break;
|
|
20981
21028
|
}
|
|
20982
|
-
return
|
|
21029
|
+
return _context40.abrupt("return");
|
|
20983
21030
|
case 19:
|
|
20984
|
-
logging.error('Error while binding video',
|
|
20985
|
-
throw
|
|
21031
|
+
logging.error('Error while binding video', _context40.t1);
|
|
21032
|
+
throw _context40.t1;
|
|
20986
21033
|
case 21:
|
|
20987
|
-
|
|
21034
|
+
_context40.prev = 21;
|
|
20988
21035
|
replaceTracks();
|
|
20989
|
-
|
|
21036
|
+
_context40.next = 29;
|
|
20990
21037
|
break;
|
|
20991
21038
|
case 25:
|
|
20992
|
-
|
|
20993
|
-
|
|
20994
|
-
logging.error('Error replacing tracks',
|
|
20995
|
-
throw
|
|
21039
|
+
_context40.prev = 25;
|
|
21040
|
+
_context40.t2 = _context40["catch"](21);
|
|
21041
|
+
logging.error('Error replacing tracks', _context40.t2);
|
|
21042
|
+
throw _context40.t2;
|
|
20996
21043
|
case 29:
|
|
20997
21044
|
case "end":
|
|
20998
|
-
return
|
|
21045
|
+
return _context40.stop();
|
|
20999
21046
|
}
|
|
21000
|
-
},
|
|
21047
|
+
}, _callee40, null, [[0, 6], [11, 15], [21, 25]]);
|
|
21001
21048
|
}))();
|
|
21002
21049
|
},
|
|
21003
21050
|
getDataChannel(label, getOptions, completion) {
|
|
@@ -21019,8 +21066,8 @@ function PublisherFactory(_ref) {
|
|
|
21019
21066
|
}
|
|
21020
21067
|
getAllPeerConnections().then(peerConnections => {
|
|
21021
21068
|
peerConnections.forEach(peerConnection => {
|
|
21022
|
-
const
|
|
21023
|
-
remoteConnectionId =
|
|
21069
|
+
const _getPeerConnectionMet8 = getPeerConnectionMeta(peerConnection),
|
|
21070
|
+
remoteConnectionId = _getPeerConnectionMet8.remoteConnectionId;
|
|
21024
21071
|
logRepublish('Attempt', {
|
|
21025
21072
|
remoteConnectionId
|
|
21026
21073
|
});
|
|
@@ -21037,27 +21084,27 @@ function PublisherFactory(_ref) {
|
|
|
21037
21084
|
},
|
|
21038
21085
|
demoOnlyCycleVideo: this.cycleVideo,
|
|
21039
21086
|
testOnlyGetFramesEncoded() {
|
|
21040
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
21087
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41() {
|
|
21041
21088
|
var peerConnections;
|
|
21042
|
-
return _regenerator.default.wrap(function
|
|
21043
|
-
while (1) switch (
|
|
21089
|
+
return _regenerator.default.wrap(function _callee41$(_context41) {
|
|
21090
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
21044
21091
|
case 0:
|
|
21045
|
-
|
|
21092
|
+
_context41.next = 2;
|
|
21046
21093
|
return getAllPeerConnections();
|
|
21047
21094
|
case 2:
|
|
21048
|
-
peerConnections =
|
|
21095
|
+
peerConnections = _context41.sent;
|
|
21049
21096
|
if (peerConnections.length) {
|
|
21050
|
-
|
|
21097
|
+
_context41.next = 5;
|
|
21051
21098
|
break;
|
|
21052
21099
|
}
|
|
21053
21100
|
throw new Error('No established PeerConnections yet');
|
|
21054
21101
|
case 5:
|
|
21055
|
-
return
|
|
21102
|
+
return _context41.abrupt("return", peerConnections[0]._testOnlyGetFramesEncoded());
|
|
21056
21103
|
case 6:
|
|
21057
21104
|
case "end":
|
|
21058
|
-
return
|
|
21105
|
+
return _context41.stop();
|
|
21059
21106
|
}
|
|
21060
|
-
},
|
|
21107
|
+
}, _callee41);
|
|
21061
21108
|
}))();
|
|
21062
21109
|
},
|
|
21063
21110
|
onStreamAvailable,
|
|
@@ -21086,45 +21133,45 @@ function PublisherFactory(_ref) {
|
|
|
21086
21133
|
}
|
|
21087
21134
|
}.bind(this),
|
|
21088
21135
|
setCongestionLevel: function () {
|
|
21089
|
-
var _setCongestionLevel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
21136
|
+
var _setCongestionLevel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42(level, peerId) {
|
|
21090
21137
|
var pcs;
|
|
21091
|
-
return _regenerator.default.wrap(function
|
|
21092
|
-
while (1) switch (
|
|
21138
|
+
return _regenerator.default.wrap(function _callee42$(_context42) {
|
|
21139
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
21093
21140
|
case 0:
|
|
21094
21141
|
if (!audioFallbackCoordinator) {
|
|
21095
|
-
|
|
21142
|
+
_context42.next = 15;
|
|
21096
21143
|
break;
|
|
21097
21144
|
}
|
|
21098
21145
|
if (!peerId) {
|
|
21099
|
-
|
|
21146
|
+
_context42.next = 8;
|
|
21100
21147
|
break;
|
|
21101
21148
|
}
|
|
21102
|
-
|
|
21149
|
+
_context42.next = 4;
|
|
21103
21150
|
return getPeerConnectionById(peerId);
|
|
21104
21151
|
case 4:
|
|
21105
|
-
|
|
21106
|
-
|
|
21107
|
-
|
|
21152
|
+
_context42.t1 = _context42.sent;
|
|
21153
|
+
_context42.t0 = [_context42.t1];
|
|
21154
|
+
_context42.next = 11;
|
|
21108
21155
|
break;
|
|
21109
21156
|
case 8:
|
|
21110
|
-
|
|
21157
|
+
_context42.next = 10;
|
|
21111
21158
|
return getAllPeerConnections();
|
|
21112
21159
|
case 10:
|
|
21113
|
-
|
|
21160
|
+
_context42.t0 = _context42.sent;
|
|
21114
21161
|
case 11:
|
|
21115
|
-
pcs =
|
|
21162
|
+
pcs = _context42.t0;
|
|
21116
21163
|
pcs.forEach(pc => {
|
|
21117
21164
|
pc.setCongestionLevel(level);
|
|
21118
21165
|
});
|
|
21119
|
-
|
|
21166
|
+
_context42.next = 16;
|
|
21120
21167
|
break;
|
|
21121
21168
|
case 15:
|
|
21122
21169
|
logging.warn('Audio Fallback is not enabled');
|
|
21123
21170
|
case 16:
|
|
21124
21171
|
case "end":
|
|
21125
|
-
return
|
|
21172
|
+
return _context42.stop();
|
|
21126
21173
|
}
|
|
21127
|
-
},
|
|
21174
|
+
}, _callee42);
|
|
21128
21175
|
}));
|
|
21129
21176
|
function setCongestionLevel(_x31, _x32) {
|
|
21130
21177
|
return _setCongestionLevel.apply(this, arguments);
|
|
@@ -21463,37 +21510,37 @@ function PublisherFactory(_ref) {
|
|
|
21463
21510
|
* If there is an error, the promise is rejected and no new video filter is set.
|
|
21464
21511
|
*/
|
|
21465
21512
|
this.applyVideoFilter = /*#__PURE__*/function () {
|
|
21466
|
-
var
|
|
21513
|
+
var _ref51 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee43(videoFilter) {
|
|
21467
21514
|
var sanitizedVideoFilter, isSupported, message, _webRTCStream$getVide2, originalVideoTrack, filteredVideoTrack;
|
|
21468
|
-
return _regenerator.default.wrap(function
|
|
21469
|
-
while (1) switch (
|
|
21515
|
+
return _regenerator.default.wrap(function _callee43$(_context43) {
|
|
21516
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
21470
21517
|
case 0:
|
|
21471
21518
|
sanitizedVideoFilter = (0, _sanitizeVideoFilter.default)(videoFilter);
|
|
21472
21519
|
logAnalyticsEvent('applyVideoFilter', 'Attempt', {
|
|
21473
21520
|
videoFilter: sanitizedVideoFilter
|
|
21474
21521
|
});
|
|
21475
|
-
|
|
21522
|
+
_context43.prev = 2;
|
|
21476
21523
|
if (!_videoMediaProcessorConnector) {
|
|
21477
|
-
|
|
21524
|
+
_context43.next = 5;
|
|
21478
21525
|
break;
|
|
21479
21526
|
}
|
|
21480
21527
|
throw otError(Errors.NOT_SUPPORTED, new Error('Cannot apply video filter when videoMediaProcessorConnector is set.'));
|
|
21481
21528
|
case 5:
|
|
21482
21529
|
isSupported = MediaProcessor.isSupported();
|
|
21483
21530
|
if (isSupported) {
|
|
21484
|
-
|
|
21531
|
+
_context43.next = 8;
|
|
21485
21532
|
break;
|
|
21486
21533
|
}
|
|
21487
21534
|
throw otError(Errors.NOT_SUPPORTED, new Error('Browser does not support video filters (Insertable Streams and Worker APIs are required)'));
|
|
21488
21535
|
case 8:
|
|
21489
21536
|
if (mediaProcessor.isValidVideoFilter(videoFilter)) {
|
|
21490
|
-
|
|
21537
|
+
_context43.next = 10;
|
|
21491
21538
|
break;
|
|
21492
21539
|
}
|
|
21493
21540
|
throw otError(Errors.INVALID_PARAMETER, new Error('Video filter has invalid configuration'));
|
|
21494
21541
|
case 10:
|
|
21495
21542
|
if (webRTCStream) {
|
|
21496
|
-
|
|
21543
|
+
_context43.next = 15;
|
|
21497
21544
|
break;
|
|
21498
21545
|
}
|
|
21499
21546
|
message = 'Ignoring. No mediaStream';
|
|
@@ -21501,53 +21548,53 @@ function PublisherFactory(_ref) {
|
|
|
21501
21548
|
message
|
|
21502
21549
|
});
|
|
21503
21550
|
logging.warn(message);
|
|
21504
|
-
return
|
|
21551
|
+
return _context43.abrupt("return");
|
|
21505
21552
|
case 15:
|
|
21506
21553
|
if (!isScreenSharing) {
|
|
21507
|
-
|
|
21554
|
+
_context43.next = 17;
|
|
21508
21555
|
break;
|
|
21509
21556
|
}
|
|
21510
21557
|
throw otError(Errors.INVALID_PARAMETER, new Error('Video filters can not be applied to screen share'));
|
|
21511
21558
|
case 17:
|
|
21512
21559
|
enableMediaProcessorLogging();
|
|
21513
21560
|
if (properties.publishVideo) {
|
|
21514
|
-
|
|
21561
|
+
_context43.next = 22;
|
|
21515
21562
|
break;
|
|
21516
21563
|
}
|
|
21517
21564
|
currentVideoFilter = videoFilter;
|
|
21518
21565
|
logAnalyticsEvent('applyVideoFilter', 'Success', {
|
|
21519
21566
|
videoFilter: sanitizedVideoFilter
|
|
21520
21567
|
});
|
|
21521
|
-
return
|
|
21568
|
+
return _context43.abrupt("return");
|
|
21522
21569
|
case 22:
|
|
21523
21570
|
if (!mediaProcessor.getVideoFilter()) {
|
|
21524
|
-
|
|
21571
|
+
_context43.next = 37;
|
|
21525
21572
|
break;
|
|
21526
21573
|
}
|
|
21527
21574
|
if (!mediaProcessor.canUpdateVideoFilter(videoFilter.type)) {
|
|
21528
|
-
|
|
21575
|
+
_context43.next = 35;
|
|
21529
21576
|
break;
|
|
21530
21577
|
}
|
|
21531
|
-
|
|
21532
|
-
|
|
21578
|
+
_context43.prev = 24;
|
|
21579
|
+
_context43.next = 27;
|
|
21533
21580
|
return mediaProcessor.updateVideoFilter(videoFilter);
|
|
21534
21581
|
case 27:
|
|
21535
21582
|
currentVideoFilter = videoFilter;
|
|
21536
21583
|
logAnalyticsEvent('applyVideoFilter', 'Success', {
|
|
21537
21584
|
videoFilter: sanitizedVideoFilter
|
|
21538
21585
|
});
|
|
21539
|
-
return
|
|
21586
|
+
return _context43.abrupt("return");
|
|
21540
21587
|
case 32:
|
|
21541
|
-
|
|
21542
|
-
|
|
21543
|
-
logging.warn(`Error updating video filter: ${
|
|
21588
|
+
_context43.prev = 32;
|
|
21589
|
+
_context43.t0 = _context43["catch"](24);
|
|
21590
|
+
logging.warn(`Error updating video filter: ${_context43.t0}`);
|
|
21544
21591
|
case 35:
|
|
21545
|
-
|
|
21592
|
+
_context43.next = 37;
|
|
21546
21593
|
return _this.clearVideoFilter();
|
|
21547
21594
|
case 37:
|
|
21548
21595
|
_webRTCStream$getVide2 = webRTCStream.getVideoTracks(), originalVideoTrack = _webRTCStream$getVide2[0];
|
|
21549
21596
|
if (originalVideoTrack) {
|
|
21550
|
-
|
|
21597
|
+
_context43.next = 43;
|
|
21551
21598
|
break;
|
|
21552
21599
|
}
|
|
21553
21600
|
message = 'Ignoring. No video';
|
|
@@ -21555,32 +21602,32 @@ function PublisherFactory(_ref) {
|
|
|
21555
21602
|
message
|
|
21556
21603
|
});
|
|
21557
21604
|
logging.warn(message);
|
|
21558
|
-
return
|
|
21605
|
+
return _context43.abrupt("return");
|
|
21559
21606
|
case 43:
|
|
21560
|
-
|
|
21607
|
+
_context43.next = 45;
|
|
21561
21608
|
return mediaProcessor.setVideoFilter(videoFilter);
|
|
21562
21609
|
case 45:
|
|
21563
|
-
|
|
21610
|
+
_context43.next = 47;
|
|
21564
21611
|
return mediaProcessor.setMediaStream(webRTCStream);
|
|
21565
21612
|
case 47:
|
|
21566
|
-
filteredVideoTrack =
|
|
21613
|
+
filteredVideoTrack = _context43.sent;
|
|
21567
21614
|
if (!filteredVideoTrack) {
|
|
21568
|
-
|
|
21615
|
+
_context43.next = 51;
|
|
21569
21616
|
break;
|
|
21570
21617
|
}
|
|
21571
|
-
|
|
21618
|
+
_context43.next = 51;
|
|
21572
21619
|
return replaceTrackAndUpdate(originalVideoTrack, filteredVideoTrack);
|
|
21573
21620
|
case 51:
|
|
21574
|
-
|
|
21621
|
+
_context43.next = 58;
|
|
21575
21622
|
break;
|
|
21576
21623
|
case 53:
|
|
21577
|
-
|
|
21578
|
-
|
|
21579
|
-
logging.error(`Error applying video filter: ${
|
|
21624
|
+
_context43.prev = 53;
|
|
21625
|
+
_context43.t1 = _context43["catch"](2);
|
|
21626
|
+
logging.error(`Error applying video filter: ${_context43.t1}`);
|
|
21580
21627
|
logAnalyticsEvent('applyVideoFilter', 'Failure', {
|
|
21581
|
-
message:
|
|
21628
|
+
message: _context43.t1.message
|
|
21582
21629
|
});
|
|
21583
|
-
throw
|
|
21630
|
+
throw _context43.t1;
|
|
21584
21631
|
case 58:
|
|
21585
21632
|
currentVideoFilter = videoFilter;
|
|
21586
21633
|
logAnalyticsEvent('applyVideoFilter', 'Success', {
|
|
@@ -21588,12 +21635,12 @@ function PublisherFactory(_ref) {
|
|
|
21588
21635
|
});
|
|
21589
21636
|
case 60:
|
|
21590
21637
|
case "end":
|
|
21591
|
-
return
|
|
21638
|
+
return _context43.stop();
|
|
21592
21639
|
}
|
|
21593
|
-
},
|
|
21640
|
+
}, _callee43, null, [[2, 53], [24, 32]]);
|
|
21594
21641
|
}));
|
|
21595
21642
|
return function (_x33) {
|
|
21596
|
-
return
|
|
21643
|
+
return _ref51.apply(this, arguments);
|
|
21597
21644
|
};
|
|
21598
21645
|
}();
|
|
21599
21646
|
|
|
@@ -21699,35 +21746,35 @@ function PublisherFactory(_ref) {
|
|
|
21699
21746
|
* If there is an error, the promise is rejected and no new video filter is set.
|
|
21700
21747
|
*/
|
|
21701
21748
|
this.applyAudioFilter = /*#__PURE__*/function () {
|
|
21702
|
-
var
|
|
21749
|
+
var _ref52 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44(audioFilter) {
|
|
21703
21750
|
var isSupported, message, _NoiseSuppressionConf, assetsDirBaseUrl, vonageNoiseSuppression, noiseSuppressionConnector;
|
|
21704
|
-
return _regenerator.default.wrap(function
|
|
21705
|
-
while (1) switch (
|
|
21751
|
+
return _regenerator.default.wrap(function _callee44$(_context44) {
|
|
21752
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
21706
21753
|
case 0:
|
|
21707
21754
|
logAnalyticsEvent('applyAudioFilter', 'Attempt', {
|
|
21708
21755
|
audioFilter
|
|
21709
21756
|
});
|
|
21710
21757
|
isSupported = MediaProcessor.isSupported();
|
|
21711
21758
|
if (isSupported) {
|
|
21712
|
-
|
|
21759
|
+
_context44.next = 4;
|
|
21713
21760
|
break;
|
|
21714
21761
|
}
|
|
21715
21762
|
throw otError(Errors.NOT_SUPPORTED, new Error('Browser does not support audio filters (Insertable Streams and Worker APIs are required)'));
|
|
21716
21763
|
case 4:
|
|
21717
21764
|
if ((0, _isValidAudioFilter.default)(audioFilter)) {
|
|
21718
|
-
|
|
21765
|
+
_context44.next = 6;
|
|
21719
21766
|
break;
|
|
21720
21767
|
}
|
|
21721
21768
|
throw otError(Errors.INVALID_PARAMETER, new Error('Audio filter has invalid configuration'));
|
|
21722
21769
|
case 6:
|
|
21723
21770
|
if (!_audioMediaProcessorConnector) {
|
|
21724
|
-
|
|
21771
|
+
_context44.next = 8;
|
|
21725
21772
|
break;
|
|
21726
21773
|
}
|
|
21727
21774
|
throw otError(Errors.NOT_SUPPORTED, new Error('Cannot apply audio filter when audioMediaProcessorConnector is set.'));
|
|
21728
21775
|
case 8:
|
|
21729
21776
|
if (webRTCStream) {
|
|
21730
|
-
|
|
21777
|
+
_context44.next = 13;
|
|
21731
21778
|
break;
|
|
21732
21779
|
}
|
|
21733
21780
|
message = 'Ignoring. No mediaStream';
|
|
@@ -21735,28 +21782,28 @@ function PublisherFactory(_ref) {
|
|
|
21735
21782
|
message
|
|
21736
21783
|
});
|
|
21737
21784
|
logging.warn(message);
|
|
21738
|
-
return
|
|
21785
|
+
return _context44.abrupt("return");
|
|
21739
21786
|
case 13:
|
|
21740
21787
|
if (properties.publishAudio) {
|
|
21741
|
-
|
|
21788
|
+
_context44.next = 17;
|
|
21742
21789
|
break;
|
|
21743
21790
|
}
|
|
21744
21791
|
currentAudioFilter = audioFilter;
|
|
21745
21792
|
logAnalyticsEvent('applyAudioFilter', 'Success', {
|
|
21746
21793
|
audioFilter
|
|
21747
21794
|
});
|
|
21748
|
-
return
|
|
21795
|
+
return _context44.abrupt("return");
|
|
21749
21796
|
case 17:
|
|
21750
21797
|
if (!_this.getAudioFilter()) {
|
|
21751
|
-
|
|
21798
|
+
_context44.next = 20;
|
|
21752
21799
|
break;
|
|
21753
21800
|
}
|
|
21754
|
-
|
|
21801
|
+
_context44.next = 20;
|
|
21755
21802
|
return _this.clearAudioFilter();
|
|
21756
21803
|
case 20:
|
|
21757
|
-
|
|
21804
|
+
_context44.prev = 20;
|
|
21758
21805
|
if (!(audioFilter.type === 'advancedNoiseSuppression')) {
|
|
21759
|
-
|
|
21806
|
+
_context44.next = 32;
|
|
21760
21807
|
break;
|
|
21761
21808
|
}
|
|
21762
21809
|
_NoiseSuppressionConf = _defaultConfig.default.getConfig({
|
|
@@ -21764,40 +21811,40 @@ function PublisherFactory(_ref) {
|
|
|
21764
21811
|
proxyUrl: (0, _proxyUrl.getProxyUrl)()
|
|
21765
21812
|
}), assetsDirBaseUrl = _NoiseSuppressionConf.assetsDirBaseUrl;
|
|
21766
21813
|
vonageNoiseSuppression = createVonageNoiseSuppression();
|
|
21767
|
-
|
|
21814
|
+
_context44.next = 26;
|
|
21768
21815
|
return vonageNoiseSuppression.init({
|
|
21769
21816
|
assetsDirBaseUrl
|
|
21770
21817
|
});
|
|
21771
21818
|
case 26:
|
|
21772
|
-
|
|
21819
|
+
_context44.next = 28;
|
|
21773
21820
|
return vonageNoiseSuppression.getConnector();
|
|
21774
21821
|
case 28:
|
|
21775
|
-
noiseSuppressionConnector =
|
|
21776
|
-
|
|
21822
|
+
noiseSuppressionConnector = _context44.sent;
|
|
21823
|
+
_context44.next = 31;
|
|
21777
21824
|
return _setAudioMediaProcessorConnector(noiseSuppressionConnector);
|
|
21778
21825
|
case 31:
|
|
21779
21826
|
currentAudioFilter = audioFilter;
|
|
21780
21827
|
case 32:
|
|
21781
|
-
|
|
21828
|
+
_context44.next = 39;
|
|
21782
21829
|
break;
|
|
21783
21830
|
case 34:
|
|
21784
|
-
|
|
21785
|
-
|
|
21786
|
-
logging.error(`Error applying audio filter: ${
|
|
21831
|
+
_context44.prev = 34;
|
|
21832
|
+
_context44.t0 = _context44["catch"](20);
|
|
21833
|
+
logging.error(`Error applying audio filter: ${_context44.t0}`);
|
|
21787
21834
|
logAnalyticsEvent('applyAudioFilter', 'Failure', {
|
|
21788
|
-
message:
|
|
21835
|
+
message: _context44.t0.message
|
|
21789
21836
|
});
|
|
21790
|
-
throw
|
|
21837
|
+
throw _context44.t0;
|
|
21791
21838
|
case 39:
|
|
21792
21839
|
logAnalyticsEvent('applyAudioFilter', 'Success');
|
|
21793
21840
|
case 40:
|
|
21794
21841
|
case "end":
|
|
21795
|
-
return
|
|
21842
|
+
return _context44.stop();
|
|
21796
21843
|
}
|
|
21797
|
-
},
|
|
21844
|
+
}, _callee44, null, [[20, 34]]);
|
|
21798
21845
|
}));
|
|
21799
21846
|
return function (_x34) {
|
|
21800
|
-
return
|
|
21847
|
+
return _ref52.apply(this, arguments);
|
|
21801
21848
|
};
|
|
21802
21849
|
}();
|
|
21803
21850
|
|
|
@@ -21818,22 +21865,22 @@ function PublisherFactory(_ref) {
|
|
|
21818
21865
|
* @return {Promise} A promise that resolves when the operation completes successfully.
|
|
21819
21866
|
* If there is an error, the promise is rejected.
|
|
21820
21867
|
*/
|
|
21821
|
-
this.clearAudioFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
21868
|
+
this.clearAudioFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee45() {
|
|
21822
21869
|
var message;
|
|
21823
|
-
return _regenerator.default.wrap(function
|
|
21824
|
-
while (1) switch (
|
|
21870
|
+
return _regenerator.default.wrap(function _callee45$(_context45) {
|
|
21871
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
21825
21872
|
case 0:
|
|
21826
21873
|
logAnalyticsEvent('clearAudioFilter', 'Attempt');
|
|
21827
21874
|
if (!(!properties.publishAudio && _this.getAudioFilter())) {
|
|
21828
|
-
|
|
21875
|
+
_context45.next = 5;
|
|
21829
21876
|
break;
|
|
21830
21877
|
}
|
|
21831
21878
|
currentAudioFilter = null;
|
|
21832
21879
|
logAnalyticsEvent('clearAudioFilter', 'Success');
|
|
21833
|
-
return
|
|
21880
|
+
return _context45.abrupt("return");
|
|
21834
21881
|
case 5:
|
|
21835
21882
|
if (MediaProcessor.isSupported()) {
|
|
21836
|
-
|
|
21883
|
+
_context45.next = 10;
|
|
21837
21884
|
break;
|
|
21838
21885
|
}
|
|
21839
21886
|
message = 'Ignoring. "clearAudioFilter" not supported.';
|
|
@@ -21841,10 +21888,10 @@ function PublisherFactory(_ref) {
|
|
|
21841
21888
|
message
|
|
21842
21889
|
});
|
|
21843
21890
|
logging.warn(message);
|
|
21844
|
-
return
|
|
21891
|
+
return _context45.abrupt("return");
|
|
21845
21892
|
case 10:
|
|
21846
21893
|
if (_this.getAudioFilter()) {
|
|
21847
|
-
|
|
21894
|
+
_context45.next = 15;
|
|
21848
21895
|
break;
|
|
21849
21896
|
}
|
|
21850
21897
|
message = 'Ignoring. No audio filter applied';
|
|
@@ -21852,10 +21899,10 @@ function PublisherFactory(_ref) {
|
|
|
21852
21899
|
message
|
|
21853
21900
|
});
|
|
21854
21901
|
logging.debug(message);
|
|
21855
|
-
return
|
|
21902
|
+
return _context45.abrupt("return");
|
|
21856
21903
|
case 15:
|
|
21857
21904
|
if (webRTCStream) {
|
|
21858
|
-
|
|
21905
|
+
_context45.next = 20;
|
|
21859
21906
|
break;
|
|
21860
21907
|
}
|
|
21861
21908
|
message = 'Ignoring. No mediaStream';
|
|
@@ -21863,29 +21910,29 @@ function PublisherFactory(_ref) {
|
|
|
21863
21910
|
message
|
|
21864
21911
|
});
|
|
21865
21912
|
logging.warn(message);
|
|
21866
|
-
return
|
|
21913
|
+
return _context45.abrupt("return");
|
|
21867
21914
|
case 20:
|
|
21868
|
-
|
|
21869
|
-
|
|
21915
|
+
_context45.prev = 20;
|
|
21916
|
+
_context45.next = 23;
|
|
21870
21917
|
return _setAudioMediaProcessorConnector(null);
|
|
21871
21918
|
case 23:
|
|
21872
21919
|
currentAudioFilter = null;
|
|
21873
|
-
|
|
21920
|
+
_context45.next = 30;
|
|
21874
21921
|
break;
|
|
21875
21922
|
case 26:
|
|
21876
|
-
|
|
21877
|
-
|
|
21923
|
+
_context45.prev = 26;
|
|
21924
|
+
_context45.t0 = _context45["catch"](20);
|
|
21878
21925
|
logAnalyticsEvent('clearAudioFilter', 'Failure', {
|
|
21879
|
-
error:
|
|
21926
|
+
error: _context45.t0
|
|
21880
21927
|
});
|
|
21881
|
-
return
|
|
21928
|
+
return _context45.abrupt("return");
|
|
21882
21929
|
case 30:
|
|
21883
21930
|
logAnalyticsEvent('clearAudioFilter', 'Success');
|
|
21884
21931
|
case 31:
|
|
21885
21932
|
case "end":
|
|
21886
|
-
return
|
|
21933
|
+
return _context45.stop();
|
|
21887
21934
|
}
|
|
21888
|
-
},
|
|
21935
|
+
}, _callee45, null, [[20, 26]]);
|
|
21889
21936
|
}));
|
|
21890
21937
|
|
|
21891
21938
|
/**
|
|
@@ -21980,16 +22027,16 @@ function PublisherFactory(_ref) {
|
|
|
21980
22027
|
* If there is an error, the promise is rejected and no connector is set.
|
|
21981
22028
|
*/
|
|
21982
22029
|
this.setVideoMediaProcessorConnector = /*#__PURE__*/function () {
|
|
21983
|
-
var
|
|
22030
|
+
var _ref54 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee46(mediaProcessorConnector) {
|
|
21984
22031
|
var _webRTCStream$getVide3, filteredVideoTrack, videoTrack, _webRTCStream$getVide4, originalVideoTrack, message;
|
|
21985
|
-
return _regenerator.default.wrap(function
|
|
21986
|
-
while (1) switch (
|
|
22032
|
+
return _regenerator.default.wrap(function _callee46$(_context46) {
|
|
22033
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
21987
22034
|
case 0:
|
|
21988
22035
|
logAnalyticsEvent('setVideoMediaProcessorConnector', 'Attempt', {
|
|
21989
22036
|
message: mediaProcessorConnector ? 'setting the connector' : 'clearing the connector'
|
|
21990
22037
|
});
|
|
21991
22038
|
if (!_this.getVideoFilter()) {
|
|
21992
|
-
|
|
22039
|
+
_context46.next = 4;
|
|
21993
22040
|
break;
|
|
21994
22041
|
}
|
|
21995
22042
|
logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
|
|
@@ -21998,15 +22045,15 @@ function PublisherFactory(_ref) {
|
|
|
21998
22045
|
throw otError(Errors.NOT_SUPPORTED, new Error('setVideoMediaProcessorConnector: Cannot use this method when videoFilter is set.'));
|
|
21999
22046
|
case 4:
|
|
22000
22047
|
if (!_videoMediaProcessorConnector) {
|
|
22001
|
-
|
|
22048
|
+
_context46.next = 14;
|
|
22002
22049
|
break;
|
|
22003
22050
|
}
|
|
22004
22051
|
_webRTCStream$getVide3 = webRTCStream.getVideoTracks(), filteredVideoTrack = _webRTCStream$getVide3[0];
|
|
22005
|
-
|
|
22052
|
+
_context46.next = 8;
|
|
22006
22053
|
return getTrackFromDeviceId(currentDeviceId);
|
|
22007
22054
|
case 8:
|
|
22008
|
-
videoTrack =
|
|
22009
|
-
|
|
22055
|
+
videoTrack = _context46.sent;
|
|
22056
|
+
_context46.next = 11;
|
|
22010
22057
|
return replaceTrackAndUpdate(filteredVideoTrack, videoTrack);
|
|
22011
22058
|
case 11:
|
|
22012
22059
|
_videoMediaProcessorConnector.destroy();
|
|
@@ -22014,16 +22061,16 @@ function PublisherFactory(_ref) {
|
|
|
22014
22061
|
_videoMediaProcessorConnector = null;
|
|
22015
22062
|
case 14:
|
|
22016
22063
|
if (mediaProcessorConnector) {
|
|
22017
|
-
|
|
22064
|
+
_context46.next = 17;
|
|
22018
22065
|
break;
|
|
22019
22066
|
}
|
|
22020
22067
|
logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success', {
|
|
22021
22068
|
message: 'clearing the connector'
|
|
22022
22069
|
});
|
|
22023
|
-
return
|
|
22070
|
+
return _context46.abrupt("return");
|
|
22024
22071
|
case 17:
|
|
22025
22072
|
if (MediaProcessorConnector.isValidConnector(mediaProcessorConnector)) {
|
|
22026
|
-
|
|
22073
|
+
_context46.next = 20;
|
|
22027
22074
|
break;
|
|
22028
22075
|
}
|
|
22029
22076
|
logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
|
|
@@ -22034,7 +22081,7 @@ function PublisherFactory(_ref) {
|
|
|
22034
22081
|
_videoMediaProcessorConnector = new MediaProcessorConnector(mediaProcessorConnector);
|
|
22035
22082
|
_webRTCStream$getVide4 = webRTCStream.getVideoTracks(), originalVideoTrack = _webRTCStream$getVide4[0];
|
|
22036
22083
|
if (originalVideoTrack) {
|
|
22037
|
-
|
|
22084
|
+
_context46.next = 28;
|
|
22038
22085
|
break;
|
|
22039
22086
|
}
|
|
22040
22087
|
message = 'Connector not set as no video track is present.';
|
|
@@ -22043,37 +22090,37 @@ function PublisherFactory(_ref) {
|
|
|
22043
22090
|
});
|
|
22044
22091
|
logging.warn(`setVideoMediaProcessorConnector: ${message}`);
|
|
22045
22092
|
_videoMediaProcessorConnector = null;
|
|
22046
|
-
return
|
|
22093
|
+
return _context46.abrupt("return");
|
|
22047
22094
|
case 28:
|
|
22048
|
-
|
|
22049
|
-
|
|
22095
|
+
_context46.prev = 28;
|
|
22096
|
+
_context46.next = 31;
|
|
22050
22097
|
return _videoMediaProcessorConnector.setTrack(originalVideoTrack);
|
|
22051
22098
|
case 31:
|
|
22052
|
-
filteredVideoTrack =
|
|
22053
|
-
|
|
22099
|
+
filteredVideoTrack = _context46.sent;
|
|
22100
|
+
_context46.next = 34;
|
|
22054
22101
|
return replaceTrackAndUpdate(originalVideoTrack, filteredVideoTrack);
|
|
22055
22102
|
case 34:
|
|
22056
|
-
|
|
22103
|
+
_context46.next = 42;
|
|
22057
22104
|
break;
|
|
22058
22105
|
case 36:
|
|
22059
|
-
|
|
22060
|
-
|
|
22106
|
+
_context46.prev = 36;
|
|
22107
|
+
_context46.t0 = _context46["catch"](28);
|
|
22061
22108
|
_videoMediaProcessorConnector = null;
|
|
22062
|
-
logging.error(`setVideoMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${
|
|
22109
|
+
logging.error(`setVideoMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context46.t0}`);
|
|
22063
22110
|
logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
|
|
22064
|
-
message:
|
|
22111
|
+
message: _context46.t0.message
|
|
22065
22112
|
});
|
|
22066
|
-
throw
|
|
22113
|
+
throw _context46.t0;
|
|
22067
22114
|
case 42:
|
|
22068
22115
|
logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success');
|
|
22069
22116
|
case 43:
|
|
22070
22117
|
case "end":
|
|
22071
|
-
return
|
|
22118
|
+
return _context46.stop();
|
|
22072
22119
|
}
|
|
22073
|
-
},
|
|
22120
|
+
}, _callee46, null, [[28, 36]]);
|
|
22074
22121
|
}));
|
|
22075
22122
|
return function (_x35) {
|
|
22076
|
-
return
|
|
22123
|
+
return _ref54.apply(this, arguments);
|
|
22077
22124
|
};
|
|
22078
22125
|
}();
|
|
22079
22126
|
|
|
@@ -22136,71 +22183,71 @@ function PublisherFactory(_ref) {
|
|
|
22136
22183
|
* If there is an error, the promise is rejected and no connector is set.
|
|
22137
22184
|
*/
|
|
22138
22185
|
this.setAudioMediaProcessorConnector = /*#__PURE__*/function () {
|
|
22139
|
-
var
|
|
22140
|
-
return _regenerator.default.wrap(function
|
|
22141
|
-
while (1) switch (
|
|
22186
|
+
var _ref55 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee47(mediaProcessorConnector) {
|
|
22187
|
+
return _regenerator.default.wrap(function _callee47$(_context47) {
|
|
22188
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
22142
22189
|
case 0:
|
|
22143
22190
|
logAnalyticsEvent('setAudioMediaProcessorConnector', 'Attempt', {
|
|
22144
22191
|
message: mediaProcessorConnector ? 'setting the connector' : 'clearing the connector'
|
|
22145
22192
|
});
|
|
22146
|
-
|
|
22147
|
-
|
|
22193
|
+
_context47.prev = 1;
|
|
22194
|
+
_context47.next = 4;
|
|
22148
22195
|
return _setAudioMediaProcessorConnector(mediaProcessorConnector);
|
|
22149
22196
|
case 4:
|
|
22150
22197
|
logAnalyticsEvent('setAudioMediaProcessorConnector', 'Success', {
|
|
22151
22198
|
message: mediaProcessorConnector ? undefined : 'clearing the connector'
|
|
22152
22199
|
});
|
|
22153
|
-
|
|
22200
|
+
_context47.next = 11;
|
|
22154
22201
|
break;
|
|
22155
22202
|
case 7:
|
|
22156
|
-
|
|
22157
|
-
|
|
22203
|
+
_context47.prev = 7;
|
|
22204
|
+
_context47.t0 = _context47["catch"](1);
|
|
22158
22205
|
logAnalyticsEvent('setAudioMediaProcessorConnector', 'Failure', {
|
|
22159
|
-
message:
|
|
22206
|
+
message: _context47.t0.message
|
|
22160
22207
|
});
|
|
22161
|
-
throw
|
|
22208
|
+
throw _context47.t0;
|
|
22162
22209
|
case 11:
|
|
22163
22210
|
case "end":
|
|
22164
|
-
return
|
|
22211
|
+
return _context47.stop();
|
|
22165
22212
|
}
|
|
22166
|
-
},
|
|
22213
|
+
}, _callee47, null, [[1, 7]]);
|
|
22167
22214
|
}));
|
|
22168
22215
|
return function (_x36) {
|
|
22169
|
-
return
|
|
22216
|
+
return _ref55.apply(this, arguments);
|
|
22170
22217
|
};
|
|
22171
22218
|
}();
|
|
22172
22219
|
const _setAudioMediaProcessorConnector = /*#__PURE__*/function () {
|
|
22173
|
-
var
|
|
22220
|
+
var _ref56 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48(mediaProcessorConnector) {
|
|
22174
22221
|
var message, _webRTCStream$getAudi, filteredAudioTrack, _webRTCStream$getAudi2, originalAudioTrack;
|
|
22175
|
-
return _regenerator.default.wrap(function
|
|
22176
|
-
while (1) switch (
|
|
22222
|
+
return _regenerator.default.wrap(function _callee48$(_context48) {
|
|
22223
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
22177
22224
|
case 0:
|
|
22178
22225
|
if (!(_this.getAudioFilter() && mediaProcessorConnector)) {
|
|
22179
|
-
|
|
22226
|
+
_context48.next = 3;
|
|
22180
22227
|
break;
|
|
22181
22228
|
}
|
|
22182
22229
|
message = 'Tried to set audio MediaProcessorConnector when audio filter applied.';
|
|
22183
22230
|
throw otError(Errors.NOT_SUPPORTED, new Error(message));
|
|
22184
22231
|
case 3:
|
|
22185
22232
|
if (!_audioMediaProcessorConnector) {
|
|
22186
|
-
|
|
22233
|
+
_context48.next = 9;
|
|
22187
22234
|
break;
|
|
22188
22235
|
}
|
|
22189
22236
|
_webRTCStream$getAudi = webRTCStream.getAudioTracks(), filteredAudioTrack = _webRTCStream$getAudi[0];
|
|
22190
|
-
|
|
22237
|
+
_context48.next = 7;
|
|
22191
22238
|
return replaceAudioTrack(filteredAudioTrack, _audioMediaProcessorConnector.originalTrack);
|
|
22192
22239
|
case 7:
|
|
22193
22240
|
_audioMediaProcessorConnector.destroy();
|
|
22194
22241
|
_audioMediaProcessorConnector = null;
|
|
22195
22242
|
case 9:
|
|
22196
22243
|
if (mediaProcessorConnector) {
|
|
22197
|
-
|
|
22244
|
+
_context48.next = 11;
|
|
22198
22245
|
break;
|
|
22199
22246
|
}
|
|
22200
|
-
return
|
|
22247
|
+
return _context48.abrupt("return");
|
|
22201
22248
|
case 11:
|
|
22202
22249
|
if (MediaProcessorConnector.isValidConnector(mediaProcessorConnector)) {
|
|
22203
|
-
|
|
22250
|
+
_context48.next = 14;
|
|
22204
22251
|
break;
|
|
22205
22252
|
}
|
|
22206
22253
|
message = 'Invalid MediaProcessorConnector';
|
|
@@ -22208,7 +22255,7 @@ function PublisherFactory(_ref) {
|
|
|
22208
22255
|
case 14:
|
|
22209
22256
|
_webRTCStream$getAudi2 = webRTCStream.getAudioTracks(), originalAudioTrack = _webRTCStream$getAudi2[0];
|
|
22210
22257
|
if (originalAudioTrack) {
|
|
22211
|
-
|
|
22258
|
+
_context48.next = 20;
|
|
22212
22259
|
break;
|
|
22213
22260
|
}
|
|
22214
22261
|
message = 'Connector not set as no audio track is present.';
|
|
@@ -22217,30 +22264,30 @@ function PublisherFactory(_ref) {
|
|
|
22217
22264
|
throw new Error(message);
|
|
22218
22265
|
case 20:
|
|
22219
22266
|
_audioMediaProcessorConnector = new MediaProcessorConnector(mediaProcessorConnector);
|
|
22220
|
-
|
|
22221
|
-
|
|
22267
|
+
_context48.prev = 21;
|
|
22268
|
+
_context48.next = 24;
|
|
22222
22269
|
return _audioMediaProcessorConnector.setTrack(originalAudioTrack);
|
|
22223
22270
|
case 24:
|
|
22224
|
-
filteredAudioTrack =
|
|
22225
|
-
|
|
22271
|
+
filteredAudioTrack = _context48.sent;
|
|
22272
|
+
_context48.next = 27;
|
|
22226
22273
|
return replaceAudioTrack(_this.getAudioSource(), filteredAudioTrack);
|
|
22227
22274
|
case 27:
|
|
22228
|
-
|
|
22275
|
+
_context48.next = 34;
|
|
22229
22276
|
break;
|
|
22230
22277
|
case 29:
|
|
22231
|
-
|
|
22232
|
-
|
|
22278
|
+
_context48.prev = 29;
|
|
22279
|
+
_context48.t0 = _context48["catch"](21);
|
|
22233
22280
|
_audioMediaProcessorConnector = null;
|
|
22234
|
-
logging.error(`setAudioMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${
|
|
22235
|
-
throw
|
|
22281
|
+
logging.error(`setAudioMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context48.t0}`);
|
|
22282
|
+
throw _context48.t0;
|
|
22236
22283
|
case 34:
|
|
22237
22284
|
case "end":
|
|
22238
|
-
return
|
|
22285
|
+
return _context48.stop();
|
|
22239
22286
|
}
|
|
22240
|
-
},
|
|
22287
|
+
}, _callee48, null, [[21, 29]]);
|
|
22241
22288
|
}));
|
|
22242
22289
|
return function _setAudioMediaProcessorConnector(_x37) {
|
|
22243
|
-
return
|
|
22290
|
+
return _ref56.apply(this, arguments);
|
|
22244
22291
|
};
|
|
22245
22292
|
}();
|
|
22246
22293
|
|
|
@@ -22261,22 +22308,22 @@ function PublisherFactory(_ref) {
|
|
|
22261
22308
|
* @return {Promise} A promise that resolves when the operation completes successfully.
|
|
22262
22309
|
* If there is an error, the promise is rejected.
|
|
22263
22310
|
*/
|
|
22264
|
-
this.clearVideoFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
22311
|
+
this.clearVideoFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49() {
|
|
22265
22312
|
var message, oldVideoFilter, _webRTCStream$getVide5, filteredVideoTrack, videoTrack;
|
|
22266
|
-
return _regenerator.default.wrap(function
|
|
22267
|
-
while (1) switch (
|
|
22313
|
+
return _regenerator.default.wrap(function _callee49$(_context49) {
|
|
22314
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
22268
22315
|
case 0:
|
|
22269
22316
|
logAnalyticsEvent('clearVideoFilter', 'Attempt');
|
|
22270
22317
|
if (!(!properties.publishVideo && !mediaProcessor.getVideoFilter())) {
|
|
22271
|
-
|
|
22318
|
+
_context49.next = 5;
|
|
22272
22319
|
break;
|
|
22273
22320
|
}
|
|
22274
22321
|
currentVideoFilter = null;
|
|
22275
22322
|
logAnalyticsEvent('clearVideoFilter', 'Success');
|
|
22276
|
-
return
|
|
22323
|
+
return _context49.abrupt("return");
|
|
22277
22324
|
case 5:
|
|
22278
22325
|
if (!(!mediaProcessor.getVideoFilter() && !currentVideoFilter)) {
|
|
22279
|
-
|
|
22326
|
+
_context49.next = 10;
|
|
22280
22327
|
break;
|
|
22281
22328
|
}
|
|
22282
22329
|
message = 'Ignoring. No video filter applied';
|
|
@@ -22284,10 +22331,10 @@ function PublisherFactory(_ref) {
|
|
|
22284
22331
|
message
|
|
22285
22332
|
});
|
|
22286
22333
|
logging.debug(message);
|
|
22287
|
-
return
|
|
22334
|
+
return _context49.abrupt("return");
|
|
22288
22335
|
case 10:
|
|
22289
22336
|
if (MediaProcessor.isSupported()) {
|
|
22290
|
-
|
|
22337
|
+
_context49.next = 15;
|
|
22291
22338
|
break;
|
|
22292
22339
|
}
|
|
22293
22340
|
message = 'Ignoring. "clearVideoFilter" not supported.';
|
|
@@ -22295,10 +22342,10 @@ function PublisherFactory(_ref) {
|
|
|
22295
22342
|
message
|
|
22296
22343
|
});
|
|
22297
22344
|
logging.warn(message);
|
|
22298
|
-
return
|
|
22345
|
+
return _context49.abrupt("return");
|
|
22299
22346
|
case 15:
|
|
22300
22347
|
if (webRTCStream) {
|
|
22301
|
-
|
|
22348
|
+
_context49.next = 20;
|
|
22302
22349
|
break;
|
|
22303
22350
|
}
|
|
22304
22351
|
message = 'Ignoring. No mediaStream';
|
|
@@ -22306,43 +22353,43 @@ function PublisherFactory(_ref) {
|
|
|
22306
22353
|
message
|
|
22307
22354
|
});
|
|
22308
22355
|
logging.warn(message);
|
|
22309
|
-
return
|
|
22356
|
+
return _context49.abrupt("return");
|
|
22310
22357
|
case 20:
|
|
22311
22358
|
oldVideoFilter = currentVideoFilter;
|
|
22312
22359
|
currentVideoFilter = null;
|
|
22313
22360
|
_webRTCStream$getVide5 = webRTCStream.getVideoTracks(), filteredVideoTrack = _webRTCStream$getVide5[0];
|
|
22314
|
-
|
|
22315
|
-
|
|
22361
|
+
_context49.prev = 23;
|
|
22362
|
+
_context49.next = 26;
|
|
22316
22363
|
return getTrackFromDeviceId(currentDeviceId);
|
|
22317
22364
|
case 26:
|
|
22318
|
-
videoTrack =
|
|
22319
|
-
|
|
22365
|
+
videoTrack = _context49.sent;
|
|
22366
|
+
_context49.next = 33;
|
|
22320
22367
|
break;
|
|
22321
22368
|
case 29:
|
|
22322
|
-
|
|
22323
|
-
|
|
22324
|
-
logging.error(
|
|
22325
|
-
return
|
|
22369
|
+
_context49.prev = 29;
|
|
22370
|
+
_context49.t0 = _context49["catch"](23);
|
|
22371
|
+
logging.error(_context49.t0);
|
|
22372
|
+
return _context49.abrupt("return");
|
|
22326
22373
|
case 33:
|
|
22327
22374
|
if (videoTrack) {
|
|
22328
|
-
|
|
22375
|
+
_context49.next = 36;
|
|
22329
22376
|
break;
|
|
22330
22377
|
}
|
|
22331
22378
|
logging.warn('Failed to clear filter because there is no video track.');
|
|
22332
|
-
return
|
|
22379
|
+
return _context49.abrupt("return");
|
|
22333
22380
|
case 36:
|
|
22334
|
-
|
|
22335
|
-
|
|
22381
|
+
_context49.prev = 36;
|
|
22382
|
+
_context49.next = 39;
|
|
22336
22383
|
return replaceTrackAndUpdate(filteredVideoTrack, videoTrack);
|
|
22337
22384
|
case 39:
|
|
22338
|
-
|
|
22385
|
+
_context49.next = 41;
|
|
22339
22386
|
return destroyMediaProcessor();
|
|
22340
22387
|
case 41:
|
|
22341
|
-
|
|
22388
|
+
_context49.next = 46;
|
|
22342
22389
|
break;
|
|
22343
22390
|
case 43:
|
|
22344
|
-
|
|
22345
|
-
|
|
22391
|
+
_context49.prev = 43;
|
|
22392
|
+
_context49.t1 = _context49["catch"](36);
|
|
22346
22393
|
// Restore the previous filter since this call has failed. This way, this function can be
|
|
22347
22394
|
// called again if needed.
|
|
22348
22395
|
currentVideoFilter = oldVideoFilter;
|
|
@@ -22350,9 +22397,9 @@ function PublisherFactory(_ref) {
|
|
|
22350
22397
|
logAnalyticsEvent('clearVideoFilter', 'Success');
|
|
22351
22398
|
case 47:
|
|
22352
22399
|
case "end":
|
|
22353
|
-
return
|
|
22400
|
+
return _context49.stop();
|
|
22354
22401
|
}
|
|
22355
|
-
},
|
|
22402
|
+
}, _callee49, null, [[23, 29], [36, 43]]);
|
|
22356
22403
|
}));
|
|
22357
22404
|
};
|
|
22358
22405
|
|