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/index.cjs
CHANGED
|
@@ -506,9 +506,13 @@ function createImaController(video, options) {
|
|
|
506
506
|
adsLoader.addEventListener(
|
|
507
507
|
google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
|
|
508
508
|
(evt) => {
|
|
509
|
-
console.log(
|
|
509
|
+
console.log(
|
|
510
|
+
"[IMA] Ads manager loaded - enabling preloading for continuous playback"
|
|
511
|
+
);
|
|
510
512
|
try {
|
|
511
|
-
|
|
513
|
+
const adsRenderingSettings = new google.ima.AdsRenderingSettings();
|
|
514
|
+
adsRenderingSettings.enablePreloading = true;
|
|
515
|
+
adsManager = evt.getAdsManager(video, adsRenderingSettings);
|
|
512
516
|
const AdEvent = google.ima.AdEvent.Type;
|
|
513
517
|
const AdErrorEvent = google.ima.AdErrorEvent.Type;
|
|
514
518
|
adsManager.addEventListener(
|
|
@@ -2241,7 +2245,7 @@ var StormcloudVideoPlayer = class {
|
|
|
2241
2245
|
this.video.volume = 0;
|
|
2242
2246
|
if (this.config.debugAdTiming) {
|
|
2243
2247
|
console.log(
|
|
2244
|
-
`[StormcloudVideoPlayer] Playing next ad in pod (${this.currentAdIndex}/${this.totalAdsInBreak}) -
|
|
2248
|
+
`[StormcloudVideoPlayer] Playing next ad in pod (${this.currentAdIndex}/${this.totalAdsInBreak}) - IMMEDIATELY starting next ad`
|
|
2245
2249
|
);
|
|
2246
2250
|
}
|
|
2247
2251
|
this.playSingleAd(next).catch(() => {
|
|
@@ -2826,25 +2830,21 @@ var StormcloudVideoPlayer = class {
|
|
|
2826
2830
|
this.video.currentTime * 1e3
|
|
2827
2831
|
);
|
|
2828
2832
|
const tags = this.selectVastTagsForBreak(scheduled);
|
|
2829
|
-
let
|
|
2833
|
+
let vastTagUrls = [];
|
|
2830
2834
|
if (this.apiVastTagUrl) {
|
|
2831
|
-
|
|
2832
|
-
this.adPodQueue = [];
|
|
2833
|
-
this.currentAdIndex = 0;
|
|
2834
|
-
this.totalAdsInBreak = 1;
|
|
2835
|
+
vastTagUrls = [this.apiVastTagUrl];
|
|
2835
2836
|
if (this.config.debugAdTiming) {
|
|
2836
|
-
console.log(
|
|
2837
|
+
console.log(
|
|
2838
|
+
"[StormcloudVideoPlayer] Using VAST endpoint:",
|
|
2839
|
+
this.apiVastTagUrl
|
|
2840
|
+
);
|
|
2837
2841
|
}
|
|
2838
2842
|
} else if (tags && tags.length > 0) {
|
|
2839
|
-
|
|
2840
|
-
const rest = tags.slice(1);
|
|
2841
|
-
this.adPodQueue = rest;
|
|
2842
|
-
this.currentAdIndex = 0;
|
|
2843
|
-
this.totalAdsInBreak = tags.length;
|
|
2843
|
+
vastTagUrls = tags;
|
|
2844
2844
|
if (this.config.debugAdTiming) {
|
|
2845
2845
|
console.log(
|
|
2846
|
-
"[StormcloudVideoPlayer] Using scheduled VAST
|
|
2847
|
-
|
|
2846
|
+
"[StormcloudVideoPlayer] Using scheduled VAST tags (count: " + tags.length + "):",
|
|
2847
|
+
tags
|
|
2848
2848
|
);
|
|
2849
2849
|
}
|
|
2850
2850
|
} else {
|
|
@@ -2853,16 +2853,23 @@ var StormcloudVideoPlayer = class {
|
|
|
2853
2853
|
}
|
|
2854
2854
|
return;
|
|
2855
2855
|
}
|
|
2856
|
-
if (
|
|
2856
|
+
if (vastTagUrls.length > 0) {
|
|
2857
2857
|
this.inAdBreak = true;
|
|
2858
2858
|
this.showAds = true;
|
|
2859
|
-
this.currentAdIndex
|
|
2859
|
+
this.currentAdIndex = 0;
|
|
2860
|
+
this.totalAdsInBreak = vastTagUrls.length;
|
|
2861
|
+
this.adPodQueue = [...vastTagUrls];
|
|
2862
|
+
if (this.config.debugAdTiming) {
|
|
2863
|
+
console.log(
|
|
2864
|
+
`[StormcloudVideoPlayer] Starting ad pod with ${vastTagUrls.length} ads - will play continuously`
|
|
2865
|
+
);
|
|
2866
|
+
}
|
|
2860
2867
|
try {
|
|
2861
|
-
await this.
|
|
2868
|
+
await this.playAdPod();
|
|
2862
2869
|
} catch (error) {
|
|
2863
2870
|
if (this.config.debugAdTiming) {
|
|
2864
2871
|
console.error(
|
|
2865
|
-
"[StormcloudVideoPlayer] Ad playback failed
|
|
2872
|
+
"[StormcloudVideoPlayer] Ad pod playback failed:",
|
|
2866
2873
|
error
|
|
2867
2874
|
);
|
|
2868
2875
|
}
|
|
@@ -2875,6 +2882,22 @@ var StormcloudVideoPlayer = class {
|
|
|
2875
2882
|
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
2876
2883
|
}
|
|
2877
2884
|
}
|
|
2885
|
+
async playAdPod() {
|
|
2886
|
+
if (this.adPodQueue.length === 0) {
|
|
2887
|
+
if (this.config.debugAdTiming) {
|
|
2888
|
+
console.log("[StormcloudVideoPlayer] No ads in pod to play");
|
|
2889
|
+
}
|
|
2890
|
+
return;
|
|
2891
|
+
}
|
|
2892
|
+
const firstAd = this.adPodQueue.shift();
|
|
2893
|
+
this.currentAdIndex++;
|
|
2894
|
+
if (this.config.debugAdTiming) {
|
|
2895
|
+
console.log(
|
|
2896
|
+
`[StormcloudVideoPlayer] Playing ad ${this.currentAdIndex}/${this.totalAdsInBreak}`
|
|
2897
|
+
);
|
|
2898
|
+
}
|
|
2899
|
+
await this.playSingleAd(firstAd);
|
|
2900
|
+
}
|
|
2878
2901
|
findCurrentOrNextBreak(nowMs) {
|
|
2879
2902
|
var _a;
|
|
2880
2903
|
const schedule = [];
|