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/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +110 -54
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +109 -53
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +3 -22
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +3 -22
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +3 -22
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/adstormPlayer.cjs +3 -22
- package/lib/sdk/adstormPlayer.cjs.map +1 -1
- package/lib/ui/OverlayRenderer.cjs +107 -32
- package/lib/ui/OverlayRenderer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +110 -54
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -775,28 +775,9 @@ function createAdStormPlayer(contentVideo, options) {
|
|
|
775
775
|
adVideoElement.removeAttribute("src");
|
|
776
776
|
adVideoElement.load();
|
|
777
777
|
}
|
|
778
|
-
function buildVastUrl(durationSeconds
|
|
779
|
-
var baseUrl = "https://adstorm.co/api-adstorm-dev/adstorm/vast/
|
|
780
|
-
|
|
781
|
-
video: {
|
|
782
|
-
codec: "h264",
|
|
783
|
-
width: contentVideo.videoWidth || 1280,
|
|
784
|
-
height: contentVideo.videoHeight || 720,
|
|
785
|
-
fps: 29.97,
|
|
786
|
-
bitrate: 5e3,
|
|
787
|
-
profile: "high",
|
|
788
|
-
pix_fmt: "yuv420p",
|
|
789
|
-
has_b_frames: 0
|
|
790
|
-
},
|
|
791
|
-
audio: {
|
|
792
|
-
codec: "aac",
|
|
793
|
-
sample_rate: 48e3,
|
|
794
|
-
bitrate: 128
|
|
795
|
-
}
|
|
796
|
-
};
|
|
797
|
-
var finalMetadata = metadata || defaultMetadata;
|
|
798
|
-
var metadataStr = encodeURIComponent(JSON.stringify(finalMetadata));
|
|
799
|
-
return "".concat(baseUrl, "?duration=").concat(Math.ceil(durationSeconds), "&metadata=").concat(metadataStr);
|
|
778
|
+
function buildVastUrl(durationSeconds) {
|
|
779
|
+
var baseUrl = "https://adstorm.co/api-adstorm-dev/adstorm/nab/vast/pod";
|
|
780
|
+
return "".concat(baseUrl, "?duration=").concat(Math.ceil(durationSeconds));
|
|
800
781
|
}
|
|
801
782
|
function parseVastXml(xmlString) {
|
|
802
783
|
var ads = [];
|
|
@@ -6348,15 +6329,38 @@ function ScoreBugOverlay(param) {
|
|
|
6348
6329
|
})
|
|
6349
6330
|
]
|
|
6350
6331
|
}),
|
|
6351
|
-
cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
6332
|
+
(cfg.sponsorText || cfg.sponsorImageUrl) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6352
6333
|
style: {
|
|
6353
6334
|
fontSize: "0.7em",
|
|
6354
6335
|
textAlign: "center",
|
|
6355
|
-
opacity: 0.
|
|
6356
|
-
padding: "".concat(f * 0.2, "px 0"),
|
|
6357
|
-
borderTop: "1px solid ".concat(cfg.accentColor, "40")
|
|
6336
|
+
opacity: 0.6,
|
|
6337
|
+
padding: "".concat(f * 0.2, "px ").concat(f * 0.4, "px"),
|
|
6338
|
+
borderTop: "1px solid ".concat(cfg.accentColor, "40"),
|
|
6339
|
+
display: "flex",
|
|
6340
|
+
alignItems: "center",
|
|
6341
|
+
justifyContent: "center",
|
|
6342
|
+
gap: f * 0.4,
|
|
6343
|
+
overflow: "hidden"
|
|
6358
6344
|
},
|
|
6359
|
-
children:
|
|
6345
|
+
children: [
|
|
6346
|
+
cfg.sponsorImageUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
|
|
6347
|
+
src: cfg.sponsorImageUrl,
|
|
6348
|
+
alt: "sponsor",
|
|
6349
|
+
style: {
|
|
6350
|
+
height: "".concat(f * 1.4, "px"),
|
|
6351
|
+
objectFit: "contain",
|
|
6352
|
+
flexShrink: 0
|
|
6353
|
+
}
|
|
6354
|
+
}),
|
|
6355
|
+
cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
6356
|
+
style: {
|
|
6357
|
+
overflow: "hidden",
|
|
6358
|
+
textOverflow: "ellipsis",
|
|
6359
|
+
whiteSpace: "nowrap"
|
|
6360
|
+
},
|
|
6361
|
+
children: cfg.sponsorText
|
|
6362
|
+
})
|
|
6363
|
+
]
|
|
6360
6364
|
})
|
|
6361
6365
|
]
|
|
6362
6366
|
});
|
|
@@ -6418,13 +6422,35 @@ function LowerThirdOverlay(param) {
|
|
|
6418
6422
|
})
|
|
6419
6423
|
]
|
|
6420
6424
|
}),
|
|
6421
|
-
cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
6425
|
+
(cfg.sponsorText || cfg.sponsorImageUrl) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6422
6426
|
style: {
|
|
6423
6427
|
fontSize: "0.7em",
|
|
6424
|
-
opacity: 0.
|
|
6425
|
-
padding: "0 ".concat(f * 1.2, "px ").concat(f * 0.4, "px")
|
|
6428
|
+
opacity: 0.5,
|
|
6429
|
+
padding: "0 ".concat(f * 1.2, "px ").concat(f * 0.4, "px"),
|
|
6430
|
+
display: "flex",
|
|
6431
|
+
alignItems: "center",
|
|
6432
|
+
gap: f * 0.4,
|
|
6433
|
+
overflow: "hidden"
|
|
6426
6434
|
},
|
|
6427
|
-
children:
|
|
6435
|
+
children: [
|
|
6436
|
+
cfg.sponsorImageUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
|
|
6437
|
+
src: cfg.sponsorImageUrl,
|
|
6438
|
+
alt: "sponsor",
|
|
6439
|
+
style: {
|
|
6440
|
+
height: "".concat(f * 1.4, "px"),
|
|
6441
|
+
objectFit: "contain",
|
|
6442
|
+
flexShrink: 0
|
|
6443
|
+
}
|
|
6444
|
+
}),
|
|
6445
|
+
cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
6446
|
+
style: {
|
|
6447
|
+
overflow: "hidden",
|
|
6448
|
+
textOverflow: "ellipsis",
|
|
6449
|
+
whiteSpace: "nowrap"
|
|
6450
|
+
},
|
|
6451
|
+
children: cfg.sponsorText
|
|
6452
|
+
})
|
|
6453
|
+
]
|
|
6428
6454
|
})
|
|
6429
6455
|
]
|
|
6430
6456
|
});
|
|
@@ -6581,6 +6607,23 @@ function ComingUpNextOverlay(param) {
|
|
|
6581
6607
|
children: cfg.scheduledTime
|
|
6582
6608
|
})
|
|
6583
6609
|
]
|
|
6610
|
+
}),
|
|
6611
|
+
cfg.thumbnailUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6612
|
+
style: {
|
|
6613
|
+
flexShrink: 0,
|
|
6614
|
+
width: Math.max(40, size.h * 0.75),
|
|
6615
|
+
overflow: "hidden"
|
|
6616
|
+
},
|
|
6617
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
|
|
6618
|
+
src: cfg.thumbnailUrl,
|
|
6619
|
+
alt: "thumbnail",
|
|
6620
|
+
style: {
|
|
6621
|
+
width: "100%",
|
|
6622
|
+
height: "100%",
|
|
6623
|
+
objectFit: "cover",
|
|
6624
|
+
display: "block"
|
|
6625
|
+
}
|
|
6626
|
+
})
|
|
6584
6627
|
})
|
|
6585
6628
|
]
|
|
6586
6629
|
});
|
|
@@ -6816,35 +6859,41 @@ function BreakingNewsOverlay(param) {
|
|
|
6816
6859
|
]
|
|
6817
6860
|
});
|
|
6818
6861
|
}
|
|
6862
|
+
function calcCountdownRemaining(targetTime) {
|
|
6863
|
+
var diff = Math.max(0, new Date(targetTime).getTime() - Date.now());
|
|
6864
|
+
return {
|
|
6865
|
+
d: Math.floor(diff / 864e5),
|
|
6866
|
+
h: Math.floor(diff % 864e5 / 36e5),
|
|
6867
|
+
m: Math.floor(diff % 36e5 / 6e4),
|
|
6868
|
+
s: Math.floor(diff % 6e4 / 1e3),
|
|
6869
|
+
expired: diff === 0
|
|
6870
|
+
};
|
|
6871
|
+
}
|
|
6819
6872
|
function CountdownOverlay(param) {
|
|
6820
6873
|
var overlay = param.overlay, size = param.size;
|
|
6874
|
+
var _ref;
|
|
6821
6875
|
var cfg = parseConfig(overlay.content);
|
|
6822
|
-
var _ref =
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
var update = function update() {
|
|
6831
|
-
var target = new Date(cfg.targetTime).getTime();
|
|
6832
|
-
var now = Date.now();
|
|
6833
|
-
var diff = Math.max(0, target - now);
|
|
6834
|
-
setRemaining({
|
|
6835
|
-
d: Math.floor(diff / 864e5),
|
|
6836
|
-
h: Math.floor(diff % 864e5 / 36e5),
|
|
6837
|
-
m: Math.floor(diff % 36e5 / 6e4),
|
|
6838
|
-
s: Math.floor(diff % 6e4 / 1e3)
|
|
6839
|
-
});
|
|
6876
|
+
var targetTime = (_ref = cfg === null || cfg === void 0 ? void 0 : cfg.targetTime) !== null && _ref !== void 0 ? _ref : "";
|
|
6877
|
+
var _ref1 = _sliced_to_array((0, import_react.useState)(function() {
|
|
6878
|
+
return targetTime ? calcCountdownRemaining(targetTime) : {
|
|
6879
|
+
d: 0,
|
|
6880
|
+
h: 0,
|
|
6881
|
+
m: 0,
|
|
6882
|
+
s: 0,
|
|
6883
|
+
expired: false
|
|
6840
6884
|
};
|
|
6841
|
-
|
|
6842
|
-
|
|
6885
|
+
}), 2), remaining = _ref1[0], setRemaining = _ref1[1];
|
|
6886
|
+
(0, import_react.useEffect)(function() {
|
|
6887
|
+
if (!targetTime) return;
|
|
6888
|
+
setRemaining(calcCountdownRemaining(targetTime));
|
|
6889
|
+
var id = setInterval(function() {
|
|
6890
|
+
return setRemaining(calcCountdownRemaining(targetTime));
|
|
6891
|
+
}, 1e3);
|
|
6843
6892
|
return function() {
|
|
6844
6893
|
return clearInterval(id);
|
|
6845
6894
|
};
|
|
6846
6895
|
}, [
|
|
6847
|
-
|
|
6896
|
+
targetTime
|
|
6848
6897
|
]);
|
|
6849
6898
|
if (!cfg) return null;
|
|
6850
6899
|
var f = Math.max(6, size.w * 0.055);
|
|
@@ -6903,7 +6952,14 @@ function CountdownOverlay(param) {
|
|
|
6903
6952
|
},
|
|
6904
6953
|
children: cfg.eventName
|
|
6905
6954
|
}),
|
|
6906
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6955
|
+
remaining.expired ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6956
|
+
style: {
|
|
6957
|
+
fontSize: "1em",
|
|
6958
|
+
fontWeight: 700,
|
|
6959
|
+
opacity: 0.6
|
|
6960
|
+
},
|
|
6961
|
+
children: cfg.message || "Event ended"
|
|
6962
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6907
6963
|
style: {
|
|
6908
6964
|
display: "flex",
|
|
6909
6965
|
gap: f * 0.6,
|
|
@@ -6952,7 +7008,7 @@ function CountdownOverlay(param) {
|
|
|
6952
7008
|
}, u.label);
|
|
6953
7009
|
})
|
|
6954
7010
|
}),
|
|
6955
|
-
cfg.message && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
7011
|
+
!remaining.expired && cfg.message && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6956
7012
|
style: {
|
|
6957
7013
|
fontSize: "0.8em",
|
|
6958
7014
|
opacity: 0.6,
|