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
|
@@ -532,7 +532,7 @@ function isSupportedFormat(url, mimeType) {
|
|
|
532
532
|
return false;
|
|
533
533
|
}
|
|
534
534
|
function createAdStormPlayer(contentVideo, options) {
|
|
535
|
-
var licenseKey = options.licenseKey, _options_debug = options.debug, debug = _options_debug === void 0 ? false : _options_debug;
|
|
535
|
+
var licenseKey = options.licenseKey, _options_debug = options.debug, debug = _options_debug === void 0 ? false : _options_debug, channelId = options.channelId;
|
|
536
536
|
var adPlaying = false;
|
|
537
537
|
var originalMutedState = false;
|
|
538
538
|
var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
|
|
@@ -738,8 +738,13 @@ function createAdStormPlayer(contentVideo, options) {
|
|
|
738
738
|
adVideoElement.load();
|
|
739
739
|
}
|
|
740
740
|
function buildVastUrl(durationSeconds) {
|
|
741
|
-
var baseUrl = "https://adstorm.co/api
|
|
742
|
-
|
|
741
|
+
var baseUrl = "https://adstorm.co/api/adstorm/nab/vast/pod";
|
|
742
|
+
var params = new URLSearchParams();
|
|
743
|
+
if (channelId != null) {
|
|
744
|
+
params.set("channel_id", String(channelId));
|
|
745
|
+
}
|
|
746
|
+
params.set("duration", String(Math.ceil(durationSeconds)));
|
|
747
|
+
return "".concat(baseUrl, "?").concat(params.toString());
|
|
743
748
|
}
|
|
744
749
|
function parseVastXml(xmlString) {
|
|
745
750
|
var ads = [];
|
|
@@ -2737,10 +2742,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2737
2742
|
logBrowserInfo(config.debugAdTiming);
|
|
2738
2743
|
var browserForAdLayer = detectBrowser();
|
|
2739
2744
|
var isSinglePipeline = browserForAdLayer.isSmartTV || !!this.config.singlePipelineMode;
|
|
2740
|
-
this.adLayer = createAdStormPlayer(this.video, {
|
|
2745
|
+
this.adLayer = createAdStormPlayer(this.video, _object_spread({
|
|
2741
2746
|
licenseKey: this.config.licenseKey || "",
|
|
2742
2747
|
debug: !!config.debugAdTiming
|
|
2743
|
-
}
|
|
2748
|
+
}, this.config.channelId != null && {
|
|
2749
|
+
channelId: this.config.channelId
|
|
2750
|
+
}));
|
|
2744
2751
|
this.adLayer.updateOptions({
|
|
2745
2752
|
continueLiveStreamDuringAds: !isSinglePipeline && this.shouldContinueLiveStreamDuringAds()
|
|
2746
2753
|
});
|
|
@@ -2992,31 +2999,34 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2992
2999
|
this.hls.on(import_hls.default.Events.FRAG_CHANGED, function(_evt, data) {
|
|
2993
3000
|
var frag = data === null || data === void 0 ? void 0 : data.frag;
|
|
2994
3001
|
if (!frag) return;
|
|
2995
|
-
if (_this.lastAdInsertionPoint && !_this.inAdBreak &&
|
|
3002
|
+
if (_this.lastAdInsertionPoint && !_this.inAdBreak && _this.lastAdInsertionPoint.updated_at !== _this.processedAdInsertionUpdatedAt) {
|
|
2996
3003
|
var segmentName = _this.lastAdInsertionPoint.segment_ts_name;
|
|
2997
3004
|
if (_this.fragmentMatchesSegment(frag, segmentName)) {
|
|
2998
|
-
var _ref;
|
|
3005
|
+
var _ref, _ref1;
|
|
3006
|
+
var _this_pendingAdBreak;
|
|
2999
3007
|
_this.processedAdInsertionUpdatedAt = _this.lastAdInsertionPoint.updated_at;
|
|
3000
3008
|
var offsetMs = (_this.lastAdInsertionPoint.offset_seconds || 0) * 1e3;
|
|
3009
|
+
var durationSeconds = (_ref = (_this_pendingAdBreak = _this.pendingAdBreak) === null || _this_pendingAdBreak === void 0 ? void 0 : _this_pendingAdBreak.durationSeconds) !== null && _ref !== void 0 ? _ref : 60;
|
|
3010
|
+
var withPrefetch = _this.pendingAdBreak != null;
|
|
3001
3011
|
_this.pushAdInsertionDebug("segment_playing", segmentName, {
|
|
3002
3012
|
offsetSeconds: _this.lastAdInsertionPoint.offset_seconds,
|
|
3003
|
-
detail: "sn=".concat((
|
|
3013
|
+
detail: "sn=".concat((_ref1 = frag === null || frag === void 0 ? void 0 : frag.sn) !== null && _ref1 !== void 0 ? _ref1 : "?").concat(withPrefetch ? " (prefetch active)" : "")
|
|
3004
3014
|
});
|
|
3005
3015
|
if (_this.config.debugAdTiming) {
|
|
3006
|
-
console.log('[StormcloudVideoPlayer] Ad insertion segment "'.concat(segmentName, '" now playing — scheduling ad start in ').concat(offsetMs, "ms"));
|
|
3016
|
+
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)" : ""));
|
|
3007
3017
|
}
|
|
3008
3018
|
_this.pushAdInsertionDebug("ad_scheduled", segmentName, {
|
|
3009
3019
|
offsetSeconds: _this.lastAdInsertionPoint.offset_seconds,
|
|
3010
|
-
detail: "in ".concat(offsetMs, "ms, dur=
|
|
3020
|
+
detail: "in ".concat(offsetMs, "ms, dur=").concat(durationSeconds, "s").concat(withPrefetch ? " (with prefetch)" : "")
|
|
3011
3021
|
});
|
|
3012
3022
|
_this.clearAdInsertionOffsetTimer();
|
|
3013
3023
|
_this.adInsertionOffsetTimerId = window.setTimeout(function() {
|
|
3014
3024
|
_this.adInsertionOffsetTimerId = void 0;
|
|
3015
3025
|
if (_this.inAdBreak) return;
|
|
3016
3026
|
_this.pushAdInsertionDebug("ad_triggered", segmentName, {
|
|
3017
|
-
detail: "ad break started (
|
|
3027
|
+
detail: "ad break started (".concat(durationSeconds, "s").concat(withPrefetch ? ", with prefetch" : "", ")")
|
|
3018
3028
|
});
|
|
3019
|
-
void _this.handleAdStart(
|
|
3029
|
+
void _this.handleAdStart(durationSeconds);
|
|
3020
3030
|
}, offsetMs);
|
|
3021
3031
|
}
|
|
3022
3032
|
}
|
|
@@ -3884,7 +3894,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3884
3894
|
this.pushAdInsertionDebug("api_response", data.segment_ts_name, {
|
|
3885
3895
|
offsetSeconds: data.offset_seconds,
|
|
3886
3896
|
updatedAt: data.updated_at,
|
|
3887
|
-
detail: "ch=".concat(data.channel_id
|
|
3897
|
+
detail: "ch=".concat(data.channel_id)
|
|
3888
3898
|
});
|
|
3889
3899
|
if (segmentChanged && (this.pendingAdBreak || this.adInsertionOffsetTimerId != null)) {
|
|
3890
3900
|
this.clearAdInsertionOffsetTimer();
|