stormcloud-video-player 0.7.44 → 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,186 +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
- var STANDARD_16_9_LADDER = [
5970
- {
5971
- width: 384,
5972
- height: 216
5973
- },
5974
- {
5975
- width: 640,
5976
- height: 360
5977
- },
5978
- {
5979
- width: 854,
5980
- height: 480
5981
- },
5982
- {
5983
- width: 1280,
5984
- height: 720
5985
- },
5986
- {
5987
- width: 1920,
5988
- height: 1080
5989
- },
5990
- {
5991
- width: 2560,
5992
- height: 1440
5993
- },
5994
- {
5995
- width: 3840,
5996
- height: 2160
5997
- }
5998
- ];
5999
- function smallestLadderRungContaining(maxR, maxB, eps) {
6000
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6001
- try {
6002
- for(var _iterator = STANDARD_16_9_LADDER[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6003
- var rung = _step.value;
6004
- if (maxR <= rung.width + eps && maxB <= rung.height + eps) return rung;
6005
- }
6006
- } catch (err) {
6007
- _didIteratorError = true;
6008
- _iteratorError = err;
6009
- } finally{
6010
- try {
6011
- if (!_iteratorNormalCompletion && _iterator.return != null) {
6012
- _iterator.return();
6013
- }
6014
- } finally{
6015
- if (_didIteratorError) {
6016
- throw _iteratorError;
6017
- }
6018
- }
6019
- }
6020
- return null;
6021
- }
6022
- function inferSwirlOverlayCoordinateSpace(overlays, videoWidth, videoHeight) {
6023
- if (!videoWidth || !videoHeight) {
6024
- return {
6025
- width: videoWidth || SWIRL_HD_AUTHORING_WIDTH,
6026
- height: videoHeight || SWIRL_HD_AUTHORING_HEIGHT
6027
- };
6028
- }
6029
- if (!overlays.length) {
6030
- return {
6031
- width: videoWidth,
6032
- height: videoHeight
6033
- };
6034
- }
6035
- var _overlayExtents = overlayExtents(overlays), maxR = _overlayExtents.maxR, maxB = _overlayExtents.maxB;
6036
- var EPS = 1;
6037
- if (maxR <= 0 || maxB <= 0) {
6038
- return {
6039
- width: videoWidth,
6040
- height: videoHeight
6041
- };
6042
- }
6043
- var mixed = swirlProjectHasNabDemoMixedWithOther(overlays);
6044
- var fitsHdCanvas = maxR <= SWIRL_HD_AUTHORING_WIDTH + EPS && maxB <= SWIRL_HD_AUTHORING_HEIGHT + EPS;
6045
- var exceedsDecode = maxR > videoWidth + EPS || maxB > videoHeight + EPS;
6046
- var decodeLargerThanHd = videoWidth > SWIRL_HD_AUTHORING_WIDTH + EPS || videoHeight > SWIRL_HD_AUTHORING_HEIGHT + EPS;
6047
- if (fitsHdCanvas && (decodeLargerThanHd || exceedsDecode && !mixed)) {
6048
- return {
6049
- width: SWIRL_HD_AUTHORING_WIDTH,
6050
- height: SWIRL_HD_AUTHORING_HEIGHT
6051
- };
6052
- }
6053
- if (mixed) {
6054
- return {
6055
- width: videoWidth,
6056
- height: videoHeight
6057
- };
6058
- }
6059
- var rung = smallestLadderRungContaining(maxR, maxB, EPS);
6060
- if (rung && rung.width < videoWidth - EPS && rung.height < videoHeight - EPS) {
6061
- return {
6062
- width: rung.width,
6063
- height: rung.height
6064
- };
6065
- }
6066
- return {
6067
- width: videoWidth,
6068
- height: videoHeight
6069
- };
6070
- }
6071
5876
  function normalizeScrollerConfig(raw) {
6072
5877
  if (!raw || (typeof raw === "undefined" ? "undefined" : _type_of(raw)) !== "object") return void 0;
6073
5878
  var r = raw;
@@ -7951,13 +7756,8 @@ var OverlayRenderer = function OverlayRenderer(param) {
7951
7756
  },
7952
7757
  children: _to_consumable_array(fadeMap.values()).map(function(param) {
7953
7758
  var overlay = param.overlay, visible = param.visible;
7954
- var uniform = coordinateSpace && coordinateSpace.width > 0 && coordinateSpace.height > 0;
7955
- var auth = uniform ? {
7956
- width: coordinateSpace.width,
7957
- height: coordinateSpace.height
7958
- } : overlayAuthoringDimensions(overlay, dims.nativeWidth, dims.nativeHeight);
7959
- var scaleX = dims.displayWidth / auth.width;
7960
- 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;
7961
7761
  var left = overlay.x * scaleX;
7962
7762
  var top = overlay.y * scaleY;
7963
7763
  var width = overlay.width * scaleX;
@@ -8479,7 +8279,7 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
8479
8279
  var _playerRef_current;
8480
8280
  if (!swirlProjectId) return;
8481
8281
  var tryResolve = function tryResolve() {
8482
- var _ref, _ref1;
8282
+ var _player_getMinHlsResolution;
8483
8283
  var fixed = swirlOverlayCoordinateSpace;
8484
8284
  if (fixed && fixed.width > 0 && fixed.height > 0) {
8485
8285
  setOverlayCoordSpace({
@@ -8490,27 +8290,23 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
8490
8290
  }
8491
8291
  var player = playerRef.current;
8492
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
+ }
8493
8301
  var video2 = player.videoElement;
8494
- var vw = (_ref = video2 === null || video2 === void 0 ? void 0 : video2.videoWidth) !== null && _ref !== void 0 ? _ref : 0;
8495
- var vh = (_ref1 = video2 === null || video2 === void 0 ? void 0 : video2.videoHeight) !== null && _ref1 !== void 0 ? _ref1 : 0;
8496
- if (!vw || !vh) {
8497
- var _player_getMaxHlsResolution;
8498
- var maxRes = (_player_getMaxHlsResolution = player.getMaxHlsResolution) === null || _player_getMaxHlsResolution === void 0 ? void 0 : _player_getMaxHlsResolution.call(player);
8499
- if (maxRes && maxRes.width > 0 && maxRes.height > 0) {
8500
- vw = maxRes.width;
8501
- vh = maxRes.height;
8502
- } else {
8503
- var _player_getMinHlsResolution;
8504
- var minRes = (_player_getMinHlsResolution = player.getMinHlsResolution) === null || _player_getMinHlsResolution === void 0 ? void 0 : _player_getMinHlsResolution.call(player);
8505
- if (minRes && minRes.width > 0 && minRes.height > 0) {
8506
- vw = minRes.width;
8507
- vh = minRes.height;
8508
- }
8509
- }
8302
+ if (video2 && video2.videoWidth > 0 && video2.videoHeight > 0) {
8303
+ setOverlayCoordSpace({
8304
+ width: video2.videoWidth,
8305
+ height: video2.videoHeight
8306
+ });
8307
+ return true;
8510
8308
  }
8511
- if (!vw || !vh) return false;
8512
- setOverlayCoordSpace(inferSwirlOverlayCoordinateSpace(overlays, vw, vh));
8513
- return true;
8309
+ return false;
8514
8310
  };
8515
8311
  var attempts = 0;
8516
8312
  var maxAttempts = 40;
@@ -11571,8 +11367,6 @@ var StormcloudPlayer_default = StormcloudPlayer;
11571
11367
  OVERLAY_API_BASE: OVERLAY_API_BASE,
11572
11368
  SUPPORTS_DASH: SUPPORTS_DASH,
11573
11369
  SUPPORTS_HLS: SUPPORTS_HLS,
11574
- SWIRL_HD_AUTHORING_HEIGHT: SWIRL_HD_AUTHORING_HEIGHT,
11575
- SWIRL_HD_AUTHORING_WIDTH: SWIRL_HD_AUTHORING_WIDTH,
11576
11370
  StormcloudPlayer: StormcloudPlayer,
11577
11371
  StormcloudVideoPlayer: StormcloudVideoPlayer,
11578
11372
  StormcloudVideoPlayerComponent: StormcloudVideoPlayerComponent,
@@ -11584,7 +11378,6 @@ var StormcloudPlayer_default = StormcloudPlayer;
11584
11378
  getBrowserConfigOverrides: getBrowserConfigOverrides,
11585
11379
  getBrowserID: getBrowserID,
11586
11380
  getClientInfo: getClientInfo,
11587
- inferSwirlOverlayCoordinateSpace: inferSwirlOverlayCoordinateSpace,
11588
11381
  initializePolyfills: initializePolyfills,
11589
11382
  isMediaStream: isMediaStream,
11590
11383
  isOverlayActive: isOverlayActive,
@@ -11593,7 +11386,6 @@ var StormcloudPlayer_default = StormcloudPlayer;
11593
11386
  merge: merge,
11594
11387
  normalizeSwirlOverlay: normalizeSwirlOverlay,
11595
11388
  omit: omit,
11596
- overlayAuthoringDimensions: overlayAuthoringDimensions,
11597
11389
  parseQuery: parseQuery,
11598
11390
  players: players,
11599
11391
  randomString: randomString,
@@ -11603,7 +11395,6 @@ var StormcloudPlayer_default = StormcloudPlayer;
11603
11395
  supportsFeature: supportsFeature,
11604
11396
  supportsModernJS: supportsModernJS,
11605
11397
  supportsWebKitPresentationMode: supportsWebKitPresentationMode,
11606
- swirlProjectHasNabDemoMixedWithOther: swirlProjectHasNabDemoMixedWithOther,
11607
11398
  timeStringToSeconds: timeStringToSeconds
11608
11399
  });
11609
11400
  //# sourceMappingURL=index.cjs.map