@opentok/client 2.35.0-alpha.31 → 2.35.0-alpha.33

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.
@@ -624,12 +624,19 @@ declare namespace OT {
624
624
  callback?: (error?: OTError) => void
625
625
  ): Promise<void>;
626
626
 
627
- subscribe(
628
- stream: Stream,
629
- targetElement?: HTMLElement | string,
630
- properties?: SubscriberProperties,
631
- callback?: (error?: OTError) => void
632
- ): Subscriber;
627
+ subscribe: {
628
+ (
629
+ stream: Stream,
630
+ targetElement?: HTMLElement | string,
631
+ properties?: SubscriberProperties,
632
+ callback?: (error?: OTError) => void
633
+ ): Subscriber;
634
+ promise: (
635
+ stream: Stream,
636
+ targetElement?: HTMLElement | string,
637
+ properties?: SubscriberProperties,
638
+ ) => Promise<Subscriber>;
639
+ }
633
640
 
634
641
  unpublish(publisher: Publisher): void;
635
642
  unsubscribe(subscriber: Subscriber): void;
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license OpenTok.js 2.35.0 6edb54f00
2
+ * @license OpenTok.js 2.35.0 e9e5d6696
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: Tue, 26 May 2026 06:58:35 GMT
8
+ * Date: Tue, 26 May 2026 08:35:02 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -6643,6 +6643,7 @@ function PublisherPeerConnectionFactory(deps) {
6643
6643
  (_peerConnection2 = _peerConnection) == null ? void 0 : _peerConnection2.iceRestart(reason, forcedRestart);
6644
6644
  };
6645
6645
  this.hasRelayCandidates = () => _peerConnection.hasRelayCandidates();
6646
+ this.hasTrack = track => _peerConnection.hasTrack(track);
6646
6647
  this.iceConnectionStateIsConnected = function () {
6647
6648
  return _peerConnection.iceConnectionStateIsConnected();
6648
6649
  };
@@ -41919,7 +41920,7 @@ function staticConfigFactory(_temp) {
41919
41920
  _ref$axios = _ref.axios,
41920
41921
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
41921
41922
  _ref$properties = _ref.properties,
41922
- properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"6edb54f00","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;
41923
+ properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"e9e5d6696","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;
41923
41924
  /** @type builtInConfig */
41924
41925
  const builtInConfig = (0, _cloneDeep.default)(properties);
41925
41926
  /**
@@ -71541,6 +71542,28 @@ function SessionFactory(deps) {
71541
71542
  return subscriber;
71542
71543
  };
71543
71544
 
71545
+ /**
71546
+ * Promisified version of {@link Session#subscribe}.
71547
+ * Instead of passing a completion handler, await the returned Promise, which resolves
71548
+ * with the Subscriber object on success.
71549
+ *
71550
+ * @example
71551
+ * // Subscribe to a stream with a target element and properties:
71552
+ * const subscriber = await session.subscribe.promise(stream, 'subscriberElementId', { insertMode: 'append' });
71553
+ *
71554
+ * // Subscribe with only a stream (optional params can be omitted):
71555
+ * const subscriber = await session.subscribe.promise(stream);
71556
+ */
71557
+ this.subscribe.promise = (stream, targetElement, properties) => new Promise((resolve, reject) => {
71558
+ this.subscribe(stream, targetElement, properties, (err, sub) => {
71559
+ if (err) {
71560
+ reject(err);
71561
+ } else {
71562
+ resolve(sub);
71563
+ }
71564
+ });
71565
+ });
71566
+
71544
71567
  /**
71545
71568
  * Stops subscribing to a stream in the session. the display of the audio-video stream is
71546
71569
  * removed from the local web page.
@@ -81000,6 +81023,7 @@ let _default = function _default(deps) {
81000
81023
  }
81001
81024
  return _context.abrupt("return");
81002
81025
  case 2:
81026
+ _this.amrAudioMuted = true;
81003
81027
  // If it is not muted, the ID is not present, or the PC does not have the cloned track,
81004
81028
  // we clone the track, disable it, and replace it.
81005
81029
  newClonedTrack = newTrack.clone();
@@ -81008,27 +81032,29 @@ let _default = function _default(deps) {
81008
81032
  // When a track is cloned, the ID changes but is otherwise identical. Thus,
81009
81033
  // we need to find the old cloned track by the (original, pre-cloned) ID,
81010
81034
  // since we cannot use strict equality to find it, and replace it with a new cloned track.
81011
- oldClonedTrack = _this.mutedMantisAudioTracksInAMR[oldTrack.id];
81012
- _context.prev = 5;
81013
- _context.next = 8;
81035
+ // Also, if the old track was not muted, we will not find it in the map, and in that case
81036
+ // we will try to replace the original track.
81037
+ oldClonedTrack = _this.mutedMantisAudioTracksInAMR[oldTrack.id] || oldTrack;
81038
+ _context.prev = 6;
81039
+ _context.next = 9;
81014
81040
  return peerConnection.findAndReplaceTrack(oldClonedTrack, newClonedTrack);
81015
- case 8:
81016
- _context.next = 14;
81041
+ case 9:
81042
+ _context.next = 15;
81017
81043
  break;
81018
- case 10:
81019
- _context.prev = 10;
81020
- _context.t0 = _context["catch"](5);
81044
+ case 11:
81045
+ _context.prev = 11;
81046
+ _context.t0 = _context["catch"](6);
81021
81047
  _this.logging.error(`Error swapping AMR audio track: ${_context.t0}`);
81022
81048
  return _context.abrupt("return");
81023
- case 14:
81049
+ case 15:
81024
81050
  // Save it, so it can be restored once unmuted.
81025
81051
  _this.mutedMantisAudioTracksInAMR[newTrack.id] = newClonedTrack;
81026
81052
  delete _this.mutedMantisAudioTracksInAMR[oldTrack.id];
81027
- case 16:
81053
+ case 17:
81028
81054
  case "end":
81029
81055
  return _context.stop();
81030
81056
  }
81031
- }, _callee, null, [[5, 10]]);
81057
+ }, _callee, null, [[6, 11]]);
81032
81058
  }));
81033
81059
  return function (_x, _x2, _x3) {
81034
81060
  return _ref.apply(this, arguments);