@opentok/client 2.27.3 → 2.27.4

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.27.3 60c008e
2
+ * @license OpenTok.js 2.27.4 e40b742
3
3
  *
4
4
  * Copyright (c) 2010-2024 TokBox, Inc.
5
5
  * Subject to the applicable Software Development Kit (SDK) License Agreement:
6
6
  * https://www.vonage.com/legal/communications-apis/terms-of-use/
7
7
  *
8
- * Date: Wed, 27 Mar 2024 17:25:24 GMT
8
+ * Date: Wed, 17 Apr 2024 10:04:05 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -6765,9 +6765,10 @@ function EventsFactory(deps) {
6765
6765
  reason
6766
6766
  });
6767
6767
  };
6768
- Events.ConnectionStateChangedEvent = function ConnectionStateChangedEvent(type, target) {
6768
+ Events.ConnectionStateChangedEvent = function ConnectionStateChangedEvent(type, target, mediaMode) {
6769
6769
  return new _Event4.default(type, false, {
6770
- target
6770
+ target,
6771
+ mediaMode
6771
6772
  });
6772
6773
  };
6773
6774
 
@@ -7946,7 +7947,7 @@ const logging = (0, _log.default)('StaticConfig');
7946
7947
  */
7947
7948
 
7948
7949
  /** @type builtInConfig */
7949
- const builtInConfig = (0, _cloneDeep.default)({"version":"v2.27.3","buildHash":"60c008e","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"});
7950
+ const builtInConfig = (0, _cloneDeep.default)({"version":"v2.27.4","buildHash":"e40b742","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"});
7950
7951
  const whitelistAllowedRuntimeProperties = (0, _pick.default)(['apiURL', 'assetURL', 'cdnURL', 'sessionInfoOverrides', 'loggingURL']);
7951
7952
  const liveConfigMap = {
7952
7953
  apiUrl: 'apiURL',
@@ -14873,9 +14874,9 @@ function StylableComponent(self, initialStyles, showControls, logSetStyleWithPay
14873
14874
  *
14874
14875
  * <li><code>videoDisabledDisplayMode</code> (String) &#151; Whether to display the video
14875
14876
  * disabled indicator and video disabled warning icons for a Subscriber. These icons
14876
- * indicate that the video has been disabled (or is in risk of being disabled for
14877
+ * indicate that the video has been disabled (or is at risk of being disabled for
14877
14878
  * the warning icon) due to poor stream quality. Possible values are: <code>"auto"</code>
14878
- * (the icons are automatically when the displayed video is disabled or in risk of being
14879
+ * (the icons are automatically when the displayed video is disabled or at risk of being
14879
14880
  * disabled due to poor stream quality), <code>"off"</code> (do not display the icons), and
14880
14881
  * <code>"on"</code> (display the icons).</li>
14881
14882
  * </ul>
@@ -21164,6 +21165,14 @@ function PublisherFactory(_ref) {
21164
21165
  * They are not supported in other (non-Chromium-based) browsers or on iOS. You can check if the client
21165
21166
  * supports this feature by calling the
21166
21167
  * <a href="OT.html#hasMediaProcessorSupport">OT.hasMediaProcessorSupport()</a> method.
21168
+ * </p>
21169
+ *
21170
+ * <p>
21171
+ * <b>Important:</b> Video filters require adequate processor support.
21172
+ * Even in supported browsers, transformers may not be stable when background
21173
+ * processes limit available processing resources. See
21174
+ * <a href="https://tokbox.com/developer/guides/vonage-media-processor/js/#client-requirements">Client requirements</a>.
21175
+ * </p>
21167
21176
  *
21168
21177
  * <p>
21169
21178
  * Calling this method results in an error (the Promise returned by the method is rejected)
@@ -21616,6 +21625,13 @@ function PublisherFactory(_ref) {
21616
21625
  * </p>
21617
21626
  *
21618
21627
  * <p>
21628
+ * <b>Important:</b> Media processors require adequate processor support.
21629
+ * Even in supported browsers, transformers may not be stable when background
21630
+ * processes limit available processing resources. See
21631
+ * <a href="https://tokbox.com/developer/guides/vonage-media-processor/js/#client-requirements">Client requirements</a>.
21632
+ * </p>
21633
+ *
21634
+ * <p>
21619
21635
  * Calling this method results in an error (the Promise returned by the method is rejected)
21620
21636
  * in the following conditions:
21621
21637
  * <ul>
@@ -21768,6 +21784,13 @@ function PublisherFactory(_ref) {
21768
21784
  * </p>
21769
21785
  *
21770
21786
  * <p>
21787
+ * <b>Important:</b> Media processors require adequate processor support.
21788
+ * Even in supported browsers, transformers may not be stable when background
21789
+ * processes limit available processing resources. See
21790
+ * <a href="https://tokbox.com/developer/guides/vonage-media-processor/js/#client-requirements">Client requirements</a>.
21791
+ * </p>
21792
+ *
21793
+ * <p>
21771
21794
  * Calling this method results in an error (the Promise returned by the method is rejected)
21772
21795
  * in the following conditions:
21773
21796
  * <ul>
@@ -22166,7 +22189,7 @@ function PublisherFactory(_ref) {
22166
22189
  * <p>
22167
22190
  * You can enable this audio-only fallback feature, by setting the
22168
22191
  * <code>publisher</code> property to <code>true</code> in the
22169
- * <code>audioFallback</code> option passed
22192
+ * <code>audioFallbackEnabled</code> option passed
22170
22193
  * into the <code>OT.initPublisher()</code> method for the publishing client. (See
22171
22194
  * <a href="OT.html#initPublisher">OT.initPublisher()</a>.)</li>
22172
22195
  *
@@ -34380,7 +34403,7 @@ function SubscriberFactory(_ref2) {
34380
34403
  _widgetView.loading(currentConnectionState !== _eventNames.default.SUBSCRIBER_CONNECTED);
34381
34404
  }
34382
34405
  logging.debug(`OT.Subscriber.connectionStateChanged to ${state}`);
34383
- this.dispatchEvent(new Events.ConnectionStateChangedEvent(currentConnectionState, this));
34406
+ this.dispatchEvent(new Events.ConnectionStateChangedEvent(currentConnectionState, this, (0, _getMediaModeBySourceStreamId.default)(sourceStreamId)));
34384
34407
  }
34385
34408
  };
34386
34409
  const onIceRestartSuccess = () => {
@@ -35606,9 +35629,10 @@ function SubscriberFactory(_ref2) {
35606
35629
  * You can set the initial preferred resolution used by setting the
35607
35630
  * <code>preferredResolution</code> property of the <code>options</code> object you pass into the
35608
35631
  * <code>Session.subscribe()</code> method.
35609
- * <b>Note:</b> If you set the initial preferred resolution to <code>auto</code> and decide to set it
35610
- * to a particular value using this method, you will receive a warning that setting the resolution
35611
- * using <code>setPreferredResolution()</code> method is not allowed.
35632
+ * <p>
35633
+ * <b>Note:</b> If you set the initial preferred resolution to <code>"auto"</code> when calling
35634
+ * <code>Session.subscribe()</code>, calling <code>setPreferredResolution()</code> fails silently,
35635
+ * and you will receive a warning.
35612
35636
  *
35613
35637
  * @param {Object} resolution Set this to an object with two properties: <code>width</code> and
35614
35638
  * <code>height</code> (both numbers), such as <code>{width: 320, height: 240}</code>. Set this to
@@ -63298,10 +63322,10 @@ function initPublisherFactory(deps) {
63298
63322
  *
63299
63323
  * <li><code>videoDisabledDisplayMode</code> (String) &#151; Whether to display the video
63300
63324
  * disabled indicator and video disabled warning icons for the Publisher. These icons
63301
- * indicate that the video has been disabled (or is in risk of being disabled for
63325
+ * indicate that the video has been disabled (or is at risk of being disabled for
63302
63326
  * the warning icon) due to poor stream quality. This style only applies to the Publisher
63303
63327
  * object. Possible values are: <code>"auto"</code> (the icons are automatically when the
63304
- * displayed video is disabled or in risk of being disabled due to poor stream quality),
63328
+ * displayed video is disabled or at risk of being disabled due to poor stream quality),
63305
63329
  * <code>"off"</code> (do not display the icons), and <code>"on"</code> (display the
63306
63330
  * icons). The default setting is <code>"auto"</code>.
63307
63331
  * <p>
@@ -65235,13 +65259,15 @@ function SessionFactory(deps) {
65235
65259
  * <code>setPreferredFrameRate()</code> method of the Subscriber object.
65236
65260
  * </li>
65237
65261
  * <li>
65238
- * <code>preferredResolution</code> (Object) &#151; The preferred resolution of the subscriber's
65239
- * video. Set this to either a string <code>'auto'</code> to have the resolution to be handled by OpenTok, or
65240
- * an object with two properties: <code>width</code> and <code>height</code>
65262
+ * <code>preferredResolution</code> (String | Object) &#151; The preferred resolution of the subscriber's
65263
+ * video. Set this to <code>"auto"</code> (a string, recommended) to have OpenTok.js
65264
+ * set the resolution based on the subscriber's dimensions in the browser.
65265
+ * Or set this to an object with two properties: <code>width</code> and <code>height</code>
65241
65266
  * (both numbers), such as <code>{width: 320, height: 240}</code>. Lowering the preferred video
65242
65267
  * resolution lowers video quality on the subscribing client, but it also reduces network and CPU
65243
65268
  * usage. You may want to use a lower resolution based on the dimensions of subscriber's video on
65244
- * the web page. You may want to use a resolution for subscribers to a stream that is less
65269
+ * the web page (which is handled automatically with the <code>"auto"</code> setting).
65270
+ * Or you may want to use a resolution for subscribers to a stream that is less
65245
65271
  * important (and smaller) than other streams.
65246
65272
  * <p>
65247
65273
  * This property only applies when subscribing to a stream that uses the
@@ -65325,10 +65351,10 @@ function SessionFactory(deps) {
65325
65351
  *
65326
65352
  * <li><code>videoDisabledDisplayMode</code> (String) &#151; Whether to display the video
65327
65353
  * disabled indicator and video disabled warning icons for a Subscriber. These icons
65328
- * indicate that the video has been disabled (or is in risk of being disabled for
65354
+ * indicate that the video has been disabled (or is at risk of being disabled for
65329
65355
  * the warning icon) due to poor stream quality. This style only applies to the Subscriber
65330
65356
  * object. Possible values are: <code>"auto"</code> (the icons are automatically when the
65331
- * displayed video is disabled or in risk of being disabled due to poor stream quality),
65357
+ * displayed video is disabled or at risk of being disabled due to poor stream quality),
65332
65358
  * <code>"off"</code> (do not display the icons), and <code>"on"</code> (display the
65333
65359
  * icons). The default setting is <code>"auto"</code></li>
65334
65360
  * </ul>
@@ -91909,16 +91935,27 @@ function SinglePeerConnectionAdapterFactory(deps) {
91909
91935
  return function SinglePeerConnectionAdapter(options, controller) {
91910
91936
  const _transceivers = {};
91911
91937
  const _tracks = [];
91912
- let _iceConnectedEmitted = false;
91913
91938
  const mediaStream = createMediaStream();
91914
91939
  this._id = (0, _uuid.default)();
91915
91940
 
91916
- // SPC events wrapper for PeerConnection
91917
-
91941
+ // Trigger wrappers to ensure events only fired once
91942
+ let _iceConnectedEmitted = false;
91918
91943
  const _onIceConnected = () => {
91919
- this.trigger('iceConnected');
91920
- _iceConnectedEmitted = true;
91944
+ if (!_iceConnectedEmitted) {
91945
+ this.trigger('iceConnected');
91946
+ _iceConnectedEmitted = true;
91947
+ }
91948
+ };
91949
+ let _iceConnectionStateConnectedEmitted = false;
91950
+ const _onIceConnectionStateChanged = state => {
91951
+ if (state === 'connected' && _iceConnectionStateConnectedEmitted) {
91952
+ return;
91953
+ }
91954
+ _iceConnectionStateConnectedEmitted = state === 'connected';
91955
+ this.trigger('iceConnectionStateChange', state);
91921
91956
  };
91957
+
91958
+ // SPC events wrapper for PeerConnection
91922
91959
  const _onClosed = () => this.trigger('close');
91923
91960
  const _onRemoteVideoSupported = supported => this.trigger('remoteVideoSupported', supported);
91924
91961
  const _onPeerError = _ref => {
@@ -91933,7 +91970,6 @@ function SinglePeerConnectionAdapterFactory(deps) {
91933
91970
  qos.parsedStats.singlePeerConnection = true;
91934
91971
  this.trigger('qos', qos);
91935
91972
  };
91936
- const _onIceConnectionStateChange = state => this.trigger('iceConnectionStateChange', state);
91937
91973
  const _onSignalingStateChange = state => this.trigger('signalingStateChange', state);
91938
91974
  const _onSignalingStateStable = state => this.trigger('signalingStateStable', state);
91939
91975
  const _onDecryptFailed = () => this.trigger('decryptFailed');
@@ -91947,25 +91983,26 @@ function SinglePeerConnectionAdapterFactory(deps) {
91947
91983
  signalingStateStable: _onSignalingStateStable,
91948
91984
  error: _onPeerError,
91949
91985
  qos: _onQoS,
91950
- iceConnectionStateChange: _onIceConnectionStateChange,
91986
+ iceConnectionStateChange: _onIceConnectionStateChanged,
91951
91987
  remoteVideoSupported: _onRemoteVideoSupported,
91952
91988
  decryptFailed: _onDecryptFailed,
91953
91989
  decryptRestored: _onDecryptRestored
91954
91990
  }, this);
91955
91991
 
91956
91992
  // Specific SPC logic
91957
-
91958
- const shouldEmitIceConnected = () => _peerConnection.iceConnectionStateIsConnected() && !_iceConnectedEmitted;
91959
- this._onTrackAdded = _ref2 => {
91993
+ this.onTrackAdded = _ref2 => {
91960
91994
  let track = _ref2.track,
91961
91995
  transceiver = _ref2.transceiver;
91962
91996
  _transceivers[track.id] = transceiver.mid;
91963
91997
  controller.addSubscriberMid(transceiver.mid, this._id);
91964
91998
  _tracks.push(track);
91965
91999
  mediaStream.addTrack(track);
91966
- if (shouldEmitIceConnected()) {
91967
- // Since PC is already connected, we will need to emit the event now.
92000
+ if (_peerConnection.iceConnectionStateIsConnected()) {
92001
+ // For SPC if ICE state is already connected when track is added
92002
+ // then this is not the first subscriber and we must trigger the event manually
92003
+ // using the following wrappers protect against firing events multiple times.
91968
92004
  _onIceConnected();
92005
+ _onIceConnectionStateChanged('connected');
91969
92006
  }
91970
92007
  this.trigger('trackAdded', {
91971
92008
  stream: mediaStream,
@@ -103084,7 +103121,7 @@ let SinglePeerConnectionController = /*#__PURE__*/function () {
103084
103121
  // Also store all tracks per SinglePeerConnection
103085
103122
  this._tracks.push(track.id);
103086
103123
  this._currentAndPreviousMids.push(transceiver.mid);
103087
- this._subscriberPcToAdd._onTrackAdded({
103124
+ this._subscriberPcToAdd.onTrackAdded({
103088
103125
  track,
103089
103126
  transceiver
103090
103127
  });