@wistia/wistia-player 0.0.54 → 0.0.56

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.
@@ -8020,6 +8020,7 @@ var Color = /*#__PURE__*/function () {
8020
8020
  }, {
8021
8021
  key: "lightness",
8022
8022
  value: function lightness(l) {
8023
+ this._hslFromRgb();
8023
8024
  if (l != null) {
8024
8025
  this._l = Math.max(0, Math.min(100, l));
8025
8026
  this._rgbFromHsl();
@@ -9950,7 +9951,7 @@ var PROD_EMBED_HOST = 'embed.wistia.com';
9950
9951
  var PROD_SSL_EMBED_HOST = 'embed-ssl.wistia.com';
9951
9952
  var PROD_FASTLY_SSL_HOST = 'embed-fastly.wistia.com';
9952
9953
  var SSL_EMBED_HOST = "embed-ssl.wistia.com";
9953
- var TAGGED_VERSION = "0.0.54" || 0;
9954
+ var TAGGED_VERSION = "0.0.56" || 0;
9954
9955
  var DEFAULT_PROTOCOL = function () {
9955
9956
  if (typeof window !== 'undefined' && utilities_root_js__WEBPACK_IMPORTED_MODULE_0__/* .root */ .z === window && utilities_root_js__WEBPACK_IMPORTED_MODULE_0__/* .root */ .z.location) {
9956
9957
  return utilities_root_js__WEBPACK_IMPORTED_MODULE_0__/* .root */ .z.location.protocol;
@@ -14016,6 +14017,7 @@ var _preloadThumbnailRoot = /*#__PURE__*/new WeakMap();
14016
14017
  var _publicApiScript = /*#__PURE__*/new WeakMap();
14017
14018
  var _resizeObserver = /*#__PURE__*/new WeakMap();
14018
14019
  var _WistiaPlayer_brand = /*#__PURE__*/new WeakSet();
14020
+ var _handlePreloadThumbnailClick = /*#__PURE__*/new WeakMap();
14019
14021
  var WistiaPlayer = /*#__PURE__*/function (_HTMLElement) {
14020
14022
  /**
14021
14023
  * Represents one embedded Wistia media player.
@@ -14054,6 +14056,10 @@ var WistiaPlayer = /*#__PURE__*/function (_HTMLElement) {
14054
14056
  _classPrivateFieldInitSpec(_this2, _preloadThumbnailRoot, null);
14055
14057
  _classPrivateFieldInitSpec(_this2, _publicApiScript, (0,_utilities_runScript_js__WEBPACK_IMPORTED_MODULE_13__/* .runScript */ .j)("".concat((0,_utilities_url_js__WEBPACK_IMPORTED_MODULE_16__/* .proto */ .ff)(), "//").concat((0,_appHostname_js__WEBPACK_IMPORTED_MODULE_24__/* .appHostname */ .N)('fast'), "/assets/external/publicApi.js")));
14056
14058
  _classPrivateFieldInitSpec(_this2, _resizeObserver, null);
14059
+ _classPrivateFieldInitSpec(_this2, _handlePreloadThumbnailClick, function () {
14060
+ _classPrivateFieldSet(_playPending, _this2, true);
14061
+ _assertClassBrand(_WistiaPlayer_brand, _this2, _renderPreloadThumbnail).call(_this2);
14062
+ });
14057
14063
  if ('attachInternals' in HTMLElement.prototype && 'states' in ElementInternals.prototype) {
14058
14064
  _classPrivateFieldSet(_internals, _this2, _this2.attachInternals());
14059
14065
  _classPrivateFieldGet(_internals, _this2).states.add('--initializing');
@@ -15782,8 +15788,7 @@ var WistiaPlayer = /*#__PURE__*/function (_HTMLElement) {
15782
15788
  return _context4.abrupt("return", addPlugin());
15783
15789
  case 3:
15784
15790
  return _context4.abrupt("return", new Promise(function (resolve, reject) {
15785
- var _handler = function handler() {
15786
- _this4.removeEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .API_READY_EVENT */ .c5, _handler);
15791
+ _this4.whenApiReady().then(function () {
15787
15792
  addPlugin().then(function (plugin) {
15788
15793
  return resolve(plugin);
15789
15794
  }).catch(function (err) {
@@ -15793,8 +15798,9 @@ var WistiaPlayer = /*#__PURE__*/function (_HTMLElement) {
15793
15798
  reject(new Error('Promise rejected with non-Error value'));
15794
15799
  }
15795
15800
  });
15796
- };
15797
- _this4.addEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .API_READY_EVENT */ .c5, _handler);
15801
+ })
15802
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
15803
+ .catch(function (_error) {});
15798
15804
  }));
15799
15805
  case 4:
15800
15806
  case "end":
@@ -16099,15 +16105,15 @@ var WistiaPlayer = /*#__PURE__*/function (_HTMLElement) {
16099
16105
  if (!_classPrivateFieldGet(_api, _this6)) {
16100
16106
  reject(new Error('api not ready to replace'));
16101
16107
  }
16102
- var _handler2 = function handler() {
16103
- _this6.removeEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .AFTER_REPLACE_EVENT */ .$1, _handler2);
16108
+ var _handler = function handler() {
16109
+ _this6.removeEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .AFTER_REPLACE_EVENT */ .$1, _handler);
16104
16110
  _this6.mediaId = mediaId;
16105
16111
  _this6.uniqueId = _assertClassBrand(_WistiaPlayer_brand, _this6, _generateUniqueId).call(_this6, mediaId);
16106
16112
  _assertClassBrand(_WistiaPlayer_brand, _this6, _maybeInjectJsonLd).call(_this6);
16107
16113
  (0,_utilities_embedOptionStore_ts__WEBPACK_IMPORTED_MODULE_8__/* .setEmbedOptionStore */ .gY)("__".concat(_this6.uniqueId, "_dom_options__"), _classPrivateFieldGet(_playerData, _this6).embedOptions);
16108
16114
  resolve();
16109
16115
  };
16110
- _this6.addEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .AFTER_REPLACE_EVENT */ .$1, _handler2);
16116
+ _this6.addEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .AFTER_REPLACE_EVENT */ .$1, _handler);
16111
16117
  (0,_utilities_injectJsonLd_js__WEBPACK_IMPORTED_MODULE_21__/* .removeInjectedJsonLd */ .Z)(_classPrivateFieldGet(_jsonLdId, _this6));
16112
16118
  (_classPrivateFieldGet128 = _classPrivateFieldGet(_api, _this6)) === null || _classPrivateFieldGet128 === void 0 ? void 0 : _classPrivateFieldGet128.replaceWith(mediaId, options);
16113
16119
  }));
@@ -16242,6 +16248,37 @@ var WistiaPlayer = /*#__PURE__*/function (_HTMLElement) {
16242
16248
  return _showPopover.apply(this, arguments);
16243
16249
  }
16244
16250
  return showPopover;
16251
+ }())
16252
+ }, {
16253
+ key: "whenApiReady",
16254
+ value: function () {
16255
+ var _whenApiReady = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
16256
+ var _this8 = this;
16257
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
16258
+ while (1) switch (_context19.prev = _context19.next) {
16259
+ case 0:
16260
+ return _context19.abrupt("return", new Promise(function (resolve) {
16261
+ if (_classPrivateFieldGet(_api, _this8)) {
16262
+ _classPrivateFieldGet(_api, _this8).ready(function () {
16263
+ resolve();
16264
+ });
16265
+ }
16266
+ var _handler2 = function handler() {
16267
+ _this8.removeEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .API_READY_EVENT */ .c5, _handler2);
16268
+ resolve();
16269
+ };
16270
+ _this8.addEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .API_READY_EVENT */ .c5, _handler2);
16271
+ }));
16272
+ case 1:
16273
+ case "end":
16274
+ return _context19.stop();
16275
+ }
16276
+ }, _callee19);
16277
+ }));
16278
+ function whenApiReady() {
16279
+ return _whenApiReady.apply(this, arguments);
16280
+ }
16281
+ return whenApiReady;
16245
16282
  }() // --------------------------------------------------
16246
16283
  // Custom element lifecycle methods
16247
16284
  // --------------------------------------------------
@@ -16254,7 +16291,6 @@ var WistiaPlayer = /*#__PURE__*/function (_HTMLElement) {
16254
16291
  * @param {string} newValue - The new value of the attribute, or null if it was removed.
16255
16292
  * @returns {void}
16256
16293
  */
16257
- )
16258
16294
  }, {
16259
16295
  key: "attributeChangedCallback",
16260
16296
  value: function attributeChangedCallback(name, oldValue, newValue) {
@@ -16293,7 +16329,7 @@ var WistiaPlayer = /*#__PURE__*/function (_HTMLElement) {
16293
16329
  key: "connectedCallback",
16294
16330
  value: function connectedCallback() {
16295
16331
  var _window$wistiaOptions,
16296
- _this8 = this,
16332
+ _this9 = this,
16297
16333
  _this$embedHost;
16298
16334
  if (_classPrivateFieldGet(_hasElementConnectedToDOM, this)) {
16299
16335
  return;
@@ -16332,17 +16368,17 @@ var WistiaPlayer = /*#__PURE__*/function (_HTMLElement) {
16332
16368
  // Gather any attributes set on the element and save them so the public api can use them
16333
16369
  _assertClassBrand(_WistiaPlayer_brand, this, _saveInitialAttributesFromDomOptions).call(this);
16334
16370
  var resizeCallback = function resizeCallback() {
16335
- _assertClassBrand(_WistiaPlayer_brand, _this8, _renderPreloadThumbnail).call(_this8);
16371
+ _assertClassBrand(_WistiaPlayer_brand, _this9, _renderPreloadThumbnail).call(_this9);
16336
16372
  };
16337
16373
  _classPrivateFieldSet(_resizeObserver, this, new ResizeObserver(resizeCallback));
16338
16374
  _classPrivateFieldGet(_resizeObserver, this).observe(this);
16339
16375
  (0,_utilities_getInitialMediaData_ts__WEBPACK_IMPORTED_MODULE_22__/* .getInitialMediaData */ .n)(mediaId, {
16340
16376
  embedHost: (_this$embedHost = this.embedHost) !== null && _this$embedHost !== void 0 ? _this$embedHost : ''
16341
16377
  }).then(function (mediaData) {
16342
- _classPrivateFieldGet(_playerData, _this8).setMediaDataSource(mediaData);
16343
- _assertClassBrand(_WistiaPlayer_brand, _this8, _initPlayerEmbed).call(_this8, {
16344
- container: _this8.uniqueId,
16345
- mediaData: _classPrivateFieldGet(_playerData, _this8).mediaData
16378
+ _classPrivateFieldGet(_playerData, _this9).setMediaDataSource(mediaData);
16379
+ _assertClassBrand(_WistiaPlayer_brand, _this9, _initPlayerEmbed).call(_this9, {
16380
+ container: _this9.uniqueId,
16381
+ mediaData: _classPrivateFieldGet(_playerData, _this9).mediaData
16346
16382
  });
16347
16383
  }).catch(function (error) {
16348
16384
  (0,_utilities_simpleMetrics_js__WEBPACK_IMPORTED_MODULE_14__/* .countMetric */ .WO)('player/failure/init-failed');
@@ -16495,17 +16531,17 @@ function _initPublicApi(_x17, _x18) {
16495
16531
  return _initPublicApi2.apply(this, arguments);
16496
16532
  }
16497
16533
  function _initPublicApi2() {
16498
- _initPublicApi2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(mediaId, options) {
16499
- var _this14 = this;
16534
+ _initPublicApi2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(mediaId, options) {
16535
+ var _this15 = this;
16500
16536
  var embeddedCallback;
16501
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
16502
- while (1) switch (_context21.prev = _context21.next) {
16537
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
16538
+ while (1) switch (_context22.prev = _context22.next) {
16503
16539
  case 0:
16504
- _context21.next = 2;
16540
+ _context22.next = 2;
16505
16541
  return _classPrivateFieldGet(_publicApiScript, this);
16506
16542
  case 2:
16507
16543
  if (_wistia_namespace_ts__WEBPACK_IMPORTED_MODULE_1__/* .Wistia */ .s.PublicApi) {
16508
- _context21.next = 5;
16544
+ _context22.next = 5;
16509
16545
  break;
16510
16546
  }
16511
16547
  (0,_utilities_simpleMetrics_js__WEBPACK_IMPORTED_MODULE_14__/* .countMetric */ .WO)('player/failure/init-failed');
@@ -16513,19 +16549,20 @@ function _initPublicApi2() {
16513
16549
  case 5:
16514
16550
  embeddedCallback = function embeddedCallback() {
16515
16551
  var _classPrivateFieldGet148, _classPrivateFieldGet149;
16516
- void _assertClassBrand(_WistiaPlayer_brand, _this14, _maybeInitializeMux).call(_this14);
16517
- _classPrivateFieldSet(_preloadAspectRatio, _this14, undefined);
16518
- _assertClassBrand(_WistiaPlayer_brand, _this14, _renderEmbedTemplate).call(_this14);
16519
- (_classPrivateFieldGet148 = _classPrivateFieldGet(_preloadThumbnailRoot, _this14)) === null || _classPrivateFieldGet148 === void 0 ? void 0 : _classPrivateFieldGet148.remove();
16520
- (_classPrivateFieldGet149 = _classPrivateFieldGet(_resizeObserver, _this14)) === null || _classPrivateFieldGet149 === void 0 ? void 0 : _classPrivateFieldGet149.disconnect();
16521
- _classPrivateFieldSet(_resizeObserver, _this14, null);
16522
- if (_classPrivateFieldGet(_playPending, _this14)) {
16523
- void _this14.play();
16552
+ void _assertClassBrand(_WistiaPlayer_brand, _this15, _maybeInitializeMux).call(_this15);
16553
+ _classPrivateFieldSet(_preloadAspectRatio, _this15, undefined);
16554
+ _assertClassBrand(_WistiaPlayer_brand, _this15, _renderEmbedTemplate).call(_this15);
16555
+ (_classPrivateFieldGet148 = _classPrivateFieldGet(_preloadThumbnailRoot, _this15)) === null || _classPrivateFieldGet148 === void 0 ? void 0 : _classPrivateFieldGet148.remove();
16556
+ _this15.removeEventListener('click', _classPrivateFieldGet(_handlePreloadThumbnailClick, _this15));
16557
+ (_classPrivateFieldGet149 = _classPrivateFieldGet(_resizeObserver, _this15)) === null || _classPrivateFieldGet149 === void 0 ? void 0 : _classPrivateFieldGet149.disconnect();
16558
+ _classPrivateFieldSet(_resizeObserver, _this15, null);
16559
+ if (_classPrivateFieldGet(_playPending, _this15)) {
16560
+ void _this15.play();
16524
16561
  }
16525
16562
  };
16526
16563
  this.addEventListener('embedded', embeddedCallback);
16527
16564
  _classPrivateFieldGet(_removeEventListeners, this).push(function () {
16528
- _this14.removeEventListener('embedded', embeddedCallback);
16565
+ _this15.removeEventListener('embedded', embeddedCallback);
16529
16566
  });
16530
16567
 
16531
16568
  // Initialize!
@@ -16533,38 +16570,38 @@ function _initPublicApi2() {
16533
16570
  _classPrivateFieldGet(_api, this).ready(function () {
16534
16571
  var _classPrivateFieldGet150;
16535
16572
  // event for public consumption, exposed on our event types
16536
- _this14.dispatchEvent(new CustomEvent(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .API_READY_EVENT */ .c5, {
16573
+ _this15.dispatchEvent(new CustomEvent(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .API_READY_EVENT */ .c5, {
16537
16574
  detail: {
16538
16575
  mediaId: mediaId
16539
16576
  }
16540
16577
  }));
16541
16578
 
16542
16579
  // event for internal consumption, not exposed on our event types
16543
- _this14.dispatchEvent(new CustomEvent(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .INTERNAL_API_ON_FIND_EVENT */ .iP, {
16580
+ _this15.dispatchEvent(new CustomEvent(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .INTERNAL_API_ON_FIND_EVENT */ .iP, {
16544
16581
  detail: {
16545
16582
  mediaId: mediaId,
16546
- api: _classPrivateFieldGet(_api, _this14)
16583
+ api: _classPrivateFieldGet(_api, _this15)
16547
16584
  }
16548
16585
  }));
16549
16586
 
16550
16587
  // Sync embed options from the public api back to the embed config
16551
- if ((_classPrivateFieldGet150 = _classPrivateFieldGet(_api, _this14)) !== null && _classPrivateFieldGet150 !== void 0 && _classPrivateFieldGet150._impl) {
16552
- Object.entries(_classPrivateFieldGet(_api, _this14)._impl._attrs).forEach(function (_ref25) {
16588
+ if ((_classPrivateFieldGet150 = _classPrivateFieldGet(_api, _this15)) !== null && _classPrivateFieldGet150 !== void 0 && _classPrivateFieldGet150._impl) {
16589
+ Object.entries(_classPrivateFieldGet(_api, _this15)._impl._attrs).forEach(function (_ref25) {
16553
16590
  var _ref26 = _slicedToArray(_ref25, 2),
16554
16591
  key = _ref26[0],
16555
16592
  value = _ref26[1];
16556
- _classPrivateFieldGet(_playerData, _this14).updateEmbedOptionOverrides(_defineProperty({}, key, value));
16593
+ _classPrivateFieldGet(_playerData, _this15).updateEmbedOptionOverrides(_defineProperty({}, key, value));
16557
16594
  });
16558
16595
  }
16559
16596
 
16560
16597
  // Updates our PlayerDataProvider and re-renders the thumbnail with the new embed options
16561
- _assertClassBrand(_WistiaPlayer_brand, _this14, _renderPreloadThumbnail).call(_this14);
16598
+ _assertClassBrand(_WistiaPlayer_brand, _this15, _renderPreloadThumbnail).call(_this15);
16562
16599
  });
16563
16600
  case 10:
16564
16601
  case "end":
16565
- return _context21.stop();
16602
+ return _context22.stop();
16566
16603
  }
16567
- }, _callee21, this);
16604
+ }, _callee22, this);
16568
16605
  }));
16569
16606
  return _initPublicApi2.apply(this, arguments);
16570
16607
  }
@@ -16584,29 +16621,29 @@ function _maybeInitializeMux() {
16584
16621
  return _maybeInitializeMux2.apply(this, arguments);
16585
16622
  }
16586
16623
  function _maybeInitializeMux2() {
16587
- _maybeInitializeMux2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
16588
- var _this15 = this;
16624
+ _maybeInitializeMux2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
16625
+ var _this16 = this;
16589
16626
  var shouldRandomEnableMux, shouldEnableMuxForPlayer, embedType, mux;
16590
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
16591
- while (1) switch (_context22.prev = _context22.next) {
16627
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
16628
+ while (1) switch (_context23.prev = _context23.next) {
16592
16629
  case 0:
16593
16630
  if (_classPrivateFieldGet(_api, this)) {
16594
- _context22.next = 2;
16631
+ _context23.next = 2;
16595
16632
  break;
16596
16633
  }
16597
- return _context22.abrupt("return");
16634
+ return _context23.abrupt("return");
16598
16635
  case 2:
16599
16636
  shouldRandomEnableMux = (0,_utilities_coinFlip_ts__WEBPACK_IMPORTED_MODULE_30__/* .didWinCoinFlip */ .k)(_utilities_shouldEnableMux_ts__WEBPACK_IMPORTED_MODULE_31__/* .MUX_PERCENTAGE_TO_ENABLE */ ._);
16600
16637
  shouldEnableMuxForPlayer = (0,_utilities_shouldEnableMux_ts__WEBPACK_IMPORTED_MODULE_31__/* .shouldEnableMux */ .J)(_classPrivateFieldGet(_api, this), shouldRandomEnableMux) && (0,_utilities_trackingConsentApi_js__WEBPACK_IMPORTED_MODULE_15__/* .isVisitorTrackingEnabled */ .D5)();
16601
16638
  embedType = this.useWebComponent ? 'translated-web-component' : 'web-component';
16602
16639
  if (!shouldEnableMuxForPlayer) {
16603
- _context22.next = 11;
16640
+ _context23.next = 11;
16604
16641
  break;
16605
16642
  }
16606
- _context22.next = 8;
16643
+ _context23.next = 8;
16607
16644
  return (0,_utilities_dynamicImport_ts__WEBPACK_IMPORTED_MODULE_7__/* .dynamicImport */ .$)('assets/external/wistia-mux.js');
16608
16645
  case 8:
16609
- mux = _context22.sent;
16646
+ mux = _context23.sent;
16610
16647
  mux.init(_classPrivateFieldGet(_api, this), {
16611
16648
  embedType: embedType
16612
16649
  });
@@ -16614,14 +16651,14 @@ function _maybeInitializeMux2() {
16614
16651
  var isTrackingEnabled = event.detail.isTrackingEnabled;
16615
16652
  if (!isTrackingEnabled) {
16616
16653
  var _classPrivateFieldGet152, _classPrivateFieldGet153;
16617
- (_classPrivateFieldGet152 = _classPrivateFieldGet(_api, _this15)) === null || _classPrivateFieldGet152 === void 0 ? void 0 : (_classPrivateFieldGet153 = _classPrivateFieldGet152.mux) === null || _classPrivateFieldGet153 === void 0 ? void 0 : _classPrivateFieldGet153.destroy();
16654
+ (_classPrivateFieldGet152 = _classPrivateFieldGet(_api, _this16)) === null || _classPrivateFieldGet152 === void 0 ? void 0 : (_classPrivateFieldGet153 = _classPrivateFieldGet152.mux) === null || _classPrivateFieldGet153 === void 0 ? void 0 : _classPrivateFieldGet153.destroy();
16618
16655
  }
16619
16656
  });
16620
16657
  case 11:
16621
16658
  case "end":
16622
- return _context22.stop();
16659
+ return _context23.stop();
16623
16660
  }
16624
- }, _callee22, this);
16661
+ }, _callee23, this);
16625
16662
  }));
16626
16663
  return _maybeInitializeMux2.apply(this, arguments);
16627
16664
  }
@@ -16655,7 +16692,7 @@ function _maybeSetupEmbedOptionsFromIframe() {
16655
16692
  */
16656
16693
  function _renderEmbedTemplate() {
16657
16694
  var _this$embedHost2,
16658
- _this9 = this;
16695
+ _this10 = this;
16659
16696
  if (!_classPrivateFieldGet(_preactRoot, this)) {
16660
16697
  return;
16661
16698
  }
@@ -16705,7 +16742,7 @@ function _renderEmbedTemplate() {
16705
16742
  "aria-hidden": "true"
16706
16743
  })))), (0,preact__WEBPACK_IMPORTED_MODULE_0__.h)("div", {
16707
16744
  ref: function ref(_ref20) {
16708
- _classPrivateFieldSet(_preloadThumbnailRoot, _this9, _ref20);
16745
+ _classPrivateFieldSet(_preloadThumbnailRoot, _this10, _ref20);
16709
16746
  }
16710
16747
  })), _classPrivateFieldGet(_preactRoot, this));
16711
16748
  }
@@ -16748,35 +16785,35 @@ function _renderPreloadThumbnail() {
16748
16785
  * @private
16749
16786
  */
16750
16787
  function _runMethodsFromAttributes() {
16751
- var _this10 = this;
16788
+ var _this11 = this;
16752
16789
  // We have to wait until the api is ready to set the current time
16753
16790
  if (_assertClassBrand(_WistiaPlayer_brand, this, _getValueFromAttribute).call(this, 'current-time') !== null) {
16754
- var _setInitialCurrentTime = function setInitialCurrentTime() {
16791
+ this.whenApiReady().then(function () {
16755
16792
  var _ref21, _classPrivateFieldGet141, _classPrivateFieldGet142, _classPrivateFieldGet143;
16756
- var newTime = Number(_assertClassBrand(_WistiaPlayer_brand, _this10, _getValueFromAttribute).call(_this10, 'current-time'));
16757
- var isClosedPopover = (_ref21 = ((_classPrivateFieldGet141 = _classPrivateFieldGet(_api, _this10)) === null || _classPrivateFieldGet141 === void 0 ? void 0 : _classPrivateFieldGet141.popover) && !_classPrivateFieldGet(_api, _this10).popover.isVisible()) !== null && _ref21 !== void 0 ? _ref21 : false;
16793
+ var newTime = Number(_assertClassBrand(_WistiaPlayer_brand, _this11, _getValueFromAttribute).call(_this11, 'current-time'));
16794
+ var isClosedPopover = (_ref21 = ((_classPrivateFieldGet141 = _classPrivateFieldGet(_api, _this11)) === null || _classPrivateFieldGet141 === void 0 ? void 0 : _classPrivateFieldGet141.popover) && !_classPrivateFieldGet(_api, _this11).popover.isVisible()) !== null && _ref21 !== void 0 ? _ref21 : false;
16758
16795
  var isMobile = (0,_utilities_detect_js__WEBPACK_IMPORTED_MODULE_6__/* .detectIsMobile */ .GS)();
16759
- var shouldDelayUntilPlay = _this10.state !== 'playing' && (isMobile || isClosedPopover);
16760
- void ((_classPrivateFieldGet142 = _classPrivateFieldGet(_api, _this10)) === null || _classPrivateFieldGet142 === void 0 ? void 0 : (_classPrivateFieldGet143 = _classPrivateFieldGet142._impl) === null || _classPrivateFieldGet143 === void 0 ? void 0 : _classPrivateFieldGet143.time(newTime, {
16796
+ var shouldDelayUntilPlay = _this11.state !== 'playing' && (isMobile || isClosedPopover);
16797
+ void ((_classPrivateFieldGet142 = _classPrivateFieldGet(_api, _this11)) === null || _classPrivateFieldGet142 === void 0 ? void 0 : (_classPrivateFieldGet143 = _classPrivateFieldGet142._impl) === null || _classPrivateFieldGet143 === void 0 ? void 0 : _classPrivateFieldGet143.time(newTime, {
16761
16798
  lazy: shouldDelayUntilPlay
16762
16799
  }));
16763
- _assertClassBrand(_WistiaPlayer_brand, _this10, _setSyncedEmbedOption).call(_this10, 'currentTime', newTime);
16764
- _this10.removeEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .API_READY_EVENT */ .c5, _setInitialCurrentTime);
16765
- };
16766
- this.addEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .API_READY_EVENT */ .c5, _setInitialCurrentTime);
16800
+ _assertClassBrand(_WistiaPlayer_brand, _this11, _setSyncedEmbedOption).call(_this11, 'currentTime', newTime);
16801
+ })
16802
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
16803
+ .catch(function (_error) {});
16767
16804
  }
16768
16805
  if (_assertClassBrand(_WistiaPlayer_brand, this, _getValueFromAttribute).call(this, 'email') !== null) {
16769
16806
  _assertClassBrand(_WistiaPlayer_brand, this, _updateEmail).call(this, _assertClassBrand(_WistiaPlayer_brand, this, _getValueFromAttribute).call(this, 'email'));
16770
16807
  }
16771
16808
  if (_assertClassBrand(_WistiaPlayer_brand, this, _getValueFromAttribute).call(this, 'video-quality') !== null) {
16772
- var _setVideoQualityFromAttribute = function setVideoQualityFromAttribute() {
16809
+ this.whenApiReady().then(function () {
16773
16810
  var _classPrivateFieldGet144, _classPrivateFieldGet145;
16774
- var newQuality = _assertClassBrand(_WistiaPlayer_brand, _this10, _getValueFromAttribute).call(_this10, 'video-quality');
16775
- (_classPrivateFieldGet144 = _classPrivateFieldGet(_api, _this10)) === null || _classPrivateFieldGet144 === void 0 ? void 0 : (_classPrivateFieldGet145 = _classPrivateFieldGet144._impl) === null || _classPrivateFieldGet145 === void 0 ? void 0 : _classPrivateFieldGet145.setVideoQuality(newQuality);
16776
- _assertClassBrand(_WistiaPlayer_brand, _this10, _setSyncedEmbedOption).call(_this10, 'videoQuality', newQuality);
16777
- _this10.removeEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .API_READY_EVENT */ .c5, _setVideoQualityFromAttribute);
16778
- };
16779
- this.addEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .API_READY_EVENT */ .c5, _setVideoQualityFromAttribute);
16811
+ var newQuality = _assertClassBrand(_WistiaPlayer_brand, _this11, _getValueFromAttribute).call(_this11, 'video-quality');
16812
+ (_classPrivateFieldGet144 = _classPrivateFieldGet(_api, _this11)) === null || _classPrivateFieldGet144 === void 0 ? void 0 : (_classPrivateFieldGet145 = _classPrivateFieldGet144._impl) === null || _classPrivateFieldGet145 === void 0 ? void 0 : _classPrivateFieldGet145.setVideoQuality(newQuality);
16813
+ _assertClassBrand(_WistiaPlayer_brand, _this11, _setSyncedEmbedOption).call(_this11, 'videoQuality', newQuality);
16814
+ })
16815
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
16816
+ .catch(function (_error) {});
16780
16817
  }
16781
16818
  }
16782
16819
  /**
@@ -16785,11 +16822,11 @@ function _runMethodsFromAttributes() {
16785
16822
  * @private
16786
16823
  */
16787
16824
  function _saveInitialAttributesFromDomOptions() {
16788
- var _this11 = this;
16825
+ var _this12 = this;
16789
16826
  var domOptions = Object.fromEntries(Object.entries(this.attributes).map(function (_ref22) {
16790
16827
  var _ref23 = _slicedToArray(_ref22, 2),
16791
16828
  value = _ref23[1];
16792
- return [(0,_utilities_camelCaseToKebabCase_ts__WEBPACK_IMPORTED_MODULE_27__/* .kebabCaseToCamelCase */ .b)(value.name), _assertClassBrand(_WistiaPlayer_brand, _this11, _getValueFromAttribute).call(_this11, value.name)];
16829
+ return [(0,_utilities_camelCaseToKebabCase_ts__WEBPACK_IMPORTED_MODULE_27__/* .kebabCaseToCamelCase */ .b)(value.name), _assertClassBrand(_WistiaPlayer_brand, _this12, _getValueFromAttribute).call(_this12, value.name)];
16793
16830
  }));
16794
16831
  _classPrivateFieldGet(_playerData, this).setDomEmbedOptionSource(domOptions);
16795
16832
 
@@ -16821,20 +16858,17 @@ function _setSyncedEmbedOption(key, value) {
16821
16858
  _assertClassBrand(_WistiaPlayer_brand, this, _renderPreloadThumbnail).call(this);
16822
16859
  }
16823
16860
  function _setupEventListeners() {
16824
- var _this12 = this;
16861
+ var _this13 = this;
16825
16862
  var loadedMediaDataCallback = function loadedMediaDataCallback(event) {
16826
16863
  var _ref24 = event.detail,
16827
16864
  mediaData = _ref24.mediaData;
16828
- _assertClassBrand(_WistiaPlayer_brand, _this12, _updateMediaData).call(_this12, mediaData);
16865
+ _assertClassBrand(_WistiaPlayer_brand, _this13, _updateMediaData).call(_this13, mediaData);
16829
16866
  };
16830
16867
  this.addEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .LOADED_MEDIADATA_EVENT */ .Wg, loadedMediaDataCallback);
16831
16868
  _classPrivateFieldGet(_removeEventListeners, this).push(function () {
16832
- _this12.removeEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .LOADED_MEDIADATA_EVENT */ .Wg, loadedMediaDataCallback);
16869
+ _this13.removeEventListener(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_26__/* .LOADED_MEDIADATA_EVENT */ .Wg, loadedMediaDataCallback);
16833
16870
  });
16834
- this.addEventListener('click', function () {
16835
- _classPrivateFieldSet(_playPending, _this12, true);
16836
- _assertClassBrand(_WistiaPlayer_brand, _this12, _renderPreloadThumbnail).call(_this12);
16837
- }, {
16871
+ this.addEventListener('click', _classPrivateFieldGet(_handlePreloadThumbnailClick, this), {
16838
16872
  once: true
16839
16873
  });
16840
16874
  }
@@ -16854,10 +16888,10 @@ function _shouldDisplaySwatch() {
16854
16888
  * @private
16855
16889
  */
16856
16890
  function _updateEmail(email) {
16857
- var _this13 = this;
16891
+ var _this14 = this;
16858
16892
  (0,_utilities_wistiaLocalStorage_js__WEBPACK_IMPORTED_MODULE_17__/* .updateWistiaLocalStorage */ .$B)(function (localStorage) {
16859
16893
  // eslint-disable-next-line no-param-reassign
16860
- localStorage[_classPrivateGetter(_WistiaPlayer_brand, _this13, _get_pageUrl)] = _objectSpread(_objectSpread({}, localStorage[_classPrivateGetter(_WistiaPlayer_brand, _this13, _get_pageUrl)]), {}, {
16894
+ localStorage[_classPrivateGetter(_WistiaPlayer_brand, _this14, _get_pageUrl)] = _objectSpread(_objectSpread({}, localStorage[_classPrivateGetter(_WistiaPlayer_brand, _this14, _get_pageUrl)]), {}, {
16861
16895
  trackEmail: email
16862
16896
  });
16863
16897
  });
@@ -16879,22 +16913,22 @@ function _updateMediaData(mediaData) {
16879
16913
  _assertClassBrand(_WistiaPlayer_brand, this, _renderPreloadThumbnail).call(this);
16880
16914
  }
16881
16915
  var getSwatchMetaData = /*#__PURE__*/function () {
16882
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(url) {
16916
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(url) {
16883
16917
  var swatch;
16884
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
16885
- while (1) switch (_context19.prev = _context19.next) {
16918
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
16919
+ while (1) switch (_context20.prev = _context20.next) {
16886
16920
  case 0:
16887
16921
  swatch = new Image();
16888
16922
  swatch.src = url;
16889
- _context19.next = 4;
16923
+ _context20.next = 4;
16890
16924
  return swatch.decode();
16891
16925
  case 4:
16892
- return _context19.abrupt("return", swatch);
16926
+ return _context20.abrupt("return", swatch);
16893
16927
  case 5:
16894
16928
  case "end":
16895
- return _context19.stop();
16929
+ return _context20.stop();
16896
16930
  }
16897
- }, _callee19);
16931
+ }, _callee20);
16898
16932
  }));
16899
16933
  return function getSwatchMetaData(_x14) {
16900
16934
  return _ref15.apply(this, arguments);
@@ -16908,26 +16942,26 @@ var getSwatchMetaData = /*#__PURE__*/function () {
16908
16942
  * @returns {Promise<HTMLStyleElement>}
16909
16943
  */
16910
16944
  var wistiaSwatchElement = /*#__PURE__*/function () {
16911
- var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(mediaId, embedHost) {
16945
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(mediaId, embedHost) {
16912
16946
  var swatchUrl, swatchImg, naturalHeight, naturalWidth, ratio, style;
16913
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
16914
- while (1) switch (_context20.prev = _context20.next) {
16947
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
16948
+ while (1) switch (_context21.prev = _context21.next) {
16915
16949
  case 0:
16916
16950
  swatchUrl = getSwatchUrl(mediaId, embedHost);
16917
- _context20.next = 3;
16951
+ _context21.next = 3;
16918
16952
  return getSwatchMetaData(swatchUrl);
16919
16953
  case 3:
16920
- swatchImg = _context20.sent;
16954
+ swatchImg = _context21.sent;
16921
16955
  naturalHeight = swatchImg.naturalHeight, naturalWidth = swatchImg.naturalWidth;
16922
16956
  ratio = naturalHeight / naturalWidth * 100;
16923
16957
  style = document.createElement('style');
16924
16958
  style.innerHTML = "\n wistia-player[media-id='".concat(mediaId, "']:not(:defined) {\n padding: ").concat(ratio, "% 0 0 0;\n background: url(").concat(swatchUrl, ");\n background-size: contain;\n filter: blur(5px);\n display: block;\n }\n ");
16925
- return _context20.abrupt("return", style);
16959
+ return _context21.abrupt("return", style);
16926
16960
  case 9:
16927
16961
  case "end":
16928
- return _context20.stop();
16962
+ return _context21.stop();
16929
16963
  }
16930
- }, _callee20);
16964
+ }, _callee21);
16931
16965
  }));
16932
16966
  return function wistiaSwatchElement(_x15, _x16) {
16933
16967
  return _ref16.apply(this, arguments);