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/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +18 -227
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -9
- package/lib/index.d.ts +1 -9
- package/lib/index.js +19 -208
- package/lib/index.js.map +1 -1
- package/lib/ui/OverlayRenderer.cjs +2 -28
- package/lib/ui/OverlayRenderer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +18 -207
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/overlays.cjs +0 -200
- package/lib/utils/overlays.cjs.map +1 -1
- package/lib/utils/overlays.d.cts +1 -9
- package/package.json +1 -1
|
@@ -5689,186 +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
|
-
var STANDARD_16_9_LADDER = [
|
|
5771
|
-
{
|
|
5772
|
-
width: 384,
|
|
5773
|
-
height: 216
|
|
5774
|
-
},
|
|
5775
|
-
{
|
|
5776
|
-
width: 640,
|
|
5777
|
-
height: 360
|
|
5778
|
-
},
|
|
5779
|
-
{
|
|
5780
|
-
width: 854,
|
|
5781
|
-
height: 480
|
|
5782
|
-
},
|
|
5783
|
-
{
|
|
5784
|
-
width: 1280,
|
|
5785
|
-
height: 720
|
|
5786
|
-
},
|
|
5787
|
-
{
|
|
5788
|
-
width: 1920,
|
|
5789
|
-
height: 1080
|
|
5790
|
-
},
|
|
5791
|
-
{
|
|
5792
|
-
width: 2560,
|
|
5793
|
-
height: 1440
|
|
5794
|
-
},
|
|
5795
|
-
{
|
|
5796
|
-
width: 3840,
|
|
5797
|
-
height: 2160
|
|
5798
|
-
}
|
|
5799
|
-
];
|
|
5800
|
-
function smallestLadderRungContaining(maxR, maxB, eps) {
|
|
5801
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5802
|
-
try {
|
|
5803
|
-
for(var _iterator = STANDARD_16_9_LADDER[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5804
|
-
var rung = _step.value;
|
|
5805
|
-
if (maxR <= rung.width + eps && maxB <= rung.height + eps) return rung;
|
|
5806
|
-
}
|
|
5807
|
-
} catch (err) {
|
|
5808
|
-
_didIteratorError = true;
|
|
5809
|
-
_iteratorError = err;
|
|
5810
|
-
} finally{
|
|
5811
|
-
try {
|
|
5812
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5813
|
-
_iterator.return();
|
|
5814
|
-
}
|
|
5815
|
-
} finally{
|
|
5816
|
-
if (_didIteratorError) {
|
|
5817
|
-
throw _iteratorError;
|
|
5818
|
-
}
|
|
5819
|
-
}
|
|
5820
|
-
}
|
|
5821
|
-
return null;
|
|
5822
|
-
}
|
|
5823
|
-
function inferSwirlOverlayCoordinateSpace(overlays, videoWidth, videoHeight) {
|
|
5824
|
-
if (!videoWidth || !videoHeight) {
|
|
5825
|
-
return {
|
|
5826
|
-
width: videoWidth || SWIRL_HD_AUTHORING_WIDTH,
|
|
5827
|
-
height: videoHeight || SWIRL_HD_AUTHORING_HEIGHT
|
|
5828
|
-
};
|
|
5829
|
-
}
|
|
5830
|
-
if (!overlays.length) {
|
|
5831
|
-
return {
|
|
5832
|
-
width: videoWidth,
|
|
5833
|
-
height: videoHeight
|
|
5834
|
-
};
|
|
5835
|
-
}
|
|
5836
|
-
var _overlayExtents = overlayExtents(overlays), maxR = _overlayExtents.maxR, maxB = _overlayExtents.maxB;
|
|
5837
|
-
var EPS = 1;
|
|
5838
|
-
if (maxR <= 0 || maxB <= 0) {
|
|
5839
|
-
return {
|
|
5840
|
-
width: videoWidth,
|
|
5841
|
-
height: videoHeight
|
|
5842
|
-
};
|
|
5843
|
-
}
|
|
5844
|
-
var mixed = swirlProjectHasNabDemoMixedWithOther(overlays);
|
|
5845
|
-
var fitsHdCanvas = maxR <= SWIRL_HD_AUTHORING_WIDTH + EPS && maxB <= SWIRL_HD_AUTHORING_HEIGHT + EPS;
|
|
5846
|
-
var exceedsDecode = maxR > videoWidth + EPS || maxB > videoHeight + EPS;
|
|
5847
|
-
var decodeLargerThanHd = videoWidth > SWIRL_HD_AUTHORING_WIDTH + EPS || videoHeight > SWIRL_HD_AUTHORING_HEIGHT + EPS;
|
|
5848
|
-
if (fitsHdCanvas && (decodeLargerThanHd || exceedsDecode && !mixed)) {
|
|
5849
|
-
return {
|
|
5850
|
-
width: SWIRL_HD_AUTHORING_WIDTH,
|
|
5851
|
-
height: SWIRL_HD_AUTHORING_HEIGHT
|
|
5852
|
-
};
|
|
5853
|
-
}
|
|
5854
|
-
if (mixed) {
|
|
5855
|
-
return {
|
|
5856
|
-
width: videoWidth,
|
|
5857
|
-
height: videoHeight
|
|
5858
|
-
};
|
|
5859
|
-
}
|
|
5860
|
-
var rung = smallestLadderRungContaining(maxR, maxB, EPS);
|
|
5861
|
-
if (rung && rung.width < videoWidth - EPS && rung.height < videoHeight - EPS) {
|
|
5862
|
-
return {
|
|
5863
|
-
width: rung.width,
|
|
5864
|
-
height: rung.height
|
|
5865
|
-
};
|
|
5866
|
-
}
|
|
5867
|
-
return {
|
|
5868
|
-
width: videoWidth,
|
|
5869
|
-
height: videoHeight
|
|
5870
|
-
};
|
|
5871
|
-
}
|
|
5872
5692
|
function normalizeScrollerConfig(raw) {
|
|
5873
5693
|
if (!raw || (typeof raw === "undefined" ? "undefined" : _type_of(raw)) !== "object") return void 0;
|
|
5874
5694
|
var r = raw;
|
|
@@ -7752,13 +7572,8 @@ var OverlayRenderer = function OverlayRenderer(param) {
|
|
|
7752
7572
|
},
|
|
7753
7573
|
children: _to_consumable_array(fadeMap.values()).map(function(param) {
|
|
7754
7574
|
var overlay = param.overlay, visible = param.visible;
|
|
7755
|
-
var
|
|
7756
|
-
var
|
|
7757
|
-
width: coordinateSpace.width,
|
|
7758
|
-
height: coordinateSpace.height
|
|
7759
|
-
} : overlayAuthoringDimensions(overlay, dims.nativeWidth, dims.nativeHeight);
|
|
7760
|
-
var scaleX = dims.displayWidth / auth.width;
|
|
7761
|
-
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;
|
|
7762
7577
|
var left = overlay.x * scaleX;
|
|
7763
7578
|
var top = overlay.y * scaleY;
|
|
7764
7579
|
var width = overlay.width * scaleX;
|
|
@@ -8280,7 +8095,7 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
8280
8095
|
var _playerRef_current;
|
|
8281
8096
|
if (!swirlProjectId) return;
|
|
8282
8097
|
var tryResolve = function tryResolve() {
|
|
8283
|
-
var
|
|
8098
|
+
var _player_getMinHlsResolution;
|
|
8284
8099
|
var fixed = swirlOverlayCoordinateSpace;
|
|
8285
8100
|
if (fixed && fixed.width > 0 && fixed.height > 0) {
|
|
8286
8101
|
setOverlayCoordSpace({
|
|
@@ -8291,27 +8106,23 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
8291
8106
|
}
|
|
8292
8107
|
var player = playerRef.current;
|
|
8293
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
|
+
}
|
|
8294
8117
|
var video2 = player.videoElement;
|
|
8295
|
-
|
|
8296
|
-
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
|
|
8300
|
-
|
|
8301
|
-
vw = maxRes.width;
|
|
8302
|
-
vh = maxRes.height;
|
|
8303
|
-
} else {
|
|
8304
|
-
var _player_getMinHlsResolution;
|
|
8305
|
-
var minRes = (_player_getMinHlsResolution = player.getMinHlsResolution) === null || _player_getMinHlsResolution === void 0 ? void 0 : _player_getMinHlsResolution.call(player);
|
|
8306
|
-
if (minRes && minRes.width > 0 && minRes.height > 0) {
|
|
8307
|
-
vw = minRes.width;
|
|
8308
|
-
vh = minRes.height;
|
|
8309
|
-
}
|
|
8310
|
-
}
|
|
8118
|
+
if (video2 && video2.videoWidth > 0 && video2.videoHeight > 0) {
|
|
8119
|
+
setOverlayCoordSpace({
|
|
8120
|
+
width: video2.videoWidth,
|
|
8121
|
+
height: video2.videoHeight
|
|
8122
|
+
});
|
|
8123
|
+
return true;
|
|
8311
8124
|
}
|
|
8312
|
-
|
|
8313
|
-
setOverlayCoordSpace(inferSwirlOverlayCoordinateSpace(overlays, vw, vh));
|
|
8314
|
-
return true;
|
|
8125
|
+
return false;
|
|
8315
8126
|
};
|
|
8316
8127
|
var attempts = 0;
|
|
8317
8128
|
var maxAttempts = 40;
|