@opentok/client 2.30.2-alpha.13 → 2.30.2-alpha.14
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 +133 -149
- 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.30.2
|
|
2
|
+
* @license OpenTok.js 2.30.2 685e223aa
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2010-2025 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:
|
|
8
|
+
* Date: Thu, 19 Jun 2025 18:12:43 GMT
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
@@ -8679,7 +8679,7 @@ const logging = (0, _log.default)('StaticConfig');
|
|
|
8679
8679
|
*/
|
|
8680
8680
|
|
|
8681
8681
|
/** @type builtInConfig */
|
|
8682
|
-
const builtInConfig = (0, _cloneDeep.default)({"version":"v2.30.2","buildHash":"
|
|
8682
|
+
const builtInConfig = (0, _cloneDeep.default)({"version":"v2.30.2","buildHash":"685e223aa","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"});
|
|
8683
8683
|
const whitelistAllowedRuntimeProperties = (0, _pick.default)(['apiURL', 'assetURL', 'cdnURL', 'sessionInfoOverrides', 'loggingURL']);
|
|
8684
8684
|
const liveConfigMap = {
|
|
8685
8685
|
apiUrl: 'apiURL',
|
|
@@ -18671,33 +18671,15 @@ function PublisherFactory(_ref) {
|
|
|
18671
18671
|
return _ref11.apply(this, arguments);
|
|
18672
18672
|
};
|
|
18673
18673
|
}();
|
|
18674
|
+
const isAudioFallbackActive = () => {
|
|
18675
|
+
var _audioFallbackCoordin2;
|
|
18676
|
+
return ((_audioFallbackCoordin2 = audioFallbackCoordinator) == null ? void 0 : _audioFallbackCoordin2.getState()) === _audioFallbackVideoStates.default.SUSPENDED_VIDEO;
|
|
18677
|
+
};
|
|
18674
18678
|
const onPeerConnected = peerConnection => {
|
|
18675
|
-
|
|
18676
|
-
|
|
18677
|
-
|
|
18678
|
-
|
|
18679
|
-
NearestResolution: (0, _getSpatialResolution.default)(this.videoWidth(), this.videoHeight())
|
|
18680
|
-
};
|
|
18681
|
-
if ((0, _isString.default)(_videoMaxBitrateSetting)) {
|
|
18682
|
-
log.Preset = _videoMaxBitrateSetting.toLowerCase();
|
|
18683
|
-
} else {
|
|
18684
|
-
log.BitrateBps = _videoMaxBitrateSetting;
|
|
18685
|
-
}
|
|
18686
|
-
logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Success', log);
|
|
18687
|
-
}
|
|
18688
|
-
} catch (e) {
|
|
18689
|
-
if (_videoMaxBitrateSetting !== undefined) {
|
|
18690
|
-
const log = {
|
|
18691
|
-
NearestResolution: (0, _getSpatialResolution.default)(this.videoWidth(), this.videoHeight())
|
|
18692
|
-
};
|
|
18693
|
-
if ((0, _isString.default)(_videoMaxBitrateSetting)) {
|
|
18694
|
-
log.Preset = _videoMaxBitrateSetting.toLowerCase();
|
|
18695
|
-
} else {
|
|
18696
|
-
log.BitrateBps = _videoMaxBitrateSetting;
|
|
18697
|
-
}
|
|
18698
|
-
log.Reason = e.message;
|
|
18699
|
-
logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Failure', log);
|
|
18700
|
-
}
|
|
18679
|
+
// Don't apply max bitrate if PAF is active. setMaxBitrate can alter the active state.
|
|
18680
|
+
// max bitrate will be applied once PAF is inactive.
|
|
18681
|
+
if (!isAudioFallbackActive()) {
|
|
18682
|
+
setMaxVideoBitrateToPublisher(peerConnection);
|
|
18701
18683
|
}
|
|
18702
18684
|
peerConnection.startEncryption(this.session.connection.id);
|
|
18703
18685
|
if (isRoutedToRelayedTransitionComplete(peerConnection)) {
|
|
@@ -20031,6 +20013,7 @@ function PublisherFactory(_ref) {
|
|
|
20031
20013
|
_this.trigger('videoEnabled', {
|
|
20032
20014
|
reason: 'quality'
|
|
20033
20015
|
});
|
|
20016
|
+
setMaxVideoBitrateToPublisher();
|
|
20034
20017
|
} else {
|
|
20035
20018
|
_this.trigger('videoDisableWarningLifted');
|
|
20036
20019
|
}
|
|
@@ -20609,41 +20592,19 @@ function PublisherFactory(_ref) {
|
|
|
20609
20592
|
_context27.next = 5;
|
|
20610
20593
|
return Promise.all(pcs.map( /*#__PURE__*/function () {
|
|
20611
20594
|
var _ref39 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26(pc) {
|
|
20612
|
-
var log;
|
|
20613
20595
|
return _regenerator.default.wrap(function _callee26$(_context26) {
|
|
20614
20596
|
while (1) switch (_context26.prev = _context26.next) {
|
|
20615
20597
|
case 0:
|
|
20616
20598
|
_context26.next = 2;
|
|
20617
20599
|
return pc.findAndReplaceTrack(oldTrack, newTrack);
|
|
20618
20600
|
case 2:
|
|
20619
|
-
|
|
20620
|
-
|
|
20621
|
-
|
|
20622
|
-
log = {
|
|
20623
|
-
NearestResolution: (0, _getSpatialResolution.default)(_this.videoWidth(), _this.videoHeight())
|
|
20624
|
-
};
|
|
20625
|
-
if ((0, _isString.default)(_videoMaxBitrateSetting)) {
|
|
20626
|
-
log.Preset = _videoMaxBitrateSetting.toLowerCase();
|
|
20627
|
-
} else {
|
|
20628
|
-
log.BitrateBps = _videoMaxBitrateSetting;
|
|
20629
|
-
}
|
|
20630
|
-
logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Success', log);
|
|
20631
|
-
}
|
|
20632
|
-
} catch (e) {
|
|
20633
|
-
if (_videoMaxBitrateSetting !== undefined) {
|
|
20634
|
-
log = {
|
|
20635
|
-
NearestResolution: (0, _getSpatialResolution.default)(_this.videoWidth(), _this.videoHeight())
|
|
20636
|
-
};
|
|
20637
|
-
if ((0, _isString.default)(_videoMaxBitrateSetting)) {
|
|
20638
|
-
log.Preset = _videoMaxBitrateSetting.toLowerCase();
|
|
20639
|
-
} else {
|
|
20640
|
-
log.BitrateBps = _videoMaxBitrateSetting;
|
|
20641
|
-
}
|
|
20642
|
-
log.Reason = e.message;
|
|
20643
|
-
logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Failure', log);
|
|
20644
|
-
}
|
|
20601
|
+
if (isAudioFallbackActive()) {
|
|
20602
|
+
_context26.next = 5;
|
|
20603
|
+
break;
|
|
20645
20604
|
}
|
|
20646
|
-
|
|
20605
|
+
_context26.next = 5;
|
|
20606
|
+
return setMaxVideoBitrateToPublisher(pc);
|
|
20607
|
+
case 5:
|
|
20647
20608
|
case "end":
|
|
20648
20609
|
return _context26.stop();
|
|
20649
20610
|
}
|
|
@@ -23340,6 +23301,85 @@ function PublisherFactory(_ref) {
|
|
|
23340
23301
|
* @memberOf Publisher
|
|
23341
23302
|
*/
|
|
23342
23303
|
this.getVideoBitratePreset = () => properties.videoBitratePreset;
|
|
23304
|
+
const setMaxVideoBitrateToPublisher = /*#__PURE__*/function () {
|
|
23305
|
+
var _ref59 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee53(peerConnection) {
|
|
23306
|
+
var payload, applyMaxBitrate, peerConnections;
|
|
23307
|
+
return _regenerator.default.wrap(function _callee53$(_context53) {
|
|
23308
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
23309
|
+
case 0:
|
|
23310
|
+
if (!(_videoMaxBitrateSetting === undefined)) {
|
|
23311
|
+
_context53.next = 2;
|
|
23312
|
+
break;
|
|
23313
|
+
}
|
|
23314
|
+
return _context53.abrupt("return");
|
|
23315
|
+
case 2:
|
|
23316
|
+
if (isNaN(_videoMaxBitrateSetting)) {
|
|
23317
|
+
payload = {
|
|
23318
|
+
Preset: _videoMaxBitrateSetting
|
|
23319
|
+
};
|
|
23320
|
+
} else {
|
|
23321
|
+
payload = _videoMaxBitrateSetting === 0 ? {
|
|
23322
|
+
Preset: 'default'
|
|
23323
|
+
} : {
|
|
23324
|
+
BitrateBps: _videoMaxBitrateSetting
|
|
23325
|
+
};
|
|
23326
|
+
}
|
|
23327
|
+
payload.NearestResolution = (0, _getSpatialResolution.default)(_this.videoWidth(), _this.videoHeight());
|
|
23328
|
+
logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Attempt', payload);
|
|
23329
|
+
applyMaxBitrate = /*#__PURE__*/function () {
|
|
23330
|
+
var _ref60 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52(pc) {
|
|
23331
|
+
return _regenerator.default.wrap(function _callee52$(_context52) {
|
|
23332
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
23333
|
+
case 0:
|
|
23334
|
+
_context52.prev = 0;
|
|
23335
|
+
_context52.next = 3;
|
|
23336
|
+
return applySetMaxBitrateToPeerConnection(pc);
|
|
23337
|
+
case 3:
|
|
23338
|
+
logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Success', payload);
|
|
23339
|
+
_context52.next = 11;
|
|
23340
|
+
break;
|
|
23341
|
+
case 6:
|
|
23342
|
+
_context52.prev = 6;
|
|
23343
|
+
_context52.t0 = _context52["catch"](0);
|
|
23344
|
+
payload.Reason = _context52.t0.message;
|
|
23345
|
+
logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Failure', payload);
|
|
23346
|
+
throw otError(Errors.UNEXPECTED_ERROR_CODE, new Error('An unexpected error was encountered'));
|
|
23347
|
+
case 11:
|
|
23348
|
+
case "end":
|
|
23349
|
+
return _context52.stop();
|
|
23350
|
+
}
|
|
23351
|
+
}, _callee52, null, [[0, 6]]);
|
|
23352
|
+
}));
|
|
23353
|
+
return function applyMaxBitrate(_x41) {
|
|
23354
|
+
return _ref60.apply(this, arguments);
|
|
23355
|
+
};
|
|
23356
|
+
}();
|
|
23357
|
+
if (!peerConnection) {
|
|
23358
|
+
_context53.next = 11;
|
|
23359
|
+
break;
|
|
23360
|
+
}
|
|
23361
|
+
_context53.next = 9;
|
|
23362
|
+
return applyMaxBitrate(peerConnection);
|
|
23363
|
+
case 9:
|
|
23364
|
+
_context53.next = 16;
|
|
23365
|
+
break;
|
|
23366
|
+
case 11:
|
|
23367
|
+
_context53.next = 13;
|
|
23368
|
+
return getAllPeerConnections();
|
|
23369
|
+
case 13:
|
|
23370
|
+
peerConnections = _context53.sent;
|
|
23371
|
+
_context53.next = 16;
|
|
23372
|
+
return Promise.all(peerConnections.map(applyMaxBitrate));
|
|
23373
|
+
case 16:
|
|
23374
|
+
case "end":
|
|
23375
|
+
return _context53.stop();
|
|
23376
|
+
}
|
|
23377
|
+
}, _callee53);
|
|
23378
|
+
}));
|
|
23379
|
+
return function setMaxVideoBitrateToPublisher(_x40) {
|
|
23380
|
+
return _ref59.apply(this, arguments);
|
|
23381
|
+
};
|
|
23382
|
+
}();
|
|
23343
23383
|
|
|
23344
23384
|
/**
|
|
23345
23385
|
* Sets the publisher's maxBitrate value/s that will be distributed to each of
|
|
@@ -23366,73 +23406,44 @@ function PublisherFactory(_ref) {
|
|
|
23366
23406
|
* @memberOf Publisher
|
|
23367
23407
|
*/
|
|
23368
23408
|
this.setMaxVideoBitrate = /*#__PURE__*/function () {
|
|
23369
|
-
var
|
|
23370
|
-
var bitrate
|
|
23371
|
-
return _regenerator.default.wrap(function
|
|
23372
|
-
while (1) switch (
|
|
23409
|
+
var _ref61 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54(bitrateBps) {
|
|
23410
|
+
var bitrate;
|
|
23411
|
+
return _regenerator.default.wrap(function _callee54$(_context54) {
|
|
23412
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
23373
23413
|
case 0:
|
|
23374
23414
|
if (!(typeof bitrateBps !== 'number')) {
|
|
23375
|
-
|
|
23415
|
+
_context54.next = 2;
|
|
23376
23416
|
break;
|
|
23377
23417
|
}
|
|
23378
23418
|
throw otError(Errors.INVALID_PARAMETER, new Error('Invalid bitrate: it must be 0 or any number between 5000 and 10000000'));
|
|
23379
23419
|
case 2:
|
|
23380
23420
|
bitrate = parseInt(bitrateBps, 10);
|
|
23381
23421
|
if (!(isNaN(bitrate) || bitrate !== 0 && (bitrate < 5000 || bitrate > 10000000))) {
|
|
23382
|
-
|
|
23422
|
+
_context54.next = 5;
|
|
23383
23423
|
break;
|
|
23384
23424
|
}
|
|
23385
23425
|
throw otError(Errors.INVALID_PARAMETER, new Error('Invalid bitrate: it must be 0 or any number between 5000 and 10000000'));
|
|
23386
23426
|
case 5:
|
|
23387
23427
|
_videoMaxBitrateSetting = bitrate === 0 ? _VideoBitratePreset.default.DEFAULT : bitrate;
|
|
23388
|
-
|
|
23389
|
-
|
|
23390
|
-
|
|
23391
|
-
|
|
23392
|
-
|
|
23393
|
-
|
|
23394
|
-
|
|
23395
|
-
|
|
23396
|
-
|
|
23428
|
+
if (isAudioFallbackActive()) {
|
|
23429
|
+
_context54.next = 11;
|
|
23430
|
+
break;
|
|
23431
|
+
}
|
|
23432
|
+
_context54.next = 9;
|
|
23433
|
+
return setMaxVideoBitrateToPublisher();
|
|
23434
|
+
case 9:
|
|
23435
|
+
_context54.next = 12;
|
|
23436
|
+
break;
|
|
23397
23437
|
case 11:
|
|
23398
|
-
|
|
23399
|
-
|
|
23400
|
-
return Promise.all(peerConnections.map( /*#__PURE__*/function () {
|
|
23401
|
-
var _ref60 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52(peerConnection) {
|
|
23402
|
-
return _regenerator.default.wrap(function _callee52$(_context52) {
|
|
23403
|
-
while (1) switch (_context52.prev = _context52.next) {
|
|
23404
|
-
case 0:
|
|
23405
|
-
_context52.prev = 0;
|
|
23406
|
-
_context52.next = 3;
|
|
23407
|
-
return applySetMaxBitrateToPeerConnection(peerConnection);
|
|
23408
|
-
case 3:
|
|
23409
|
-
logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Success', log);
|
|
23410
|
-
_context52.next = 11;
|
|
23411
|
-
break;
|
|
23412
|
-
case 6:
|
|
23413
|
-
_context52.prev = 6;
|
|
23414
|
-
_context52.t0 = _context52["catch"](0);
|
|
23415
|
-
log.Reason = _context52.t0.message;
|
|
23416
|
-
logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Failure', log);
|
|
23417
|
-
throw otError(Errors.UNEXPECTED_ERROR_CODE, new Error('An unexpected error was encountered'));
|
|
23418
|
-
case 11:
|
|
23419
|
-
case "end":
|
|
23420
|
-
return _context52.stop();
|
|
23421
|
-
}
|
|
23422
|
-
}, _callee52, null, [[0, 6]]);
|
|
23423
|
-
}));
|
|
23424
|
-
return function (_x41) {
|
|
23425
|
-
return _ref60.apply(this, arguments);
|
|
23426
|
-
};
|
|
23427
|
-
}()));
|
|
23428
|
-
case 14:
|
|
23438
|
+
logging.debug('Video is currently inactive, max bitrate will be applied once active.');
|
|
23439
|
+
case 12:
|
|
23429
23440
|
case "end":
|
|
23430
|
-
return
|
|
23441
|
+
return _context54.stop();
|
|
23431
23442
|
}
|
|
23432
|
-
},
|
|
23443
|
+
}, _callee54);
|
|
23433
23444
|
}));
|
|
23434
|
-
return function (
|
|
23435
|
-
return
|
|
23445
|
+
return function (_x42) {
|
|
23446
|
+
return _ref61.apply(this, arguments);
|
|
23436
23447
|
};
|
|
23437
23448
|
}();
|
|
23438
23449
|
|
|
@@ -23459,8 +23470,8 @@ function PublisherFactory(_ref) {
|
|
|
23459
23470
|
* @memberOf Publisher
|
|
23460
23471
|
*/
|
|
23461
23472
|
this.setVideoBitratePreset = /*#__PURE__*/function () {
|
|
23462
|
-
var
|
|
23463
|
-
var filteredPreset
|
|
23473
|
+
var _ref62 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55(preset) {
|
|
23474
|
+
var filteredPreset;
|
|
23464
23475
|
return _regenerator.default.wrap(function _callee55$(_context55) {
|
|
23465
23476
|
while (1) switch (_context55.prev = _context55.next) {
|
|
23466
23477
|
case 0:
|
|
@@ -23478,52 +23489,25 @@ function PublisherFactory(_ref) {
|
|
|
23478
23489
|
throw otError(Errors.INVALID_PARAMETER, new Error('Invalid preset. It must be either "default", "bw_saver", or "extra_bw_saver"'));
|
|
23479
23490
|
case 5:
|
|
23480
23491
|
_videoMaxBitrateSetting = filteredPreset;
|
|
23481
|
-
|
|
23482
|
-
|
|
23483
|
-
|
|
23484
|
-
|
|
23485
|
-
|
|
23486
|
-
|
|
23487
|
-
|
|
23492
|
+
if (isAudioFallbackActive()) {
|
|
23493
|
+
_context55.next = 11;
|
|
23494
|
+
break;
|
|
23495
|
+
}
|
|
23496
|
+
_context55.next = 9;
|
|
23497
|
+
return setMaxVideoBitrateToPublisher();
|
|
23498
|
+
case 9:
|
|
23499
|
+
_context55.next = 12;
|
|
23500
|
+
break;
|
|
23488
23501
|
case 11:
|
|
23489
|
-
|
|
23490
|
-
|
|
23491
|
-
return Promise.all(peerConnections.map( /*#__PURE__*/function () {
|
|
23492
|
-
var _ref62 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54(peerConnection) {
|
|
23493
|
-
return _regenerator.default.wrap(function _callee54$(_context54) {
|
|
23494
|
-
while (1) switch (_context54.prev = _context54.next) {
|
|
23495
|
-
case 0:
|
|
23496
|
-
_context54.prev = 0;
|
|
23497
|
-
_context54.next = 3;
|
|
23498
|
-
return applySetMaxBitrateToPeerConnection(peerConnection);
|
|
23499
|
-
case 3:
|
|
23500
|
-
logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Success', log);
|
|
23501
|
-
_context54.next = 11;
|
|
23502
|
-
break;
|
|
23503
|
-
case 6:
|
|
23504
|
-
_context54.prev = 6;
|
|
23505
|
-
_context54.t0 = _context54["catch"](0);
|
|
23506
|
-
log.Reason = _context54.t0.message;
|
|
23507
|
-
logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Failure', log);
|
|
23508
|
-
throw otError(Errors.UNEXPECTED_ERROR_CODE, new Error('An unexpected error was encountered'));
|
|
23509
|
-
case 11:
|
|
23510
|
-
case "end":
|
|
23511
|
-
return _context54.stop();
|
|
23512
|
-
}
|
|
23513
|
-
}, _callee54, null, [[0, 6]]);
|
|
23514
|
-
}));
|
|
23515
|
-
return function (_x43) {
|
|
23516
|
-
return _ref62.apply(this, arguments);
|
|
23517
|
-
};
|
|
23518
|
-
}()));
|
|
23519
|
-
case 14:
|
|
23502
|
+
logging.debug('Video is currently inactive, bitrate preset will be applied once active.');
|
|
23503
|
+
case 12:
|
|
23520
23504
|
case "end":
|
|
23521
23505
|
return _context55.stop();
|
|
23522
23506
|
}
|
|
23523
23507
|
}, _callee55);
|
|
23524
23508
|
}));
|
|
23525
|
-
return function (
|
|
23526
|
-
return
|
|
23509
|
+
return function (_x43) {
|
|
23510
|
+
return _ref62.apply(this, arguments);
|
|
23527
23511
|
};
|
|
23528
23512
|
}();
|
|
23529
23513
|
|