@opentok/client 2.24.7 → 2.25.0

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.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license OpenTok.js 2.24.7 f4f0acb02
2
+ * @license OpenTok.js 2.25.0 7e57edb03
3
3
  *
4
4
  * Copyright (c) 2010-2023 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: Thu, 02 Mar 2023 18:35:49 GMT
8
+ * Date: Thu, 23 Mar 2023 19:47:29 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -2025,7 +2025,7 @@ OTHelpers.ElementCollection = __webpack_require__(245);
2025
2025
  OTHelpers.env = __webpack_require__(2);
2026
2026
  OTHelpers.ajax = __webpack_require__(243);
2027
2027
  OTHelpers.statable = __webpack_require__(554);
2028
- OTHelpers.Analytics = __webpack_require__(25);
2028
+ OTHelpers.Analytics = __webpack_require__(20);
2029
2029
  OTHelpers.Collection = __webpack_require__(247);
2030
2030
  OTHelpers.domExtras = __webpack_require__(555);
2031
2031
  OTHelpers.Error = __webpack_require__(249);
@@ -2069,7 +2069,7 @@ module.exports = OTHelpers;
2069
2069
  var assignValue = __webpack_require__(82),
2070
2070
  copyObject = __webpack_require__(39),
2071
2071
  createAssigner = __webpack_require__(191),
2072
- isArrayLike = __webpack_require__(24),
2072
+ isArrayLike = __webpack_require__(25),
2073
2073
  isPrototype = __webpack_require__(67),
2074
2074
  keys = __webpack_require__(29);
2075
2075
 
@@ -2255,7 +2255,7 @@ module.exports = function otErrorFactory(deps) {
2255
2255
  deps = {};
2256
2256
  }
2257
2257
  const Errors = deps.Errors || __webpack_require__(7);
2258
- const OTErrorClass = deps.OTErrorClass || __webpack_require__(21);
2258
+ const OTErrorClass = deps.OTErrorClass || __webpack_require__(22);
2259
2259
  const names = Object.keys(Errors).map(shortName => Errors[shortName]);
2260
2260
  return function otError(name, plainError, code) {
2261
2261
  if (names.indexOf(name) === -1) {
@@ -3258,6 +3258,206 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
3258
3258
  "use strict";
3259
3259
 
3260
3260
 
3261
+ var _interopRequireDefault = __webpack_require__(3);
3262
+ var _regenerator = _interopRequireDefault(__webpack_require__(4));
3263
+ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(5));
3264
+ var _createClass2 = _interopRequireDefault(__webpack_require__(44));
3265
+ /* eslint-disable no-underscore-dangle */
3266
+
3267
+ const guidStorage = __webpack_require__(240);
3268
+ const Analytics = __webpack_require__(541);
3269
+ const SessionInfo = __webpack_require__(141);
3270
+ const StaticConfig = __webpack_require__(33)();
3271
+ const getMessagingUrl = __webpack_require__(556);
3272
+ const eventing = __webpack_require__(6);
3273
+ const sanitizeQosData = __webpack_require__(558);
3274
+ const defaultGetUserAgentClientHintData = __webpack_require__(561);
3275
+ const LOG_VERSION = '2';
3276
+ let AnalyticsHelper = /*#__PURE__*/function () {
3277
+ function AnalyticsHelper(_temp) {
3278
+ let _ref = _temp === void 0 ? {} : _temp,
3279
+ _ref$staticConfig = _ref.staticConfig,
3280
+ staticConfig = _ref$staticConfig === void 0 ? StaticConfig.onlyLocal() : _ref$staticConfig,
3281
+ _ref$sessionInfo = _ref.sessionInfo,
3282
+ sessionInfo = _ref$sessionInfo === void 0 ? new SessionInfo() : _ref$sessionInfo,
3283
+ ajax = _ref.ajax,
3284
+ queue = _ref.queue,
3285
+ _ref$getUserAgentClie = _ref.getUserAgentClientHintData,
3286
+ getUserAgentClientHintData = _ref$getUserAgentClie === void 0 ? defaultGetUserAgentClientHintData : _ref$getUserAgentClie,
3287
+ _ref$userAgentData = _ref.userAgentData,
3288
+ userAgentData = _ref$userAgentData === void 0 ? typeof navigator !== 'undefined' && navigator.userAgentData : _ref$userAgentData;
3289
+ this.getTurnServerName = iceServers => {
3290
+ let turnNoTLSServerName;
3291
+ let turnTLSServerName;
3292
+
3293
+ // In case we don't find the server name we will be returning nothing
3294
+ // which will be ignored and relay server will not be present in the logs
3295
+ if (!iceServers || typeof iceServers !== 'object') return turnNoTLSServerName;
3296
+ const servers = Array.isArray(iceServers) ? iceServers : [iceServers];
3297
+ servers.forEach(server => {
3298
+ const urls = server.urls || server.url;
3299
+ const arrUrl = Array.isArray(urls) ? urls : [urls];
3300
+ arrUrl.forEach(url => {
3301
+ // Index where server name value starts
3302
+ const prefixIndex = url.indexOf(':') + 1;
3303
+ // Index of the port number
3304
+ const suffixIndex = url.lastIndexOf(':');
3305
+
3306
+ // We assume that TLS turn, i.e. turns, is the one which contains
3307
+ // the domain name.
3308
+ if (url.includes('turns')) {
3309
+ turnTLSServerName = url.substring(prefixIndex, suffixIndex);
3310
+ } else {
3311
+ turnNoTLSServerName = url.substring(prefixIndex, suffixIndex);
3312
+ }
3313
+ });
3314
+ });
3315
+ return turnTLSServerName || turnNoTLSServerName;
3316
+ };
3317
+ this.ajax = ajax;
3318
+ this.queue = queue;
3319
+ this.sessionInfo = sessionInfo;
3320
+ this.getUserAgentClientHintData = getUserAgentClientHintData;
3321
+ this.userAgentData = userAgentData;
3322
+
3323
+ // setting static config invokes the setter below and instantiates Analytics
3324
+ // This must be called last.
3325
+ this.staticConfig = staticConfig;
3326
+ }
3327
+ var _proto = AnalyticsHelper.prototype;
3328
+ _proto._getCachedUserAgentData = /*#__PURE__*/function () {
3329
+ var _getCachedUserAgentData2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
3330
+ return _regenerator.default.wrap(function _callee$(_context) {
3331
+ while (1) switch (_context.prev = _context.next) {
3332
+ case 0:
3333
+ if (this.cachedUserAgentData) {
3334
+ _context.next = 4;
3335
+ break;
3336
+ }
3337
+ _context.next = 3;
3338
+ return this.getUserAgentClientHintData(this.userAgentData);
3339
+ case 3:
3340
+ this.cachedUserAgentData = _context.sent;
3341
+ case 4:
3342
+ return _context.abrupt("return", this.cachedUserAgentData);
3343
+ case 5:
3344
+ case "end":
3345
+ return _context.stop();
3346
+ }
3347
+ }, _callee, this);
3348
+ }));
3349
+ function _getCachedUserAgentData() {
3350
+ return _getCachedUserAgentData2.apply(this, arguments);
3351
+ }
3352
+ return _getCachedUserAgentData;
3353
+ }();
3354
+ _proto.commonQoSFields = function commonQoSFields() {
3355
+ const proxyUrl = this._analytics.proxyUrl;
3356
+ const messagingURL = this.sessionInfo.messagingURL;
3357
+ return {
3358
+ clientVersion: this.staticConfig.clientVersion,
3359
+ buildHash: this.staticConfig.buildHash,
3360
+ source: (typeof window !== undefined ? window : global).location && (typeof window !== undefined ? window : global).location.href,
3361
+ logVersion: LOG_VERSION,
3362
+ apiServer: this.staticConfig.apiUrl,
3363
+ clientSystemTime: new Date().getTime(),
3364
+ sessionId: this.sessionInfo.sessionId,
3365
+ mediaServerName: this.sessionInfo.mediaServerName,
3366
+ relayServer: this.getTurnServerName(this.sessionInfo.iceServers),
3367
+ p2p: this.sessionInfo.p2pEnabled,
3368
+ messagingServer: this.sessionInfo.messagingServer,
3369
+ messagingUrl: getMessagingUrl(proxyUrl, messagingURL),
3370
+ version: this.staticConfig.version,
3371
+ partnerId: this.sessionInfo.partnerId
3372
+ };
3373
+ };
3374
+ _proto._getCommonDataFields = /*#__PURE__*/function () {
3375
+ var _getCommonDataFields2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
3376
+ var guid, userAgentDataFields;
3377
+ return _regenerator.default.wrap(function _callee2$(_context2) {
3378
+ while (1) switch (_context2.prev = _context2.next) {
3379
+ case 0:
3380
+ _context2.next = 2;
3381
+ return guidStorage.getAsync();
3382
+ case 2:
3383
+ guid = _context2.sent;
3384
+ _context2.next = 5;
3385
+ return this._getCachedUserAgentData();
3386
+ case 5:
3387
+ userAgentDataFields = _context2.sent;
3388
+ return _context2.abrupt("return", Object.assign({
3389
+ guid
3390
+ }, this.commonQoSFields(), userAgentDataFields));
3391
+ case 7:
3392
+ case "end":
3393
+ return _context2.stop();
3394
+ }
3395
+ }, _callee2, this);
3396
+ }));
3397
+ function _getCommonDataFields() {
3398
+ return _getCommonDataFields2.apply(this, arguments);
3399
+ }
3400
+ return _getCommonDataFields;
3401
+ }();
3402
+ _proto.logError = function logError(code, type, message, details, options) {
3403
+ if (options === void 0) {
3404
+ options = {};
3405
+ }
3406
+ this._getCommonDataFields().then(commonDataFields => {
3407
+ const args = [code, type, message, details, Object.assign({}, commonDataFields, options)];
3408
+ AnalyticsHelper.emit('logError', ...args);
3409
+ this._analytics.logError(...args);
3410
+ });
3411
+ };
3412
+ _proto.logEvent = function logEvent(options, throttle, completionHandler) {
3413
+ if (options === void 0) {
3414
+ options = {};
3415
+ }
3416
+ this._getCommonDataFields().then(commonDataFields => {
3417
+ const logData = Object.assign({}, commonDataFields, options);
3418
+ AnalyticsHelper.emit('logEvent', logData);
3419
+ this._analytics.logEvent(logData, false, throttle, completionHandler);
3420
+ });
3421
+ };
3422
+ _proto.logQOS = function logQOS(options) {
3423
+ if (options === void 0) {
3424
+ options = {};
3425
+ }
3426
+ this._getCommonDataFields().then(commonDataFields => {
3427
+ const qosData = Object.assign({
3428
+ duration: 0
3429
+ }, commonDataFields, options);
3430
+ sanitizeQosData(qosData);
3431
+ AnalyticsHelper.emit('logQOS', qosData);
3432
+ this._analytics.logQOS(qosData);
3433
+ });
3434
+ };
3435
+ (0, _createClass2.default)(AnalyticsHelper, [{
3436
+ key: "staticConfig",
3437
+ get: function get() {
3438
+ return this._staticConfig;
3439
+ },
3440
+ set: function set(staticConfig) {
3441
+ this._staticConfig = staticConfig;
3442
+ this._analytics = new Analytics({
3443
+ loggingUrl: this.staticConfig.loggingUrl,
3444
+ ajax: this.ajax,
3445
+ queue: this.queue
3446
+ });
3447
+ }
3448
+ }]);
3449
+ return AnalyticsHelper;
3450
+ }();
3451
+ eventing(AnalyticsHelper);
3452
+ module.exports = AnalyticsHelper;
3453
+
3454
+ /***/ }),
3455
+ /* 21 */
3456
+ /***/ (function(module, exports, __webpack_require__) {
3457
+
3458
+ "use strict";
3459
+
3460
+
3261
3461
  // TODO: Eliminate the need for this module, which is globally tracking these objects.
3262
3462
  const Collection = __webpack_require__(247);
3263
3463
  const sessionObjects = {
@@ -3270,7 +3470,7 @@ const sessionObjects = {
3270
3470
  module.exports = sessionObjects;
3271
3471
 
3272
3472
  /***/ }),
3273
- /* 21 */
3473
+ /* 22 */
3274
3474
  /***/ (function(module, exports, __webpack_require__) {
3275
3475
 
3276
3476
  "use strict";
@@ -3283,7 +3483,7 @@ const logging = __webpack_require__(1)('GlobalExceptionHandler');
3283
3483
  const eventing = __webpack_require__(6);
3284
3484
  const eventNames = __webpack_require__(26);
3285
3485
  const errorCodeToErrorTitleMap = __webpack_require__(553);
3286
- const Events = __webpack_require__(22)();
3486
+ const Events = __webpack_require__(23)();
3287
3487
 
3288
3488
  /**
3289
3489
  * The Error class is used to define the error object passed into completion handlers.
@@ -3314,6 +3514,7 @@ const Events = __webpack_require__(22)();
3314
3514
  * <li><a href="Publisher.html#getRtcStatsReport">Publisher.getRtcStatsReport()</a></li>
3315
3515
  * <li><a href="Session.html#forceMuteAll">Session.forceMuteAll()</a></li>
3316
3516
  * <li><a href="Session.html#forceMuteStream">Session.forceMuteStream()</a></li>
3517
+ * <li><a href="Session.html#setEncryptionSecret">Session.setEncryptionSecret()</a><li>
3317
3518
  * <li><a href="Subscriber.html#getRtcStatsReport">Subscriber.getRtcStatsReport()</a></li>
3318
3519
  * </ul>
3319
3520
  *
@@ -3878,6 +4079,14 @@ const Events = __webpack_require__(22)();
3878
4079
  * <td><code>'OT_XDOMAIN_OR_PARSING_ERROR'</code></td>
3879
4080
  * <td>There was a cross domain error or the server responded with invalid JSON.</td>
3880
4081
  * </tr>
4082
+ * <tr>
4083
+ * <td><code>'OT_INVALID_ENCRYPTION_SECRET'</code></td>
4084
+ * <td>The encryption secret is invalid.</td>
4085
+ * </tr>
4086
+ * <tr>
4087
+ * <td><code>'OT_UNSUPPORTED_BROWSER'</code></td>
4088
+ * <td>The browser does not support end-to-end encryption.</td>
4089
+ * </tr>
3881
4090
  * </table>
3882
4091
  *
3883
4092
  * <p>Errors that can occur when calling <code>Session.forceDisconnect()</code>:</p>
@@ -4005,6 +4214,11 @@ const Events = __webpack_require__(22)();
4005
4214
  * It might be in use by another application.</td>
4006
4215
  * </tr>
4007
4216
  * <tr>
4217
+ * <td><code>'OT_STREAM_CREATE_FAILED'</code></td>
4218
+ * <td>The user attempted to publish in an end-to-end encryption enabled session without
4219
+ * specifying an encryption key.</td>
4220
+ * </tr>
4221
+ * <tr>
4008
4222
  * <td><code>'OT_ICE_WORKFLOW_FAILED'</code></td>
4009
4223
  * <td>Something went wrong while establishing WebRTC connectivity.</td>
4010
4224
  * </tr>
@@ -4136,6 +4350,11 @@ const Events = __webpack_require__(22)();
4136
4350
  * <td>Action failed because the client is not connected to the session.</td>
4137
4351
  * </tr>
4138
4352
  * <tr>
4353
+ * <td><code>'OT_UNABLE_TO_SUBSCRIBE'</code></td>
4354
+ * <td>The user attempted to subscribe in an end-to-end encryption enabled session
4355
+ * without having specified an encryption secret.</td>
4356
+ * </tr>
4357
+ * <tr>
4139
4358
  * <td><code>'OT_INVALID_PARAMETER'</code></td>
4140
4359
  * <td>One or more parameters was not valid or not provided.</td>
4141
4360
  * </tr>
@@ -4333,7 +4552,7 @@ OTErrorClass.handleJsException = _ref => {
4333
4552
  };
4334
4553
 
4335
4554
  /***/ }),
4336
- /* 22 */
4555
+ /* 23 */
4337
4556
  /***/ (function(module, exports, __webpack_require__) {
4338
4557
 
4339
4558
  "use strict";
@@ -5362,7 +5581,7 @@ module.exports = function EventsFactory(deps) {
5362
5581
  };
5363
5582
 
5364
5583
  /***/ }),
5365
- /* 23 */
5584
+ /* 24 */
5366
5585
  /***/ (function(module, exports, __webpack_require__) {
5367
5586
 
5368
5587
  "use strict";
@@ -5544,7 +5763,7 @@ module.exports = function (deps) {
5544
5763
  /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(0)))
5545
5764
 
5546
5765
  /***/ }),
5547
- /* 24 */
5766
+ /* 25 */
5548
5767
  /***/ (function(module, exports, __webpack_require__) {
5549
5768
 
5550
5769
  var isFunction = __webpack_require__(16),
@@ -5582,206 +5801,6 @@ function isArrayLike(value) {
5582
5801
  module.exports = isArrayLike;
5583
5802
 
5584
5803
 
5585
- /***/ }),
5586
- /* 25 */
5587
- /***/ (function(module, exports, __webpack_require__) {
5588
-
5589
- "use strict";
5590
-
5591
-
5592
- var _interopRequireDefault = __webpack_require__(3);
5593
- var _regenerator = _interopRequireDefault(__webpack_require__(4));
5594
- var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(5));
5595
- var _createClass2 = _interopRequireDefault(__webpack_require__(44));
5596
- /* eslint-disable no-underscore-dangle */
5597
-
5598
- const guidStorage = __webpack_require__(240);
5599
- const Analytics = __webpack_require__(541);
5600
- const SessionInfo = __webpack_require__(141);
5601
- const StaticConfig = __webpack_require__(33)();
5602
- const getMessagingUrl = __webpack_require__(556);
5603
- const eventing = __webpack_require__(6);
5604
- const sanitizeQosData = __webpack_require__(558);
5605
- const defaultGetUserAgentClientHintData = __webpack_require__(561);
5606
- const LOG_VERSION = '2';
5607
- let AnalyticsHelper = /*#__PURE__*/function () {
5608
- function AnalyticsHelper(_temp) {
5609
- let _ref = _temp === void 0 ? {} : _temp,
5610
- _ref$staticConfig = _ref.staticConfig,
5611
- staticConfig = _ref$staticConfig === void 0 ? StaticConfig.onlyLocal() : _ref$staticConfig,
5612
- _ref$sessionInfo = _ref.sessionInfo,
5613
- sessionInfo = _ref$sessionInfo === void 0 ? new SessionInfo() : _ref$sessionInfo,
5614
- ajax = _ref.ajax,
5615
- queue = _ref.queue,
5616
- _ref$getUserAgentClie = _ref.getUserAgentClientHintData,
5617
- getUserAgentClientHintData = _ref$getUserAgentClie === void 0 ? defaultGetUserAgentClientHintData : _ref$getUserAgentClie,
5618
- _ref$userAgentData = _ref.userAgentData,
5619
- userAgentData = _ref$userAgentData === void 0 ? typeof navigator !== 'undefined' && navigator.userAgentData : _ref$userAgentData;
5620
- this.getTurnServerName = iceServers => {
5621
- let turnNoTLSServerName;
5622
- let turnTLSServerName;
5623
-
5624
- // In case we don't find the server name we will be returning nothing
5625
- // which will be ignored and relay server will not be present in the logs
5626
- if (!iceServers || typeof iceServers !== 'object') return turnNoTLSServerName;
5627
- const servers = Array.isArray(iceServers) ? iceServers : [iceServers];
5628
- servers.forEach(server => {
5629
- const urls = server.urls || server.url;
5630
- const arrUrl = Array.isArray(urls) ? urls : [urls];
5631
- arrUrl.forEach(url => {
5632
- // Index where server name value starts
5633
- const prefixIndex = url.indexOf(':') + 1;
5634
- // Index of the port number
5635
- const suffixIndex = url.lastIndexOf(':');
5636
-
5637
- // We assume that TLS turn, i.e. turns, is the one which contains
5638
- // the domain name.
5639
- if (url.includes('turns')) {
5640
- turnTLSServerName = url.substring(prefixIndex, suffixIndex);
5641
- } else {
5642
- turnNoTLSServerName = url.substring(prefixIndex, suffixIndex);
5643
- }
5644
- });
5645
- });
5646
- return turnTLSServerName || turnNoTLSServerName;
5647
- };
5648
- this.ajax = ajax;
5649
- this.queue = queue;
5650
- this.sessionInfo = sessionInfo;
5651
- this.getUserAgentClientHintData = getUserAgentClientHintData;
5652
- this.userAgentData = userAgentData;
5653
-
5654
- // setting static config invokes the setter below and instantiates Analytics
5655
- // This must be called last.
5656
- this.staticConfig = staticConfig;
5657
- }
5658
- var _proto = AnalyticsHelper.prototype;
5659
- _proto._getCachedUserAgentData = /*#__PURE__*/function () {
5660
- var _getCachedUserAgentData2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
5661
- return _regenerator.default.wrap(function _callee$(_context) {
5662
- while (1) switch (_context.prev = _context.next) {
5663
- case 0:
5664
- if (this.cachedUserAgentData) {
5665
- _context.next = 4;
5666
- break;
5667
- }
5668
- _context.next = 3;
5669
- return this.getUserAgentClientHintData(this.userAgentData);
5670
- case 3:
5671
- this.cachedUserAgentData = _context.sent;
5672
- case 4:
5673
- return _context.abrupt("return", this.cachedUserAgentData);
5674
- case 5:
5675
- case "end":
5676
- return _context.stop();
5677
- }
5678
- }, _callee, this);
5679
- }));
5680
- function _getCachedUserAgentData() {
5681
- return _getCachedUserAgentData2.apply(this, arguments);
5682
- }
5683
- return _getCachedUserAgentData;
5684
- }();
5685
- _proto.commonQoSFields = function commonQoSFields() {
5686
- const proxyUrl = this._analytics.proxyUrl;
5687
- const messagingURL = this.sessionInfo.messagingURL;
5688
- return {
5689
- clientVersion: this.staticConfig.clientVersion,
5690
- buildHash: this.staticConfig.buildHash,
5691
- source: (typeof window !== undefined ? window : global).location && (typeof window !== undefined ? window : global).location.href,
5692
- logVersion: LOG_VERSION,
5693
- apiServer: this.staticConfig.apiUrl,
5694
- clientSystemTime: new Date().getTime(),
5695
- sessionId: this.sessionInfo.sessionId,
5696
- mediaServerName: this.sessionInfo.mediaServerName,
5697
- relayServer: this.getTurnServerName(this.sessionInfo.iceServers),
5698
- p2p: this.sessionInfo.p2pEnabled,
5699
- messagingServer: this.sessionInfo.messagingServer,
5700
- messagingUrl: getMessagingUrl(proxyUrl, messagingURL),
5701
- version: this.staticConfig.version,
5702
- partnerId: this.sessionInfo.partnerId
5703
- };
5704
- };
5705
- _proto._getCommonDataFields = /*#__PURE__*/function () {
5706
- var _getCommonDataFields2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
5707
- var guid, userAgentDataFields;
5708
- return _regenerator.default.wrap(function _callee2$(_context2) {
5709
- while (1) switch (_context2.prev = _context2.next) {
5710
- case 0:
5711
- _context2.next = 2;
5712
- return guidStorage.getAsync();
5713
- case 2:
5714
- guid = _context2.sent;
5715
- _context2.next = 5;
5716
- return this._getCachedUserAgentData();
5717
- case 5:
5718
- userAgentDataFields = _context2.sent;
5719
- return _context2.abrupt("return", Object.assign({
5720
- guid
5721
- }, this.commonQoSFields(), userAgentDataFields));
5722
- case 7:
5723
- case "end":
5724
- return _context2.stop();
5725
- }
5726
- }, _callee2, this);
5727
- }));
5728
- function _getCommonDataFields() {
5729
- return _getCommonDataFields2.apply(this, arguments);
5730
- }
5731
- return _getCommonDataFields;
5732
- }();
5733
- _proto.logError = function logError(code, type, message, details, options) {
5734
- if (options === void 0) {
5735
- options = {};
5736
- }
5737
- this._getCommonDataFields().then(commonDataFields => {
5738
- const args = [code, type, message, details, Object.assign({}, commonDataFields, options)];
5739
- AnalyticsHelper.emit('logError', ...args);
5740
- this._analytics.logError(...args);
5741
- });
5742
- };
5743
- _proto.logEvent = function logEvent(options, throttle, completionHandler) {
5744
- if (options === void 0) {
5745
- options = {};
5746
- }
5747
- this._getCommonDataFields().then(commonDataFields => {
5748
- const logData = Object.assign({}, commonDataFields, options);
5749
- AnalyticsHelper.emit('logEvent', logData);
5750
- this._analytics.logEvent(logData, false, throttle, completionHandler);
5751
- });
5752
- };
5753
- _proto.logQOS = function logQOS(options) {
5754
- if (options === void 0) {
5755
- options = {};
5756
- }
5757
- this._getCommonDataFields().then(commonDataFields => {
5758
- const qosData = Object.assign({
5759
- duration: 0
5760
- }, commonDataFields, options);
5761
- sanitizeQosData(qosData);
5762
- AnalyticsHelper.emit('logQOS', qosData);
5763
- this._analytics.logQOS(qosData);
5764
- });
5765
- };
5766
- (0, _createClass2.default)(AnalyticsHelper, [{
5767
- key: "staticConfig",
5768
- get: function get() {
5769
- return this._staticConfig;
5770
- },
5771
- set: function set(staticConfig) {
5772
- this._staticConfig = staticConfig;
5773
- this._analytics = new Analytics({
5774
- loggingUrl: this.staticConfig.loggingUrl,
5775
- ajax: this.ajax,
5776
- queue: this.queue
5777
- });
5778
- }
5779
- }]);
5780
- return AnalyticsHelper;
5781
- }();
5782
- eventing(AnalyticsHelper);
5783
- module.exports = AnalyticsHelper;
5784
-
5785
5804
  /***/ }),
5786
5805
  /* 26 */
5787
5806
  /***/ (function(module, exports, __webpack_require__) {
@@ -6073,7 +6092,7 @@ module.exports = baseGetTag;
6073
6092
 
6074
6093
  var arrayLikeKeys = __webpack_require__(177),
6075
6094
  baseKeys = __webpack_require__(115),
6076
- isArrayLike = __webpack_require__(24);
6095
+ isArrayLike = __webpack_require__(25);
6077
6096
 
6078
6097
  /**
6079
6098
  * Creates an array of the own enumerable property names of `object`.
@@ -6254,7 +6273,7 @@ const _require = __webpack_require__(99),
6254
6273
  */
6255
6274
 
6256
6275
  /** @type builtInConfig */
6257
- const builtInConfig = cloneDeep({"version":"v2.24.7","buildHash":"f4f0acb02","minimumVersion":{"firefox":52,"chrome":49},"debug":"false","websiteURL":"http://www.tokbox.com","configURL":"https://config.opentok.com","ipWhitelistConfigURL":"","cdnURL":"https://static.opentok.com","loggingURL":"https://hlg.tokbox.com/prod","apiURL":"https://anvil.opentok.com"});
6276
+ const builtInConfig = cloneDeep({"version":"v2.25.0","buildHash":"7e57edb03","minimumVersion":{"firefox":52,"chrome":49},"debug":false,"websiteURL":"http://www.tokbox.com","configURL":"https://config.opentok.com","ipWhitelistConfigURL":"","cdnURL":"https://static.opentok.com","loggingURL":"https://hlg.tokbox.com/prod","apiURL":"https://anvil.opentok.com"});
6258
6277
  const whitelistAllowedRuntimeProperties = pick(['apiURL', 'assetURL', 'cdnURL', 'sessionInfoOverrides', 'loggingURL']);
6259
6278
  const liveConfigMap = {
6260
6279
  apiUrl: 'apiURL',
@@ -7924,11 +7943,22 @@ SDPHelpers.includesAny = (sdpLine, values) => {
7924
7943
  }
7925
7944
  return false;
7926
7945
  };
7927
- SDPHelpers.getVersion = sdpLine =>
7928
- // For example: o=- 2356644873 4 IN IP4 34.194.94.104
7929
- // Will return: 4
7930
- sdpLine.match(/(\d+) IN/)[1];
7946
+ SDPHelpers.getVersion = sdpLines => {
7947
+ // For example: o=- 2356644873 4 IN IP4 34.194.94.104
7948
+ // Will return: 4
7949
+ const isOrigin = line => /^o=/.test(line);
7950
+ const origin = sdpLines.find(isOrigin);
7951
+ if (origin === undefined) {
7952
+ return undefined;
7953
+ }
7954
+ const version = Number(origin.match(/ (\d+) IN /)[1]);
7955
+ return Number.isInteger(version) ? version : undefined;
7956
+ };
7931
7957
  SDPHelpers.getBundleIndex = sdpLines => sdpLines.findIndex(line => line.includes(SDPHelpers.patterns.bundle));
7958
+ SDPHelpers.getBundleLine = sdpLines => {
7959
+ const bundleIndex = SDPHelpers.getBundleIndex(sdpLines);
7960
+ return sdpLines[bundleIndex];
7961
+ };
7932
7962
  SDPHelpers.createBundleLine = tracks => `${SDPHelpers.patterns.bundle} ${tracks.join(' ')}`;
7933
7963
  SDPHelpers.parseMLine = mLine => {
7934
7964
  // Given: m=audio 41511 RTP/SAVPF 111
@@ -7994,19 +8024,12 @@ SDPHelpers.disableTrackSection = section => {
7994
8024
  sdp: disabledTrackSdp
7995
8025
  };
7996
8026
  };
7997
- SDPHelpers.getEnabledTracks = (sdpLines, bundleIndex) => {
7998
- let sdpLine;
7999
-
8000
- // Get SDP BUNDLE line, e.g. a=group:BUNDLE 0a 1v 2a 3v
8001
- if (Number.isInteger(bundleIndex)) {
8002
- sdpLine = sdpLines[bundleIndex];
8003
- } else {
8004
- sdpLine = sdpLines.find(line => line.includes(SDPHelpers.patterns.bundle));
8005
- }
8027
+ SDPHelpers.getEnabledTracks = sdpLines => {
8028
+ const bundleLine = SDPHelpers.getBundleLine(sdpLines);
8006
8029
 
8007
8030
  // Extract the list of tracks
8008
8031
  // So that 'a=group:BUNDLE 0a 1v 2a 3v', returns [0a, 1v, 2a, 3v]
8009
- const tracks = sdpLine.match(new RegExp(`^${SDPHelpers.patterns.bundle} (.+)$`))[1];
8032
+ const tracks = bundleLine.match(new RegExp(`^${SDPHelpers.patterns.bundle} (.+)$`))[1];
8010
8033
  return tracks.split(' ');
8011
8034
  };
8012
8035
  SDPHelpers.getDisabledTracks = (currentTracks, newTracks) =>
@@ -8030,10 +8053,25 @@ SDPHelpers.getTrackSection = (sdpLines, mid) => {
8030
8053
  };
8031
8054
  };
8032
8055
  SDPHelpers.getHeaders = sdpLines => {
8033
- // Headers consist of SDP lines from the beggining to the first track section
8056
+ // Headers consist of SDP lines from the beginning to the first track section
8034
8057
  const indexFirstTrack = sdpLines.findIndex(line => line.includes('m=audio') || line.includes('m=video'));
8035
8058
  return sdpLines.slice(0, indexFirstTrack);
8036
8059
  };
8060
+ SDPHelpers.disableTracks = (sections, tracks) => sections.map(section => tracks.includes(section.mid) ? SDPHelpers.disableTrackSection(section) : section);
8061
+ SDPHelpers.getSDPLines = sdp => sdp.split('\r\n')
8062
+ // Remove empty strings, if any
8063
+ .filter(line => line);
8064
+ SDPHelpers.parseSDP = sdp => {
8065
+ const sdpLines = SDPHelpers.getSDPLines(sdp);
8066
+ const parsedSDP = {
8067
+ bundle: SDPHelpers.getBundleLine(sdpLines),
8068
+ headers: SDPHelpers.getHeaders(sdpLines),
8069
+ version: SDPHelpers.getVersion(sdpLines),
8070
+ tracks: SDPHelpers.getEnabledTracks(sdpLines)
8071
+ };
8072
+ parsedSDP.trackSections = parsedSDP.tracks.map(track => SDPHelpers.getTrackSection(sdpLines, track));
8073
+ return parsedSDP;
8074
+ };
8037
8075
 
8038
8076
  /***/ }),
8039
8077
  /* 52 */
@@ -8084,7 +8122,7 @@ module.exports = eq;
8084
8122
 
8085
8123
  var arrayLikeKeys = __webpack_require__(177),
8086
8124
  baseKeysIn = __webpack_require__(386),
8087
- isArrayLike = __webpack_require__(24);
8125
+ isArrayLike = __webpack_require__(25);
8088
8126
 
8089
8127
  /**
8090
8128
  * Creates an array of the own and inherited enumerable property names of `object`.
@@ -8723,7 +8761,7 @@ module.exports = function PeerConnectionFactory(deps) {
8723
8761
  const NativeRTCIceCandidate = deps.NativeRTCIceCandidate || windowMock.RTCIceCandidate;
8724
8762
  const NativeRTCSessionDescription = deps.NativeRTCSessionDescription || windowMock.RTCSessionDescription;
8725
8763
  const Errors = deps.Errors || __webpack_require__(7);
8726
- const OTErrorClass = deps.OTErrorClass || __webpack_require__(21);
8764
+ const OTErrorClass = deps.OTErrorClass || __webpack_require__(22);
8727
8765
  const ExceptionCodes = deps.ExceptionCodes || __webpack_require__(10);
8728
8766
  const hasPictureInPictureBug = deps.hasPictureInPictureBug || __webpack_require__(643);
8729
8767
  // Unified-plan does not transition to failed. Plan-b used to transition after 10 secs (empirically measured)
@@ -8793,6 +8831,7 @@ module.exports = function PeerConnectionFactory(deps) {
8793
8831
  let sFrameReceiverClient;
8794
8832
  let sFrameSenderClient;
8795
8833
  let sFrameSenderId;
8834
+ let keyStoreChangeHandler;
8796
8835
  const offerAnswerProcessor = new OfferAnswerProcessor(logAnalyticsEvent);
8797
8836
  const cleanupJobs = createCleanupJobs();
8798
8837
  function sendMessage(type, payload) {
@@ -8918,14 +8957,15 @@ module.exports = function PeerConnectionFactory(deps) {
8918
8957
  _context.next = 11;
8919
8958
  return sFrameSenderClient.setSenderEncryptionKey(sharedKey);
8920
8959
  case 11:
8921
- keyStore.on('keyChanged', key => {
8960
+ keyStoreChangeHandler = key => {
8922
8961
  sFrameSenderClient.setSenderEncryptionKey(key);
8923
- });
8962
+ };
8963
+ keyStore.on('keyChanged', keyStoreChangeHandler);
8924
8964
 
8925
8965
  // SFrame uses the RTCRtpSender objects (transceiver.sender) to extract the video
8926
8966
  // and audio streams from the publisher and then encrypt them.
8927
8967
  _peerConnection.getTransceivers().forEach(transceiver => sFrameSenderClient.encrypt(transceiver.mid, transceiver.sender));
8928
- case 13:
8968
+ case 14:
8929
8969
  case "end":
8930
8970
  return _context.stop();
8931
8971
  }
@@ -9417,6 +9457,9 @@ module.exports = function PeerConnectionFactory(deps) {
9417
9457
  });
9418
9458
  };
9419
9459
  const cleanupSFrameClients = () => {
9460
+ if (typeof keyStoreChangeHandler === 'function') {
9461
+ keyStore.off('keyChanged', keyStoreChangeHandler);
9462
+ }
9420
9463
  sFrameSenderClient = null;
9421
9464
  sFrameSenderId = null;
9422
9465
  };
@@ -10058,9 +10101,10 @@ module.exports = getStatsHelpers;
10058
10101
  exports.__esModule = true;
10059
10102
  exports.messages = exports.codes = void 0;
10060
10103
  // https://tools.ietf.org/html/rfc6455#section-7.4.1
10061
- // https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Close_codes
10104
+ // https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code
10062
10105
 
10063
10106
  const messages = {
10107
+ 1000: 'The connection successfully completed the purpose for which it was created.',
10064
10108
  1001: 'The endpoint is going away, either because of a server failure or because the browser ' + 'is navigating away from the page that opened the connection.',
10065
10109
  1002: 'The endpoint is terminating the connection due to a protocol error. ' + '(CLOSE_PROTOCOL_ERROR)',
10066
10110
  1003: 'The connection is being terminated because the endpoint has indicated ' + 'that reconnections are not available. (CLOSE_UNSUPPORTED)',
@@ -10895,11 +10939,11 @@ module.exports = {
10895
10939
 
10896
10940
 
10897
10941
  /* eslint-disable global-require */
10898
- const sessionObjects = __webpack_require__(20);
10942
+ const sessionObjects = __webpack_require__(21);
10899
10943
  const otError = __webpack_require__(13);
10900
10944
  const Errors = __webpack_require__(7);
10901
10945
  const ExceptionCodes = __webpack_require__(10);
10902
- const OTErrorClass = __webpack_require__(21);
10946
+ const OTErrorClass = __webpack_require__(22);
10903
10947
  let proxyUrl;
10904
10948
  const errorMessages = {
10905
10949
  SET_PROXY_URL_TIMING_ERROR: 'The proxyUrl was set after a session or publisher was created.',
@@ -10928,7 +10972,7 @@ module.exports = {
10928
10972
  errorMessages,
10929
10973
  setProxyUrl: url => {
10930
10974
  // This is necessary to break a circular dependancy, but seems hacky and should be cleaned up
10931
- const AnalyticsHelper = __webpack_require__(25);
10975
+ const AnalyticsHelper = __webpack_require__(20);
10932
10976
  const apiKey = __webpack_require__(70);
10933
10977
  const analytics = new AnalyticsHelper();
10934
10978
  const hasSessionInitalized = sessionObjects.sessions.length() > 0;
@@ -11612,7 +11656,7 @@ module.exports = setToString;
11612
11656
  /***/ (function(module, exports, __webpack_require__) {
11613
11657
 
11614
11658
  var eq = __webpack_require__(52),
11615
- isArrayLike = __webpack_require__(24),
11659
+ isArrayLike = __webpack_require__(25),
11616
11660
  isIndex = __webpack_require__(65),
11617
11661
  isObject = __webpack_require__(11);
11618
11662
 
@@ -11792,7 +11836,7 @@ module.exports = arrayIncludesWith;
11792
11836
  /* 130 */
11793
11837
  /***/ (function(module, exports, __webpack_require__) {
11794
11838
 
11795
- var isArrayLike = __webpack_require__(24),
11839
+ var isArrayLike = __webpack_require__(25),
11796
11840
  isObjectLike = __webpack_require__(17);
11797
11841
 
11798
11842
  /**
@@ -13050,7 +13094,7 @@ module.exports = /*#__PURE__*/function () {
13050
13094
  const domState = __webpack_require__(577);
13051
13095
  const eventNames = __webpack_require__(26);
13052
13096
  const eventing = __webpack_require__(6);
13053
- const Events = __webpack_require__(22)();
13097
+ const Events = __webpack_require__(23)();
13054
13098
 
13055
13099
  // Helper to synchronise several startup tasks and then dispatch a unified
13056
13100
  // 'envLoaded' event.
@@ -14042,7 +14086,7 @@ module.exports = function StylableComponent(self, initialStyles, showControls, l
14042
14086
 
14043
14087
  const once = __webpack_require__(49);
14044
14088
  const StaticConfig = __webpack_require__(33)();
14045
- const Analytics = __webpack_require__(25);
14089
+ const Analytics = __webpack_require__(20);
14046
14090
  const APIKEY = __webpack_require__(70);
14047
14091
  const EnvironmentLoader = __webpack_require__(146);
14048
14092
  const hasOpenTokSupport = __webpack_require__(50).once;
@@ -15454,7 +15498,7 @@ exports.CancellationError = _CancellationError3.default;
15454
15498
  "use strict";
15455
15499
  /* WEBPACK VAR INJECTION */(function(Promise) {
15456
15500
 
15457
- const sessionObjects = __webpack_require__(20);
15501
+ const sessionObjects = __webpack_require__(21);
15458
15502
  module.exports = () => Promise.all(sessionObjects.subscribers.where().map(sub => {
15459
15503
  if (!sub.isAudioBlocked()) {
15460
15504
  return undefined;
@@ -15553,7 +15597,7 @@ const eventNames = __webpack_require__(26);
15553
15597
  const eventing = __webpack_require__(6);
15554
15598
  const promiseDelay = __webpack_require__(106);
15555
15599
  const Event = __webpack_require__(127);
15556
- const AnalyticsHelperDefault = __webpack_require__(25);
15600
+ const AnalyticsHelperDefault = __webpack_require__(20);
15557
15601
  const IntervalRunnerDefault = __webpack_require__(73);
15558
15602
  const createCleanupJobs = __webpack_require__(154);
15559
15603
  const whitelistPublisherProperties = __webpack_require__(702);
@@ -15561,7 +15605,7 @@ const defaultWidgetView = __webpack_require__(164)();
15561
15605
  const audioLevelBehaviour = __webpack_require__(703);
15562
15606
  const blockCallsUntilComplete = __webpack_require__(704);
15563
15607
  const unblockAudio = __webpack_require__(166);
15564
- const _require2 = __webpack_require__(23)(),
15608
+ const _require2 = __webpack_require__(24)(),
15565
15609
  getInputMediaDevices = _require2.getInputMediaDevices;
15566
15610
  const createCanvasVideoTrack = __webpack_require__(705);
15567
15611
  const isSecureContextRequired = __webpack_require__(269);
@@ -15589,17 +15633,17 @@ module.exports = function PublisherFactory(_ref) {
15589
15633
  const createAudioFallbackCoordinator = deps.createAudioFallbackCoordinator || _audioFallbackCoordinator.default;
15590
15634
  const calculateCapableSimulcastStreams = deps.calculateCapableSimulcastStreams || __webpack_require__(251);
15591
15635
  const createChromeMixin = deps.createChromeMixin || __webpack_require__(281)();
15592
- const deviceHelpers = deps.deviceHelpers || __webpack_require__(23)();
15636
+ const deviceHelpers = deps.deviceHelpers || __webpack_require__(24)();
15593
15637
  const EnvironmentLoader = deps.EnvironmentLoader || __webpack_require__(146);
15594
15638
  const Errors = deps.Errors || __webpack_require__(7);
15595
- const Events = deps.Events || __webpack_require__(22)();
15639
+ const Events = deps.Events || __webpack_require__(23)();
15596
15640
  const ExceptionCodes = deps.ExceptionCodes || __webpack_require__(10);
15597
15641
  const interpretPeerConnectionError = deps.interpretPeerConnectionError || __webpack_require__(161)();
15598
15642
  const IntervalRunner = deps.IntervalRunner || IntervalRunnerDefault;
15599
15643
  const logging = deps.logging || __webpack_require__(1)('Publisher');
15600
15644
  const Microphone = deps.Microphone || __webpack_require__(292)();
15601
15645
  const otError = deps.otError || __webpack_require__(13)();
15602
- const OTErrorClass = deps.OTErrorClass || __webpack_require__(21);
15646
+ const OTErrorClass = deps.OTErrorClass || __webpack_require__(22);
15603
15647
  const OTHelpers = deps.OTHelpers || __webpack_require__(8);
15604
15648
  const parseIceServers = deps.parseIceServers || __webpack_require__(101).parseIceServers;
15605
15649
  const PUBLISH_MAX_DELAY = deps.PUBLISH_MAX_DELAY || __webpack_require__(266);
@@ -20673,9 +20717,9 @@ module.exports = function Capabilities(permissions, deps) {
20673
20717
 
20674
20718
  const logging = __webpack_require__(1)('Stream');
20675
20719
  const OTHelpers = __webpack_require__(8);
20676
- const sessionObjects = __webpack_require__(20);
20720
+ const sessionObjects = __webpack_require__(21);
20677
20721
  const eventing = __webpack_require__(6);
20678
- const Events = __webpack_require__(22)();
20722
+ const Events = __webpack_require__(23)();
20679
20723
  const validPropertyNames = ['name', 'archiving'];
20680
20724
 
20681
20725
  /**
@@ -21141,7 +21185,7 @@ exports.STATUS = STATUS;
21141
21185
  const assign = __webpack_require__(9);
21142
21186
  const Capabilities = __webpack_require__(169);
21143
21187
  const eventing = __webpack_require__(6);
21144
- const Events = __webpack_require__(22)();
21188
+ const Events = __webpack_require__(23)();
21145
21189
  const connectionCapabilities = __webpack_require__(747);
21146
21190
 
21147
21191
  /**
@@ -28720,7 +28764,7 @@ const patchSrcObject = __webpack_require__(656);
28720
28764
  const isDomElementVisible = __webpack_require__(657);
28721
28765
  const promiseDelay = __webpack_require__(106);
28722
28766
  const env = __webpack_require__(2);
28723
- const _require = __webpack_require__(23)(),
28767
+ const _require = __webpack_require__(24)(),
28724
28768
  hasAudioOutputApiSupport = _require.hasAudioOutputApiSupport;
28725
28769
  const noop = __webpack_require__(295);
28726
28770
  const _require2 = __webpack_require__(105),
@@ -29985,7 +30029,7 @@ module.exports = function SubscriberPeerConnectionFactory(deps) {
29985
30029
  const setCertificates = deps.setCertificates || __webpack_require__(162)();
29986
30030
  const Errors = deps.Errors || __webpack_require__(7);
29987
30031
  const ExceptionCodes = deps.ExceptionCodes || __webpack_require__(10);
29988
- const OTErrorClass = deps.OTErrorClass || __webpack_require__(21);
30032
+ const OTErrorClass = deps.OTErrorClass || __webpack_require__(22);
29989
30033
  const watchSubscriberAudio = deps.watchSubscriberAudio || __webpack_require__(666);
29990
30034
 
29991
30035
  /*
@@ -30530,7 +30574,7 @@ const BackingBarDefault = __webpack_require__(283);
30530
30574
  const ChromeDefault = __webpack_require__(144);
30531
30575
  const envDefault = __webpack_require__(2);
30532
30576
  const errorsDefault = __webpack_require__(7);
30533
- const EventsDefault = __webpack_require__(22)();
30577
+ const EventsDefault = __webpack_require__(23)();
30534
30578
  const ExceptionCodesDefault = __webpack_require__(10);
30535
30579
  const getStatsHelpersDefault = __webpack_require__(74);
30536
30580
  const hasAudioOutputLevelStatCapabilityDefault = __webpack_require__(305);
@@ -30541,7 +30585,7 @@ const loggingDefault = __webpack_require__(1)('Subscriber');
30541
30585
  const MuteButtonDefault = __webpack_require__(284)();
30542
30586
  const NamePanelDefault = __webpack_require__(285);
30543
30587
  const otErrorDefault = __webpack_require__(13)();
30544
- const OTErrorClassDefault = __webpack_require__(21);
30588
+ const OTErrorClassDefault = __webpack_require__(22);
30545
30589
  const OTHelpersDefault = __webpack_require__(8);
30546
30590
  const StylableComponentDefault = __webpack_require__(151);
30547
30591
  const windowMock = __webpack_require__(142)((typeof window !== undefined ? window : global));
@@ -31090,14 +31134,19 @@ module.exports = function SubscriberFactory(_temp) {
31090
31134
  });
31091
31135
  }
31092
31136
  });
31093
- const logConnectivityEvent = (variation, payload, options) => {
31094
- if (variation === 'Attempt') {
31095
- _attemptStartTime = new Date().getTime();
31137
+ const logConnectivityEvent = function logConnectivityEvent(variation, payload, options) {
31138
+ if (payload === void 0) {
31139
+ payload = {};
31096
31140
  }
31097
31141
  if (variation === 'Failure' || variation === 'Success' || variation === 'Cancel') {
31098
31142
  logAnalyticsEvent('Subscribe', variation, payload, Object.assign({}, options, {
31099
31143
  attemptDuration: new Date().getTime() - _attemptStartTime
31100
31144
  }));
31145
+ } else if (variation === 'Attempt') {
31146
+ _attemptStartTime = new Date().getTime();
31147
+ logAnalyticsEvent('Subscribe', variation, Object.assign({}, payload, {
31148
+ testNetwork: _properties.testNetwork
31149
+ }), options);
31101
31150
  } else {
31102
31151
  logAnalyticsEvent('Subscribe', variation, payload, options);
31103
31152
  }
@@ -33620,6 +33669,34 @@ module.exports = function SubscriberFactory(_temp) {
33620
33669
  * @memberof Subscriber
33621
33670
  */
33622
33671
 
33672
+ /**
33673
+ * Dispatched when a subscriber's media cannot be decrypted because the encryption secrets do not match.
33674
+ * In this scenario the user will still be subscribed to the stream, but the
33675
+ * video will be black and the audio will be silent. It is considered good practice
33676
+ * to communicate to the user why media is not viewable.
33677
+ *
33678
+ * @see Event
33679
+ * @see <a href="Subscriber.html#event:encryptionSecretMatch">encryptionSecretMatch</a> event
33680
+ * @see <a href="OT.html#initSession">OT.initSession</a>
33681
+ * @see <a href="Session.html#setEncryptionSecret">session.setEncryptionSecret</a>
33682
+ * @name encryptionSecretMismatch
33683
+ * @event
33684
+ * @memberof Subscriber
33685
+ */
33686
+
33687
+ /**
33688
+ * Dispatched when a subscriber's media can be decrypted because the encryption secrets match.
33689
+ * This is only dispatched when there was previously a secret mismatch.
33690
+ *
33691
+ * @see Event
33692
+ * @see <a href="Subscriber.html#event:encryptionSecretMismatch">encryptionSecretMismatch</a> event
33693
+ * @see <a href="OT.html#initSession">OT.initSession</a>
33694
+ * @see <a href="Session.html#setEncryptionSecret">session.setEncryptionSecret</a>
33695
+ * @name encryptionSecretMatch
33696
+ * @event
33697
+ * @memberof Subscriber
33698
+ */
33699
+
33623
33700
  /**
33624
33701
  * Dispatched when the OpenTok Media Router resumes sending video to the subscriber
33625
33702
  * after video was previously disabled.
@@ -59356,7 +59433,7 @@ module.exports = function initPublisherFactory(deps) {
59356
59433
  const otError = deps.otError || __webpack_require__(13)();
59357
59434
  const OTHelpers = deps.OTHelpers || __webpack_require__(8);
59358
59435
  const Publisher = deps.Publisher || __webpack_require__(168)();
59359
- const sessionObjects = deps.sessionObjects || __webpack_require__(20);
59436
+ const sessionObjects = deps.sessionObjects || __webpack_require__(21);
59360
59437
 
59361
59438
  /**
59362
59439
  * <p class="mSummary">
@@ -59690,6 +59767,18 @@ module.exports = function initPublisherFactory(deps) {
59690
59767
  * or not (<code>false</code>, the default).
59691
59768
  * </li>
59692
59769
  * <li>
59770
+ * <strong>scalableVideo</strong> (Boolean) &#151; Whether to allow (<code>true</code>,
59771
+ * the default) or disable (<code>false</code>)
59772
+ * <a href="https://tokbox.com/developer/guides/scalable-video/">scalable video</a> for the
59773
+ * publisher. This is a <i>beta</i> feature. This only applies in a routed session (one that uses the
59774
+ * <a href="https://tokbox.com/developer/guides/create-session/#media-mode">OpenTok Media Router</a>).
59775
+ * <em>Note:</em> By default, scalable video is disabled in screen-sharing videos. You can set
59776
+ * the <code>scalableScreenshare</code> option to <code>true</code> to enable scalable video
59777
+ * for screen-sharing streams. However, setting <code>scalableVideo</code> to <code>false</code>
59778
+ * disables scalable video for any video source (and the <code>scalableScreenshare</code> setting
59779
+ * is ignored for screen-sharing streams).
59780
+ * </li>
59781
+ * <li>
59693
59782
  * <strong>showControls</strong> (Boolean) &#151; Whether to display the built-in user interface
59694
59783
  * controls (default: <code>true</code>) for the Publisher. These controls include the name
59695
59784
  * display, the audio level indicator, and the microphone control button. You can turn off all user
@@ -60005,7 +60094,7 @@ const isFunction = __webpack_require__(16);
60005
60094
  const assign = __webpack_require__(9);
60006
60095
  const eventNames = __webpack_require__(26);
60007
60096
  const eventing = __webpack_require__(6);
60008
- const AnalyticsHelperDefault = __webpack_require__(25);
60097
+ const AnalyticsHelperDefault = __webpack_require__(20);
60009
60098
  const StaticConfigDefault = __webpack_require__(33)();
60010
60099
  const IntervalRunner = __webpack_require__(73);
60011
60100
  const promisify = __webpack_require__(313);
@@ -60029,14 +60118,14 @@ module.exports = function SessionFactory(deps) {
60029
60118
  const convertAnvilErrorCode = deps.convertAnvilErrorCode || __webpack_require__(724);
60030
60119
  const convertRumorError = deps.convertRumorError || __webpack_require__(320);
60031
60120
  const errors = deps.Errors || __webpack_require__(7);
60032
- const Events = deps.Events || __webpack_require__(22)();
60121
+ const Events = deps.Events || __webpack_require__(23)();
60033
60122
  const Stream = deps.Stream || __webpack_require__(170);
60034
60123
  const ExceptionCodes = deps.ExceptionCodes || __webpack_require__(10);
60035
60124
  const hasIceRestartsCapability = deps.hasIceRestartsCapability || __webpack_require__(321);
60036
60125
  const hasE2eeCapability = deps.hasE2eeCapability || __webpack_require__(109);
60037
60126
  const logging = deps.logging || __webpack_require__(1)('Session');
60038
60127
  const otError = deps.otError || __webpack_require__(13)();
60039
- const OTErrorClass = deps.OTErrorClass || __webpack_require__(21);
60128
+ const OTErrorClass = deps.OTErrorClass || __webpack_require__(22);
60040
60129
  const OTHelpers = deps.OTHelpers || __webpack_require__(8);
60041
60130
  const forceMuteErrors = __webpack_require__(725);
60042
60131
 
@@ -60048,7 +60137,7 @@ module.exports = function SessionFactory(deps) {
60048
60137
  const Publisher = deps.Publisher || __webpack_require__(168)();
60049
60138
  const RaptorSocket = deps.RaptorSocket || __webpack_require__(726).default();
60050
60139
  const SessionDispatcher = deps.SessionDispatcher || __webpack_require__(329);
60051
- const sessionObjects = deps.sessionObjects || __webpack_require__(20);
60140
+ const sessionObjects = deps.sessionObjects || __webpack_require__(21);
60052
60141
  const sessionTag = deps.sessionTag || __webpack_require__(328);
60053
60142
  const socketCloseCodes = deps.socketCloseCodes || __webpack_require__(75);
60054
60143
  const Subscriber = deps.Subscriber || __webpack_require__(304)();
@@ -60135,12 +60224,10 @@ module.exports = function SessionFactory(deps) {
60135
60224
  let _attemptStartTime;
60136
60225
  let _configurationAttemptStartTime;
60137
60226
  let _iceServerDetails;
60138
- let _initialConnection = true;
60139
60227
  let _isSocketReconnecting = false;
60140
60228
  let _apiKey = apiKey;
60141
60229
  const _session = this;
60142
60230
  let _sessionId = sessionId;
60143
- let _widgetId = uuid();
60144
60231
  let _connectionId = uuid();
60145
60232
  let _logging = logging;
60146
60233
  let _muteOnEntry = false;
@@ -60384,9 +60471,17 @@ module.exports = function SessionFactory(deps) {
60384
60471
  if (_useSinglePeerConnection) {
60385
60472
  capabilities.push('spc');
60386
60473
  }
60387
- _socket = new RaptorSocket(_connectionId, _widgetId, messagingUrl, this.sessionInfo.symphonyAddress, SessionDispatcher(this, {
60388
- connectionEventsSuppressed
60389
- }), analytics, capabilities);
60474
+ _socket = new RaptorSocket({
60475
+ connectionId: _connectionId,
60476
+ sessionId,
60477
+ messagingSocketUrl: messagingUrl,
60478
+ symphonyUrl: this.sessionInfo.symphonyAddress,
60479
+ dispatcher: SessionDispatcher(this, {
60480
+ connectionEventsSuppressed
60481
+ }),
60482
+ analytics,
60483
+ requestedCapabilities: capabilities
60484
+ });
60390
60485
 
60391
60486
  /**
60392
60487
  * Maps an error from RaptorSocket.connect to its corresponding name
@@ -60758,13 +60853,6 @@ module.exports = function SessionFactory(deps) {
60758
60853
  }
60759
60854
  _this.token = !isFunction(token) && token;
60760
60855
  _token = !isFunction(token) && token;
60761
-
60762
- // Get a new widget ID when reconnecting.
60763
- if (_initialConnection) {
60764
- _initialConnection = false;
60765
- } else {
60766
- _widgetId = uuid();
60767
- }
60768
60856
  if (completionHandler && isFunction(completionHandler)) {
60769
60857
  let cleanup;
60770
60858
  const onCompleteSuccess = function onCompleteSuccess() {
@@ -62835,6 +62923,35 @@ module.exports = function SessionFactory(deps) {
62835
62923
  }
62836
62924
  });
62837
62925
  });
62926
+
62927
+ /**
62928
+ * Sets the encryption secret for a session with end-to-end encryption enabled. If this method is called in a session without
62929
+ * encryption enabled the function will resolve and no error will be thrown. Users may change their set encryption key at
62930
+ * any time. See the end-to-end encryption <a href="https://www.tokbox.com/developer/guides/end-to-end-encryption/">
62931
+ * developer guide</a>.
62932
+ *
62933
+ * @method #setEncryptionSecret
62934
+ * @memberOf Session
62935
+ * @param {string} secret The encryption secret.
62936
+ *
62937
+ * @see <a href="OT.html#initSession">OT.initSession</a>
62938
+ * @see <a href="Subscriber.html#events">Subscriber events</a>
62939
+ *
62940
+ * @return {Promise} A promise that resolves with no value when the operation
62941
+ * completes successfully. The promise is rejected if there is an error. The
62942
+ * <code>name</code> property of the Error object is set to one of the following
62943
+ * values, depending the type of error:
62944
+ *
62945
+ * <p>
62946
+ * <ul>
62947
+ * <li><code>'OT_INVALID_ENCRYPTION_SECRET'</code>; The secret is invalid.</li>
62948
+ * <ul>
62949
+ * </p>
62950
+ *
62951
+ * A secret mismatch may occur when no error is dispatched. See
62952
+ * <a href="Subscriber.html#events">subscrriber events</a> for more information.
62953
+ */
62954
+
62838
62955
  this.setEncryptionSecret = /*#__PURE__*/function () {
62839
62956
  var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(secret) {
62840
62957
  return _regenerator.default.wrap(function _callee2$(_context2) {
@@ -63162,7 +63279,7 @@ module.exports = function SessionFactory(deps) {
63162
63279
 
63163
63280
 
63164
63281
  const ExceptionCodes = __webpack_require__(10);
63165
- const OTErrorClass = __webpack_require__(21);
63282
+ const OTErrorClass = __webpack_require__(22);
63166
63283
  const knownErrorCodes = [400, 403, 409, ExceptionCodes.CONNECTION_LIMIT_EXCEEDED];
63167
63284
  const reasons = {
63168
63285
  CONNECT: 'ConnectToSession',
@@ -63284,7 +63401,7 @@ exports.default = _default;
63284
63401
  /* eslint-disable prefer-rest-params */
63285
63402
 
63286
63403
  const isFunction = __webpack_require__(16);
63287
- const OTErrorClass = __webpack_require__(21);
63404
+ const OTErrorClass = __webpack_require__(22);
63288
63405
  const eventing = __webpack_require__(6);
63289
63406
  const logging = __webpack_require__(1)('Dispatcher');
63290
63407
  const RumorMessageTypes = __webpack_require__(171);
@@ -63955,7 +64072,7 @@ const Connection = __webpack_require__(172);
63955
64072
  const DelayedEventQueue = __webpack_require__(749);
63956
64073
  const Dispatcher = __webpack_require__(325);
63957
64074
  const logging = __webpack_require__(1)('SessionDispatcher');
63958
- const sessionObjects = __webpack_require__(20);
64075
+ const sessionObjects = __webpack_require__(21);
63959
64076
  const Stream = __webpack_require__(170);
63960
64077
  const StreamChannel = __webpack_require__(149);
63961
64078
  const getMediaModeBySourceStreamId = __webpack_require__(167);
@@ -64435,7 +64552,7 @@ module.exports = function SessionDispatcher(session, _temp) {
64435
64552
  "use strict";
64436
64553
 
64437
64554
 
64438
- const Events = __webpack_require__(22)();
64555
+ const Events = __webpack_require__(23)();
64439
64556
  const eventing = __webpack_require__(6);
64440
64557
  module.exports = function Archive(id, name, status) {
64441
64558
  this.id = id;
@@ -64463,7 +64580,7 @@ module.exports = function Archive(id, name, status) {
64463
64580
  "use strict";
64464
64581
 
64465
64582
 
64466
- const _require = __webpack_require__(23)(),
64583
+ const _require = __webpack_require__(24)(),
64467
64584
  getAudioOutputMediaDevices = _require.getAudioOutputMediaDevices;
64468
64585
 
64469
64586
  /**
@@ -64514,7 +64631,7 @@ module.exports = () => getAudioOutputMediaDevices();
64514
64631
  "use strict";
64515
64632
 
64516
64633
 
64517
- const _require = __webpack_require__(23)(),
64634
+ const _require = __webpack_require__(24)(),
64518
64635
  getActiveAudioOutputDevice = _require.getActiveAudioOutputDevice;
64519
64636
 
64520
64637
  /**
@@ -64557,15 +64674,15 @@ module.exports = () => getActiveAudioOutputDevice();
64557
64674
  var _interopRequireDefault = __webpack_require__(3);
64558
64675
  var _regenerator = _interopRequireDefault(__webpack_require__(4));
64559
64676
  var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(5));
64560
- const sessionObjects = __webpack_require__(20);
64677
+ const sessionObjects = __webpack_require__(21);
64561
64678
  const _require = __webpack_require__(105),
64562
64679
  setCurrentAudioOutputDeviceId = _require.setCurrentAudioOutputDeviceId;
64563
64680
  const getActiveAudioOutputDevice = __webpack_require__(332);
64564
- const _require2 = __webpack_require__(23)(),
64681
+ const _require2 = __webpack_require__(24)(),
64565
64682
  getDefaultAudioOutputDeviceId = _require2.getDefaultAudioOutputDeviceId,
64566
64683
  getAudioOutputMediaDevices = _require2.getAudioOutputMediaDevices;
64567
64684
  const noop = __webpack_require__(295);
64568
- const AnalyticsHelper = __webpack_require__(25);
64685
+ const AnalyticsHelper = __webpack_require__(20);
64569
64686
  const analytics = new AnalyticsHelper();
64570
64687
  const logUpdateSubscriberSinkId = (variation, payload) => {
64571
64688
  analytics.logEvent({
@@ -64735,7 +64852,7 @@ const eventNames = __webpack_require__(26);
64735
64852
  const eventing = __webpack_require__(6);
64736
64853
  const Event = __webpack_require__(127);
64737
64854
  const StaticConfig = __webpack_require__(33)();
64738
- const AnalyticsHelper = __webpack_require__(25);
64855
+ const AnalyticsHelper = __webpack_require__(20);
64739
64856
  const setDeprecatedProperty = __webpack_require__(248);
64740
64857
  const runtimeProperties = __webpack_require__(562);
64741
64858
  const mutableRuntimeProperties = __webpack_require__(563);
@@ -64781,11 +64898,11 @@ const guidStorage = __webpack_require__(240);
64781
64898
  const logging = __webpack_require__(1)('OT');
64782
64899
  const logLevels = __webpack_require__(120);
64783
64900
  const setLogLevel = __webpack_require__(591);
64784
- const OTErrorClass = __webpack_require__(21);
64901
+ const OTErrorClass = __webpack_require__(22);
64785
64902
  const _require = __webpack_require__(101),
64786
64903
  parseIceServers = _require.parseIceServers;
64787
64904
  const PUBLISH_MAX_DELAY = __webpack_require__(266);
64788
- const sessionObjects = __webpack_require__(20);
64905
+ const sessionObjects = __webpack_require__(21);
64789
64906
  const StreamChannel = __webpack_require__(149);
64790
64907
  const StylableComponent = __webpack_require__(151);
64791
64908
  const systemRequirements = __webpack_require__(152);
@@ -64801,10 +64918,10 @@ const createChromeMixin = __webpack_require__(281)();
64801
64918
  const getNativeEnumerateDevices = __webpack_require__(287)({
64802
64919
  global: windowMock
64803
64920
  });
64804
- const deviceHelpers = __webpack_require__(23)({
64921
+ const deviceHelpers = __webpack_require__(24)({
64805
64922
  getNativeEnumerateDevices
64806
64923
  });
64807
- const Events = __webpack_require__(22)();
64924
+ const Events = __webpack_require__(23)();
64808
64925
  const generateSimpleStateMachine = __webpack_require__(159)();
64809
64926
  const getUserMediaHelper = __webpack_require__(646)({
64810
64927
  otError,
@@ -76486,7 +76603,7 @@ var baseKeys = __webpack_require__(115),
76486
76603
  getTag = __webpack_require__(40),
76487
76604
  isArguments = __webpack_require__(63),
76488
76605
  isArray = __webpack_require__(12),
76489
- isArrayLike = __webpack_require__(24),
76606
+ isArrayLike = __webpack_require__(25),
76490
76607
  isBuffer = __webpack_require__(64),
76491
76608
  isPrototype = __webpack_require__(67),
76492
76609
  isTypedArray = __webpack_require__(84);
@@ -76807,7 +76924,7 @@ module.exports = ['audioLocalAddress', 'audioRemoteAddress', 'videoLocalAddress'
76807
76924
  // @todo enable the following disabled rules see OPENTOK-31136 for more info
76808
76925
  /* eslint-disable one-var, no-underscore-dangle, no-use-before-define, no-param-reassign */
76809
76926
  /* eslint-disable max-len, no-var, vars-on-top, global-require */
76810
- const sessionObjects = __webpack_require__(20);
76927
+ const sessionObjects = __webpack_require__(21);
76811
76928
  const sessions = sessionObjects.sessions;
76812
76929
  module.exports = sessionId => {
76813
76930
  const session = sessions.get(sessionId);
@@ -83195,7 +83312,7 @@ module.exports = baseSome;
83195
83312
  /* 595 */
83196
83313
  /***/ (function(module, exports, __webpack_require__) {
83197
83314
 
83198
- var isArrayLike = __webpack_require__(24);
83315
+ var isArrayLike = __webpack_require__(25);
83199
83316
 
83200
83317
  /**
83201
83318
  * Creates a `baseEach` or `baseEachRight` function.
@@ -83293,7 +83410,7 @@ module.exports = map;
83293
83410
  /***/ (function(module, exports, __webpack_require__) {
83294
83411
 
83295
83412
  var baseEach = __webpack_require__(265),
83296
- isArrayLike = __webpack_require__(24);
83413
+ isArrayLike = __webpack_require__(25);
83297
83414
 
83298
83415
  /**
83299
83416
  * The base implementation of `_.map` without support for iteratee shorthands.
@@ -83568,7 +83685,7 @@ module.exports = /*#__PURE__*/function (_Events) {
83568
83685
 
83569
83686
 
83570
83687
  /* eslint-disable global-require */
83571
- const AnalyticsHelper = __webpack_require__(25);
83688
+ const AnalyticsHelper = __webpack_require__(20);
83572
83689
  module.exports = function (deps) {
83573
83690
  if (deps === void 0) {
83574
83691
  deps = {};
@@ -83820,7 +83937,7 @@ module.exports = customOmitClone;
83820
83937
  /***/ (function(module, exports, __webpack_require__) {
83821
83938
 
83822
83939
  var baseIteratee = __webpack_require__(34),
83823
- isArrayLike = __webpack_require__(24),
83940
+ isArrayLike = __webpack_require__(25),
83824
83941
  keys = __webpack_require__(29);
83825
83942
 
83826
83943
  /**
@@ -84303,7 +84420,7 @@ module.exports = {
84303
84420
  var Symbol = __webpack_require__(38),
84304
84421
  copyArray = __webpack_require__(54),
84305
84422
  getTag = __webpack_require__(40),
84306
- isArrayLike = __webpack_require__(24),
84423
+ isArrayLike = __webpack_require__(25),
84307
84424
  isString = __webpack_require__(275),
84308
84425
  iteratorToArray = __webpack_require__(624),
84309
84426
  mapToArray = __webpack_require__(232),
@@ -86061,8 +86178,8 @@ const assign = __webpack_require__(9);
86061
86178
  const isObject = __webpack_require__(11);
86062
86179
  const promiseDelay = __webpack_require__(106);
86063
86180
  const trackUsage = __webpack_require__(647);
86064
- const AnalyticsHelper = __webpack_require__(25);
86065
- const OTErrorClass = __webpack_require__(21);
86181
+ const AnalyticsHelper = __webpack_require__(20);
86182
+ const OTErrorClass = __webpack_require__(22);
86066
86183
  const eventing = __webpack_require__(6);
86067
86184
  module.exports = function getUserMediaFactory(deps) {
86068
86185
  if (deps === void 0) {
@@ -87878,7 +87995,7 @@ module.exports = function watchSubscriberAudio(getStats, warningCb, disableAudio
87878
87995
 
87879
87996
  /* eslint-disable global-require */
87880
87997
 
87881
- const Analytics = __webpack_require__(25);
87998
+ const Analytics = __webpack_require__(20);
87882
87999
  const defaultAnalytics = new Analytics();
87883
88000
  module.exports = function reportIssueFactory(deps) {
87884
88001
  if (deps === void 0) {
@@ -87889,7 +88006,7 @@ module.exports = function reportIssueFactory(deps) {
87889
88006
  const errors = deps.errors || __webpack_require__(7);
87890
88007
  const ExceptionCodes = deps.ExceptionCodes || __webpack_require__(10);
87891
88008
  const otError = deps.otError || __webpack_require__(13)();
87892
- const sessionObjects = deps.sessionObjects || __webpack_require__(20);
88009
+ const sessionObjects = deps.sessionObjects || __webpack_require__(21);
87893
88010
  const uuid = deps.uuid || __webpack_require__(15);
87894
88011
 
87895
88012
  /**
@@ -88405,7 +88522,7 @@ module.exports = err => {
88405
88522
  const eventNames = __webpack_require__(26);
88406
88523
  const now = __webpack_require__(48);
88407
88524
  const RafRunner = __webpack_require__(103);
88408
- const Events = __webpack_require__(22)();
88525
+ const Events = __webpack_require__(23)();
88409
88526
  module.exports = _ref => {
88410
88527
  let subscriber = _ref.subscriber,
88411
88528
  audioLevelSampler = _ref.audioLevelSampler;
@@ -88504,6 +88621,10 @@ module.exports = function (peerConnection, deps) {
88504
88621
  "use strict";
88505
88622
 
88506
88623
 
88624
+ // getSynchronizationSources is currently broken for SIP calls. See https://jira.vonage.com/browse/VIDCS-40
88625
+ // This is a bandaid fix. In the future we may override this to only return false when
88626
+ // ssrc-audio-level is missing from the SDP
88627
+ const isEnabledOverride = false;
88507
88628
  const env = __webpack_require__(2);
88508
88629
  const hasGetSynchronizationSupport = () => window.RTCRtpReceiver && 'getSynchronizationSources' in window.RTCRtpReceiver.prototype;
88509
88630
 
@@ -88516,7 +88637,8 @@ module.exports = function (deps) {
88516
88637
  deps = {};
88517
88638
  }
88518
88639
  const hasGetSyncSupport = deps.hasGetSynchronizationSupport || hasGetSynchronizationSupport;
88519
- return hasGetSyncSupport() && !env.isFirefox;
88640
+ const isEnabled = typeof deps.isEnabled === 'boolean' ? deps.isEnabled : isEnabledOverride;
88641
+ return isEnabled && hasGetSyncSupport() && !env.isFirefox;
88520
88642
  };
88521
88643
 
88522
88644
  /***/ }),
@@ -88868,17 +88990,18 @@ const createAudioFallbackCoordinator = _ref => {
88868
88990
  stream = _ref3.stream,
88869
88991
  peerId = _ref3.peerId;
88870
88992
  if (publishVideo) {
88993
+ const subscriberId = peerConnection.getSourceStreamId() === 'MANTIS' ? undefined : peerId;
88871
88994
  switch (audioFallbackState) {
88872
88995
  case ACTIVE_VIDEO:
88873
88996
  setEncodersActiveState(peerConnection, true);
88874
- stream.setChannelActiveState('video', true, 'auto', _congestionLevels.LOW, peerId);
88997
+ stream.setChannelActiveState('video', true, 'auto', _congestionLevels.LOW, subscriberId);
88875
88998
  break;
88876
88999
  case ACTIVE_VIDEO_WITH_WARNING:
88877
- stream.setChannelActiveState('video', true, 'auto', _congestionLevels.MEDIUM, peerId);
89000
+ stream.setChannelActiveState('video', true, 'auto', _congestionLevels.MEDIUM, subscriberId);
88878
89001
  break;
88879
89002
  case SUSPENDED_VIDEO:
88880
89003
  setEncodersActiveState(peerConnection, false);
88881
- stream.setChannelActiveState('video', false, 'auto', _congestionLevels.CRITICAL, peerId);
89004
+ stream.setChannelActiveState('video', false, 'auto', _congestionLevels.CRITICAL, subscriberId);
88882
89005
  break;
88883
89006
  default:
88884
89007
  break;
@@ -89372,7 +89495,7 @@ module.exports = x => {
89372
89495
  const eventNames = __webpack_require__(26);
89373
89496
  const now = __webpack_require__(48);
89374
89497
  const RafRunner = __webpack_require__(103);
89375
- const Events = __webpack_require__(22)();
89498
+ const Events = __webpack_require__(23)();
89376
89499
  module.exports = _ref => {
89377
89500
  let publisher = _ref.publisher,
89378
89501
  widgetView = _ref.widgetView;
@@ -92602,11 +92725,16 @@ function RaptorSocketFactory(deps) {
92602
92725
 
92603
92726
  // The Dispatcher bit is purely to make testing simpler, it defaults to a new Dispatcher so in
92604
92727
  // normal operation you would omit it.
92605
- const RaptorSocket = function RaptorSocket(connectionId, widgetId, messagingSocketUrl, symphonyUrl, dispatcher, analytics, requestedCapabilities) {
92728
+ const RaptorSocket = function RaptorSocket(_ref) {
92606
92729
  var _this = this;
92607
- if (requestedCapabilities === void 0) {
92608
- requestedCapabilities = [];
92609
- }
92730
+ let connectionId = _ref.connectionId,
92731
+ sessionId = _ref.sessionId,
92732
+ messagingSocketUrl = _ref.messagingSocketUrl,
92733
+ symphonyUrl = _ref.symphonyUrl,
92734
+ dispatcher = _ref.dispatcher,
92735
+ analytics = _ref.analytics,
92736
+ _ref$requestedCapabil = _ref.requestedCapabilities,
92737
+ requestedCapabilities = _ref$requestedCapabil === void 0 ? [] : _ref$requestedCapabil;
92610
92738
  let _apiKey, _sessionId, _token, _sessionInfo, _completion, _p2p, _messagingServer, _rumorErrored;
92611
92739
  const _states = ['disconnected', 'connecting', 'connected', 'error', 'disconnecting'];
92612
92740
  const _dispatcher = dispatcher || new Dispatcher();
@@ -92721,6 +92849,7 @@ function RaptorSocketFactory(deps) {
92721
92849
  messagingURL: messagingSocketUrl,
92722
92850
  notifyDisconnectAddress: symphonyUrl,
92723
92851
  connectionId,
92852
+ sessionId,
92724
92853
  enableReconnection: sessionInfo.reconnection
92725
92854
  });
92726
92855
  this._rumor.on('close', onClose);
@@ -92789,8 +92918,8 @@ function RaptorSocketFactory(deps) {
92789
92918
  if (!replyData.connection || replyData.connection.length === 0) {
92790
92919
  replyData.connection = [];
92791
92920
  if (Array.isArray(replyData.stream)) {
92792
- replyData.stream.forEach(_ref => {
92793
- let connection = _ref.connection;
92921
+ replyData.stream.forEach(_ref2 => {
92922
+ let connection = _ref2.connection;
92794
92923
  return replyData.connection.push(connection);
92795
92924
  });
92796
92925
  }
@@ -93034,6 +93163,7 @@ var _log = _interopRequireDefault(__webpack_require__(1));
93034
93163
  var _ReconnectableSocket = _interopRequireDefault(__webpack_require__(729));
93035
93164
  var _RumorSocket = _interopRequireDefault(__webpack_require__(734));
93036
93165
  var _WebSocket = _interopRequireDefault(__webpack_require__(739));
93166
+ var _analytics = _interopRequireDefault(__webpack_require__(20));
93037
93167
  /* eslint-disable no-underscore-dangle */
93038
93168
 
93039
93169
  function defaultRumorSocket(_temp) {
@@ -93042,6 +93172,7 @@ function defaultRumorSocket(_temp) {
93042
93172
  WebSocket = _ref$WebSocket === void 0 ? _WebSocket.default : _ref$WebSocket;
93043
93173
  const allocateId = (0, _createCounter.default)();
93044
93174
  const ReconnectableSocket = (0, _ReconnectableSocket.default)({
93175
+ AnalyticsHelper: _analytics.default,
93045
93176
  EventEmitter: _events.default,
93046
93177
  WebSocket,
93047
93178
  logging: _log.default,
@@ -93103,7 +93234,8 @@ const isValidCode = code => code === 1000 || code >= 3000 && code <= 4999;
93103
93234
  const CLOSE_TIMEOUT = _socketCloseCodes.codes.CLOSE_TIMEOUT;
93104
93235
  var _default = _ref => {
93105
93236
  var _class;
93106
- let EventEmitter = _ref.EventEmitter,
93237
+ let AnalyticsHelper = _ref.AnalyticsHelper,
93238
+ EventEmitter = _ref.EventEmitter,
93107
93239
  WebSocket = _ref.WebSocket,
93108
93240
  logging = _ref.logging,
93109
93241
  allocateId = _ref.allocateId,
@@ -93115,23 +93247,6 @@ var _default = _ref => {
93115
93247
  (0, _inheritsLoose2.default)(ReconnectableSocket, _EventEmitter);
93116
93248
  function ReconnectableSocket(opt) {
93117
93249
  var _this;
93118
- const _ref2 = typeof opt === 'string' ? {
93119
- url: opt
93120
- } : opt,
93121
- url = _ref2.url,
93122
- _ref2$connectTimeout = _ref2.connectTimeout,
93123
- connectTimeout = _ref2$connectTimeout === void 0 ? 15000 : _ref2$connectTimeout,
93124
- _ref2$pingThreshold = _ref2.pingThreshold,
93125
- pingThreshold = _ref2$pingThreshold === void 0 ? 3000 : _ref2$pingThreshold,
93126
- _ref2$pingWarningDela = _ref2.pingWarningDelay,
93127
- pingWarningDelay = _ref2$pingWarningDela === void 0 ? 100 : _ref2$pingWarningDela,
93128
- _ref2$disconnectThres = _ref2.disconnectThreshold,
93129
- disconnectThreshold = _ref2$disconnectThres === void 0 ? 5900 : _ref2$disconnectThres,
93130
- _ref2$reconnectMaxDur = _ref2.reconnectMaxDuration,
93131
- reconnectMaxDuration = _ref2$reconnectMaxDur === void 0 ? 60000 : _ref2$reconnectMaxDur;
93132
- if (!url) {
93133
- throw new Error('Must provide url');
93134
- }
93135
93250
  _this = _EventEmitter.call(this) || this;
93136
93251
  _this._url = void 0;
93137
93252
  _this._id = allocateId();
@@ -93143,6 +93258,37 @@ var _default = _ref => {
93143
93258
  _this._disconnectTimer = void 0;
93144
93259
  _this._queuedMessages = [];
93145
93260
  _this._draining = false;
93261
+ _this._analytics = new AnalyticsHelper();
93262
+ _this._logAnalyticsEvent = _ref2 => {
93263
+ let action = _ref2.action,
93264
+ variation = _ref2.variation,
93265
+ payload = _ref2.payload;
93266
+ _this._analytics.logEvent({
93267
+ action,
93268
+ variation,
93269
+ payload,
93270
+ sessionId: _this.sessionId,
93271
+ connectionId: _this.connectionId
93272
+ });
93273
+ };
93274
+ const url = opt.url,
93275
+ connectionId = opt.connectionId,
93276
+ sessionId = opt.sessionId,
93277
+ _opt$connectTimeout = opt.connectTimeout,
93278
+ connectTimeout = _opt$connectTimeout === void 0 ? 15000 : _opt$connectTimeout,
93279
+ _opt$pingThreshold = opt.pingThreshold,
93280
+ pingThreshold = _opt$pingThreshold === void 0 ? 3000 : _opt$pingThreshold,
93281
+ _opt$pingWarningDelay = opt.pingWarningDelay,
93282
+ pingWarningDelay = _opt$pingWarningDelay === void 0 ? 100 : _opt$pingWarningDelay,
93283
+ _opt$disconnectThresh = opt.disconnectThreshold,
93284
+ disconnectThreshold = _opt$disconnectThresh === void 0 ? 5900 : _opt$disconnectThresh,
93285
+ _opt$reconnectMaxDura = opt.reconnectMaxDuration,
93286
+ reconnectMaxDuration = _opt$reconnectMaxDura === void 0 ? 60000 : _opt$reconnectMaxDura;
93287
+ if (!url) {
93288
+ throw new Error('Must provide url');
93289
+ }
93290
+ _this.connectionId = connectionId;
93291
+ _this.sessionId = sessionId;
93146
93292
  _this.readyStateMachine = (0, _createReadyStateMachine.default)({
93147
93293
  reconnectMaxDuration,
93148
93294
  CLOSED: ReconnectableSocket.CLOSED,
@@ -93163,21 +93309,41 @@ var _default = _ref => {
93163
93309
  _this._queuedMessages.forEach(msg => _this.send(msg, true));
93164
93310
  _this._queuedMessages = [];
93165
93311
  _this.emit('reconnected');
93312
+ _this._logAnalyticsEvent({
93313
+ action: 'WebSocket:reconnect',
93314
+ variation: 'Success'
93315
+ });
93166
93316
  } else {
93167
93317
  _this.emit('open');
93318
+ _this._logAnalyticsEvent({
93319
+ action: 'WebSocket:open'
93320
+ });
93168
93321
  }
93169
93322
  });
93170
- _this.readyStateMachine.observe('onEnterClosed', (_, error) => {
93323
+ _this.readyStateMachine.observe('onEnterClosed', (_ref4, error) => {
93324
+ let from = _ref4.from,
93325
+ code = _ref4.code,
93326
+ reason = _ref4.reason;
93171
93327
  _this.emit('close', error);
93328
+ if (from === 'reconnecting') {
93329
+ _this._logAnalyticsEvent({
93330
+ action: 'WebSocket:reconnect',
93331
+ variation: 'Failure',
93332
+ payload: {
93333
+ code,
93334
+ reason
93335
+ }
93336
+ });
93337
+ }
93172
93338
  });
93173
93339
  _this.readyStateMachine.observe('onEnterClosing', removeReturnVal( /*#__PURE__*/function () {
93174
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref4, _ref5) {
93340
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref5, _ref6) {
93175
93341
  var from, code, reason;
93176
93342
  return _regenerator.default.wrap(function _callee$(_context) {
93177
93343
  while (1) switch (_context.prev = _context.next) {
93178
93344
  case 0:
93179
- from = _ref4.from;
93180
- code = _ref5.code, reason = _ref5.reason;
93345
+ from = _ref5.from;
93346
+ code = _ref6.code, reason = _ref6.reason;
93181
93347
  _this._clearTimers();
93182
93348
  _context.next = 5;
93183
93349
  return _this._clearSocket({
@@ -93191,6 +93357,10 @@ var _default = _ref => {
93191
93357
  code,
93192
93358
  reason
93193
93359
  });
93360
+ _this._logAnalyticsEvent({
93361
+ action: 'WebSocket:reconnect',
93362
+ variation: 'Failure'
93363
+ });
93194
93364
  }
93195
93365
  setTimeout(() => {
93196
93366
  _this.readyStateMachine.closed({
@@ -93205,22 +93375,26 @@ var _default = _ref => {
93205
93375
  }, _callee);
93206
93376
  }));
93207
93377
  return function (_x, _x2) {
93208
- return _ref6.apply(this, arguments);
93378
+ return _ref7.apply(this, arguments);
93209
93379
  };
93210
93380
  }()));
93211
93381
  _this.readyStateMachine.observe('onEnterReconnecting', () => {
93212
93382
  _this.emit('reconnecting');
93383
+ _this._logAnalyticsEvent({
93384
+ action: 'WebSocket:reconnect',
93385
+ variation: 'Attempt'
93386
+ });
93213
93387
  });
93214
93388
  _this.readyStateMachine.observe('onDisconnect', removeReturnVal( /*#__PURE__*/function () {
93215
- var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref7, _ref8) {
93389
+ var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref8, _ref9) {
93216
93390
  var from, to, code, reason;
93217
93391
  return _regenerator.default.wrap(function _callee2$(_context2) {
93218
93392
  while (1) switch (_context2.prev = _context2.next) {
93219
93393
  case 0:
93220
- from = _ref7.from, to = _ref7.to;
93221
- code = _ref8.code, reason = _ref8.reason;
93394
+ from = _ref8.from, to = _ref8.to;
93395
+ code = _ref9.code, reason = _ref9.reason;
93222
93396
  if (!(to === 'reconnecting')) {
93223
- _context2.next = 10;
93397
+ _context2.next = 12;
93224
93398
  break;
93225
93399
  }
93226
93400
  if (!_this._draining) {
@@ -93239,14 +93413,24 @@ var _default = _ref => {
93239
93413
  });
93240
93414
  case 9:
93241
93415
  _this._createSocket();
93242
- case 10:
93416
+ _context2.next = 13;
93417
+ break;
93418
+ case 12:
93419
+ _this._logAnalyticsEvent({
93420
+ action: 'WebSocket:disconnect',
93421
+ payload: {
93422
+ code,
93423
+ reason
93424
+ }
93425
+ });
93426
+ case 13:
93243
93427
  case "end":
93244
93428
  return _context2.stop();
93245
93429
  }
93246
93430
  }, _callee2);
93247
93431
  }));
93248
93432
  return function (_x3, _x4) {
93249
- return _ref9.apply(this, arguments);
93433
+ return _ref10.apply(this, arguments);
93250
93434
  };
93251
93435
  }()));
93252
93436
  const createTimer = (name, duration) => new _Timer.default({
@@ -93269,9 +93453,9 @@ var _default = _ref => {
93269
93453
  wsEvents.on('open', () => {
93270
93454
  this.readyStateMachine.open();
93271
93455
  });
93272
- wsEvents.on('close', _ref10 => {
93273
- let code = _ref10.code,
93274
- reason = _ref10.reason;
93456
+ wsEvents.on('close', _ref11 => {
93457
+ let code = _ref11.code,
93458
+ reason = _ref11.reason;
93275
93459
  this.readyStateMachine.disconnect({
93276
93460
  code,
93277
93461
  reason
@@ -93303,17 +93487,17 @@ var _default = _ref => {
93303
93487
  };
93304
93488
  _proto._clearSocket = /*#__PURE__*/function () {
93305
93489
  var _clearSocket2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_temp) {
93306
- var _ref11, _ref11$drain, drain, code, reason;
93490
+ var _ref12, _ref12$drain, drain, code, reason;
93307
93491
  return _regenerator.default.wrap(function _callee3$(_context3) {
93308
93492
  while (1) switch (_context3.prev = _context3.next) {
93309
93493
  case 0:
93310
- _ref11 = _temp === void 0 ? {} : _temp, _ref11$drain = _ref11.drain, drain = _ref11$drain === void 0 ? false : _ref11$drain, code = _ref11.code, reason = _ref11.reason;
93494
+ _ref12 = _temp === void 0 ? {} : _temp, _ref12$drain = _ref12.drain, drain = _ref12$drain === void 0 ? false : _ref12$drain, code = _ref12.code, reason = _ref12.reason;
93311
93495
  this._draining = true;
93312
93496
  if (this._webSocketEvents) {
93313
93497
  this._webSocketEvents.removeAll();
93314
93498
  }
93315
93499
  if (!(this._webSocket.readyState !== ReconnectableSocket.CLOSED)) {
93316
- _context3.next = 8;
93500
+ _context3.next = 9;
93317
93501
  break;
93318
93502
  }
93319
93503
  if (!drain) {
@@ -93326,6 +93510,14 @@ var _default = _ref => {
93326
93510
  BUFFER_DRAIN_MAX_RETRIES
93327
93511
  });
93328
93512
  case 7:
93513
+ this._logAnalyticsEvent({
93514
+ action: 'WebSocket:close',
93515
+ payload: {
93516
+ code,
93517
+ reason
93518
+ },
93519
+ variation: 'Attempt'
93520
+ });
93329
93521
  try {
93330
93522
  if (!isValidCode(code) || code === undefined && reason === undefined) {
93331
93523
  // because IE
@@ -93333,12 +93525,27 @@ var _default = _ref => {
93333
93525
  } else {
93334
93526
  this._webSocket.close(code, reason);
93335
93527
  }
93528
+ this._logAnalyticsEvent({
93529
+ action: 'WebSocket:close',
93530
+ payload: {
93531
+ code,
93532
+ reason
93533
+ },
93534
+ variation: 'Success'
93535
+ });
93336
93536
  } catch (err) {
93337
93537
  logging.error('Could not close websocket', err);
93538
+ this._logAnalyticsEvent({
93539
+ action: 'WebSocket:close',
93540
+ payload: {
93541
+ err
93542
+ },
93543
+ variation: 'Failure'
93544
+ });
93338
93545
  }
93339
- case 8:
93340
- this._draining = false;
93341
93546
  case 9:
93547
+ this._draining = false;
93548
+ case 10:
93342
93549
  case "end":
93343
93550
  return _context3.stop();
93344
93551
  }
@@ -93689,6 +93896,7 @@ var _default = _ref => {
93689
93896
  let messagingURL = _ref2.messagingURL,
93690
93897
  notifyDisconnectAddress = _ref2.notifyDisconnectAddress,
93691
93898
  connectionId = _ref2.connectionId,
93899
+ sessionId = _ref2.sessionId,
93692
93900
  enableReconnection = _ref2.enableReconnection,
93693
93901
  _ref2$pingThreshold = _ref2.pingThreshold,
93694
93902
  pingThreshold = _ref2$pingThreshold === void 0 ? 2000 : _ref2$pingThreshold,
@@ -93725,7 +93933,9 @@ var _default = _ref => {
93725
93933
  url: () => !_this._enableReconnection ? _this.url : [_this.url, _this.url.indexOf('?') >= 0 ? '&' : '?', `socketId=${_this._socketID}`, _this._socket && _this._socket.reconnecting ? '&reconnect=true' : '', `&attempt=${(0, _uuid.default)()}`].join(''),
93726
93934
  pingThreshold,
93727
93935
  disconnectThreshold,
93728
- reconnectMaxDuration
93936
+ reconnectMaxDuration,
93937
+ connectionId,
93938
+ sessionId
93729
93939
  });
93730
93940
  } catch (e) {
93731
93941
  _this._logger.error(e);
@@ -96252,7 +96462,7 @@ module.exports = function initSessionFactory(deps) {
96252
96462
  deps = {};
96253
96463
  }
96254
96464
  const Session = deps.Session || __webpack_require__(319)();
96255
- const sessionObjects = deps.sessionObjects || __webpack_require__(20);
96465
+ const sessionObjects = deps.sessionObjects || __webpack_require__(21);
96256
96466
 
96257
96467
  /**
96258
96468
  * The first step in using the OpenTok API is to call the <code>OT.initSession()</code>
@@ -96319,6 +96529,10 @@ module.exports = function initSessionFactory(deps) {
96319
96529
  * <li><code>iceConfig</code> &mdash; (Object) This feature is part of the configurable TURN
96320
96530
  * <a href="https://tokbox.com/pricing/plans" target="_blank">add-on feature</a>.
96321
96531
  * </li>
96532
+ * <li><code>encryptionSecret</code. (String) This is the initial encryption secret used by the
96533
+ * end-to-end encryption feature. See <a href="https://www.tokbox.com/developer/guides/end-to-end-encryption/">
96534
+ * the developer guide</a>.
96535
+ * </li>
96322
96536
  * </ul>
96323
96537
  *
96324
96538
  * @returns {Session} The session object through which all further interactions with
@@ -96683,8 +96897,6 @@ const hasEndToEndEncryptionSupport = __webpack_require__(109);
96683
96897
  * }
96684
96898
  * </pre>
96685
96899
  *
96686
- * This is a <em>beta</em> feature.
96687
- *
96688
96900
  * @return {Boolean} Whether the client supports end-to-end encryption (<code>true</code>),
96689
96901
  * or not (<code>false</code>).
96690
96902
  *
@@ -96703,7 +96915,7 @@ module.exports = hasEndToEndEncryptionSupport;
96703
96915
  "use strict";
96704
96916
 
96705
96917
 
96706
- const _require = __webpack_require__(23)(),
96918
+ const _require = __webpack_require__(24)(),
96707
96919
  getInputMediaDevices = _require.getInputMediaDevices;
96708
96920
 
96709
96921
  /**
@@ -96763,7 +96975,7 @@ module.exports = function (deps) {
96763
96975
  if (deps === void 0) {
96764
96976
  deps = {};
96765
96977
  }
96766
- const _ref = deps.deviceHelpers || __webpack_require__(23)(),
96978
+ const _ref = deps.deviceHelpers || __webpack_require__(24)(),
96767
96979
  hasAudioOutputApiSupport = _ref.hasAudioOutputApiSupport,
96768
96980
  hasDevice = _ref.hasDevice;
96769
96981
  const getAudioOutputDevices = deps.getAudioOutputDevices || __webpack_require__(331);
@@ -96847,7 +97059,7 @@ var _interopRequireDefault = __webpack_require__(3);
96847
97059
  var _regenerator = _interopRequireDefault(__webpack_require__(4));
96848
97060
  var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(5));
96849
97061
  const audioOutputDevicesChangeHandler = __webpack_require__(768)();
96850
- const _require = __webpack_require__(23)(),
97062
+ const _require = __webpack_require__(24)(),
96851
97063
  hasAudioOutputApiSupport = _require.hasAudioOutputApiSupport,
96852
97064
  getNativeMediaDevices = _require.getNativeMediaDevices;
96853
97065
  module.exports = () => {
@@ -96895,7 +97107,7 @@ module.exports = function (deps) {
96895
97107
  if (deps === void 0) {
96896
97108
  deps = {};
96897
97109
  }
96898
- const _ref = deps.deviceHelpers || __webpack_require__(23)(),
97110
+ const _ref = deps.deviceHelpers || __webpack_require__(24)(),
96899
97111
  getAudioOutputMediaDevices = _ref.getAudioOutputMediaDevices,
96900
97112
  getDefaultAudioOutputDeviceId = _ref.getDefaultAudioOutputDeviceId,
96901
97113
  hasDevice = _ref.hasDevice;