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
package/lib/players/index.cjs
CHANGED
|
@@ -481,9 +481,13 @@ function createImaController(video, options) {
|
|
|
481
481
|
adsLoader.addEventListener(
|
|
482
482
|
google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
|
|
483
483
|
(evt) => {
|
|
484
|
-
console.log(
|
|
484
|
+
console.log(
|
|
485
|
+
"[IMA] Ads manager loaded - enabling preloading for continuous playback"
|
|
486
|
+
);
|
|
485
487
|
try {
|
|
486
|
-
|
|
488
|
+
const adsRenderingSettings = new google.ima.AdsRenderingSettings();
|
|
489
|
+
adsRenderingSettings.enablePreloading = true;
|
|
490
|
+
adsManager = evt.getAdsManager(video, adsRenderingSettings);
|
|
487
491
|
const AdEvent = google.ima.AdEvent.Type;
|
|
488
492
|
const AdErrorEvent = google.ima.AdErrorEvent.Type;
|
|
489
493
|
adsManager.addEventListener(
|
|
@@ -2216,7 +2220,7 @@ var StormcloudVideoPlayer = class {
|
|
|
2216
2220
|
this.video.volume = 0;
|
|
2217
2221
|
if (this.config.debugAdTiming) {
|
|
2218
2222
|
console.log(
|
|
2219
|
-
`[StormcloudVideoPlayer] Playing next ad in pod (${this.currentAdIndex}/${this.totalAdsInBreak}) -
|
|
2223
|
+
`[StormcloudVideoPlayer] Playing next ad in pod (${this.currentAdIndex}/${this.totalAdsInBreak}) - IMMEDIATELY starting next ad`
|
|
2220
2224
|
);
|
|
2221
2225
|
}
|
|
2222
2226
|
this.playSingleAd(next).catch(() => {
|
|
@@ -2801,25 +2805,21 @@ var StormcloudVideoPlayer = class {
|
|
|
2801
2805
|
this.video.currentTime * 1e3
|
|
2802
2806
|
);
|
|
2803
2807
|
const tags = this.selectVastTagsForBreak(scheduled);
|
|
2804
|
-
let
|
|
2808
|
+
let vastTagUrls = [];
|
|
2805
2809
|
if (this.apiVastTagUrl) {
|
|
2806
|
-
|
|
2807
|
-
this.adPodQueue = [];
|
|
2808
|
-
this.currentAdIndex = 0;
|
|
2809
|
-
this.totalAdsInBreak = 1;
|
|
2810
|
+
vastTagUrls = [this.apiVastTagUrl];
|
|
2810
2811
|
if (this.config.debugAdTiming) {
|
|
2811
|
-
console.log(
|
|
2812
|
+
console.log(
|
|
2813
|
+
"[StormcloudVideoPlayer] Using VAST endpoint:",
|
|
2814
|
+
this.apiVastTagUrl
|
|
2815
|
+
);
|
|
2812
2816
|
}
|
|
2813
2817
|
} else if (tags && tags.length > 0) {
|
|
2814
|
-
|
|
2815
|
-
const rest = tags.slice(1);
|
|
2816
|
-
this.adPodQueue = rest;
|
|
2817
|
-
this.currentAdIndex = 0;
|
|
2818
|
-
this.totalAdsInBreak = tags.length;
|
|
2818
|
+
vastTagUrls = tags;
|
|
2819
2819
|
if (this.config.debugAdTiming) {
|
|
2820
2820
|
console.log(
|
|
2821
|
-
"[StormcloudVideoPlayer] Using scheduled VAST
|
|
2822
|
-
|
|
2821
|
+
"[StormcloudVideoPlayer] Using scheduled VAST tags (count: " + tags.length + "):",
|
|
2822
|
+
tags
|
|
2823
2823
|
);
|
|
2824
2824
|
}
|
|
2825
2825
|
} else {
|
|
@@ -2828,16 +2828,23 @@ var StormcloudVideoPlayer = class {
|
|
|
2828
2828
|
}
|
|
2829
2829
|
return;
|
|
2830
2830
|
}
|
|
2831
|
-
if (
|
|
2831
|
+
if (vastTagUrls.length > 0) {
|
|
2832
2832
|
this.inAdBreak = true;
|
|
2833
2833
|
this.showAds = true;
|
|
2834
|
-
this.currentAdIndex
|
|
2834
|
+
this.currentAdIndex = 0;
|
|
2835
|
+
this.totalAdsInBreak = vastTagUrls.length;
|
|
2836
|
+
this.adPodQueue = [...vastTagUrls];
|
|
2837
|
+
if (this.config.debugAdTiming) {
|
|
2838
|
+
console.log(
|
|
2839
|
+
`[StormcloudVideoPlayer] Starting ad pod with ${vastTagUrls.length} ads - will play continuously`
|
|
2840
|
+
);
|
|
2841
|
+
}
|
|
2835
2842
|
try {
|
|
2836
|
-
await this.
|
|
2843
|
+
await this.playAdPod();
|
|
2837
2844
|
} catch (error) {
|
|
2838
2845
|
if (this.config.debugAdTiming) {
|
|
2839
2846
|
console.error(
|
|
2840
|
-
"[StormcloudVideoPlayer] Ad playback failed
|
|
2847
|
+
"[StormcloudVideoPlayer] Ad pod playback failed:",
|
|
2841
2848
|
error
|
|
2842
2849
|
);
|
|
2843
2850
|
}
|
|
@@ -2850,6 +2857,22 @@ var StormcloudVideoPlayer = class {
|
|
|
2850
2857
|
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
2851
2858
|
}
|
|
2852
2859
|
}
|
|
2860
|
+
async playAdPod() {
|
|
2861
|
+
if (this.adPodQueue.length === 0) {
|
|
2862
|
+
if (this.config.debugAdTiming) {
|
|
2863
|
+
console.log("[StormcloudVideoPlayer] No ads in pod to play");
|
|
2864
|
+
}
|
|
2865
|
+
return;
|
|
2866
|
+
}
|
|
2867
|
+
const firstAd = this.adPodQueue.shift();
|
|
2868
|
+
this.currentAdIndex++;
|
|
2869
|
+
if (this.config.debugAdTiming) {
|
|
2870
|
+
console.log(
|
|
2871
|
+
`[StormcloudVideoPlayer] Playing ad ${this.currentAdIndex}/${this.totalAdsInBreak}`
|
|
2872
|
+
);
|
|
2873
|
+
}
|
|
2874
|
+
await this.playSingleAd(firstAd);
|
|
2875
|
+
}
|
|
2853
2876
|
findCurrentOrNextBreak(nowMs) {
|
|
2854
2877
|
var _a;
|
|
2855
2878
|
const schedule = [];
|