stormcloud-video-player 0.6.2 → 0.6.4
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 +237 -141
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +237 -141
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +237 -141
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +237 -141
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +237 -141
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/vastAdLayer.cjs +229 -136
- package/lib/sdk/vastAdLayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +237 -141
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -1123,6 +1123,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1123
1123
|
var destroyed = false;
|
|
1124
1124
|
var tornDown = false;
|
|
1125
1125
|
var trackingFired = createEmptyTrackingState();
|
|
1126
|
+
var adStallTimerId;
|
|
1126
1127
|
var currentAdEventHandlers;
|
|
1127
1128
|
var preloadSlots = /* @__PURE__ */ new Map();
|
|
1128
1129
|
function emit(event, payload) {
|
|
@@ -1238,7 +1239,14 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1238
1239
|
video.volume = 1;
|
|
1239
1240
|
return video;
|
|
1240
1241
|
}
|
|
1242
|
+
function clearAdStallTimer() {
|
|
1243
|
+
if (adStallTimerId != null) {
|
|
1244
|
+
clearTimeout(adStallTimerId);
|
|
1245
|
+
adStallTimerId = void 0;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1241
1248
|
function removeAdEventListeners() {
|
|
1249
|
+
clearAdStallTimer();
|
|
1242
1250
|
if (!currentAdEventHandlers || !adVideoElement) return;
|
|
1243
1251
|
var el = adVideoElement;
|
|
1244
1252
|
el.removeEventListener("timeupdate", currentAdEventHandlers.timeupdate);
|
|
@@ -1248,6 +1256,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1248
1256
|
el.removeEventListener("volumechange", currentAdEventHandlers.volumechange);
|
|
1249
1257
|
el.removeEventListener("pause", currentAdEventHandlers.pause);
|
|
1250
1258
|
el.removeEventListener("play", currentAdEventHandlers.play);
|
|
1259
|
+
el.removeEventListener("waiting", currentAdEventHandlers.waiting);
|
|
1251
1260
|
currentAdEventHandlers = void 0;
|
|
1252
1261
|
}
|
|
1253
1262
|
function setupAdEventListeners() {
|
|
@@ -1272,6 +1281,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1272
1281
|
}
|
|
1273
1282
|
},
|
|
1274
1283
|
playing: function playing() {
|
|
1284
|
+
clearAdStallTimer();
|
|
1275
1285
|
var ad = currentAd;
|
|
1276
1286
|
if (!ad || trackingFired.start) return;
|
|
1277
1287
|
trackingFired.start = true;
|
|
@@ -1308,6 +1318,16 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1308
1318
|
if (currentAd && adVideoElement && adVideoElement.currentTime > 0) {
|
|
1309
1319
|
fireTrackingPixels2(currentAd.trackingUrls.resume);
|
|
1310
1320
|
}
|
|
1321
|
+
},
|
|
1322
|
+
waiting: function waiting() {
|
|
1323
|
+
clearAdStallTimer();
|
|
1324
|
+
adStallTimerId = setTimeout(function() {
|
|
1325
|
+
adStallTimerId = void 0;
|
|
1326
|
+
if (adPlaying) {
|
|
1327
|
+
if (debug) console.warn("".concat(LOG, " Ad video stalled for too long, treating as error"));
|
|
1328
|
+
handleAdError();
|
|
1329
|
+
}
|
|
1330
|
+
}, 8e3);
|
|
1311
1331
|
}
|
|
1312
1332
|
};
|
|
1313
1333
|
adVideoElement.addEventListener("timeupdate", handlers.timeupdate);
|
|
@@ -1317,6 +1337,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1317
1337
|
adVideoElement.addEventListener("volumechange", handlers.volumechange);
|
|
1318
1338
|
adVideoElement.addEventListener("pause", handlers.pause);
|
|
1319
1339
|
adVideoElement.addEventListener("play", handlers.play);
|
|
1340
|
+
adVideoElement.addEventListener("waiting", handlers.waiting);
|
|
1320
1341
|
currentAdEventHandlers = handlers;
|
|
1321
1342
|
}
|
|
1322
1343
|
function setAdPlayingFlag(isPlaying) {
|
|
@@ -1328,6 +1349,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1328
1349
|
}
|
|
1329
1350
|
function handleAdComplete() {
|
|
1330
1351
|
if (tornDown) return;
|
|
1352
|
+
clearAdStallTimer();
|
|
1331
1353
|
if (debug) console.log("".concat(LOG, " Handling ad completion"));
|
|
1332
1354
|
adPlaying = false;
|
|
1333
1355
|
setAdPlayingFlag(false);
|
|
@@ -1341,6 +1363,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1341
1363
|
function handleAdError() {
|
|
1342
1364
|
if (tornDown) return;
|
|
1343
1365
|
if (!adPlaying) return;
|
|
1366
|
+
clearAdStallTimer();
|
|
1344
1367
|
if (debug) console.log("".concat(LOG, " Handling ad error"));
|
|
1345
1368
|
adPlaying = false;
|
|
1346
1369
|
setAdPlayingFlag(false);
|
|
@@ -1391,6 +1414,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1391
1414
|
adHls.loadSource(mediaFile.url);
|
|
1392
1415
|
adHls.attachMedia(adVideoElement);
|
|
1393
1416
|
adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
|
|
1417
|
+
if (!adPlaying) return;
|
|
1394
1418
|
adVideoElement.play().catch(function(error) {
|
|
1395
1419
|
console.error("".concat(LOG, " Error starting HLS ad playback:"), error);
|
|
1396
1420
|
handleAdError();
|
|
@@ -1439,7 +1463,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1439
1463
|
}
|
|
1440
1464
|
function playAd(bids) {
|
|
1441
1465
|
return _async_to_generator(function() {
|
|
1442
|
-
var winner, ad, contentVolume, _contentVideo_parentElement, container, adVolume, mediaFile;
|
|
1466
|
+
var winner, ad, contentVolume, adVolume2, mediaFile2, _contentVideo_parentElement, container, adVolume, mediaFile;
|
|
1443
1467
|
return _ts_generator(this, function(_state) {
|
|
1444
1468
|
switch(_state.label){
|
|
1445
1469
|
case 0:
|
|
@@ -1483,37 +1507,71 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1483
1507
|
trackingFired.impression = true;
|
|
1484
1508
|
contentVolume = contentVideo.volume;
|
|
1485
1509
|
originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
|
|
1486
|
-
if (singleElementMode)
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1510
|
+
if (!singleElementMode) return [
|
|
1511
|
+
3,
|
|
1512
|
+
3
|
|
1513
|
+
];
|
|
1514
|
+
mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
|
|
1515
|
+
teardownCurrentPlayback();
|
|
1516
|
+
adVideoElement = contentVideo;
|
|
1517
|
+
adHls = void 0;
|
|
1518
|
+
adPlaying = true;
|
|
1519
|
+
setAdPlayingFlag(true);
|
|
1520
|
+
contentVideo.removeAttribute("src");
|
|
1521
|
+
contentVideo.load();
|
|
1522
|
+
if (!continueLiveStreamDuringAds) {
|
|
1523
|
+
contentVideo.pause();
|
|
1524
|
+
}
|
|
1525
|
+
contentVideo.muted = true;
|
|
1526
|
+
contentVideo.volume = 0;
|
|
1527
|
+
return [
|
|
1528
|
+
4,
|
|
1529
|
+
new Promise(function(resolve) {
|
|
1530
|
+
return setTimeout(resolve, 200);
|
|
1531
|
+
})
|
|
1532
|
+
];
|
|
1533
|
+
case 2:
|
|
1534
|
+
_state.sent();
|
|
1535
|
+
if (destroyed || tornDown) return [
|
|
1536
|
+
2
|
|
1537
|
+
];
|
|
1538
|
+
contentVideo.style.visibility = "visible";
|
|
1539
|
+
contentVideo.style.opacity = "1";
|
|
1540
|
+
emit("content_pause");
|
|
1541
|
+
setupAdEventListeners();
|
|
1542
|
+
adVolume2 = originalMutedState ? 1 : originalVolume;
|
|
1543
|
+
adVideoElement.volume = Math.max(0, Math.min(1, adVolume2));
|
|
1544
|
+
adVideoElement.muted = false;
|
|
1545
|
+
mediaFile2 = selectBestMediaFile(ad.mediaFiles);
|
|
1546
|
+
if (debug) console.log("".concat(LOG, " Loading ad from: ").concat(mediaFile2.url));
|
|
1547
|
+
startPlayback(mediaFile2);
|
|
1548
|
+
return [
|
|
1549
|
+
2
|
|
1550
|
+
];
|
|
1551
|
+
case 3:
|
|
1552
|
+
if (!adContainerEl) {
|
|
1553
|
+
;
|
|
1554
|
+
container = document.createElement("div");
|
|
1555
|
+
container.style.position = "absolute";
|
|
1556
|
+
container.style.left = "0";
|
|
1557
|
+
container.style.top = "0";
|
|
1558
|
+
container.style.right = "0";
|
|
1559
|
+
container.style.bottom = "0";
|
|
1560
|
+
container.style.display = "none";
|
|
1561
|
+
container.style.alignItems = "center";
|
|
1562
|
+
container.style.justifyContent = "center";
|
|
1563
|
+
container.style.pointerEvents = "none";
|
|
1564
|
+
container.style.zIndex = "10";
|
|
1565
|
+
container.style.backgroundColor = "#000";
|
|
1566
|
+
(_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
|
|
1567
|
+
adContainerEl = container;
|
|
1568
|
+
}
|
|
1569
|
+
if (!adVideoElement) {
|
|
1570
|
+
adVideoElement = createAdVideoElement();
|
|
1571
|
+
adContainerEl.appendChild(adVideoElement);
|
|
1491
1572
|
setupAdEventListeners();
|
|
1492
1573
|
} else {
|
|
1493
|
-
|
|
1494
|
-
;
|
|
1495
|
-
container = document.createElement("div");
|
|
1496
|
-
container.style.position = "absolute";
|
|
1497
|
-
container.style.left = "0";
|
|
1498
|
-
container.style.top = "0";
|
|
1499
|
-
container.style.right = "0";
|
|
1500
|
-
container.style.bottom = "0";
|
|
1501
|
-
container.style.display = "none";
|
|
1502
|
-
container.style.alignItems = "center";
|
|
1503
|
-
container.style.justifyContent = "center";
|
|
1504
|
-
container.style.pointerEvents = "none";
|
|
1505
|
-
container.style.zIndex = "10";
|
|
1506
|
-
container.style.backgroundColor = "#000";
|
|
1507
|
-
(_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
|
|
1508
|
-
adContainerEl = container;
|
|
1509
|
-
}
|
|
1510
|
-
if (!adVideoElement) {
|
|
1511
|
-
adVideoElement = createAdVideoElement();
|
|
1512
|
-
adContainerEl.appendChild(adVideoElement);
|
|
1513
|
-
setupAdEventListeners();
|
|
1514
|
-
} else {
|
|
1515
|
-
teardownCurrentPlayback();
|
|
1516
|
-
}
|
|
1574
|
+
teardownCurrentPlayback();
|
|
1517
1575
|
}
|
|
1518
1576
|
if (!continueLiveStreamDuringAds) {
|
|
1519
1577
|
contentVideo.pause();
|
|
@@ -1525,7 +1583,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1525
1583
|
adVolume = originalMutedState ? 1 : originalVolume;
|
|
1526
1584
|
adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
|
|
1527
1585
|
adVideoElement.muted = false;
|
|
1528
|
-
if (
|
|
1586
|
+
if (adContainerEl) {
|
|
1529
1587
|
adContainerEl.style.display = "flex";
|
|
1530
1588
|
adContainerEl.style.pointerEvents = "auto";
|
|
1531
1589
|
}
|
|
@@ -1629,6 +1687,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1629
1687
|
if (debug) console.log("".concat(LOG, " [preload] HLS manifest parsed, token=").concat(token));
|
|
1630
1688
|
});
|
|
1631
1689
|
hls.on(import_hls.default.Events.ERROR, function(_evt, data) {
|
|
1690
|
+
if (!preloadSlots.has(token)) return;
|
|
1632
1691
|
if (data.fatal) {
|
|
1633
1692
|
if (debug) console.warn("".concat(LOG, " [preload] HLS error for token=").concat(token));
|
|
1634
1693
|
preloadSlots.delete(token);
|
|
@@ -1665,113 +1724,146 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1665
1724
|
}
|
|
1666
1725
|
function playPreloaded(token) {
|
|
1667
1726
|
return _async_to_generator(function() {
|
|
1668
|
-
var slot, contentVolume, adVolume2, videoEl, container2, adVolume21, adVolume, container;
|
|
1727
|
+
var slot, contentVolume, adVolume2, videoEl, container2, adVolume21, nonFatalNetworkErrors, adVolume, container;
|
|
1669
1728
|
return _ts_generator(this, function(_state) {
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1729
|
+
switch(_state.label){
|
|
1730
|
+
case 0:
|
|
1731
|
+
if (destroyed) return [
|
|
1732
|
+
2,
|
|
1733
|
+
Promise.reject(new Error("Layer has been destroyed"))
|
|
1734
|
+
];
|
|
1735
|
+
slot = preloadSlots.get(token);
|
|
1736
|
+
if (!slot) {
|
|
1737
|
+
if (debug) console.warn("".concat(LOG, " [preload] No slot found for token=").concat(token, ", nothing to play"));
|
|
1738
|
+
return [
|
|
1739
|
+
2
|
|
1740
|
+
];
|
|
1741
|
+
}
|
|
1742
|
+
preloadSlots.delete(token);
|
|
1743
|
+
if (debug) console.log("".concat(LOG, " [preload] Playing preloaded ad, token=").concat(token, ", ready=").concat(slot.ready));
|
|
1744
|
+
contentVolume = contentVideo.volume;
|
|
1745
|
+
originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
|
|
1746
|
+
sessionId = generateSessionId();
|
|
1747
|
+
currentAd = slot.ad;
|
|
1748
|
+
trackingFired = _object_spread({}, createEmptyTrackingState());
|
|
1749
|
+
fireTrackingPixels2(slot.ad.trackingUrls.impression);
|
|
1750
|
+
trackingFired.impression = true;
|
|
1751
|
+
if (!singleElementMode) return [
|
|
1752
|
+
3,
|
|
1753
|
+
2
|
|
1754
|
+
];
|
|
1755
|
+
mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
|
|
1756
|
+
teardownCurrentPlayback();
|
|
1757
|
+
adVideoElement = contentVideo;
|
|
1758
|
+
adHls = void 0;
|
|
1759
|
+
adPlaying = true;
|
|
1760
|
+
setAdPlayingFlag(true);
|
|
1761
|
+
contentVideo.removeAttribute("src");
|
|
1762
|
+
contentVideo.load();
|
|
1763
|
+
contentVideo.muted = true;
|
|
1764
|
+
contentVideo.volume = 0;
|
|
1765
|
+
return [
|
|
1766
|
+
4,
|
|
1767
|
+
new Promise(function(resolve) {
|
|
1768
|
+
return setTimeout(resolve, 200);
|
|
1769
|
+
})
|
|
1770
|
+
];
|
|
1771
|
+
case 1:
|
|
1772
|
+
_state.sent();
|
|
1773
|
+
if (destroyed || tornDown) return [
|
|
1774
|
+
2
|
|
1775
|
+
];
|
|
1776
|
+
contentVideo.style.visibility = "visible";
|
|
1777
|
+
contentVideo.style.opacity = "1";
|
|
1778
|
+
emit("content_pause");
|
|
1779
|
+
setupAdEventListeners();
|
|
1780
|
+
adVolume2 = originalMutedState ? 1 : originalVolume;
|
|
1781
|
+
contentVideo.volume = Math.max(0, Math.min(1, adVolume2));
|
|
1782
|
+
contentVideo.muted = false;
|
|
1783
|
+
if (debug) console.log("".concat(LOG, " [preload] singleElementMode: attaching ad to contentVideo, url=").concat(slot.mediaFile.url));
|
|
1784
|
+
startPlayback(slot.mediaFile);
|
|
1785
|
+
return [
|
|
1786
|
+
2
|
|
1787
|
+
];
|
|
1788
|
+
case 2:
|
|
1789
|
+
if (smartTVMode && !slot.videoEl) {
|
|
1790
|
+
teardownCurrentPlayback();
|
|
1791
|
+
if (adVideoElement) {
|
|
1792
|
+
adVideoElement.remove();
|
|
1793
|
+
adVideoElement = void 0;
|
|
1794
|
+
}
|
|
1795
|
+
videoEl = createAdVideoElement();
|
|
1796
|
+
videoEl.style.visibility = "visible";
|
|
1797
|
+
videoEl.style.pointerEvents = "none";
|
|
1798
|
+
container2 = ensureAdContainer();
|
|
1799
|
+
container2.appendChild(videoEl);
|
|
1800
|
+
adVideoElement = videoEl;
|
|
1801
|
+
setupAdEventListeners();
|
|
1802
|
+
if (!continueLiveStreamDuringAds) {
|
|
1803
|
+
contentVideo.pause();
|
|
1804
|
+
}
|
|
1805
|
+
contentVideo.muted = true;
|
|
1806
|
+
contentVideo.volume = 0;
|
|
1807
|
+
adPlaying = true;
|
|
1808
|
+
setAdPlayingFlag(true);
|
|
1809
|
+
adVolume21 = originalMutedState ? 1 : originalVolume;
|
|
1810
|
+
adVideoElement.volume = Math.max(0, Math.min(1, adVolume21));
|
|
1811
|
+
adVideoElement.muted = false;
|
|
1812
|
+
container2.style.display = "flex";
|
|
1813
|
+
container2.style.pointerEvents = "auto";
|
|
1814
|
+
emit("content_pause");
|
|
1815
|
+
if (debug) console.log("".concat(LOG, " [preload] smartTVMode deferred: creating video element and loading, url=").concat(slot.mediaFile.url));
|
|
1816
|
+
startPlayback(slot.mediaFile);
|
|
1817
|
+
return [
|
|
1818
|
+
2
|
|
1819
|
+
];
|
|
1820
|
+
}
|
|
1821
|
+
teardownCurrentPlayback();
|
|
1822
|
+
if (adVideoElement && adVideoElement !== slot.videoEl) {
|
|
1823
|
+
adVideoElement.remove();
|
|
1824
|
+
}
|
|
1825
|
+
slot.videoEl.style.visibility = "visible";
|
|
1826
|
+
slot.videoEl.style.pointerEvents = "none";
|
|
1827
|
+
adVideoElement = slot.videoEl;
|
|
1828
|
+
adHls = slot.hlsInstance;
|
|
1829
|
+
if (adHls) {
|
|
1830
|
+
nonFatalNetworkErrors = 0;
|
|
1831
|
+
adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
|
|
1832
|
+
if (!adPlaying) return;
|
|
1833
|
+
if (data.fatal) {
|
|
1834
|
+
handleAdError();
|
|
1835
|
+
} else if (data.type === import_hls.default.ErrorTypes.NETWORK_ERROR) {
|
|
1836
|
+
nonFatalNetworkErrors++;
|
|
1837
|
+
if (nonFatalNetworkErrors >= 3) {
|
|
1838
|
+
if (debug) console.warn("".concat(LOG, " [preload] Too many non-fatal HLS network errors during playback, treating as fatal"));
|
|
1839
|
+
handleAdError();
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
});
|
|
1843
|
+
}
|
|
1844
|
+
setupAdEventListeners();
|
|
1845
|
+
if (!continueLiveStreamDuringAds) {
|
|
1846
|
+
contentVideo.pause();
|
|
1847
|
+
}
|
|
1848
|
+
contentVideo.muted = true;
|
|
1849
|
+
contentVideo.volume = 0;
|
|
1850
|
+
adPlaying = true;
|
|
1851
|
+
setAdPlayingFlag(true);
|
|
1852
|
+
adVolume = originalMutedState ? 1 : originalVolume;
|
|
1853
|
+
adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
|
|
1854
|
+
adVideoElement.muted = false;
|
|
1855
|
+
container = ensureAdContainer();
|
|
1856
|
+
container.style.display = "flex";
|
|
1857
|
+
container.style.pointerEvents = "auto";
|
|
1858
|
+
emit("content_pause");
|
|
1859
|
+
adVideoElement.play().catch(function(error) {
|
|
1860
|
+
console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
|
|
1861
|
+
handleAdError();
|
|
1862
|
+
});
|
|
1863
|
+
return [
|
|
1864
|
+
2
|
|
1865
|
+
];
|
|
1748
1866
|
}
|
|
1749
|
-
slot.videoEl.style.visibility = "visible";
|
|
1750
|
-
slot.videoEl.style.pointerEvents = "none";
|
|
1751
|
-
adVideoElement = slot.videoEl;
|
|
1752
|
-
adHls = slot.hlsInstance;
|
|
1753
|
-
setupAdEventListeners();
|
|
1754
|
-
if (!continueLiveStreamDuringAds) {
|
|
1755
|
-
contentVideo.pause();
|
|
1756
|
-
}
|
|
1757
|
-
contentVideo.muted = true;
|
|
1758
|
-
contentVideo.volume = 0;
|
|
1759
|
-
adPlaying = true;
|
|
1760
|
-
setAdPlayingFlag(true);
|
|
1761
|
-
adVolume = originalMutedState ? 1 : originalVolume;
|
|
1762
|
-
adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
|
|
1763
|
-
adVideoElement.muted = false;
|
|
1764
|
-
container = ensureAdContainer();
|
|
1765
|
-
container.style.display = "flex";
|
|
1766
|
-
container.style.pointerEvents = "auto";
|
|
1767
|
-
emit("content_pause");
|
|
1768
|
-
adVideoElement.play().catch(function(error) {
|
|
1769
|
-
console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
|
|
1770
|
-
handleAdError();
|
|
1771
|
-
});
|
|
1772
|
-
return [
|
|
1773
|
-
2
|
|
1774
|
-
];
|
|
1775
1867
|
});
|
|
1776
1868
|
})();
|
|
1777
1869
|
}
|
|
@@ -1956,6 +2048,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1956
2048
|
return 1;
|
|
1957
2049
|
},
|
|
1958
2050
|
showPlaceholder: function showPlaceholder() {
|
|
2051
|
+
if (singleElementMode) return;
|
|
1959
2052
|
contentVideo.style.opacity = "0";
|
|
1960
2053
|
contentVideo.style.visibility = "hidden";
|
|
1961
2054
|
if (!adContainerEl) {
|
|
@@ -3677,7 +3770,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3677
3770
|
}
|
|
3678
3771
|
_this.adLayer.cancelPreload(token);
|
|
3679
3772
|
} else {
|
|
3680
|
-
_this.
|
|
3773
|
+
if (!_this.config.singlePipelineMode) {
|
|
3774
|
+
_this.showPlaceholderLayer();
|
|
3775
|
+
}
|
|
3681
3776
|
_this.adLayer.showPlaceholder();
|
|
3682
3777
|
_this.isInAdTransition = true;
|
|
3683
3778
|
setTimeout(function() {
|
|
@@ -3701,7 +3796,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3701
3796
|
console.log("[StormcloudVideoPlayer] content_resume: skip pending bids, only", remainingNow1, "ms left");
|
|
3702
3797
|
}
|
|
3703
3798
|
} else {
|
|
3704
|
-
_this.
|
|
3799
|
+
if (!_this.config.singlePipelineMode) {
|
|
3800
|
+
_this.showPlaceholderLayer();
|
|
3801
|
+
}
|
|
3705
3802
|
_this.adLayer.showPlaceholder();
|
|
3706
3803
|
_this.isInAdTransition = true;
|
|
3707
3804
|
setTimeout(function() {
|
|
@@ -4052,7 +4149,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4052
4149
|
};
|
|
4053
4150
|
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
4054
4151
|
}
|
|
4055
|
-
if (!this.config.disableFiller && !this.video.muted) {
|
|
4152
|
+
if (!this.config.disableFiller && !this.video.muted && !this.adLayer.isAdPlaying()) {
|
|
4056
4153
|
this.video.muted = true;
|
|
4057
4154
|
this.video.volume = 0;
|
|
4058
4155
|
if (this.config.debugAdTiming) {
|
|
@@ -5069,7 +5166,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5069
5166
|
if (!this.config.disableFiller) this.showAds = true;
|
|
5070
5167
|
if (adBreakDurationMs != null) {
|
|
5071
5168
|
this.startFillerBreakTimer(adBreakDurationMs);
|
|
5072
|
-
} else if (!this.config.disableFiller) {
|
|
5169
|
+
} else if (!this.config.disableFiller && this.preloadedTokens.length === 0) {
|
|
5073
5170
|
this.showPlaceholderLayer();
|
|
5074
5171
|
}
|
|
5075
5172
|
if (!this.config.disableFiller) this.adLayer.showPlaceholder();
|
|
@@ -5686,7 +5783,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5686
5783
|
console.log("[StormcloudVideoPlayer] Smart TV: audio state restored on MANIFEST_PARSED after re-attach");
|
|
5687
5784
|
}
|
|
5688
5785
|
hlsRef.startLoad(-1);
|
|
5689
|
-
tryPlay(0);
|
|
5690
5786
|
if (debugEnabled) {
|
|
5691
5787
|
console.log("[StormcloudVideoPlayer] Smart TV: seeking to live edge and resuming playback after re-attach");
|
|
5692
5788
|
}
|