@opentok/client 2.29.3 → 2.29.4-alpha.2

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.29.3 96e2a8f
2
+ * @license OpenTok.js 2.29.4 60014c7
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: Mon, 10 Mar 2025 07:27:23 GMT
8
+ * Date: Fri, 25 Apr 2025 22:49:06 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -8672,7 +8672,7 @@ const logging = (0, _log.default)('StaticConfig');
8672
8672
  */
8673
8673
 
8674
8674
  /** @type builtInConfig */
8675
- const builtInConfig = (0, _cloneDeep.default)({"version":"v2.29.3","buildHash":"96e2a8f","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"});
8675
+ const builtInConfig = (0, _cloneDeep.default)({"version":"v2.29.4","buildHash":"60014c7","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"});
8676
8676
  const whitelistAllowedRuntimeProperties = (0, _pick.default)(['apiURL', 'assetURL', 'cdnURL', 'sessionInfoOverrides', 'loggingURL']);
8677
8677
  const liveConfigMap = {
8678
8678
  apiUrl: 'apiURL',
@@ -16732,10 +16732,15 @@ function WidgetViewFactory(_temp) {
16732
16732
  var _proto = WidgetView.prototype;
16733
16733
  _proto.addError = function addError(errorMsg, helpMsg, classNames) {
16734
16734
  if (this._container) {
16735
+ var _this$_container$quer;
16735
16736
  this._container.innerHTML = `<p>${errorMsg}${helpMsg ? ` <span class="ot-help-message">${helpMsg}</span>` : ''}</p>`;
16736
16737
  OTHelpers.addClass(this._container, classNames || 'OT_subscriber_error');
16737
- if (this._container.querySelector('p').offsetHeight > this._container.offsetHeight) {
16738
- this._container.querySelector('span').style.display = 'none';
16738
+ if (((_this$_container$quer = this._container.querySelector('p')) == null ? void 0 : _this$_container$quer.offsetHeight) > this._container.offsetHeight) {
16739
+ // `span` will not exist if `helpMsg` argument was undefined
16740
+ const spanElement = this._container.querySelector('span');
16741
+ if (spanElement) {
16742
+ spanElement.style.display = 'none';
16743
+ }
16739
16744
  }
16740
16745
  }
16741
16746
  }
@@ -17155,6 +17160,10 @@ function WidgetViewFactory(_temp) {
17155
17160
  OTHelpers.css(this._posterContainer, 'backgroundImage', `url(${src})`);
17156
17161
  return this.poster();
17157
17162
  };
17163
+ _proto.prepareForStreamTransition = function prepareForStreamTransition() {
17164
+ var _this$_videoElementFa;
17165
+ (_this$_videoElementFa = this._videoElementFacade) == null ? void 0 : _this$_videoElementFa.prepareForStreamTransition();
17166
+ };
17158
17167
  _proto.loading = function loading(isLoading) {
17159
17168
  if (isLoading === undefined) {
17160
17169
  return this._loading;
@@ -25245,7 +25254,11 @@ function NativeVideoElementWrapperFactory(deps) {
25245
25254
  _proto.aspectRatio = function aspectRatio() {
25246
25255
  return this.videoWidth() / this.videoHeight();
25247
25256
  };
25248
- _proto.imgData = function imgData() {
25257
+ _proto.prepareForStreamTransition = function prepareForStreamTransition() {
25258
+ const streamImage = this._getStreamImage();
25259
+ this._domElement.poster = streamImage;
25260
+ };
25261
+ _proto._getStreamImage = function _getStreamImage() {
25249
25262
  const canvas = OTHelpers.createElement('canvas', {
25250
25263
  width: this.videoWidth(),
25251
25264
  height: this.videoHeight(),
@@ -25268,7 +25281,10 @@ function NativeVideoElementWrapperFactory(deps) {
25268
25281
  this.logging.warn('Cannot get image data yet');
25269
25282
  return null;
25270
25283
  }
25271
- return imgData.replace('data:image/png;base64,', '').trim();
25284
+ return imgData;
25285
+ };
25286
+ _proto.imgData = function imgData() {
25287
+ return this._getStreamImage().replace('data:image/png;base64,', '').trim();
25272
25288
  }
25273
25289
  // Append the Video DOM element to a parent node
25274
25290
  ;
@@ -28331,7 +28347,7 @@ module.exports = function xhrAdapter(config) {
28331
28347
  requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
28332
28348
  }
28333
28349
 
28334
- var fullPath = buildFullPath(config.baseURL, config.url);
28350
+ var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
28335
28351
 
28336
28352
  request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
28337
28353
 
@@ -28532,10 +28548,13 @@ var combineURLs = __webpack_require__(494);
28532
28548
  *
28533
28549
  * @param {string} baseURL The base URL
28534
28550
  * @param {string} requestedURL Absolute or relative URL to combine
28551
+ * @param {boolean} allowAbsoluteUrls Set to true to allow absolute URLs
28552
+ *
28535
28553
  * @returns {string} The combined full path
28536
28554
  */
28537
- module.exports = function buildFullPath(baseURL, requestedURL) {
28538
- if (baseURL && !isAbsoluteURL(requestedURL)) {
28555
+ module.exports = function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
28556
+ var isRelativeURL = !isAbsoluteURL(requestedURL);
28557
+ if (baseURL && (isRelativeURL || allowAbsoluteUrls === false)) {
28539
28558
  return combineURLs(baseURL, requestedURL);
28540
28559
  }
28541
28560
  return requestedURL;
@@ -28669,7 +28688,7 @@ module.exports = function mergeConfig(config1, config2) {
28669
28688
  /***/ (function(module, exports) {
28670
28689
 
28671
28690
  module.exports = {
28672
- "version": "0.29.0"
28691
+ "version": "0.30.0"
28673
28692
  };
28674
28693
 
28675
28694
  /***/ }),
@@ -36818,6 +36837,7 @@ function SubscriberFactory(_ref2) {
36818
36837
  P2P: _eventNames.default.SUBSCRIBER_DISCONNECTED,
36819
36838
  MANTIS: _eventNames.default.SUBSCRIBER_DISCONNECTED
36820
36839
  };
36840
+ let _subscriberConnectionState = _eventNames.default.SUBSCRIBER_DISCONNECTED;
36821
36841
  let _videoMediaProcessorConnector;
36822
36842
  let _originalVideoTrack;
36823
36843
  let _senderStats;
@@ -36948,29 +36968,31 @@ function SubscriberFactory(_ref2) {
36948
36968
  hasVideo: (_stream2 = _stream) == null ? void 0 : _stream2.hasVideo
36949
36969
  }; // We want to catch any error in the prebuffering when transition to P2P.
36950
36970
  // Otherwise, we ignore it.
36951
- throwIfBufferFails = _isAdaptiveEnabled && _activeSourceStreamId === 'P2P';
36952
- _context3.prev = 5;
36953
- _context3.next = 8;
36971
+ throwIfBufferFails = _isAdaptiveEnabled && _activeSourceStreamId === 'P2P'; // To minimize the blip effect during a stream transition, we take a snapshot of the video stream (if available)
36972
+ // and display it instead of a blank screen.
36973
+ _widgetView.prepareForStreamTransition();
36974
+ _context3.prev = 6;
36975
+ _context3.next = 9;
36954
36976
  return _widgetView.bindVideo(webRTCStream, videoContainerOptions, throwIfBufferFails);
36955
- case 8:
36956
- _context3.next = 16;
36977
+ case 9:
36978
+ _context3.next = 17;
36957
36979
  break;
36958
- case 10:
36959
- _context3.prev = 10;
36960
- _context3.t0 = _context3["catch"](5);
36980
+ case 11:
36981
+ _context3.prev = 11;
36982
+ _context3.t0 = _context3["catch"](6);
36961
36983
  if (!(_context3.t0 instanceof _cancel.CancellationError || _state.isDestroyed())) {
36962
- _context3.next = 14;
36984
+ _context3.next = 15;
36963
36985
  break;
36964
36986
  }
36965
36987
  return _context3.abrupt("return");
36966
- case 14:
36988
+ case 15:
36967
36989
  onVideoError(_context3.t0);
36968
36990
  throw _context3.t0;
36969
- case 16:
36991
+ case 17:
36970
36992
  case "end":
36971
36993
  return _context3.stop();
36972
36994
  }
36973
- }, _callee3, null, [[5, 10]]);
36995
+ }, _callee3, null, [[6, 11]]);
36974
36996
  }));
36975
36997
  return function bindWebRTCStream(_x3) {
36976
36998
  return _ref6.apply(this, arguments);
@@ -38004,7 +38026,7 @@ function SubscriberFactory(_ref2) {
38004
38026
  };
38005
38027
  const notifyStateChange = (state, currentConnectionState, sourceStreamId) => {
38006
38028
  logging.debug(`OT.Subscriber.connectionStateChanged to ${state}`);
38007
- if (state === 'failed' && !_session._.isSocketConnected()) {
38029
+ if (_subscriberConnectionState === currentConnectionState || state === 'failed' && !_session._.isSocketConnected()) {
38008
38030
  return;
38009
38031
  }
38010
38032
 
@@ -38034,6 +38056,7 @@ function SubscriberFactory(_ref2) {
38034
38056
  if (sourceStreamId === _activeSourceStreamId) {
38035
38057
  updateWidgetView(currentConnectionState);
38036
38058
  notifyStateChange(state, currentConnectionState, sourceStreamId);
38059
+ _subscriberConnectionState = currentConnectionState;
38037
38060
  }
38038
38061
  };
38039
38062
  const onIceRestartSuccess = () => {
@@ -53550,7 +53573,7 @@ Axios.prototype.request = function request(configOrUrl, config) {
53550
53573
 
53551
53574
  Axios.prototype.getUri = function getUri(config) {
53552
53575
  config = mergeConfig(this.defaults, config);
53553
- var fullPath = buildFullPath(config.baseURL, config.url);
53576
+ var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
53554
53577
  return buildURL(fullPath, config.params, config.paramsSerializer);
53555
53578
  };
53556
53579