stormcloud-video-player 0.2.16 → 0.2.17
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 +38 -2
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +38 -2
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +38 -2
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +38 -2
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +38 -2
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/ima.cjs +38 -2
- package/lib/sdk/ima.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +38 -2
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -284,6 +284,14 @@ function createImaController(video, options) {
|
|
|
284
284
|
function makeAdsRequest(google, vastTagUrl) {
|
|
285
285
|
const adsRequest = new google.ima.AdsRequest();
|
|
286
286
|
adsRequest.adTagUrl = vastTagUrl;
|
|
287
|
+
const videoWidth = video.offsetWidth || video.clientWidth || 640;
|
|
288
|
+
const videoHeight = video.offsetHeight || video.clientHeight || 360;
|
|
289
|
+
adsRequest.linearAdSlotWidth = videoWidth;
|
|
290
|
+
adsRequest.linearAdSlotHeight = videoHeight;
|
|
291
|
+
adsRequest.nonLinearAdSlotWidth = videoWidth;
|
|
292
|
+
adsRequest.nonLinearAdSlotHeight = videoHeight;
|
|
293
|
+
adsRequest.vastLoadTimeout = 5e3;
|
|
294
|
+
console.log(`[IMA] Ads request dimensions: ${videoWidth}x${videoHeight}`);
|
|
287
295
|
adsLoader.requestAds(adsRequest);
|
|
288
296
|
}
|
|
289
297
|
function destroyAdsManager() {
|
|
@@ -330,6 +338,18 @@ function createImaController(video, options) {
|
|
|
330
338
|
},
|
|
331
339
|
async requestAds(vastTagUrl) {
|
|
332
340
|
console.log("[IMA] Requesting ads:", vastTagUrl);
|
|
341
|
+
if (!vastTagUrl || vastTagUrl.trim() === "") {
|
|
342
|
+
const error = new Error("VAST tag URL is empty or undefined");
|
|
343
|
+
console.warn("[IMA]", error.message);
|
|
344
|
+
return Promise.reject(error);
|
|
345
|
+
}
|
|
346
|
+
try {
|
|
347
|
+
new URL(vastTagUrl);
|
|
348
|
+
} catch (e) {
|
|
349
|
+
const error = new Error(`Invalid VAST tag URL format: ${vastTagUrl}`);
|
|
350
|
+
console.warn("[IMA]", error.message);
|
|
351
|
+
return Promise.reject(error);
|
|
352
|
+
}
|
|
333
353
|
if (adPlaying) {
|
|
334
354
|
console.warn(
|
|
335
355
|
"[IMA] Cannot request new ads while an ad is playing. Call stop() first."
|
|
@@ -391,6 +411,18 @@ function createImaController(video, options) {
|
|
|
391
411
|
);
|
|
392
412
|
}
|
|
393
413
|
}
|
|
414
|
+
const videoWidth = video.offsetWidth || video.clientWidth;
|
|
415
|
+
const videoHeight = video.offsetHeight || video.clientHeight;
|
|
416
|
+
if (!videoWidth || !videoHeight || videoWidth === 0 || videoHeight === 0) {
|
|
417
|
+
const error = new Error(
|
|
418
|
+
`Invalid video dimensions: ${videoWidth}x${videoHeight}. Cannot initialize ads.`
|
|
419
|
+
);
|
|
420
|
+
console.warn("[IMA]", error.message);
|
|
421
|
+
currentReject == null ? void 0 : currentReject(error);
|
|
422
|
+
adsLoadedReject = void 0;
|
|
423
|
+
adsLoadedResolve = void 0;
|
|
424
|
+
return Promise.reject(error);
|
|
425
|
+
}
|
|
394
426
|
if (!adsLoader) {
|
|
395
427
|
console.log("[IMA] Creating ads loader");
|
|
396
428
|
const adsLoaderCls = new google.ima.AdsLoader(adDisplayContainer);
|
|
@@ -439,7 +471,9 @@ function createImaController(video, options) {
|
|
|
439
471
|
emit("ad_error");
|
|
440
472
|
if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
441
473
|
if (video.paused) {
|
|
442
|
-
console.log(
|
|
474
|
+
console.log(
|
|
475
|
+
"[IMA] Resuming paused video after ad error"
|
|
476
|
+
);
|
|
443
477
|
(_a = video.play()) == null ? void 0 : _a.catch(() => {
|
|
444
478
|
});
|
|
445
479
|
}
|
|
@@ -541,7 +575,9 @@ function createImaController(video, options) {
|
|
|
541
575
|
}
|
|
542
576
|
if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
543
577
|
if (video.paused) {
|
|
544
|
-
console.log(
|
|
578
|
+
console.log(
|
|
579
|
+
"[IMA] Resuming paused video after setup error"
|
|
580
|
+
);
|
|
545
581
|
video.play().catch(() => {
|
|
546
582
|
});
|
|
547
583
|
}
|