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.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,114 +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
- function inferSwirlOverlayCoordinateSpace(overlays, videoWidth, videoHeight) {
5783
- if (!videoWidth || !videoHeight) {
5784
- return {
5785
- width: videoWidth || SWIRL_HD_AUTHORING_WIDTH,
5786
- height: videoHeight || SWIRL_HD_AUTHORING_HEIGHT
5787
- };
5788
- }
5789
- if (!overlays.length) {
5790
- return {
5791
- width: videoWidth,
5792
- height: videoHeight
5793
- };
5794
- }
5795
- var _overlayExtents = overlayExtents(overlays), maxR = _overlayExtents.maxR, maxB = _overlayExtents.maxB;
5796
- var EPS = 1;
5797
- var exceedsDecode = maxR > videoWidth + EPS || maxB > videoHeight + EPS;
5798
- var fitsHdCanvas = maxR <= SWIRL_HD_AUTHORING_WIDTH + EPS && maxB <= SWIRL_HD_AUTHORING_HEIGHT + EPS;
5799
- var mixed = swirlProjectHasNabDemoMixedWithOther(overlays);
5800
- var decodeLargerThanHd = videoWidth > SWIRL_HD_AUTHORING_WIDTH + EPS || videoHeight > SWIRL_HD_AUTHORING_HEIGHT + EPS;
5801
- if (fitsHdCanvas && (decodeLargerThanHd || exceedsDecode && !mixed)) {
5802
- return {
5803
- width: SWIRL_HD_AUTHORING_WIDTH,
5804
- height: SWIRL_HD_AUTHORING_HEIGHT
5805
- };
5806
- }
5807
- return {
5808
- width: videoWidth,
5809
- height: videoHeight
5810
- };
5811
- }
5812
5704
  function normalizeScrollerConfig(raw) {
5813
5705
  if (!raw || (typeof raw === "undefined" ? "undefined" : _type_of(raw)) !== "object") return void 0;
5814
5706
  var r = raw;
@@ -7692,13 +7584,8 @@ var OverlayRenderer = function OverlayRenderer(param) {
7692
7584
  },
7693
7585
  children: _to_consumable_array(fadeMap.values()).map(function(param) {
7694
7586
  var overlay = param.overlay, visible = param.visible;
7695
- var uniform = coordinateSpace && coordinateSpace.width > 0 && coordinateSpace.height > 0;
7696
- var auth = uniform ? {
7697
- width: coordinateSpace.width,
7698
- height: coordinateSpace.height
7699
- } : overlayAuthoringDimensions(overlay, dims.nativeWidth, dims.nativeHeight);
7700
- var scaleX = dims.displayWidth / auth.width;
7701
- 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;
7702
7589
  var left = overlay.x * scaleX;
7703
7590
  var top = overlay.y * scaleY;
7704
7591
  var width = overlay.width * scaleX;
@@ -8220,7 +8107,7 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
8220
8107
  var _playerRef_current;
8221
8108
  if (!swirlProjectId) return;
8222
8109
  var tryResolve = function tryResolve() {
8223
- var _ref, _ref1;
8110
+ var _player_getMinHlsResolution;
8224
8111
  var fixed = swirlOverlayCoordinateSpace;
8225
8112
  if (fixed && fixed.width > 0 && fixed.height > 0) {
8226
8113
  setOverlayCoordSpace({
@@ -8231,27 +8118,23 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
8231
8118
  }
8232
8119
  var player = playerRef.current;
8233
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
+ }
8234
8129
  var video2 = player.videoElement;
8235
- var vw = (_ref = video2 === null || video2 === void 0 ? void 0 : video2.videoWidth) !== null && _ref !== void 0 ? _ref : 0;
8236
- var vh = (_ref1 = video2 === null || video2 === void 0 ? void 0 : video2.videoHeight) !== null && _ref1 !== void 0 ? _ref1 : 0;
8237
- if (!vw || !vh) {
8238
- var _player_getMaxHlsResolution;
8239
- var maxRes = (_player_getMaxHlsResolution = player.getMaxHlsResolution) === null || _player_getMaxHlsResolution === void 0 ? void 0 : _player_getMaxHlsResolution.call(player);
8240
- if (maxRes && maxRes.width > 0 && maxRes.height > 0) {
8241
- vw = maxRes.width;
8242
- vh = maxRes.height;
8243
- } else {
8244
- var _player_getMinHlsResolution;
8245
- var minRes = (_player_getMinHlsResolution = player.getMinHlsResolution) === null || _player_getMinHlsResolution === void 0 ? void 0 : _player_getMinHlsResolution.call(player);
8246
- if (minRes && minRes.width > 0 && minRes.height > 0) {
8247
- vw = minRes.width;
8248
- vh = minRes.height;
8249
- }
8250
- }
8130
+ if (video2 && video2.videoWidth > 0 && video2.videoHeight > 0) {
8131
+ setOverlayCoordSpace({
8132
+ width: video2.videoWidth,
8133
+ height: video2.videoHeight
8134
+ });
8135
+ return true;
8251
8136
  }
8252
- if (!vw || !vh) return false;
8253
- setOverlayCoordSpace(inferSwirlOverlayCoordinateSpace(overlays, vw, vh));
8254
- return true;
8137
+ return false;
8255
8138
  };
8256
8139
  var attempts = 0;
8257
8140
  var maxAttempts = 40;
@@ -11307,5 +11190,5 @@ var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallbac
11307
11190
  };
11308
11191
  var StormcloudPlayer = createStormcloudPlayer(players_default, players_default[players_default.length - 1]);
11309
11192
  var StormcloudPlayer_default = StormcloudPlayer;
11310
- 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 };
11311
11194
  //# sourceMappingURL=index.js.map