stormcloud-video-player 0.7.45 → 0.7.47

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.js CHANGED
@@ -7211,7 +7211,8 @@ var SHOWCASE_PERSISTENT_TYPES = /* @__PURE__ */ new Set([
7211
7211
  "text",
7212
7212
  "shape",
7213
7213
  "countdown",
7214
- "qr_code"
7214
+ "qr_code",
7215
+ "coming_up_next"
7215
7216
  ]);
7216
7217
  function easeOutCubic(t) {
7217
7218
  var u = 1 - t;
@@ -7334,6 +7335,21 @@ var OverlayRenderer = function OverlayRenderer(param) {
7334
7335
  var rafRef = useRef(null);
7335
7336
  var _useState1 = _sliced_to_array(useState(/* @__PURE__ */ new Map()), 2), fadeMap = _useState1[0], setFadeMap = _useState1[1];
7336
7337
  var removeTimers = useRef(/* @__PURE__ */ new Map());
7338
+ var mountTimeRef = useRef(Date.now());
7339
+ var _useState2 = _sliced_to_array(useState(0), 2), wallclockSec = _useState2[0], setWallclockSec = _useState2[1];
7340
+ useEffect(function() {
7341
+ if (!showcaseMode) return;
7342
+ var tick = function tick() {
7343
+ return setWallclockSec((Date.now() - mountTimeRef.current) / 1e3);
7344
+ };
7345
+ tick();
7346
+ var id = window.setInterval(tick, 200);
7347
+ return function() {
7348
+ return clearInterval(id);
7349
+ };
7350
+ }, [
7351
+ showcaseMode
7352
+ ]);
7337
7353
  var _useMemo = useMemo(function() {
7338
7354
  return partitionShowcase(overlays);
7339
7355
  }, [
@@ -7390,7 +7406,10 @@ var OverlayRenderer = function OverlayRenderer(param) {
7390
7406
  if (showcaseMode) {
7391
7407
  var _showcaseBeats_showcaseBeatIndex;
7392
7408
  var beat = (_showcaseBeats_showcaseBeatIndex = showcaseBeats[showcaseBeatIndex]) !== null && _showcaseBeats_showcaseBeatIndex !== void 0 ? _showcaseBeats_showcaseBeatIndex : [];
7393
- return _to_consumable_array(showcasePersistent).concat(_to_consumable_array(beat));
7409
+ var scheduledPersistent = showcasePersistent.filter(function(o) {
7410
+ return isOverlayActive(o, wallclockSec);
7411
+ });
7412
+ return _to_consumable_array(scheduledPersistent).concat(_to_consumable_array(beat));
7394
7413
  }
7395
7414
  return overlays.filter(function(o) {
7396
7415
  return isOverlayActive(o, currentTime);
@@ -7398,6 +7417,7 @@ var OverlayRenderer = function OverlayRenderer(param) {
7398
7417
  }, [
7399
7418
  overlays,
7400
7419
  currentTime,
7420
+ wallclockSec,
7401
7421
  showcaseMode,
7402
7422
  showcasePersistent,
7403
7423
  showcaseBeats,
@@ -8110,6 +8130,7 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
8110
8130
  var _player_getMinHlsResolution;
8111
8131
  var fixed = swirlOverlayCoordinateSpace;
8112
8132
  if (fixed && fixed.width > 0 && fixed.height > 0) {
8133
+ console.debug("[StormcloudVideoPlayer] overlay coord space (prop):", fixed.width, "x", fixed.height);
8113
8134
  setOverlayCoordSpace({
8114
8135
  width: fixed.width,
8115
8136
  height: fixed.height
@@ -8120,6 +8141,7 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
8120
8141
  if (!player) return false;
8121
8142
  var minRes = (_player_getMinHlsResolution = player.getMinHlsResolution) === null || _player_getMinHlsResolution === void 0 ? void 0 : _player_getMinHlsResolution.call(player);
8122
8143
  if (minRes && minRes.width > 0 && minRes.height > 0) {
8144
+ console.debug("[StormcloudVideoPlayer] overlay coord space (minHlsResolution):", minRes.width, "x", minRes.height);
8123
8145
  setOverlayCoordSpace({
8124
8146
  width: minRes.width,
8125
8147
  height: minRes.height
@@ -8128,6 +8150,7 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
8128
8150
  }
8129
8151
  var video2 = player.videoElement;
8130
8152
  if (video2 && video2.videoWidth > 0 && video2.videoHeight > 0) {
8153
+ console.debug("[StormcloudVideoPlayer] overlay coord space (videoNative):", video2.videoWidth, "x", video2.videoHeight);
8131
8154
  setOverlayCoordSpace({
8132
8155
  width: video2.videoWidth,
8133
8156
  height: video2.videoHeight
@@ -8160,8 +8183,7 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
8160
8183
  }, [
8161
8184
  swirlProjectId,
8162
8185
  criticalPropsKey,
8163
- swirlOverlayCoordinateSpace,
8164
- overlays
8186
+ swirlOverlayCoordinateSpace
8165
8187
  ]);
8166
8188
  useEffect2(function() {
8167
8189
  if (!playerRef.current) return;
@@ -8588,11 +8610,11 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
8588
8610
  }, restVideoAttrs), {
8589
8611
  children: children
8590
8612
  })),
8591
- displayOverlays.length > 0 && !adStatus.showAds && !overlaysDisabled && /* @__PURE__ */ jsx2(OverlayRenderer, {
8613
+ displayOverlays.length > 0 && !adStatus.showAds && !overlaysDisabled && overlayCoordSpace && /* @__PURE__ */ jsx2(OverlayRenderer, {
8592
8614
  overlays: displayOverlays,
8593
8615
  currentTime: currentTime,
8594
8616
  videoRef: videoRef,
8595
- coordinateSpace: swirlOverlayCoordinateSpace && swirlOverlayCoordinateSpace.width > 0 && swirlOverlayCoordinateSpace.height > 0 ? swirlOverlayCoordinateSpace : null,
8617
+ coordinateSpace: overlayCoordSpace,
8596
8618
  showcaseMode: !!swirlShowcaseDemo
8597
8619
  }),
8598
8620
  (isLoading || isBuffering) && !hideLoadingIndicator && /* @__PURE__ */ jsxs2("div", {