stormcloud-video-player 0.7.7 → 0.7.9

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
@@ -759,28 +759,9 @@ function createAdStormPlayer(contentVideo, options) {
759
759
  adVideoElement.removeAttribute("src");
760
760
  adVideoElement.load();
761
761
  }
762
- function buildVastUrl(durationSeconds, metadata) {
763
- var baseUrl = "https://adstorm.co/api-adstorm-dev/adstorm/vast/".concat(licenseKey, "/pod");
764
- var defaultMetadata = {
765
- video: {
766
- codec: "h264",
767
- width: contentVideo.videoWidth || 1280,
768
- height: contentVideo.videoHeight || 720,
769
- fps: 29.97,
770
- bitrate: 5e3,
771
- profile: "high",
772
- pix_fmt: "yuv420p",
773
- has_b_frames: 0
774
- },
775
- audio: {
776
- codec: "aac",
777
- sample_rate: 48e3,
778
- bitrate: 128
779
- }
780
- };
781
- var finalMetadata = metadata || defaultMetadata;
782
- var metadataStr = encodeURIComponent(JSON.stringify(finalMetadata));
783
- return "".concat(baseUrl, "?duration=").concat(Math.ceil(durationSeconds), "&metadata=").concat(metadataStr);
762
+ function buildVastUrl(durationSeconds) {
763
+ var baseUrl = "https://adstorm.co/api-adstorm-dev/adstorm/nab/vast/pod";
764
+ return "".concat(baseUrl, "?duration=").concat(Math.ceil(durationSeconds));
784
765
  }
785
766
  function parseVastXml(xmlString) {
786
767
  var ads = [];
@@ -6360,15 +6341,38 @@ function ScoreBugOverlay(param) {
6360
6341
  })
6361
6342
  ]
6362
6343
  }),
6363
- cfg.sponsorText && /* @__PURE__ */ jsx("div", {
6344
+ (cfg.sponsorText || cfg.sponsorImageUrl) && /* @__PURE__ */ jsxs("div", {
6364
6345
  style: {
6365
6346
  fontSize: "0.7em",
6366
6347
  textAlign: "center",
6367
- opacity: 0.5,
6368
- padding: "".concat(f * 0.2, "px 0"),
6369
- borderTop: "1px solid ".concat(cfg.accentColor, "40")
6348
+ opacity: 0.6,
6349
+ padding: "".concat(f * 0.2, "px ").concat(f * 0.4, "px"),
6350
+ borderTop: "1px solid ".concat(cfg.accentColor, "40"),
6351
+ display: "flex",
6352
+ alignItems: "center",
6353
+ justifyContent: "center",
6354
+ gap: f * 0.4,
6355
+ overflow: "hidden"
6370
6356
  },
6371
- children: cfg.sponsorText
6357
+ children: [
6358
+ cfg.sponsorImageUrl && /* @__PURE__ */ jsx("img", {
6359
+ src: cfg.sponsorImageUrl,
6360
+ alt: "sponsor",
6361
+ style: {
6362
+ height: "".concat(f * 1.4, "px"),
6363
+ objectFit: "contain",
6364
+ flexShrink: 0
6365
+ }
6366
+ }),
6367
+ cfg.sponsorText && /* @__PURE__ */ jsx("span", {
6368
+ style: {
6369
+ overflow: "hidden",
6370
+ textOverflow: "ellipsis",
6371
+ whiteSpace: "nowrap"
6372
+ },
6373
+ children: cfg.sponsorText
6374
+ })
6375
+ ]
6372
6376
  })
6373
6377
  ]
6374
6378
  });
@@ -6430,13 +6434,35 @@ function LowerThirdOverlay(param) {
6430
6434
  })
6431
6435
  ]
6432
6436
  }),
6433
- cfg.sponsorText && /* @__PURE__ */ jsx("div", {
6437
+ (cfg.sponsorText || cfg.sponsorImageUrl) && /* @__PURE__ */ jsxs("div", {
6434
6438
  style: {
6435
6439
  fontSize: "0.7em",
6436
- opacity: 0.4,
6437
- padding: "0 ".concat(f * 1.2, "px ").concat(f * 0.4, "px")
6440
+ opacity: 0.5,
6441
+ padding: "0 ".concat(f * 1.2, "px ").concat(f * 0.4, "px"),
6442
+ display: "flex",
6443
+ alignItems: "center",
6444
+ gap: f * 0.4,
6445
+ overflow: "hidden"
6438
6446
  },
6439
- children: cfg.sponsorText
6447
+ children: [
6448
+ cfg.sponsorImageUrl && /* @__PURE__ */ jsx("img", {
6449
+ src: cfg.sponsorImageUrl,
6450
+ alt: "sponsor",
6451
+ style: {
6452
+ height: "".concat(f * 1.4, "px"),
6453
+ objectFit: "contain",
6454
+ flexShrink: 0
6455
+ }
6456
+ }),
6457
+ cfg.sponsorText && /* @__PURE__ */ jsx("span", {
6458
+ style: {
6459
+ overflow: "hidden",
6460
+ textOverflow: "ellipsis",
6461
+ whiteSpace: "nowrap"
6462
+ },
6463
+ children: cfg.sponsorText
6464
+ })
6465
+ ]
6440
6466
  })
6441
6467
  ]
6442
6468
  });
@@ -6593,6 +6619,23 @@ function ComingUpNextOverlay(param) {
6593
6619
  children: cfg.scheduledTime
6594
6620
  })
6595
6621
  ]
6622
+ }),
6623
+ cfg.thumbnailUrl && /* @__PURE__ */ jsx("div", {
6624
+ style: {
6625
+ flexShrink: 0,
6626
+ width: Math.max(40, size.h * 0.75),
6627
+ overflow: "hidden"
6628
+ },
6629
+ children: /* @__PURE__ */ jsx("img", {
6630
+ src: cfg.thumbnailUrl,
6631
+ alt: "thumbnail",
6632
+ style: {
6633
+ width: "100%",
6634
+ height: "100%",
6635
+ objectFit: "cover",
6636
+ display: "block"
6637
+ }
6638
+ })
6596
6639
  })
6597
6640
  ]
6598
6641
  });
@@ -6828,35 +6871,41 @@ function BreakingNewsOverlay(param) {
6828
6871
  ]
6829
6872
  });
6830
6873
  }
6874
+ function calcCountdownRemaining(targetTime) {
6875
+ var diff = Math.max(0, new Date(targetTime).getTime() - Date.now());
6876
+ return {
6877
+ d: Math.floor(diff / 864e5),
6878
+ h: Math.floor(diff % 864e5 / 36e5),
6879
+ m: Math.floor(diff % 36e5 / 6e4),
6880
+ s: Math.floor(diff % 6e4 / 1e3),
6881
+ expired: diff === 0
6882
+ };
6883
+ }
6831
6884
  function CountdownOverlay(param) {
6832
6885
  var overlay = param.overlay, size = param.size;
6886
+ var _ref;
6833
6887
  var cfg = parseConfig(overlay.content);
6834
- var _useState = _sliced_to_array(useState({
6835
- d: 0,
6836
- h: 0,
6837
- m: 0,
6838
- s: 0
6888
+ var targetTime = (_ref = cfg === null || cfg === void 0 ? void 0 : cfg.targetTime) !== null && _ref !== void 0 ? _ref : "";
6889
+ var _useState = _sliced_to_array(useState(function() {
6890
+ return targetTime ? calcCountdownRemaining(targetTime) : {
6891
+ d: 0,
6892
+ h: 0,
6893
+ m: 0,
6894
+ s: 0,
6895
+ expired: false
6896
+ };
6839
6897
  }), 2), remaining = _useState[0], setRemaining = _useState[1];
6840
6898
  useEffect(function() {
6841
- if (!cfg) return;
6842
- var update = function update() {
6843
- var target = new Date(cfg.targetTime).getTime();
6844
- var now = Date.now();
6845
- var diff = Math.max(0, target - now);
6846
- setRemaining({
6847
- d: Math.floor(diff / 864e5),
6848
- h: Math.floor(diff % 864e5 / 36e5),
6849
- m: Math.floor(diff % 36e5 / 6e4),
6850
- s: Math.floor(diff % 6e4 / 1e3)
6851
- });
6852
- };
6853
- update();
6854
- var id = setInterval(update, 1e3);
6899
+ if (!targetTime) return;
6900
+ setRemaining(calcCountdownRemaining(targetTime));
6901
+ var id = setInterval(function() {
6902
+ return setRemaining(calcCountdownRemaining(targetTime));
6903
+ }, 1e3);
6855
6904
  return function() {
6856
6905
  return clearInterval(id);
6857
6906
  };
6858
6907
  }, [
6859
- cfg === null || cfg === void 0 ? void 0 : cfg.targetTime
6908
+ targetTime
6860
6909
  ]);
6861
6910
  if (!cfg) return null;
6862
6911
  var f = Math.max(6, size.w * 0.055);
@@ -6915,7 +6964,14 @@ function CountdownOverlay(param) {
6915
6964
  },
6916
6965
  children: cfg.eventName
6917
6966
  }),
6918
- /* @__PURE__ */ jsx("div", {
6967
+ remaining.expired ? /* @__PURE__ */ jsx("div", {
6968
+ style: {
6969
+ fontSize: "1em",
6970
+ fontWeight: 700,
6971
+ opacity: 0.6
6972
+ },
6973
+ children: cfg.message || "Event ended"
6974
+ }) : /* @__PURE__ */ jsx("div", {
6919
6975
  style: {
6920
6976
  display: "flex",
6921
6977
  gap: f * 0.6,
@@ -6964,7 +7020,7 @@ function CountdownOverlay(param) {
6964
7020
  }, u.label);
6965
7021
  })
6966
7022
  }),
6967
- cfg.message && /* @__PURE__ */ jsx("div", {
7023
+ !remaining.expired && cfg.message && /* @__PURE__ */ jsx("div", {
6968
7024
  style: {
6969
7025
  fontSize: "0.8em",
6970
7026
  opacity: 0.6,