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
|
@@ -584,7 +584,7 @@ function isSupportedFormat(url, mimeType) {
|
|
|
584
584
|
return false;
|
|
585
585
|
}
|
|
586
586
|
function createAdStormPlayer(contentVideo, options) {
|
|
587
|
-
var licenseKey = options.licenseKey, _options_debug = options.debug, debug = _options_debug === void 0 ? false : _options_debug;
|
|
587
|
+
var licenseKey = options.licenseKey, _options_debug = options.debug, debug = _options_debug === void 0 ? false : _options_debug, channelId = options.channelId;
|
|
588
588
|
var adPlaying = false;
|
|
589
589
|
var originalMutedState = false;
|
|
590
590
|
var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
|
|
@@ -790,8 +790,13 @@ function createAdStormPlayer(contentVideo, options) {
|
|
|
790
790
|
adVideoElement.load();
|
|
791
791
|
}
|
|
792
792
|
function buildVastUrl(durationSeconds) {
|
|
793
|
-
var baseUrl = "https://adstorm.co/api
|
|
794
|
-
|
|
793
|
+
var baseUrl = "https://adstorm.co/api/adstorm/nab/vast/pod";
|
|
794
|
+
var params = new URLSearchParams();
|
|
795
|
+
if (channelId != null) {
|
|
796
|
+
params.set("channel_id", String(channelId));
|
|
797
|
+
}
|
|
798
|
+
params.set("duration", String(Math.ceil(durationSeconds)));
|
|
799
|
+
return "".concat(baseUrl, "?").concat(params.toString());
|
|
795
800
|
}
|
|
796
801
|
function parseVastXml(xmlString) {
|
|
797
802
|
var ads = [];
|
|
@@ -2789,10 +2794,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2789
2794
|
logBrowserInfo(config.debugAdTiming);
|
|
2790
2795
|
var browserForAdLayer = detectBrowser();
|
|
2791
2796
|
var isSinglePipeline = browserForAdLayer.isSmartTV || !!this.config.singlePipelineMode;
|
|
2792
|
-
this.adLayer = createAdStormPlayer(this.video, {
|
|
2797
|
+
this.adLayer = createAdStormPlayer(this.video, _object_spread({
|
|
2793
2798
|
licenseKey: this.config.licenseKey || "",
|
|
2794
2799
|
debug: !!config.debugAdTiming
|
|
2795
|
-
}
|
|
2800
|
+
}, this.config.channelId != null && {
|
|
2801
|
+
channelId: this.config.channelId
|
|
2802
|
+
}));
|
|
2796
2803
|
this.adLayer.updateOptions({
|
|
2797
2804
|
continueLiveStreamDuringAds: !isSinglePipeline && this.shouldContinueLiveStreamDuringAds()
|
|
2798
2805
|
});
|
|
@@ -3044,31 +3051,34 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3044
3051
|
this.hls.on(import_hls.default.Events.FRAG_CHANGED, function(_evt, data) {
|
|
3045
3052
|
var frag = data === null || data === void 0 ? void 0 : data.frag;
|
|
3046
3053
|
if (!frag) return;
|
|
3047
|
-
if (_this.lastAdInsertionPoint && !_this.inAdBreak &&
|
|
3054
|
+
if (_this.lastAdInsertionPoint && !_this.inAdBreak && _this.lastAdInsertionPoint.updated_at !== _this.processedAdInsertionUpdatedAt) {
|
|
3048
3055
|
var segmentName = _this.lastAdInsertionPoint.segment_ts_name;
|
|
3049
3056
|
if (_this.fragmentMatchesSegment(frag, segmentName)) {
|
|
3050
|
-
var _ref;
|
|
3057
|
+
var _ref, _ref1;
|
|
3058
|
+
var _this_pendingAdBreak;
|
|
3051
3059
|
_this.processedAdInsertionUpdatedAt = _this.lastAdInsertionPoint.updated_at;
|
|
3052
3060
|
var offsetMs = (_this.lastAdInsertionPoint.offset_seconds || 0) * 1e3;
|
|
3061
|
+
var durationSeconds = (_ref = (_this_pendingAdBreak = _this.pendingAdBreak) === null || _this_pendingAdBreak === void 0 ? void 0 : _this_pendingAdBreak.durationSeconds) !== null && _ref !== void 0 ? _ref : 60;
|
|
3062
|
+
var withPrefetch = _this.pendingAdBreak != null;
|
|
3053
3063
|
_this.pushAdInsertionDebug("segment_playing", segmentName, {
|
|
3054
3064
|
offsetSeconds: _this.lastAdInsertionPoint.offset_seconds,
|
|
3055
|
-
detail: "sn=".concat((
|
|
3065
|
+
detail: "sn=".concat((_ref1 = frag === null || frag === void 0 ? void 0 : frag.sn) !== null && _ref1 !== void 0 ? _ref1 : "?").concat(withPrefetch ? " (prefetch active)" : "")
|
|
3056
3066
|
});
|
|
3057
3067
|
if (_this.config.debugAdTiming) {
|
|
3058
|
-
console.log('[StormcloudVideoPlayer] Ad insertion segment "'.concat(segmentName, '" now playing — scheduling ad start in ').concat(offsetMs, "ms"));
|
|
3068
|
+
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)" : ""));
|
|
3059
3069
|
}
|
|
3060
3070
|
_this.pushAdInsertionDebug("ad_scheduled", segmentName, {
|
|
3061
3071
|
offsetSeconds: _this.lastAdInsertionPoint.offset_seconds,
|
|
3062
|
-
detail: "in ".concat(offsetMs, "ms, dur=
|
|
3072
|
+
detail: "in ".concat(offsetMs, "ms, dur=").concat(durationSeconds, "s").concat(withPrefetch ? " (with prefetch)" : "")
|
|
3063
3073
|
});
|
|
3064
3074
|
_this.clearAdInsertionOffsetTimer();
|
|
3065
3075
|
_this.adInsertionOffsetTimerId = window.setTimeout(function() {
|
|
3066
3076
|
_this.adInsertionOffsetTimerId = void 0;
|
|
3067
3077
|
if (_this.inAdBreak) return;
|
|
3068
3078
|
_this.pushAdInsertionDebug("ad_triggered", segmentName, {
|
|
3069
|
-
detail: "ad break started (
|
|
3079
|
+
detail: "ad break started (".concat(durationSeconds, "s").concat(withPrefetch ? ", with prefetch" : "", ")")
|
|
3070
3080
|
});
|
|
3071
|
-
void _this.handleAdStart(
|
|
3081
|
+
void _this.handleAdStart(durationSeconds);
|
|
3072
3082
|
}, offsetMs);
|
|
3073
3083
|
}
|
|
3074
3084
|
}
|
|
@@ -3936,7 +3946,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3936
3946
|
this.pushAdInsertionDebug("api_response", data.segment_ts_name, {
|
|
3937
3947
|
offsetSeconds: data.offset_seconds,
|
|
3938
3948
|
updatedAt: data.updated_at,
|
|
3939
|
-
detail: "ch=".concat(data.channel_id
|
|
3949
|
+
detail: "ch=".concat(data.channel_id)
|
|
3940
3950
|
});
|
|
3941
3951
|
if (segmentChanged && (this.pendingAdBreak || this.adInsertionOffsetTimerId != null)) {
|
|
3942
3952
|
this.clearAdInsertionOffsetTimer();
|