stormcloud-video-player 0.7.43 → 0.7.45

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.
@@ -5689,114 +5689,6 @@ function isOverlayActive(overlay, currentTime) {
5689
5689
  if (durationSec <= 0) return false;
5690
5690
  return currentTime >= startSec && currentTime < startSec + durationSec;
5691
5691
  }
5692
- var SWIRL_HD_AUTHORING_WIDTH = 1920;
5693
- var SWIRL_HD_AUTHORING_HEIGHT = 1080;
5694
- var NAB_DEMO_NAME_PREFIX = "NAB Demo \u2014 ";
5695
- function overlayAuthoringDimensions(overlay, decodeWidth, decodeHeight) {
5696
- if (overlay.name.startsWith(NAB_DEMO_NAME_PREFIX)) {
5697
- return {
5698
- width: SWIRL_HD_AUTHORING_WIDTH,
5699
- height: SWIRL_HD_AUTHORING_HEIGHT
5700
- };
5701
- }
5702
- if (!decodeWidth || !decodeHeight) {
5703
- return {
5704
- width: decodeWidth || SWIRL_HD_AUTHORING_WIDTH,
5705
- height: decodeHeight || SWIRL_HD_AUTHORING_HEIGHT
5706
- };
5707
- }
5708
- return {
5709
- width: decodeWidth,
5710
- height: decodeHeight
5711
- };
5712
- }
5713
- function overlayExtents(overlays) {
5714
- var maxR = 0;
5715
- var maxB = 0;
5716
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5717
- try {
5718
- for(var _iterator = overlays[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5719
- var o = _step.value;
5720
- if (!o.visible) continue;
5721
- maxR = Math.max(maxR, o.x + o.width);
5722
- maxB = Math.max(maxB, o.y + o.height);
5723
- }
5724
- } catch (err) {
5725
- _didIteratorError = true;
5726
- _iteratorError = err;
5727
- } finally{
5728
- try {
5729
- if (!_iteratorNormalCompletion && _iterator.return != null) {
5730
- _iterator.return();
5731
- }
5732
- } finally{
5733
- if (_didIteratorError) {
5734
- throw _iteratorError;
5735
- }
5736
- }
5737
- }
5738
- return {
5739
- maxR: maxR,
5740
- maxB: maxB
5741
- };
5742
- }
5743
- function swirlProjectHasNabDemoMixedWithOther(overlays) {
5744
- var hasNab = false;
5745
- var hasOther = false;
5746
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5747
- try {
5748
- for(var _iterator = overlays[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5749
- var o = _step.value;
5750
- if (!o.visible) continue;
5751
- if (o.name.startsWith(NAB_DEMO_NAME_PREFIX)) hasNab = true;
5752
- else hasOther = true;
5753
- }
5754
- } catch (err) {
5755
- _didIteratorError = true;
5756
- _iteratorError = err;
5757
- } finally{
5758
- try {
5759
- if (!_iteratorNormalCompletion && _iterator.return != null) {
5760
- _iterator.return();
5761
- }
5762
- } finally{
5763
- if (_didIteratorError) {
5764
- throw _iteratorError;
5765
- }
5766
- }
5767
- }
5768
- return hasNab && hasOther;
5769
- }
5770
- function inferSwirlOverlayCoordinateSpace(overlays, videoWidth, videoHeight) {
5771
- if (!videoWidth || !videoHeight) {
5772
- return {
5773
- width: videoWidth || SWIRL_HD_AUTHORING_WIDTH,
5774
- height: videoHeight || SWIRL_HD_AUTHORING_HEIGHT
5775
- };
5776
- }
5777
- if (!overlays.length) {
5778
- return {
5779
- width: videoWidth,
5780
- height: videoHeight
5781
- };
5782
- }
5783
- var _overlayExtents = overlayExtents(overlays), maxR = _overlayExtents.maxR, maxB = _overlayExtents.maxB;
5784
- var EPS = 1;
5785
- var exceedsDecode = maxR > videoWidth + EPS || maxB > videoHeight + EPS;
5786
- var fitsHdCanvas = maxR <= SWIRL_HD_AUTHORING_WIDTH + EPS && maxB <= SWIRL_HD_AUTHORING_HEIGHT + EPS;
5787
- var mixed = swirlProjectHasNabDemoMixedWithOther(overlays);
5788
- var decodeLargerThanHd = videoWidth > SWIRL_HD_AUTHORING_WIDTH + EPS || videoHeight > SWIRL_HD_AUTHORING_HEIGHT + EPS;
5789
- if (fitsHdCanvas && (decodeLargerThanHd || exceedsDecode && !mixed)) {
5790
- return {
5791
- width: SWIRL_HD_AUTHORING_WIDTH,
5792
- height: SWIRL_HD_AUTHORING_HEIGHT
5793
- };
5794
- }
5795
- return {
5796
- width: videoWidth,
5797
- height: videoHeight
5798
- };
5799
- }
5800
5692
  function normalizeScrollerConfig(raw) {
5801
5693
  if (!raw || (typeof raw === "undefined" ? "undefined" : _type_of(raw)) !== "object") return void 0;
5802
5694
  var r = raw;
@@ -7680,13 +7572,8 @@ var OverlayRenderer = function OverlayRenderer(param) {
7680
7572
  },
7681
7573
  children: _to_consumable_array(fadeMap.values()).map(function(param) {
7682
7574
  var overlay = param.overlay, visible = param.visible;
7683
- var uniform = coordinateSpace && coordinateSpace.width > 0 && coordinateSpace.height > 0;
7684
- var auth = uniform ? {
7685
- width: coordinateSpace.width,
7686
- height: coordinateSpace.height
7687
- } : overlayAuthoringDimensions(overlay, dims.nativeWidth, dims.nativeHeight);
7688
- var scaleX = dims.displayWidth / auth.width;
7689
- var scaleY = dims.displayHeight / auth.height;
7575
+ var scaleX = (coordinateSpace === null || coordinateSpace === void 0 ? void 0 : coordinateSpace.width) ? dims.displayWidth / coordinateSpace.width : dims.scaleX;
7576
+ var scaleY = (coordinateSpace === null || coordinateSpace === void 0 ? void 0 : coordinateSpace.height) ? dims.displayHeight / coordinateSpace.height : dims.scaleY;
7690
7577
  var left = overlay.x * scaleX;
7691
7578
  var top = overlay.y * scaleY;
7692
7579
  var width = overlay.width * scaleX;
@@ -8208,7 +8095,7 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
8208
8095
  var _playerRef_current;
8209
8096
  if (!swirlProjectId) return;
8210
8097
  var tryResolve = function tryResolve() {
8211
- var _ref, _ref1;
8098
+ var _player_getMinHlsResolution;
8212
8099
  var fixed = swirlOverlayCoordinateSpace;
8213
8100
  if (fixed && fixed.width > 0 && fixed.height > 0) {
8214
8101
  setOverlayCoordSpace({
@@ -8219,27 +8106,23 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
8219
8106
  }
8220
8107
  var player = playerRef.current;
8221
8108
  if (!player) return false;
8109
+ var minRes = (_player_getMinHlsResolution = player.getMinHlsResolution) === null || _player_getMinHlsResolution === void 0 ? void 0 : _player_getMinHlsResolution.call(player);
8110
+ if (minRes && minRes.width > 0 && minRes.height > 0) {
8111
+ setOverlayCoordSpace({
8112
+ width: minRes.width,
8113
+ height: minRes.height
8114
+ });
8115
+ return true;
8116
+ }
8222
8117
  var video2 = player.videoElement;
8223
- var vw = (_ref = video2 === null || video2 === void 0 ? void 0 : video2.videoWidth) !== null && _ref !== void 0 ? _ref : 0;
8224
- var vh = (_ref1 = video2 === null || video2 === void 0 ? void 0 : video2.videoHeight) !== null && _ref1 !== void 0 ? _ref1 : 0;
8225
- if (!vw || !vh) {
8226
- var _player_getMaxHlsResolution;
8227
- var maxRes = (_player_getMaxHlsResolution = player.getMaxHlsResolution) === null || _player_getMaxHlsResolution === void 0 ? void 0 : _player_getMaxHlsResolution.call(player);
8228
- if (maxRes && maxRes.width > 0 && maxRes.height > 0) {
8229
- vw = maxRes.width;
8230
- vh = maxRes.height;
8231
- } else {
8232
- var _player_getMinHlsResolution;
8233
- var minRes = (_player_getMinHlsResolution = player.getMinHlsResolution) === null || _player_getMinHlsResolution === void 0 ? void 0 : _player_getMinHlsResolution.call(player);
8234
- if (minRes && minRes.width > 0 && minRes.height > 0) {
8235
- vw = minRes.width;
8236
- vh = minRes.height;
8237
- }
8238
- }
8118
+ if (video2 && video2.videoWidth > 0 && video2.videoHeight > 0) {
8119
+ setOverlayCoordSpace({
8120
+ width: video2.videoWidth,
8121
+ height: video2.videoHeight
8122
+ });
8123
+ return true;
8239
8124
  }
8240
- if (!vw || !vh) return false;
8241
- setOverlayCoordSpace(inferSwirlOverlayCoordinateSpace(overlays, vw, vh));
8242
- return true;
8125
+ return false;
8243
8126
  };
8244
8127
  var attempts = 0;
8245
8128
  var maxAttempts = 40;