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.cjs CHANGED
@@ -928,28 +928,9 @@ function createAdStormPlayer(contentVideo, options) {
928
928
  adVideoElement.removeAttribute("src");
929
929
  adVideoElement.load();
930
930
  }
931
- function buildVastUrl(durationSeconds, metadata) {
932
- var baseUrl = "https://adstorm.co/api-adstorm-dev/adstorm/vast/".concat(licenseKey, "/pod");
933
- var defaultMetadata = {
934
- video: {
935
- codec: "h264",
936
- width: contentVideo.videoWidth || 1280,
937
- height: contentVideo.videoHeight || 720,
938
- fps: 29.97,
939
- bitrate: 5e3,
940
- profile: "high",
941
- pix_fmt: "yuv420p",
942
- has_b_frames: 0
943
- },
944
- audio: {
945
- codec: "aac",
946
- sample_rate: 48e3,
947
- bitrate: 128
948
- }
949
- };
950
- var finalMetadata = metadata || defaultMetadata;
951
- var metadataStr = encodeURIComponent(JSON.stringify(finalMetadata));
952
- return "".concat(baseUrl, "?duration=").concat(Math.ceil(durationSeconds), "&metadata=").concat(metadataStr);
931
+ function buildVastUrl(durationSeconds) {
932
+ var baseUrl = "https://adstorm.co/api-adstorm-dev/adstorm/nab/vast/pod";
933
+ return "".concat(baseUrl, "?duration=").concat(Math.ceil(durationSeconds));
953
934
  }
954
935
  function parseVastXml(xmlString) {
955
936
  var ads = [];
@@ -6526,15 +6507,38 @@ function ScoreBugOverlay(param) {
6526
6507
  })
6527
6508
  ]
6528
6509
  }),
6529
- cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6510
+ (cfg.sponsorText || cfg.sponsorImageUrl) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6530
6511
  style: {
6531
6512
  fontSize: "0.7em",
6532
6513
  textAlign: "center",
6533
- opacity: 0.5,
6534
- padding: "".concat(f * 0.2, "px 0"),
6535
- borderTop: "1px solid ".concat(cfg.accentColor, "40")
6514
+ opacity: 0.6,
6515
+ padding: "".concat(f * 0.2, "px ").concat(f * 0.4, "px"),
6516
+ borderTop: "1px solid ".concat(cfg.accentColor, "40"),
6517
+ display: "flex",
6518
+ alignItems: "center",
6519
+ justifyContent: "center",
6520
+ gap: f * 0.4,
6521
+ overflow: "hidden"
6536
6522
  },
6537
- children: cfg.sponsorText
6523
+ children: [
6524
+ cfg.sponsorImageUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
6525
+ src: cfg.sponsorImageUrl,
6526
+ alt: "sponsor",
6527
+ style: {
6528
+ height: "".concat(f * 1.4, "px"),
6529
+ objectFit: "contain",
6530
+ flexShrink: 0
6531
+ }
6532
+ }),
6533
+ cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6534
+ style: {
6535
+ overflow: "hidden",
6536
+ textOverflow: "ellipsis",
6537
+ whiteSpace: "nowrap"
6538
+ },
6539
+ children: cfg.sponsorText
6540
+ })
6541
+ ]
6538
6542
  })
6539
6543
  ]
6540
6544
  });
@@ -6596,13 +6600,35 @@ function LowerThirdOverlay(param) {
6596
6600
  })
6597
6601
  ]
6598
6602
  }),
6599
- cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6603
+ (cfg.sponsorText || cfg.sponsorImageUrl) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6600
6604
  style: {
6601
6605
  fontSize: "0.7em",
6602
- opacity: 0.4,
6603
- padding: "0 ".concat(f * 1.2, "px ").concat(f * 0.4, "px")
6606
+ opacity: 0.5,
6607
+ padding: "0 ".concat(f * 1.2, "px ").concat(f * 0.4, "px"),
6608
+ display: "flex",
6609
+ alignItems: "center",
6610
+ gap: f * 0.4,
6611
+ overflow: "hidden"
6604
6612
  },
6605
- children: cfg.sponsorText
6613
+ children: [
6614
+ cfg.sponsorImageUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
6615
+ src: cfg.sponsorImageUrl,
6616
+ alt: "sponsor",
6617
+ style: {
6618
+ height: "".concat(f * 1.4, "px"),
6619
+ objectFit: "contain",
6620
+ flexShrink: 0
6621
+ }
6622
+ }),
6623
+ cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6624
+ style: {
6625
+ overflow: "hidden",
6626
+ textOverflow: "ellipsis",
6627
+ whiteSpace: "nowrap"
6628
+ },
6629
+ children: cfg.sponsorText
6630
+ })
6631
+ ]
6606
6632
  })
6607
6633
  ]
6608
6634
  });
@@ -6759,6 +6785,23 @@ function ComingUpNextOverlay(param) {
6759
6785
  children: cfg.scheduledTime
6760
6786
  })
6761
6787
  ]
6788
+ }),
6789
+ cfg.thumbnailUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6790
+ style: {
6791
+ flexShrink: 0,
6792
+ width: Math.max(40, size.h * 0.75),
6793
+ overflow: "hidden"
6794
+ },
6795
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
6796
+ src: cfg.thumbnailUrl,
6797
+ alt: "thumbnail",
6798
+ style: {
6799
+ width: "100%",
6800
+ height: "100%",
6801
+ objectFit: "cover",
6802
+ display: "block"
6803
+ }
6804
+ })
6762
6805
  })
6763
6806
  ]
6764
6807
  });
@@ -6994,35 +7037,41 @@ function BreakingNewsOverlay(param) {
6994
7037
  ]
6995
7038
  });
6996
7039
  }
7040
+ function calcCountdownRemaining(targetTime) {
7041
+ var diff = Math.max(0, new Date(targetTime).getTime() - Date.now());
7042
+ return {
7043
+ d: Math.floor(diff / 864e5),
7044
+ h: Math.floor(diff % 864e5 / 36e5),
7045
+ m: Math.floor(diff % 36e5 / 6e4),
7046
+ s: Math.floor(diff % 6e4 / 1e3),
7047
+ expired: diff === 0
7048
+ };
7049
+ }
6997
7050
  function CountdownOverlay(param) {
6998
7051
  var overlay = param.overlay, size = param.size;
7052
+ var _ref;
6999
7053
  var cfg = parseConfig(overlay.content);
7000
- var _ref = _sliced_to_array((0, import_react.useState)({
7001
- d: 0,
7002
- h: 0,
7003
- m: 0,
7004
- s: 0
7005
- }), 2), remaining = _ref[0], setRemaining = _ref[1];
7006
- (0, import_react.useEffect)(function() {
7007
- if (!cfg) return;
7008
- var update = function update() {
7009
- var target = new Date(cfg.targetTime).getTime();
7010
- var now = Date.now();
7011
- var diff = Math.max(0, target - now);
7012
- setRemaining({
7013
- d: Math.floor(diff / 864e5),
7014
- h: Math.floor(diff % 864e5 / 36e5),
7015
- m: Math.floor(diff % 36e5 / 6e4),
7016
- s: Math.floor(diff % 6e4 / 1e3)
7017
- });
7054
+ var targetTime = (_ref = cfg === null || cfg === void 0 ? void 0 : cfg.targetTime) !== null && _ref !== void 0 ? _ref : "";
7055
+ var _ref1 = _sliced_to_array((0, import_react.useState)(function() {
7056
+ return targetTime ? calcCountdownRemaining(targetTime) : {
7057
+ d: 0,
7058
+ h: 0,
7059
+ m: 0,
7060
+ s: 0,
7061
+ expired: false
7018
7062
  };
7019
- update();
7020
- var id = setInterval(update, 1e3);
7063
+ }), 2), remaining = _ref1[0], setRemaining = _ref1[1];
7064
+ (0, import_react.useEffect)(function() {
7065
+ if (!targetTime) return;
7066
+ setRemaining(calcCountdownRemaining(targetTime));
7067
+ var id = setInterval(function() {
7068
+ return setRemaining(calcCountdownRemaining(targetTime));
7069
+ }, 1e3);
7021
7070
  return function() {
7022
7071
  return clearInterval(id);
7023
7072
  };
7024
7073
  }, [
7025
- cfg === null || cfg === void 0 ? void 0 : cfg.targetTime
7074
+ targetTime
7026
7075
  ]);
7027
7076
  if (!cfg) return null;
7028
7077
  var f = Math.max(6, size.w * 0.055);
@@ -7081,7 +7130,14 @@ function CountdownOverlay(param) {
7081
7130
  },
7082
7131
  children: cfg.eventName
7083
7132
  }),
7084
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7133
+ remaining.expired ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7134
+ style: {
7135
+ fontSize: "1em",
7136
+ fontWeight: 700,
7137
+ opacity: 0.6
7138
+ },
7139
+ children: cfg.message || "Event ended"
7140
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7085
7141
  style: {
7086
7142
  display: "flex",
7087
7143
  gap: f * 0.6,
@@ -7130,7 +7186,7 @@ function CountdownOverlay(param) {
7130
7186
  }, u.label);
7131
7187
  })
7132
7188
  }),
7133
- cfg.message && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7189
+ !remaining.expired && cfg.message && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7134
7190
  style: {
7135
7191
  fontSize: "0.8em",
7136
7192
  opacity: 0.6,