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
|
@@ -287,6 +287,14 @@ function createImaController(video, options) {
|
|
|
287
287
|
function makeAdsRequest(google, vastTagUrl) {
|
|
288
288
|
const adsRequest = new google.ima.AdsRequest();
|
|
289
289
|
adsRequest.adTagUrl = vastTagUrl;
|
|
290
|
+
const videoWidth = video.offsetWidth || video.clientWidth || 640;
|
|
291
|
+
const videoHeight = video.offsetHeight || video.clientHeight || 360;
|
|
292
|
+
adsRequest.linearAdSlotWidth = videoWidth;
|
|
293
|
+
adsRequest.linearAdSlotHeight = videoHeight;
|
|
294
|
+
adsRequest.nonLinearAdSlotWidth = videoWidth;
|
|
295
|
+
adsRequest.nonLinearAdSlotHeight = videoHeight;
|
|
296
|
+
adsRequest.vastLoadTimeout = 5e3;
|
|
297
|
+
console.log(`[IMA] Ads request dimensions: ${videoWidth}x${videoHeight}`);
|
|
290
298
|
adsLoader.requestAds(adsRequest);
|
|
291
299
|
}
|
|
292
300
|
function destroyAdsManager() {
|
|
@@ -333,6 +341,18 @@ function createImaController(video, options) {
|
|
|
333
341
|
},
|
|
334
342
|
async requestAds(vastTagUrl) {
|
|
335
343
|
console.log("[IMA] Requesting ads:", vastTagUrl);
|
|
344
|
+
if (!vastTagUrl || vastTagUrl.trim() === "") {
|
|
345
|
+
const error = new Error("VAST tag URL is empty or undefined");
|
|
346
|
+
console.warn("[IMA]", error.message);
|
|
347
|
+
return Promise.reject(error);
|
|
348
|
+
}
|
|
349
|
+
try {
|
|
350
|
+
new URL(vastTagUrl);
|
|
351
|
+
} catch (e) {
|
|
352
|
+
const error = new Error(`Invalid VAST tag URL format: ${vastTagUrl}`);
|
|
353
|
+
console.warn("[IMA]", error.message);
|
|
354
|
+
return Promise.reject(error);
|
|
355
|
+
}
|
|
336
356
|
if (adPlaying) {
|
|
337
357
|
console.warn(
|
|
338
358
|
"[IMA] Cannot request new ads while an ad is playing. Call stop() first."
|
|
@@ -394,6 +414,18 @@ function createImaController(video, options) {
|
|
|
394
414
|
);
|
|
395
415
|
}
|
|
396
416
|
}
|
|
417
|
+
const videoWidth = video.offsetWidth || video.clientWidth;
|
|
418
|
+
const videoHeight = video.offsetHeight || video.clientHeight;
|
|
419
|
+
if (!videoWidth || !videoHeight || videoWidth === 0 || videoHeight === 0) {
|
|
420
|
+
const error = new Error(
|
|
421
|
+
`Invalid video dimensions: ${videoWidth}x${videoHeight}. Cannot initialize ads.`
|
|
422
|
+
);
|
|
423
|
+
console.warn("[IMA]", error.message);
|
|
424
|
+
currentReject == null ? void 0 : currentReject(error);
|
|
425
|
+
adsLoadedReject = void 0;
|
|
426
|
+
adsLoadedResolve = void 0;
|
|
427
|
+
return Promise.reject(error);
|
|
428
|
+
}
|
|
397
429
|
if (!adsLoader) {
|
|
398
430
|
console.log("[IMA] Creating ads loader");
|
|
399
431
|
const adsLoaderCls = new google.ima.AdsLoader(adDisplayContainer);
|
|
@@ -442,7 +474,9 @@ function createImaController(video, options) {
|
|
|
442
474
|
emit("ad_error");
|
|
443
475
|
if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
444
476
|
if (video.paused) {
|
|
445
|
-
console.log(
|
|
477
|
+
console.log(
|
|
478
|
+
"[IMA] Resuming paused video after ad error"
|
|
479
|
+
);
|
|
446
480
|
(_a = video.play()) == null ? void 0 : _a.catch(() => {
|
|
447
481
|
});
|
|
448
482
|
}
|
|
@@ -544,7 +578,9 @@ function createImaController(video, options) {
|
|
|
544
578
|
}
|
|
545
579
|
if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
546
580
|
if (video.paused) {
|
|
547
|
-
console.log(
|
|
581
|
+
console.log(
|
|
582
|
+
"[IMA] Resuming paused video after setup error"
|
|
583
|
+
);
|
|
548
584
|
video.play().catch(() => {
|
|
549
585
|
});
|
|
550
586
|
}
|