stormcloud-video-player 0.7.23 → 0.7.25
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 +27 -15
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +2 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +27 -15
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +23 -13
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/players/HlsPlayer.cjs +23 -13
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +23 -13
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/adstormPlayer.cjs +8 -3
- package/lib/sdk/adstormPlayer.cjs.map +1 -1
- package/lib/sdk/adstormPlayer.d.cts +2 -1
- package/lib/{types-DrBGHN4q.d.cts → types-CIHDHY7A.d.cts} +1 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +27 -15
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/package.json +1 -1
|
@@ -570,7 +570,7 @@ function isSupportedFormat(url, mimeType) {
|
|
|
570
570
|
return false;
|
|
571
571
|
}
|
|
572
572
|
function createAdStormPlayer(contentVideo, options) {
|
|
573
|
-
var licenseKey = options.licenseKey, _options_debug = options.debug, debug = _options_debug === void 0 ? false : _options_debug;
|
|
573
|
+
var licenseKey = options.licenseKey, _options_debug = options.debug, debug = _options_debug === void 0 ? false : _options_debug, channelId = options.channelId;
|
|
574
574
|
var adPlaying = false;
|
|
575
575
|
var originalMutedState = false;
|
|
576
576
|
var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
|
|
@@ -776,8 +776,13 @@ function createAdStormPlayer(contentVideo, options) {
|
|
|
776
776
|
adVideoElement.load();
|
|
777
777
|
}
|
|
778
778
|
function buildVastUrl(durationSeconds) {
|
|
779
|
-
var baseUrl = "https://adstorm.co/api
|
|
780
|
-
|
|
779
|
+
var baseUrl = "https://adstorm.co/api/adstorm/nab/vast/pod";
|
|
780
|
+
var params = new URLSearchParams();
|
|
781
|
+
if (channelId != null) {
|
|
782
|
+
params.set("channel_id", String(channelId));
|
|
783
|
+
}
|
|
784
|
+
params.set("duration", String(Math.ceil(durationSeconds)));
|
|
785
|
+
return "".concat(baseUrl, "?").concat(params.toString());
|
|
781
786
|
}
|
|
782
787
|
function parseVastXml(xmlString) {
|
|
783
788
|
var ads = [];
|
|
@@ -2775,10 +2780,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2775
2780
|
logBrowserInfo(config.debugAdTiming);
|
|
2776
2781
|
var browserForAdLayer = detectBrowser();
|
|
2777
2782
|
var isSinglePipeline = browserForAdLayer.isSmartTV || !!this.config.singlePipelineMode;
|
|
2778
|
-
this.adLayer = createAdStormPlayer(this.video, {
|
|
2783
|
+
this.adLayer = createAdStormPlayer(this.video, _object_spread({
|
|
2779
2784
|
licenseKey: this.config.licenseKey || "",
|
|
2780
2785
|
debug: !!config.debugAdTiming
|
|
2781
|
-
}
|
|
2786
|
+
}, this.config.channelId != null && {
|
|
2787
|
+
channelId: this.config.channelId
|
|
2788
|
+
}));
|
|
2782
2789
|
this.adLayer.updateOptions({
|
|
2783
2790
|
continueLiveStreamDuringAds: !isSinglePipeline && this.shouldContinueLiveStreamDuringAds()
|
|
2784
2791
|
});
|
|
@@ -3030,31 +3037,34 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3030
3037
|
this.hls.on(import_hls.default.Events.FRAG_CHANGED, function(_evt, data) {
|
|
3031
3038
|
var frag = data === null || data === void 0 ? void 0 : data.frag;
|
|
3032
3039
|
if (!frag) return;
|
|
3033
|
-
if (_this.lastAdInsertionPoint && !_this.inAdBreak &&
|
|
3040
|
+
if (_this.lastAdInsertionPoint && !_this.inAdBreak && _this.lastAdInsertionPoint.updated_at !== _this.processedAdInsertionUpdatedAt) {
|
|
3034
3041
|
var segmentName = _this.lastAdInsertionPoint.segment_ts_name;
|
|
3035
3042
|
if (_this.fragmentMatchesSegment(frag, segmentName)) {
|
|
3036
|
-
var _ref;
|
|
3043
|
+
var _ref, _ref1;
|
|
3044
|
+
var _this_pendingAdBreak;
|
|
3037
3045
|
_this.processedAdInsertionUpdatedAt = _this.lastAdInsertionPoint.updated_at;
|
|
3038
3046
|
var offsetMs = (_this.lastAdInsertionPoint.offset_seconds || 0) * 1e3;
|
|
3047
|
+
var durationSeconds = (_ref = (_this_pendingAdBreak = _this.pendingAdBreak) === null || _this_pendingAdBreak === void 0 ? void 0 : _this_pendingAdBreak.durationSeconds) !== null && _ref !== void 0 ? _ref : 60;
|
|
3048
|
+
var withPrefetch = _this.pendingAdBreak != null;
|
|
3039
3049
|
_this.pushAdInsertionDebug("segment_playing", segmentName, {
|
|
3040
3050
|
offsetSeconds: _this.lastAdInsertionPoint.offset_seconds,
|
|
3041
|
-
detail: "sn=".concat((
|
|
3051
|
+
detail: "sn=".concat((_ref1 = frag === null || frag === void 0 ? void 0 : frag.sn) !== null && _ref1 !== void 0 ? _ref1 : "?").concat(withPrefetch ? " (prefetch active)" : "")
|
|
3042
3052
|
});
|
|
3043
3053
|
if (_this.config.debugAdTiming) {
|
|
3044
|
-
console.log('[StormcloudVideoPlayer] Ad insertion segment "'.concat(segmentName, '" now playing — scheduling ad start in ').concat(offsetMs, "ms"));
|
|
3054
|
+
console.log('[StormcloudVideoPlayer] Ad insertion segment "'.concat(segmentName, '" now playing — scheduling ad start in ').concat(offsetMs, "ms") + (withPrefetch ? " (prefetch was active, preloaded tokens will be used)" : ""));
|
|
3045
3055
|
}
|
|
3046
3056
|
_this.pushAdInsertionDebug("ad_scheduled", segmentName, {
|
|
3047
3057
|
offsetSeconds: _this.lastAdInsertionPoint.offset_seconds,
|
|
3048
|
-
detail: "in ".concat(offsetMs, "ms, dur=
|
|
3058
|
+
detail: "in ".concat(offsetMs, "ms, dur=").concat(durationSeconds, "s").concat(withPrefetch ? " (with prefetch)" : "")
|
|
3049
3059
|
});
|
|
3050
3060
|
_this.clearAdInsertionOffsetTimer();
|
|
3051
3061
|
_this.adInsertionOffsetTimerId = window.setTimeout(function() {
|
|
3052
3062
|
_this.adInsertionOffsetTimerId = void 0;
|
|
3053
3063
|
if (_this.inAdBreak) return;
|
|
3054
3064
|
_this.pushAdInsertionDebug("ad_triggered", segmentName, {
|
|
3055
|
-
detail: "ad break started (
|
|
3065
|
+
detail: "ad break started (".concat(durationSeconds, "s").concat(withPrefetch ? ", with prefetch" : "", ")")
|
|
3056
3066
|
});
|
|
3057
|
-
void _this.handleAdStart(
|
|
3067
|
+
void _this.handleAdStart(durationSeconds);
|
|
3058
3068
|
}, offsetMs);
|
|
3059
3069
|
}
|
|
3060
3070
|
}
|
|
@@ -3922,7 +3932,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3922
3932
|
this.pushAdInsertionDebug("api_response", data.segment_ts_name, {
|
|
3923
3933
|
offsetSeconds: data.offset_seconds,
|
|
3924
3934
|
updatedAt: data.updated_at,
|
|
3925
|
-
detail: "ch=".concat(data.channel_id
|
|
3935
|
+
detail: "ch=".concat(data.channel_id)
|
|
3926
3936
|
});
|
|
3927
3937
|
if (segmentChanged && (this.pendingAdBreak || this.adInsertionOffsetTimerId != null)) {
|
|
3928
3938
|
this.clearAdInsertionOffsetTimer();
|
|
@@ -7566,8 +7576,10 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
7566
7576
|
if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
|
|
7567
7577
|
if (disableAds !== void 0) cfg.disableAds = disableAds;
|
|
7568
7578
|
cfg.disableFiller = disableFiller !== null && disableFiller !== void 0 ? disableFiller : true;
|
|
7569
|
-
if (adcisionChannelId !== void 0)
|
|
7570
|
-
|
|
7579
|
+
if (adcisionChannelId !== void 0) {
|
|
7580
|
+
cfg.projectId = String(adcisionChannelId);
|
|
7581
|
+
cfg.channelId = adcisionChannelId;
|
|
7582
|
+
} else if (swirlProjectId !== void 0) cfg.projectId = String(swirlProjectId);
|
|
7571
7583
|
var player = new StormcloudVideoPlayer(cfg);
|
|
7572
7584
|
playerRef.current = player;
|
|
7573
7585
|
player.load().then(function() {
|