stormcloud-video-player 0.7.44 → 0.7.46
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 +24 -231
- 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 +25 -212
- 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 +24 -211
- 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
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
|
|
7955
|
-
var
|
|
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,9 +8279,10 @@ 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
|
|
8282
|
+
var _player_getMinHlsResolution;
|
|
8483
8283
|
var fixed = swirlOverlayCoordinateSpace;
|
|
8484
8284
|
if (fixed && fixed.width > 0 && fixed.height > 0) {
|
|
8285
|
+
console.debug("[StormcloudVideoPlayer] overlay coord space (prop):", fixed.width, "x", fixed.height);
|
|
8485
8286
|
setOverlayCoordSpace({
|
|
8486
8287
|
width: fixed.width,
|
|
8487
8288
|
height: fixed.height
|
|
@@ -8490,27 +8291,25 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
8490
8291
|
}
|
|
8491
8292
|
var player = playerRef.current;
|
|
8492
8293
|
if (!player) return false;
|
|
8294
|
+
var minRes = (_player_getMinHlsResolution = player.getMinHlsResolution) === null || _player_getMinHlsResolution === void 0 ? void 0 : _player_getMinHlsResolution.call(player);
|
|
8295
|
+
if (minRes && minRes.width > 0 && minRes.height > 0) {
|
|
8296
|
+
console.debug("[StormcloudVideoPlayer] overlay coord space (minHlsResolution):", minRes.width, "x", minRes.height);
|
|
8297
|
+
setOverlayCoordSpace({
|
|
8298
|
+
width: minRes.width,
|
|
8299
|
+
height: minRes.height
|
|
8300
|
+
});
|
|
8301
|
+
return true;
|
|
8302
|
+
}
|
|
8493
8303
|
var video2 = player.videoElement;
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
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
|
-
}
|
|
8304
|
+
if (video2 && video2.videoWidth > 0 && video2.videoHeight > 0) {
|
|
8305
|
+
console.debug("[StormcloudVideoPlayer] overlay coord space (videoNative):", video2.videoWidth, "x", video2.videoHeight);
|
|
8306
|
+
setOverlayCoordSpace({
|
|
8307
|
+
width: video2.videoWidth,
|
|
8308
|
+
height: video2.videoHeight
|
|
8309
|
+
});
|
|
8310
|
+
return true;
|
|
8510
8311
|
}
|
|
8511
|
-
|
|
8512
|
-
setOverlayCoordSpace(inferSwirlOverlayCoordinateSpace(overlays, vw, vh));
|
|
8513
|
-
return true;
|
|
8312
|
+
return false;
|
|
8514
8313
|
};
|
|
8515
8314
|
var attempts = 0;
|
|
8516
8315
|
var maxAttempts = 40;
|
|
@@ -8536,8 +8335,7 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
8536
8335
|
}, [
|
|
8537
8336
|
swirlProjectId,
|
|
8538
8337
|
criticalPropsKey,
|
|
8539
|
-
swirlOverlayCoordinateSpace
|
|
8540
|
-
overlays
|
|
8338
|
+
swirlOverlayCoordinateSpace
|
|
8541
8339
|
]);
|
|
8542
8340
|
(0, import_react2.useEffect)(function() {
|
|
8543
8341
|
if (!playerRef.current) return;
|
|
@@ -8964,11 +8762,11 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
8964
8762
|
}, restVideoAttrs), {
|
|
8965
8763
|
children: children
|
|
8966
8764
|
})),
|
|
8967
|
-
displayOverlays.length > 0 && !adStatus.showAds && !overlaysDisabled && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OverlayRenderer, {
|
|
8765
|
+
displayOverlays.length > 0 && !adStatus.showAds && !overlaysDisabled && overlayCoordSpace && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OverlayRenderer, {
|
|
8968
8766
|
overlays: displayOverlays,
|
|
8969
8767
|
currentTime: currentTime,
|
|
8970
8768
|
videoRef: videoRef,
|
|
8971
|
-
coordinateSpace:
|
|
8769
|
+
coordinateSpace: overlayCoordSpace,
|
|
8972
8770
|
showcaseMode: !!swirlShowcaseDemo
|
|
8973
8771
|
}),
|
|
8974
8772
|
(isLoading || isBuffering) && !hideLoadingIndicator && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", {
|
|
@@ -11571,8 +11369,6 @@ var StormcloudPlayer_default = StormcloudPlayer;
|
|
|
11571
11369
|
OVERLAY_API_BASE: OVERLAY_API_BASE,
|
|
11572
11370
|
SUPPORTS_DASH: SUPPORTS_DASH,
|
|
11573
11371
|
SUPPORTS_HLS: SUPPORTS_HLS,
|
|
11574
|
-
SWIRL_HD_AUTHORING_HEIGHT: SWIRL_HD_AUTHORING_HEIGHT,
|
|
11575
|
-
SWIRL_HD_AUTHORING_WIDTH: SWIRL_HD_AUTHORING_WIDTH,
|
|
11576
11372
|
StormcloudPlayer: StormcloudPlayer,
|
|
11577
11373
|
StormcloudVideoPlayer: StormcloudVideoPlayer,
|
|
11578
11374
|
StormcloudVideoPlayerComponent: StormcloudVideoPlayerComponent,
|
|
@@ -11584,7 +11380,6 @@ var StormcloudPlayer_default = StormcloudPlayer;
|
|
|
11584
11380
|
getBrowserConfigOverrides: getBrowserConfigOverrides,
|
|
11585
11381
|
getBrowserID: getBrowserID,
|
|
11586
11382
|
getClientInfo: getClientInfo,
|
|
11587
|
-
inferSwirlOverlayCoordinateSpace: inferSwirlOverlayCoordinateSpace,
|
|
11588
11383
|
initializePolyfills: initializePolyfills,
|
|
11589
11384
|
isMediaStream: isMediaStream,
|
|
11590
11385
|
isOverlayActive: isOverlayActive,
|
|
@@ -11593,7 +11388,6 @@ var StormcloudPlayer_default = StormcloudPlayer;
|
|
|
11593
11388
|
merge: merge,
|
|
11594
11389
|
normalizeSwirlOverlay: normalizeSwirlOverlay,
|
|
11595
11390
|
omit: omit,
|
|
11596
|
-
overlayAuthoringDimensions: overlayAuthoringDimensions,
|
|
11597
11391
|
parseQuery: parseQuery,
|
|
11598
11392
|
players: players,
|
|
11599
11393
|
randomString: randomString,
|
|
@@ -11603,7 +11397,6 @@ var StormcloudPlayer_default = StormcloudPlayer;
|
|
|
11603
11397
|
supportsFeature: supportsFeature,
|
|
11604
11398
|
supportsModernJS: supportsModernJS,
|
|
11605
11399
|
supportsWebKitPresentationMode: supportsWebKitPresentationMode,
|
|
11606
|
-
swirlProjectHasNabDemoMixedWithOther: swirlProjectHasNabDemoMixedWithOther,
|
|
11607
11400
|
timeStringToSeconds: timeStringToSeconds
|
|
11608
11401
|
});
|
|
11609
11402
|
//# sourceMappingURL=index.cjs.map
|