@opentok/client 2.36.0-alpha.15 → 2.36.0-alpha.16

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.
@@ -488,6 +488,8 @@ declare namespace OT {
488
488
  promise: (value: boolean) => Promise<void>;
489
489
  }
490
490
  publishCaptions(value: boolean): Promise<void>;
491
+ setCaptionsInputLanguage(langCode: CaptionsLanguageCode | null): Promise<void>;
492
+ getCaptionsInputLanguage(): CaptionsLanguageCode | null;
491
493
  cycleVideo(): Promise<{ deviceId: string }>;
492
494
  setAudioSource(audioSource:string | MediaStreamTrack): Promise<undefined>;
493
495
  getAudioSource(): MediaStreamTrack;
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license OpenTok.js 2.36.0 895d7e807
2
+ * @license OpenTok.js 2.36.0 80ef11d29
3
3
  *
4
4
  * Copyright (c) 2010-2026 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: Wed, 29 Jul 2026 10:30:07 GMT
8
+ * Date: Wed, 29 Jul 2026 11:28:57 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -27523,6 +27523,12 @@ function RaptorSocketFactory(deps) {
27523
27523
  }
27524
27524
  this.publish(RaptorMessage.streamChannels.update(_apiKey, _sessionId, streamId, channelId, attributes), {}, true, completion);
27525
27525
  };
27526
+ this.publisherChannelUpdate = function (streamId, channelId, attributes, completion) {
27527
+ if (completion === void 0) {
27528
+ completion = () => {};
27529
+ }
27530
+ this.publish(RaptorMessage.streamChannels.update(_apiKey, _sessionId, streamId, channelId, attributes), {}, true, completion);
27531
+ };
27526
27532
  this.streamChannelSendData = function (streamId, channelId, data, completion) {
27527
27533
  this.publish(RaptorMessage.streamChannels.data(_apiKey, _sessionId, streamId, channelId, data), {}, true, completion);
27528
27534
  };
@@ -39866,7 +39872,7 @@ function staticConfigFactory(_temp) {
39866
39872
  _ref$axios = _ref.axios,
39867
39873
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
39868
39874
  _ref$properties = _ref.properties,
39869
- properties = _ref$properties === void 0 ? {"version":"v2.36.0","buildHash":"895d7e807","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","vonageApiURL":""} : _ref$properties;
39875
+ properties = _ref$properties === void 0 ? {"version":"v2.36.0","buildHash":"80ef11d29","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","vonageApiURL":""} : _ref$properties;
39870
39876
  /** @type builtInConfig */
39871
39877
  const builtInConfig = (0, _cloneDeep.default)(properties);
39872
39878
  /**
@@ -41516,6 +41522,7 @@ var _getSpatialResolution = _interopRequireDefault(__webpack_require__(39841));
41516
41522
  var _VideoBitratePreset = _interopRequireDefault(__webpack_require__(51831));
41517
41523
  var _videoConstraints = _interopRequireDefault(__webpack_require__(49474));
41518
41524
  var _networkConditionConstants = __webpack_require__(46179);
41525
+ var _languageCodes = __webpack_require__(38891);
41519
41526
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
41520
41527
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41521
41528
  /* eslint-disable global-require, func-names, max-len */
@@ -41717,6 +41724,9 @@ function PublisherFactory(_ref) {
41717
41724
  let networkCondition = _networkConditionConstants.NETWORK_CONDITION.GOOD;
41718
41725
  let getStatsCalled = false;
41719
41726
  let filteredVideoTrackId;
41727
+ let _captionsInputLanguage = null;
41728
+ let _pendingSetCaptionsInputLanguageArgs;
41729
+ let _setCaptionsInputLanguageInFlight = false;
41720
41730
 
41721
41731
  /** @type IntervalRunnerDefault | undefined */
41722
41732
  let connectivityAttemptPinger;
@@ -44175,6 +44185,102 @@ function PublisherFactory(_ref) {
44175
44185
  streamReadyJobs.add(() => finishPublishCaptions(value, resolve, reject));
44176
44186
  }
44177
44187
  });
44188
+ const sendCaptionsInputLanguageUpdate = () => {
44189
+ var _this$session22, _this$stream;
44190
+ _setCaptionsInputLanguageInFlight = true;
44191
+ const _pendingSetCaptionsIn = _pendingSetCaptionsInputLanguageArgs,
44192
+ langCode = _pendingSetCaptionsIn.langCode,
44193
+ resolve = _pendingSetCaptionsIn.resolve,
44194
+ reject = _pendingSetCaptionsIn.reject;
44195
+ _pendingSetCaptionsInputLanguageArgs = null;
44196
+ const attributes = {
44197
+ category: langCode === null ? '' : langCode
44198
+ };
44199
+ const socket = (_this$session22 = this.session) == null ? void 0 : _this$session22._.getSocket();
44200
+ const streamId = ((_this$stream = this.stream) == null ? void 0 : _this$stream.id) || this.streamId;
44201
+ socket.publisherChannelUpdate(streamId, 'caption1', attributes, err => {
44202
+ _setCaptionsInputLanguageInFlight = false;
44203
+ if (err) {
44204
+ reject(err);
44205
+ } else {
44206
+ _captionsInputLanguage = langCode;
44207
+ logAnalyticsEvent('setCaptionsInputLanguage', 'Event', {
44208
+ captionsInputLanguage: langCode
44209
+ });
44210
+ resolve();
44211
+ }
44212
+ // If there's a pending call queued while we were in-flight, process it now
44213
+ if (_pendingSetCaptionsInputLanguageArgs) {
44214
+ if (_pendingSetCaptionsInputLanguageArgs.langCode === _captionsInputLanguage) {
44215
+ // Same language as what just succeeded, resolve without another network call
44216
+ _pendingSetCaptionsInputLanguageArgs.resolve();
44217
+ _pendingSetCaptionsInputLanguageArgs = null;
44218
+ } else {
44219
+ sendCaptionsInputLanguageUpdate();
44220
+ }
44221
+ }
44222
+ });
44223
+ };
44224
+
44225
+ /**
44226
+ * Sets the language used for captions input on the publisher. The language code
44227
+ * is sent to the captions service to indicate the spoken language of the audio.
44228
+ * Pass <code>null</code> to clear the captions input language.
44229
+ *
44230
+ * <p>
44231
+ * If the publisher is not yet publishing to a session, the language will be applied
44232
+ * once publishing begins.
44233
+ *
44234
+ * @param {String|null} langCode A BCP-47 language code (for example, <code>"en-US"</code>,
44235
+ * <code>"es"</code>), or <code>null</code> to clear the captions input language.
44236
+ *
44237
+ * @see <a href="#getCaptionsInputLanguage">Publisher.getCaptionsInputLanguage()</a>
44238
+ * @see <a href="#publishCaptions">Publisher.publishCaptions()</a>
44239
+ * @returns {Promise<void>} A promise that resolves when the language has been set,
44240
+ * or rejects with an error if the language code is invalid or the operation fails.
44241
+ * @method #setCaptionsInputLanguage
44242
+ * @memberOf Publisher
44243
+ */
44244
+ this.setCaptionsInputLanguage = langCode => new Promise((resolve, reject) => {
44245
+ if (langCode !== null && !(0, _languageCodes.validateLanguageCode)(langCode)) {
44246
+ const message = `Invalid captions input language ${langCode}`;
44247
+ logging.warn(`setCaptionsInputLanguage: ${message}`);
44248
+ reject(otError(Errors.INVALID_PARAMETER, new Error(`setCaptionsInputLanguage: ${message}`)));
44249
+ return;
44250
+ }
44251
+ if (_pendingSetCaptionsInputLanguageArgs) {
44252
+ streamReadyJobs.remove(sendCaptionsInputLanguageUpdate);
44253
+ _pendingSetCaptionsInputLanguageArgs.reject(new Error('setCaptionsInputLanguage: call superseded by a newer setCaptionsInputLanguage call'));
44254
+ _pendingSetCaptionsInputLanguageArgs = undefined;
44255
+ }
44256
+ if (langCode === _captionsInputLanguage && !_setCaptionsInputLanguageInFlight) {
44257
+ resolve();
44258
+ return;
44259
+ }
44260
+ _pendingSetCaptionsInputLanguageArgs = {
44261
+ langCode,
44262
+ resolve,
44263
+ reject
44264
+ };
44265
+ if (this.stream) {
44266
+ if (!_setCaptionsInputLanguageInFlight) {
44267
+ sendCaptionsInputLanguageUpdate();
44268
+ }
44269
+ } else {
44270
+ streamReadyJobs.add(sendCaptionsInputLanguageUpdate);
44271
+ }
44272
+ });
44273
+
44274
+ /**
44275
+ * Returns the current captions input language set for the publisher.
44276
+ *
44277
+ * @return {String|null} The BCP-47 language code (for example, <code>"en-US"</code>)
44278
+ * currently set for captions input, or <code>null</code> if no language has been set.
44279
+ * @see <a href="#setCaptionsInputLanguage">Publisher.setCaptionsInputLanguage()</a>
44280
+ * @method #getCaptionsInputLanguage
44281
+ * @memberOf Publisher
44282
+ */
44283
+ this.getCaptionsInputLanguage = () => _captionsInputLanguage;
44178
44284
  let updateVideoSenderParametersSentinel;
44179
44285
 
44180
44286
  // keeps track of if the client has called mediaStreamTrack.stop(), so that we don't restart
@@ -45045,8 +45151,8 @@ function PublisherFactory(_ref) {
45045
45151
  break;
45046
45152
  default:
45047
45153
  if (!futurePeerConnection) {
45048
- var _this$session22, _this$session22$sessi;
45049
- if (!state.isMigrating() && (_this$session22 = this.session) != null && (_this$session22$sessi = _this$session22.sessionInfo) != null && _this$session22$sessi.isAdaptiveEnabled && getP2pPeerConnection()) {
45154
+ var _this$session23, _this$session23$sessi;
45155
+ if (!state.isMigrating() && (_this$session23 = this.session) != null && (_this$session23$sessi = _this$session23.sessionInfo) != null && _this$session23$sessi.isAdaptiveEnabled && getP2pPeerConnection()) {
45050
45156
  // In the case Rumor sends two generateOffers for the P2P leg,
45051
45157
  // we need to ignore the second one.
45052
45158
  return;
@@ -45587,7 +45693,7 @@ function PublisherFactory(_ref) {
45587
45693
  document.addEventListener('visibilitychange', visibilityHandler);
45588
45694
  };
45589
45695
  const handleBuggedUnMutedLocalAudioTrack = audioTrack => {
45590
- var _this$session23;
45696
+ var _this$session24;
45591
45697
  if (hasAudio()) {
45592
45698
  if (!hasVideo()) {
45593
45699
  // We only need to reset the audio source when the publisher is audio only.
@@ -45602,7 +45708,7 @@ function PublisherFactory(_ref) {
45602
45708
  this.videoElement().pause();
45603
45709
  }
45604
45710
  }
45605
- this == null ? void 0 : (_this$session23 = this.session) == null ? void 0 : _this$session23.trigger('gsmCallEnded');
45711
+ this == null ? void 0 : (_this$session24 = this.session) == null ? void 0 : _this$session24.trigger('gsmCallEnded');
45606
45712
  };
45607
45713
 
45608
45714
  /**
@@ -46415,7 +46521,7 @@ function PublisherFactory(_ref) {
46415
46521
  },
46416
46522
  startMigration: function () {
46417
46523
  var _startMigration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49() {
46418
- var _publisherSenderStats6, _this$session24, _this$session24$sessi;
46524
+ var _publisherSenderStats6, _this$session25, _this$session25$sessi;
46419
46525
  var relayedPeerConnection, onCreateStreamError;
46420
46526
  return _regenerator.default.wrap(function _callee49$(_context49) {
46421
46527
  while (1) switch (_context49.prev = _context49.next) {
@@ -46437,7 +46543,7 @@ function PublisherFactory(_ref) {
46437
46543
  throw new Error(error);
46438
46544
  }
46439
46545
  };
46440
- if (!((_this$session24 = _this.session) != null && (_this$session24$sessi = _this$session24.sessionInfo) != null && _this$session24$sessi.p2pEnabled)) {
46546
+ if (!((_this$session25 = _this.session) != null && (_this$session25$sessi = _this$session25.sessionInfo) != null && _this$session25$sessi.p2pEnabled)) {
46441
46547
  _context49.next = 13;
46442
46548
  break;
46443
46549
  }
@@ -46462,7 +46568,7 @@ function PublisherFactory(_ref) {
46462
46568
  return startMigration;
46463
46569
  }(),
46464
46570
  finishMigration: () => {
46465
- var _this$session25, _this$session25$sessi;
46571
+ var _this$session26, _this$session26$sessi;
46466
46572
  clearTimeout(_migrationTimeoutId);
46467
46573
  const destroyPeerConnection = /*#__PURE__*/function () {
46468
46574
  var _ref61 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50(pc) {
@@ -46497,7 +46603,7 @@ function PublisherFactory(_ref) {
46497
46603
  _previousPeerConnection = null;
46498
46604
 
46499
46605
  // In case we don't transition to P2P after migration, clear P2P leg.
46500
- if ((_this$session25 = this.session) != null && (_this$session25$sessi = _this$session25.sessionInfo) != null && _this$session25$sessi.isAdaptiveEnabled && activeSourceStreamId === 'MANTIS') {
46606
+ if ((_this$session26 = this.session) != null && (_this$session26$sessi = _this$session26.sessionInfo) != null && _this$session26$sessi.isAdaptiveEnabled && activeSourceStreamId === 'MANTIS') {
46501
46607
  var _getP2pPeerConnection;
46502
46608
  (_getP2pPeerConnection = getP2pPeerConnection()) == null ? void 0 : _getP2pPeerConnection.then(destroyPeerConnection);
46503
46609
  }