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.d.cts CHANGED
@@ -4081,14 +4081,6 @@ interface SwirlOverlay {
4081
4081
  }
4082
4082
  declare function timeStringToSeconds(timeStr: string): number;
4083
4083
  declare function isOverlayActive(overlay: SwirlOverlay, currentTime: number): boolean;
4084
- declare const SWIRL_HD_AUTHORING_WIDTH = 1920;
4085
- declare const SWIRL_HD_AUTHORING_HEIGHT = 1080;
4086
- declare function overlayAuthoringDimensions(overlay: SwirlOverlay, decodeWidth: number, decodeHeight: number): {
4087
- width: number;
4088
- height: number;
4089
- };
4090
- declare function swirlProjectHasNabDemoMixedWithOther(overlays: SwirlOverlay[]): boolean;
4091
- declare function inferSwirlOverlayCoordinateSpace(overlays: SwirlOverlay[], videoWidth: number, videoHeight: number): OverlayCoordinateSpace;
4092
4084
  declare function normalizeSwirlOverlay(raw: SwirlOverlay & Record<string, unknown>): SwirlOverlay;
4093
4085
  declare function fetchProjectOverlays(projectId: number, apiBaseUrl?: string): Promise<SwirlOverlay[]>;
4094
4086
  declare function resolveImageUrl(imageUrl: string, apiBaseUrl?: string): string;
@@ -4150,4 +4142,4 @@ interface AdStormAdLayer extends AdController {
4150
4142
  }
4151
4143
  declare function createAdStormPlayer(contentVideo: HTMLVideoElement, options: AdStormPlayerOptions): AdStormAdLayer;
4152
4144
 
4153
- export { type AdBreak, type AdSchedule, type AdStormAdLayer, type AdStormLayerOptionsUpdate, type AdStormPlayerOptions, type BaseStormcloudPlayerProps, type BrowserInfo, type ClientInfo, type HeartbeatData, IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, type LateJoinPolicy, OVERLAY_API_BASE, type OnProgressProps, type OverlayCoordinateSpace, SUPPORTS_DASH, SUPPORTS_HLS, SWIRL_HD_AUTHORING_HEIGHT, SWIRL_HD_AUTHORING_WIDTH, StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, type StormcloudVideoPlayerConfig, type StormcloudVideoPlayerProps, type SwirlOverlay, type SwirlOverlayType, type SwirlScrollerConfig, type TrackingData, type VastBidResponse, canPlay, createAdStormPlayer, createStormcloudPlayer, StormcloudVideoPlayerComponent as default, detectBrowser, fetchProjectOverlays, getBrowserConfigOverrides, getBrowserID, getClientInfo, inferSwirlOverlayCoordinateSpace, initializePolyfills, isMediaStream, isOverlayActive, lazy, logBrowserInfo, merge, normalizeSwirlOverlay, omit, overlayAuthoringDimensions, parseQuery, players, randomString, resolveImageUrl, sendHeartbeat, sendInitialTracking, supportsFeature, supportsModernJS, supportsWebKitPresentationMode, swirlProjectHasNabDemoMixedWithOther, timeStringToSeconds };
4145
+ export { type AdBreak, type AdSchedule, type AdStormAdLayer, type AdStormLayerOptionsUpdate, type AdStormPlayerOptions, type BaseStormcloudPlayerProps, type BrowserInfo, type ClientInfo, type HeartbeatData, IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, type LateJoinPolicy, OVERLAY_API_BASE, type OnProgressProps, type OverlayCoordinateSpace, SUPPORTS_DASH, SUPPORTS_HLS, StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, type StormcloudVideoPlayerConfig, type StormcloudVideoPlayerProps, type SwirlOverlay, type SwirlOverlayType, type SwirlScrollerConfig, type TrackingData, type VastBidResponse, canPlay, createAdStormPlayer, createStormcloudPlayer, StormcloudVideoPlayerComponent as default, detectBrowser, fetchProjectOverlays, getBrowserConfigOverrides, getBrowserID, getClientInfo, initializePolyfills, isMediaStream, isOverlayActive, lazy, logBrowserInfo, merge, normalizeSwirlOverlay, omit, parseQuery, players, randomString, resolveImageUrl, sendHeartbeat, sendInitialTracking, supportsFeature, supportsModernJS, supportsWebKitPresentationMode, timeStringToSeconds };
package/lib/index.d.ts CHANGED
@@ -4081,14 +4081,6 @@ interface SwirlOverlay {
4081
4081
  }
4082
4082
  declare function timeStringToSeconds(timeStr: string): number;
4083
4083
  declare function isOverlayActive(overlay: SwirlOverlay, currentTime: number): boolean;
4084
- declare const SWIRL_HD_AUTHORING_WIDTH = 1920;
4085
- declare const SWIRL_HD_AUTHORING_HEIGHT = 1080;
4086
- declare function overlayAuthoringDimensions(overlay: SwirlOverlay, decodeWidth: number, decodeHeight: number): {
4087
- width: number;
4088
- height: number;
4089
- };
4090
- declare function swirlProjectHasNabDemoMixedWithOther(overlays: SwirlOverlay[]): boolean;
4091
- declare function inferSwirlOverlayCoordinateSpace(overlays: SwirlOverlay[], videoWidth: number, videoHeight: number): OverlayCoordinateSpace;
4092
4084
  declare function normalizeSwirlOverlay(raw: SwirlOverlay & Record<string, unknown>): SwirlOverlay;
4093
4085
  declare function fetchProjectOverlays(projectId: number, apiBaseUrl?: string): Promise<SwirlOverlay[]>;
4094
4086
  declare function resolveImageUrl(imageUrl: string, apiBaseUrl?: string): string;
@@ -4150,4 +4142,4 @@ interface AdStormAdLayer extends AdController {
4150
4142
  }
4151
4143
  declare function createAdStormPlayer(contentVideo: HTMLVideoElement, options: AdStormPlayerOptions): AdStormAdLayer;
4152
4144
 
4153
- export { type AdBreak, type AdSchedule, type AdStormAdLayer, type AdStormLayerOptionsUpdate, type AdStormPlayerOptions, type BaseStormcloudPlayerProps, type BrowserInfo, type ClientInfo, type HeartbeatData, IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, type LateJoinPolicy, OVERLAY_API_BASE, type OnProgressProps, type OverlayCoordinateSpace, SUPPORTS_DASH, SUPPORTS_HLS, SWIRL_HD_AUTHORING_HEIGHT, SWIRL_HD_AUTHORING_WIDTH, StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, type StormcloudVideoPlayerConfig, type StormcloudVideoPlayerProps, type SwirlOverlay, type SwirlOverlayType, type SwirlScrollerConfig, type TrackingData, type VastBidResponse, canPlay, createAdStormPlayer, createStormcloudPlayer, StormcloudVideoPlayerComponent as default, detectBrowser, fetchProjectOverlays, getBrowserConfigOverrides, getBrowserID, getClientInfo, inferSwirlOverlayCoordinateSpace, initializePolyfills, isMediaStream, isOverlayActive, lazy, logBrowserInfo, merge, normalizeSwirlOverlay, omit, overlayAuthoringDimensions, parseQuery, players, randomString, resolveImageUrl, sendHeartbeat, sendInitialTracking, supportsFeature, supportsModernJS, supportsWebKitPresentationMode, swirlProjectHasNabDemoMixedWithOther, timeStringToSeconds };
4145
+ export { type AdBreak, type AdSchedule, type AdStormAdLayer, type AdStormLayerOptionsUpdate, type AdStormPlayerOptions, type BaseStormcloudPlayerProps, type BrowserInfo, type ClientInfo, type HeartbeatData, IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, type LateJoinPolicy, OVERLAY_API_BASE, type OnProgressProps, type OverlayCoordinateSpace, SUPPORTS_DASH, SUPPORTS_HLS, StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, type StormcloudVideoPlayerConfig, type StormcloudVideoPlayerProps, type SwirlOverlay, type SwirlOverlayType, type SwirlScrollerConfig, type TrackingData, type VastBidResponse, canPlay, createAdStormPlayer, createStormcloudPlayer, StormcloudVideoPlayerComponent as default, detectBrowser, fetchProjectOverlays, getBrowserConfigOverrides, getBrowserID, getClientInfo, initializePolyfills, isMediaStream, isOverlayActive, lazy, logBrowserInfo, merge, normalizeSwirlOverlay, omit, parseQuery, players, randomString, resolveImageUrl, sendHeartbeat, sendInitialTracking, supportsFeature, supportsModernJS, supportsWebKitPresentationMode, timeStringToSeconds };
package/lib/index.js CHANGED
@@ -5701,186 +5701,6 @@ function isOverlayActive(overlay, currentTime) {
5701
5701
  if (durationSec <= 0) return false;
5702
5702
  return currentTime >= startSec && currentTime < startSec + durationSec;
5703
5703
  }
5704
- var SWIRL_HD_AUTHORING_WIDTH = 1920;
5705
- var SWIRL_HD_AUTHORING_HEIGHT = 1080;
5706
- var NAB_DEMO_NAME_PREFIX = "NAB Demo \u2014 ";
5707
- function overlayAuthoringDimensions(overlay, decodeWidth, decodeHeight) {
5708
- if (overlay.name.startsWith(NAB_DEMO_NAME_PREFIX)) {
5709
- return {
5710
- width: SWIRL_HD_AUTHORING_WIDTH,
5711
- height: SWIRL_HD_AUTHORING_HEIGHT
5712
- };
5713
- }
5714
- if (!decodeWidth || !decodeHeight) {
5715
- return {
5716
- width: decodeWidth || SWIRL_HD_AUTHORING_WIDTH,
5717
- height: decodeHeight || SWIRL_HD_AUTHORING_HEIGHT
5718
- };
5719
- }
5720
- return {
5721
- width: decodeWidth,
5722
- height: decodeHeight
5723
- };
5724
- }
5725
- function overlayExtents(overlays) {
5726
- var maxR = 0;
5727
- var maxB = 0;
5728
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5729
- try {
5730
- for(var _iterator = overlays[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5731
- var o = _step.value;
5732
- if (!o.visible) continue;
5733
- maxR = Math.max(maxR, o.x + o.width);
5734
- maxB = Math.max(maxB, o.y + o.height);
5735
- }
5736
- } catch (err) {
5737
- _didIteratorError = true;
5738
- _iteratorError = err;
5739
- } finally{
5740
- try {
5741
- if (!_iteratorNormalCompletion && _iterator.return != null) {
5742
- _iterator.return();
5743
- }
5744
- } finally{
5745
- if (_didIteratorError) {
5746
- throw _iteratorError;
5747
- }
5748
- }
5749
- }
5750
- return {
5751
- maxR: maxR,
5752
- maxB: maxB
5753
- };
5754
- }
5755
- function swirlProjectHasNabDemoMixedWithOther(overlays) {
5756
- var hasNab = false;
5757
- var hasOther = false;
5758
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5759
- try {
5760
- for(var _iterator = overlays[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5761
- var o = _step.value;
5762
- if (!o.visible) continue;
5763
- if (o.name.startsWith(NAB_DEMO_NAME_PREFIX)) hasNab = true;
5764
- else hasOther = true;
5765
- }
5766
- } catch (err) {
5767
- _didIteratorError = true;
5768
- _iteratorError = err;
5769
- } finally{
5770
- try {
5771
- if (!_iteratorNormalCompletion && _iterator.return != null) {
5772
- _iterator.return();
5773
- }
5774
- } finally{
5775
- if (_didIteratorError) {
5776
- throw _iteratorError;
5777
- }
5778
- }
5779
- }
5780
- return hasNab && hasOther;
5781
- }
5782
- var STANDARD_16_9_LADDER = [
5783
- {
5784
- width: 384,
5785
- height: 216
5786
- },
5787
- {
5788
- width: 640,
5789
- height: 360
5790
- },
5791
- {
5792
- width: 854,
5793
- height: 480
5794
- },
5795
- {
5796
- width: 1280,
5797
- height: 720
5798
- },
5799
- {
5800
- width: 1920,
5801
- height: 1080
5802
- },
5803
- {
5804
- width: 2560,
5805
- height: 1440
5806
- },
5807
- {
5808
- width: 3840,
5809
- height: 2160
5810
- }
5811
- ];
5812
- function smallestLadderRungContaining(maxR, maxB, eps) {
5813
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5814
- try {
5815
- for(var _iterator = STANDARD_16_9_LADDER[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5816
- var rung = _step.value;
5817
- if (maxR <= rung.width + eps && maxB <= rung.height + eps) return rung;
5818
- }
5819
- } catch (err) {
5820
- _didIteratorError = true;
5821
- _iteratorError = err;
5822
- } finally{
5823
- try {
5824
- if (!_iteratorNormalCompletion && _iterator.return != null) {
5825
- _iterator.return();
5826
- }
5827
- } finally{
5828
- if (_didIteratorError) {
5829
- throw _iteratorError;
5830
- }
5831
- }
5832
- }
5833
- return null;
5834
- }
5835
- function inferSwirlOverlayCoordinateSpace(overlays, videoWidth, videoHeight) {
5836
- if (!videoWidth || !videoHeight) {
5837
- return {
5838
- width: videoWidth || SWIRL_HD_AUTHORING_WIDTH,
5839
- height: videoHeight || SWIRL_HD_AUTHORING_HEIGHT
5840
- };
5841
- }
5842
- if (!overlays.length) {
5843
- return {
5844
- width: videoWidth,
5845
- height: videoHeight
5846
- };
5847
- }
5848
- var _overlayExtents = overlayExtents(overlays), maxR = _overlayExtents.maxR, maxB = _overlayExtents.maxB;
5849
- var EPS = 1;
5850
- if (maxR <= 0 || maxB <= 0) {
5851
- return {
5852
- width: videoWidth,
5853
- height: videoHeight
5854
- };
5855
- }
5856
- var mixed = swirlProjectHasNabDemoMixedWithOther(overlays);
5857
- var fitsHdCanvas = maxR <= SWIRL_HD_AUTHORING_WIDTH + EPS && maxB <= SWIRL_HD_AUTHORING_HEIGHT + EPS;
5858
- var exceedsDecode = maxR > videoWidth + EPS || maxB > videoHeight + EPS;
5859
- var decodeLargerThanHd = videoWidth > SWIRL_HD_AUTHORING_WIDTH + EPS || videoHeight > SWIRL_HD_AUTHORING_HEIGHT + EPS;
5860
- if (fitsHdCanvas && (decodeLargerThanHd || exceedsDecode && !mixed)) {
5861
- return {
5862
- width: SWIRL_HD_AUTHORING_WIDTH,
5863
- height: SWIRL_HD_AUTHORING_HEIGHT
5864
- };
5865
- }
5866
- if (mixed) {
5867
- return {
5868
- width: videoWidth,
5869
- height: videoHeight
5870
- };
5871
- }
5872
- var rung = smallestLadderRungContaining(maxR, maxB, EPS);
5873
- if (rung && rung.width < videoWidth - EPS && rung.height < videoHeight - EPS) {
5874
- return {
5875
- width: rung.width,
5876
- height: rung.height
5877
- };
5878
- }
5879
- return {
5880
- width: videoWidth,
5881
- height: videoHeight
5882
- };
5883
- }
5884
5704
  function normalizeScrollerConfig(raw) {
5885
5705
  if (!raw || (typeof raw === "undefined" ? "undefined" : _type_of(raw)) !== "object") return void 0;
5886
5706
  var r = raw;
@@ -7764,13 +7584,8 @@ var OverlayRenderer = function OverlayRenderer(param) {
7764
7584
  },
7765
7585
  children: _to_consumable_array(fadeMap.values()).map(function(param) {
7766
7586
  var overlay = param.overlay, visible = param.visible;
7767
- var uniform = coordinateSpace && coordinateSpace.width > 0 && coordinateSpace.height > 0;
7768
- var auth = uniform ? {
7769
- width: coordinateSpace.width,
7770
- height: coordinateSpace.height
7771
- } : overlayAuthoringDimensions(overlay, dims.nativeWidth, dims.nativeHeight);
7772
- var scaleX = dims.displayWidth / auth.width;
7773
- var scaleY = dims.displayHeight / auth.height;
7587
+ var scaleX = (coordinateSpace === null || coordinateSpace === void 0 ? void 0 : coordinateSpace.width) ? dims.displayWidth / coordinateSpace.width : dims.scaleX;
7588
+ var scaleY = (coordinateSpace === null || coordinateSpace === void 0 ? void 0 : coordinateSpace.height) ? dims.displayHeight / coordinateSpace.height : dims.scaleY;
7774
7589
  var left = overlay.x * scaleX;
7775
7590
  var top = overlay.y * scaleY;
7776
7591
  var width = overlay.width * scaleX;
@@ -8292,7 +8107,7 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
8292
8107
  var _playerRef_current;
8293
8108
  if (!swirlProjectId) return;
8294
8109
  var tryResolve = function tryResolve() {
8295
- var _ref, _ref1;
8110
+ var _player_getMinHlsResolution;
8296
8111
  var fixed = swirlOverlayCoordinateSpace;
8297
8112
  if (fixed && fixed.width > 0 && fixed.height > 0) {
8298
8113
  setOverlayCoordSpace({
@@ -8303,27 +8118,23 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
8303
8118
  }
8304
8119
  var player = playerRef.current;
8305
8120
  if (!player) return false;
8121
+ var minRes = (_player_getMinHlsResolution = player.getMinHlsResolution) === null || _player_getMinHlsResolution === void 0 ? void 0 : _player_getMinHlsResolution.call(player);
8122
+ if (minRes && minRes.width > 0 && minRes.height > 0) {
8123
+ setOverlayCoordSpace({
8124
+ width: minRes.width,
8125
+ height: minRes.height
8126
+ });
8127
+ return true;
8128
+ }
8306
8129
  var video2 = player.videoElement;
8307
- var vw = (_ref = video2 === null || video2 === void 0 ? void 0 : video2.videoWidth) !== null && _ref !== void 0 ? _ref : 0;
8308
- var vh = (_ref1 = video2 === null || video2 === void 0 ? void 0 : video2.videoHeight) !== null && _ref1 !== void 0 ? _ref1 : 0;
8309
- if (!vw || !vh) {
8310
- var _player_getMaxHlsResolution;
8311
- var maxRes = (_player_getMaxHlsResolution = player.getMaxHlsResolution) === null || _player_getMaxHlsResolution === void 0 ? void 0 : _player_getMaxHlsResolution.call(player);
8312
- if (maxRes && maxRes.width > 0 && maxRes.height > 0) {
8313
- vw = maxRes.width;
8314
- vh = maxRes.height;
8315
- } else {
8316
- var _player_getMinHlsResolution;
8317
- var minRes = (_player_getMinHlsResolution = player.getMinHlsResolution) === null || _player_getMinHlsResolution === void 0 ? void 0 : _player_getMinHlsResolution.call(player);
8318
- if (minRes && minRes.width > 0 && minRes.height > 0) {
8319
- vw = minRes.width;
8320
- vh = minRes.height;
8321
- }
8322
- }
8130
+ if (video2 && video2.videoWidth > 0 && video2.videoHeight > 0) {
8131
+ setOverlayCoordSpace({
8132
+ width: video2.videoWidth,
8133
+ height: video2.videoHeight
8134
+ });
8135
+ return true;
8323
8136
  }
8324
- if (!vw || !vh) return false;
8325
- setOverlayCoordSpace(inferSwirlOverlayCoordinateSpace(overlays, vw, vh));
8326
- return true;
8137
+ return false;
8327
8138
  };
8328
8139
  var attempts = 0;
8329
8140
  var maxAttempts = 40;
@@ -11379,5 +11190,5 @@ var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallbac
11379
11190
  };
11380
11191
  var StormcloudPlayer = createStormcloudPlayer(players_default, players_default[players_default.length - 1]);
11381
11192
  var StormcloudPlayer_default = StormcloudPlayer;
11382
- export { IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, OVERLAY_API_BASE, SUPPORTS_DASH, SUPPORTS_HLS, SWIRL_HD_AUTHORING_HEIGHT, SWIRL_HD_AUTHORING_WIDTH, StormcloudPlayer_default as StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, canPlay, createAdStormPlayer, createStormcloudPlayer, StormcloudVideoPlayerComponent as default, detectBrowser, fetchProjectOverlays, getBrowserConfigOverrides, getBrowserID, getClientInfo, inferSwirlOverlayCoordinateSpace, initializePolyfills, isMediaStream, isOverlayActive, lazy, logBrowserInfo, merge, normalizeSwirlOverlay, omit, overlayAuthoringDimensions, parseQuery, players_default as players, randomString, resolveImageUrl, sendHeartbeat, sendInitialTracking, supportsFeature, supportsModernJS, supportsWebKitPresentationMode, swirlProjectHasNabDemoMixedWithOther, timeStringToSeconds };
11193
+ export { IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, OVERLAY_API_BASE, SUPPORTS_DASH, SUPPORTS_HLS, StormcloudPlayer_default as StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, canPlay, createAdStormPlayer, createStormcloudPlayer, StormcloudVideoPlayerComponent as default, detectBrowser, fetchProjectOverlays, getBrowserConfigOverrides, getBrowserID, getClientInfo, initializePolyfills, isMediaStream, isOverlayActive, lazy, logBrowserInfo, merge, normalizeSwirlOverlay, omit, parseQuery, players_default as players, randomString, resolveImageUrl, sendHeartbeat, sendInitialTracking, supportsFeature, supportsModernJS, supportsWebKitPresentationMode, timeStringToSeconds };
11383
11194
  //# sourceMappingURL=index.js.map