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.
package/lib/index.cjs CHANGED
@@ -449,12 +449,6 @@ __export(index_exports, {
449
449
  SUPPORTS_HLS: function SUPPORTS_HLS1() {
450
450
  return SUPPORTS_HLS;
451
451
  },
452
- SWIRL_HD_AUTHORING_HEIGHT: function SWIRL_HD_AUTHORING_HEIGHT1() {
453
- return SWIRL_HD_AUTHORING_HEIGHT;
454
- },
455
- SWIRL_HD_AUTHORING_WIDTH: function SWIRL_HD_AUTHORING_WIDTH1() {
456
- return SWIRL_HD_AUTHORING_WIDTH;
457
- },
458
452
  StormcloudPlayer: function StormcloudPlayer() {
459
453
  return StormcloudPlayer_default;
460
454
  },
@@ -491,9 +485,6 @@ __export(index_exports, {
491
485
  getClientInfo: function getClientInfo1() {
492
486
  return getClientInfo;
493
487
  },
494
- inferSwirlOverlayCoordinateSpace: function inferSwirlOverlayCoordinateSpace1() {
495
- return inferSwirlOverlayCoordinateSpace;
496
- },
497
488
  initializePolyfills: function initializePolyfills1() {
498
489
  return initializePolyfills;
499
490
  },
@@ -518,9 +509,6 @@ __export(index_exports, {
518
509
  omit: function omit1() {
519
510
  return omit;
520
511
  },
521
- overlayAuthoringDimensions: function overlayAuthoringDimensions1() {
522
- return overlayAuthoringDimensions;
523
- },
524
512
  parseQuery: function parseQuery1() {
525
513
  return parseQuery;
526
514
  },
@@ -548,9 +536,6 @@ __export(index_exports, {
548
536
  supportsWebKitPresentationMode: function supportsWebKitPresentationMode1() {
549
537
  return supportsWebKitPresentationMode;
550
538
  },
551
- swirlProjectHasNabDemoMixedWithOther: function swirlProjectHasNabDemoMixedWithOther1() {
552
- return swirlProjectHasNabDemoMixedWithOther;
553
- },
554
539
  timeStringToSeconds: function timeStringToSeconds1() {
555
540
  return timeStringToSeconds;
556
541
  }
@@ -5888,114 +5873,6 @@ function isOverlayActive(overlay, currentTime) {
5888
5873
  if (durationSec <= 0) return false;
5889
5874
  return currentTime >= startSec && currentTime < startSec + durationSec;
5890
5875
  }
5891
- var SWIRL_HD_AUTHORING_WIDTH = 1920;
5892
- var SWIRL_HD_AUTHORING_HEIGHT = 1080;
5893
- var NAB_DEMO_NAME_PREFIX = "NAB Demo \u2014 ";
5894
- function overlayAuthoringDimensions(overlay, decodeWidth, decodeHeight) {
5895
- if (overlay.name.startsWith(NAB_DEMO_NAME_PREFIX)) {
5896
- return {
5897
- width: SWIRL_HD_AUTHORING_WIDTH,
5898
- height: SWIRL_HD_AUTHORING_HEIGHT
5899
- };
5900
- }
5901
- if (!decodeWidth || !decodeHeight) {
5902
- return {
5903
- width: decodeWidth || SWIRL_HD_AUTHORING_WIDTH,
5904
- height: decodeHeight || SWIRL_HD_AUTHORING_HEIGHT
5905
- };
5906
- }
5907
- return {
5908
- width: decodeWidth,
5909
- height: decodeHeight
5910
- };
5911
- }
5912
- function overlayExtents(overlays) {
5913
- var maxR = 0;
5914
- var maxB = 0;
5915
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5916
- try {
5917
- for(var _iterator = overlays[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5918
- var o = _step.value;
5919
- if (!o.visible) continue;
5920
- maxR = Math.max(maxR, o.x + o.width);
5921
- maxB = Math.max(maxB, o.y + o.height);
5922
- }
5923
- } catch (err) {
5924
- _didIteratorError = true;
5925
- _iteratorError = err;
5926
- } finally{
5927
- try {
5928
- if (!_iteratorNormalCompletion && _iterator.return != null) {
5929
- _iterator.return();
5930
- }
5931
- } finally{
5932
- if (_didIteratorError) {
5933
- throw _iteratorError;
5934
- }
5935
- }
5936
- }
5937
- return {
5938
- maxR: maxR,
5939
- maxB: maxB
5940
- };
5941
- }
5942
- function swirlProjectHasNabDemoMixedWithOther(overlays) {
5943
- var hasNab = false;
5944
- var hasOther = false;
5945
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5946
- try {
5947
- for(var _iterator = overlays[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5948
- var o = _step.value;
5949
- if (!o.visible) continue;
5950
- if (o.name.startsWith(NAB_DEMO_NAME_PREFIX)) hasNab = true;
5951
- else hasOther = true;
5952
- }
5953
- } catch (err) {
5954
- _didIteratorError = true;
5955
- _iteratorError = err;
5956
- } finally{
5957
- try {
5958
- if (!_iteratorNormalCompletion && _iterator.return != null) {
5959
- _iterator.return();
5960
- }
5961
- } finally{
5962
- if (_didIteratorError) {
5963
- throw _iteratorError;
5964
- }
5965
- }
5966
- }
5967
- return hasNab && hasOther;
5968
- }
5969
- function inferSwirlOverlayCoordinateSpace(overlays, videoWidth, videoHeight) {
5970
- if (!videoWidth || !videoHeight) {
5971
- return {
5972
- width: videoWidth || SWIRL_HD_AUTHORING_WIDTH,
5973
- height: videoHeight || SWIRL_HD_AUTHORING_HEIGHT
5974
- };
5975
- }
5976
- if (!overlays.length) {
5977
- return {
5978
- width: videoWidth,
5979
- height: videoHeight
5980
- };
5981
- }
5982
- var _overlayExtents = overlayExtents(overlays), maxR = _overlayExtents.maxR, maxB = _overlayExtents.maxB;
5983
- var EPS = 1;
5984
- var exceedsDecode = maxR > videoWidth + EPS || maxB > videoHeight + EPS;
5985
- var fitsHdCanvas = maxR <= SWIRL_HD_AUTHORING_WIDTH + EPS && maxB <= SWIRL_HD_AUTHORING_HEIGHT + EPS;
5986
- var mixed = swirlProjectHasNabDemoMixedWithOther(overlays);
5987
- var decodeLargerThanHd = videoWidth > SWIRL_HD_AUTHORING_WIDTH + EPS || videoHeight > SWIRL_HD_AUTHORING_HEIGHT + EPS;
5988
- if (fitsHdCanvas && (decodeLargerThanHd || exceedsDecode && !mixed)) {
5989
- return {
5990
- width: SWIRL_HD_AUTHORING_WIDTH,
5991
- height: SWIRL_HD_AUTHORING_HEIGHT
5992
- };
5993
- }
5994
- return {
5995
- width: videoWidth,
5996
- height: videoHeight
5997
- };
5998
- }
5999
5876
  function normalizeScrollerConfig(raw) {
6000
5877
  if (!raw || (typeof raw === "undefined" ? "undefined" : _type_of(raw)) !== "object") return void 0;
6001
5878
  var r = raw;
@@ -7879,13 +7756,8 @@ var OverlayRenderer = function OverlayRenderer(param) {
7879
7756
  },
7880
7757
  children: _to_consumable_array(fadeMap.values()).map(function(param) {
7881
7758
  var overlay = param.overlay, visible = param.visible;
7882
- var uniform = coordinateSpace && coordinateSpace.width > 0 && coordinateSpace.height > 0;
7883
- var auth = uniform ? {
7884
- width: coordinateSpace.width,
7885
- height: coordinateSpace.height
7886
- } : overlayAuthoringDimensions(overlay, dims.nativeWidth, dims.nativeHeight);
7887
- var scaleX = dims.displayWidth / auth.width;
7888
- var scaleY = dims.displayHeight / auth.height;
7759
+ var scaleX = (coordinateSpace === null || coordinateSpace === void 0 ? void 0 : coordinateSpace.width) ? dims.displayWidth / coordinateSpace.width : dims.scaleX;
7760
+ var scaleY = (coordinateSpace === null || coordinateSpace === void 0 ? void 0 : coordinateSpace.height) ? dims.displayHeight / coordinateSpace.height : dims.scaleY;
7889
7761
  var left = overlay.x * scaleX;
7890
7762
  var top = overlay.y * scaleY;
7891
7763
  var width = overlay.width * scaleX;
@@ -8407,7 +8279,7 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
8407
8279
  var _playerRef_current;
8408
8280
  if (!swirlProjectId) return;
8409
8281
  var tryResolve = function tryResolve() {
8410
- var _ref, _ref1;
8282
+ var _player_getMinHlsResolution;
8411
8283
  var fixed = swirlOverlayCoordinateSpace;
8412
8284
  if (fixed && fixed.width > 0 && fixed.height > 0) {
8413
8285
  setOverlayCoordSpace({
@@ -8418,27 +8290,23 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
8418
8290
  }
8419
8291
  var player = playerRef.current;
8420
8292
  if (!player) return false;
8293
+ var minRes = (_player_getMinHlsResolution = player.getMinHlsResolution) === null || _player_getMinHlsResolution === void 0 ? void 0 : _player_getMinHlsResolution.call(player);
8294
+ if (minRes && minRes.width > 0 && minRes.height > 0) {
8295
+ setOverlayCoordSpace({
8296
+ width: minRes.width,
8297
+ height: minRes.height
8298
+ });
8299
+ return true;
8300
+ }
8421
8301
  var video2 = player.videoElement;
8422
- var vw = (_ref = video2 === null || video2 === void 0 ? void 0 : video2.videoWidth) !== null && _ref !== void 0 ? _ref : 0;
8423
- var vh = (_ref1 = video2 === null || video2 === void 0 ? void 0 : video2.videoHeight) !== null && _ref1 !== void 0 ? _ref1 : 0;
8424
- if (!vw || !vh) {
8425
- var _player_getMaxHlsResolution;
8426
- var maxRes = (_player_getMaxHlsResolution = player.getMaxHlsResolution) === null || _player_getMaxHlsResolution === void 0 ? void 0 : _player_getMaxHlsResolution.call(player);
8427
- if (maxRes && maxRes.width > 0 && maxRes.height > 0) {
8428
- vw = maxRes.width;
8429
- vh = maxRes.height;
8430
- } else {
8431
- var _player_getMinHlsResolution;
8432
- var minRes = (_player_getMinHlsResolution = player.getMinHlsResolution) === null || _player_getMinHlsResolution === void 0 ? void 0 : _player_getMinHlsResolution.call(player);
8433
- if (minRes && minRes.width > 0 && minRes.height > 0) {
8434
- vw = minRes.width;
8435
- vh = minRes.height;
8436
- }
8437
- }
8302
+ if (video2 && video2.videoWidth > 0 && video2.videoHeight > 0) {
8303
+ setOverlayCoordSpace({
8304
+ width: video2.videoWidth,
8305
+ height: video2.videoHeight
8306
+ });
8307
+ return true;
8438
8308
  }
8439
- if (!vw || !vh) return false;
8440
- setOverlayCoordSpace(inferSwirlOverlayCoordinateSpace(overlays, vw, vh));
8441
- return true;
8309
+ return false;
8442
8310
  };
8443
8311
  var attempts = 0;
8444
8312
  var maxAttempts = 40;
@@ -11499,8 +11367,6 @@ var StormcloudPlayer_default = StormcloudPlayer;
11499
11367
  OVERLAY_API_BASE: OVERLAY_API_BASE,
11500
11368
  SUPPORTS_DASH: SUPPORTS_DASH,
11501
11369
  SUPPORTS_HLS: SUPPORTS_HLS,
11502
- SWIRL_HD_AUTHORING_HEIGHT: SWIRL_HD_AUTHORING_HEIGHT,
11503
- SWIRL_HD_AUTHORING_WIDTH: SWIRL_HD_AUTHORING_WIDTH,
11504
11370
  StormcloudPlayer: StormcloudPlayer,
11505
11371
  StormcloudVideoPlayer: StormcloudVideoPlayer,
11506
11372
  StormcloudVideoPlayerComponent: StormcloudVideoPlayerComponent,
@@ -11512,7 +11378,6 @@ var StormcloudPlayer_default = StormcloudPlayer;
11512
11378
  getBrowserConfigOverrides: getBrowserConfigOverrides,
11513
11379
  getBrowserID: getBrowserID,
11514
11380
  getClientInfo: getClientInfo,
11515
- inferSwirlOverlayCoordinateSpace: inferSwirlOverlayCoordinateSpace,
11516
11381
  initializePolyfills: initializePolyfills,
11517
11382
  isMediaStream: isMediaStream,
11518
11383
  isOverlayActive: isOverlayActive,
@@ -11521,7 +11386,6 @@ var StormcloudPlayer_default = StormcloudPlayer;
11521
11386
  merge: merge,
11522
11387
  normalizeSwirlOverlay: normalizeSwirlOverlay,
11523
11388
  omit: omit,
11524
- overlayAuthoringDimensions: overlayAuthoringDimensions,
11525
11389
  parseQuery: parseQuery,
11526
11390
  players: players,
11527
11391
  randomString: randomString,
@@ -11531,7 +11395,6 @@ var StormcloudPlayer_default = StormcloudPlayer;
11531
11395
  supportsFeature: supportsFeature,
11532
11396
  supportsModernJS: supportsModernJS,
11533
11397
  supportsWebKitPresentationMode: supportsWebKitPresentationMode,
11534
- swirlProjectHasNabDemoMixedWithOther: swirlProjectHasNabDemoMixedWithOther,
11535
11398
  timeStringToSeconds: timeStringToSeconds
11536
11399
  });
11537
11400
  //# sourceMappingURL=index.cjs.map