stormcloud-video-player 0.2.23 → 0.2.24
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 +43 -20
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +43 -20
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +43 -20
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -0
- package/lib/players/HlsPlayer.cjs +43 -20
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +43 -20
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/ima.cjs +6 -2
- package/lib/sdk/ima.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +43 -20
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -439,9 +439,13 @@ function createImaController(video, options) {
|
|
|
439
439
|
adsLoader.addEventListener(
|
|
440
440
|
google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
|
|
441
441
|
(evt) => {
|
|
442
|
-
console.log(
|
|
442
|
+
console.log(
|
|
443
|
+
"[IMA] Ads manager loaded - enabling preloading for continuous playback"
|
|
444
|
+
);
|
|
443
445
|
try {
|
|
444
|
-
|
|
446
|
+
const adsRenderingSettings = new google.ima.AdsRenderingSettings();
|
|
447
|
+
adsRenderingSettings.enablePreloading = true;
|
|
448
|
+
adsManager = evt.getAdsManager(video, adsRenderingSettings);
|
|
445
449
|
const AdEvent = google.ima.AdEvent.Type;
|
|
446
450
|
const AdErrorEvent = google.ima.AdErrorEvent.Type;
|
|
447
451
|
adsManager.addEventListener(
|
|
@@ -2174,7 +2178,7 @@ var StormcloudVideoPlayer = class {
|
|
|
2174
2178
|
this.video.volume = 0;
|
|
2175
2179
|
if (this.config.debugAdTiming) {
|
|
2176
2180
|
console.log(
|
|
2177
|
-
`[StormcloudVideoPlayer] Playing next ad in pod (${this.currentAdIndex}/${this.totalAdsInBreak}) -
|
|
2181
|
+
`[StormcloudVideoPlayer] Playing next ad in pod (${this.currentAdIndex}/${this.totalAdsInBreak}) - IMMEDIATELY starting next ad`
|
|
2178
2182
|
);
|
|
2179
2183
|
}
|
|
2180
2184
|
this.playSingleAd(next).catch(() => {
|
|
@@ -2759,25 +2763,21 @@ var StormcloudVideoPlayer = class {
|
|
|
2759
2763
|
this.video.currentTime * 1e3
|
|
2760
2764
|
);
|
|
2761
2765
|
const tags = this.selectVastTagsForBreak(scheduled);
|
|
2762
|
-
let
|
|
2766
|
+
let vastTagUrls = [];
|
|
2763
2767
|
if (this.apiVastTagUrl) {
|
|
2764
|
-
|
|
2765
|
-
this.adPodQueue = [];
|
|
2766
|
-
this.currentAdIndex = 0;
|
|
2767
|
-
this.totalAdsInBreak = 1;
|
|
2768
|
+
vastTagUrls = [this.apiVastTagUrl];
|
|
2768
2769
|
if (this.config.debugAdTiming) {
|
|
2769
|
-
console.log(
|
|
2770
|
+
console.log(
|
|
2771
|
+
"[StormcloudVideoPlayer] Using VAST endpoint:",
|
|
2772
|
+
this.apiVastTagUrl
|
|
2773
|
+
);
|
|
2770
2774
|
}
|
|
2771
2775
|
} else if (tags && tags.length > 0) {
|
|
2772
|
-
|
|
2773
|
-
const rest = tags.slice(1);
|
|
2774
|
-
this.adPodQueue = rest;
|
|
2775
|
-
this.currentAdIndex = 0;
|
|
2776
|
-
this.totalAdsInBreak = tags.length;
|
|
2776
|
+
vastTagUrls = tags;
|
|
2777
2777
|
if (this.config.debugAdTiming) {
|
|
2778
2778
|
console.log(
|
|
2779
|
-
"[StormcloudVideoPlayer] Using scheduled VAST
|
|
2780
|
-
|
|
2779
|
+
"[StormcloudVideoPlayer] Using scheduled VAST tags (count: " + tags.length + "):",
|
|
2780
|
+
tags
|
|
2781
2781
|
);
|
|
2782
2782
|
}
|
|
2783
2783
|
} else {
|
|
@@ -2786,16 +2786,23 @@ var StormcloudVideoPlayer = class {
|
|
|
2786
2786
|
}
|
|
2787
2787
|
return;
|
|
2788
2788
|
}
|
|
2789
|
-
if (
|
|
2789
|
+
if (vastTagUrls.length > 0) {
|
|
2790
2790
|
this.inAdBreak = true;
|
|
2791
2791
|
this.showAds = true;
|
|
2792
|
-
this.currentAdIndex
|
|
2792
|
+
this.currentAdIndex = 0;
|
|
2793
|
+
this.totalAdsInBreak = vastTagUrls.length;
|
|
2794
|
+
this.adPodQueue = [...vastTagUrls];
|
|
2795
|
+
if (this.config.debugAdTiming) {
|
|
2796
|
+
console.log(
|
|
2797
|
+
`[StormcloudVideoPlayer] Starting ad pod with ${vastTagUrls.length} ads - will play continuously`
|
|
2798
|
+
);
|
|
2799
|
+
}
|
|
2793
2800
|
try {
|
|
2794
|
-
await this.
|
|
2801
|
+
await this.playAdPod();
|
|
2795
2802
|
} catch (error) {
|
|
2796
2803
|
if (this.config.debugAdTiming) {
|
|
2797
2804
|
console.error(
|
|
2798
|
-
"[StormcloudVideoPlayer] Ad playback failed
|
|
2805
|
+
"[StormcloudVideoPlayer] Ad pod playback failed:",
|
|
2799
2806
|
error
|
|
2800
2807
|
);
|
|
2801
2808
|
}
|
|
@@ -2808,6 +2815,22 @@ var StormcloudVideoPlayer = class {
|
|
|
2808
2815
|
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
2809
2816
|
}
|
|
2810
2817
|
}
|
|
2818
|
+
async playAdPod() {
|
|
2819
|
+
if (this.adPodQueue.length === 0) {
|
|
2820
|
+
if (this.config.debugAdTiming) {
|
|
2821
|
+
console.log("[StormcloudVideoPlayer] No ads in pod to play");
|
|
2822
|
+
}
|
|
2823
|
+
return;
|
|
2824
|
+
}
|
|
2825
|
+
const firstAd = this.adPodQueue.shift();
|
|
2826
|
+
this.currentAdIndex++;
|
|
2827
|
+
if (this.config.debugAdTiming) {
|
|
2828
|
+
console.log(
|
|
2829
|
+
`[StormcloudVideoPlayer] Playing ad ${this.currentAdIndex}/${this.totalAdsInBreak}`
|
|
2830
|
+
);
|
|
2831
|
+
}
|
|
2832
|
+
await this.playSingleAd(firstAd);
|
|
2833
|
+
}
|
|
2811
2834
|
findCurrentOrNextBreak(nowMs) {
|
|
2812
2835
|
var _a;
|
|
2813
2836
|
const schedule = [];
|