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/players/index.cjs
CHANGED
|
@@ -1029,6 +1029,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1029
1029
|
var destroyed = false;
|
|
1030
1030
|
var tornDown = false;
|
|
1031
1031
|
var trackingFired = createEmptyTrackingState();
|
|
1032
|
+
var adStallTimerId;
|
|
1032
1033
|
var currentAdEventHandlers;
|
|
1033
1034
|
var preloadSlots = /* @__PURE__ */ new Map();
|
|
1034
1035
|
function emit(event, payload) {
|
|
@@ -1144,7 +1145,14 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1144
1145
|
video.volume = 1;
|
|
1145
1146
|
return video;
|
|
1146
1147
|
}
|
|
1148
|
+
function clearAdStallTimer() {
|
|
1149
|
+
if (adStallTimerId != null) {
|
|
1150
|
+
clearTimeout(adStallTimerId);
|
|
1151
|
+
adStallTimerId = void 0;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1147
1154
|
function removeAdEventListeners() {
|
|
1155
|
+
clearAdStallTimer();
|
|
1148
1156
|
if (!currentAdEventHandlers || !adVideoElement) return;
|
|
1149
1157
|
var el = adVideoElement;
|
|
1150
1158
|
el.removeEventListener("timeupdate", currentAdEventHandlers.timeupdate);
|
|
@@ -1154,6 +1162,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1154
1162
|
el.removeEventListener("volumechange", currentAdEventHandlers.volumechange);
|
|
1155
1163
|
el.removeEventListener("pause", currentAdEventHandlers.pause);
|
|
1156
1164
|
el.removeEventListener("play", currentAdEventHandlers.play);
|
|
1165
|
+
el.removeEventListener("waiting", currentAdEventHandlers.waiting);
|
|
1157
1166
|
currentAdEventHandlers = void 0;
|
|
1158
1167
|
}
|
|
1159
1168
|
function setupAdEventListeners() {
|
|
@@ -1178,6 +1187,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1178
1187
|
}
|
|
1179
1188
|
},
|
|
1180
1189
|
playing: function playing() {
|
|
1190
|
+
clearAdStallTimer();
|
|
1181
1191
|
var ad = currentAd;
|
|
1182
1192
|
if (!ad || trackingFired.start) return;
|
|
1183
1193
|
trackingFired.start = true;
|
|
@@ -1214,6 +1224,16 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1214
1224
|
if (currentAd && adVideoElement && adVideoElement.currentTime > 0) {
|
|
1215
1225
|
fireTrackingPixels2(currentAd.trackingUrls.resume);
|
|
1216
1226
|
}
|
|
1227
|
+
},
|
|
1228
|
+
waiting: function waiting() {
|
|
1229
|
+
clearAdStallTimer();
|
|
1230
|
+
adStallTimerId = setTimeout(function() {
|
|
1231
|
+
adStallTimerId = void 0;
|
|
1232
|
+
if (adPlaying) {
|
|
1233
|
+
if (debug) console.warn("".concat(LOG, " Ad video stalled for too long, treating as error"));
|
|
1234
|
+
handleAdError();
|
|
1235
|
+
}
|
|
1236
|
+
}, 8e3);
|
|
1217
1237
|
}
|
|
1218
1238
|
};
|
|
1219
1239
|
adVideoElement.addEventListener("timeupdate", handlers.timeupdate);
|
|
@@ -1223,6 +1243,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1223
1243
|
adVideoElement.addEventListener("volumechange", handlers.volumechange);
|
|
1224
1244
|
adVideoElement.addEventListener("pause", handlers.pause);
|
|
1225
1245
|
adVideoElement.addEventListener("play", handlers.play);
|
|
1246
|
+
adVideoElement.addEventListener("waiting", handlers.waiting);
|
|
1226
1247
|
currentAdEventHandlers = handlers;
|
|
1227
1248
|
}
|
|
1228
1249
|
function setAdPlayingFlag(isPlaying) {
|
|
@@ -1234,6 +1255,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1234
1255
|
}
|
|
1235
1256
|
function handleAdComplete() {
|
|
1236
1257
|
if (tornDown) return;
|
|
1258
|
+
clearAdStallTimer();
|
|
1237
1259
|
if (debug) console.log("".concat(LOG, " Handling ad completion"));
|
|
1238
1260
|
adPlaying = false;
|
|
1239
1261
|
setAdPlayingFlag(false);
|
|
@@ -1247,6 +1269,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1247
1269
|
function handleAdError() {
|
|
1248
1270
|
if (tornDown) return;
|
|
1249
1271
|
if (!adPlaying) return;
|
|
1272
|
+
clearAdStallTimer();
|
|
1250
1273
|
if (debug) console.log("".concat(LOG, " Handling ad error"));
|
|
1251
1274
|
adPlaying = false;
|
|
1252
1275
|
setAdPlayingFlag(false);
|
|
@@ -1297,6 +1320,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1297
1320
|
adHls.loadSource(mediaFile.url);
|
|
1298
1321
|
adHls.attachMedia(adVideoElement);
|
|
1299
1322
|
adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
|
|
1323
|
+
if (!adPlaying) return;
|
|
1300
1324
|
adVideoElement.play().catch(function(error) {
|
|
1301
1325
|
console.error("".concat(LOG, " Error starting HLS ad playback:"), error);
|
|
1302
1326
|
handleAdError();
|
|
@@ -1345,7 +1369,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1345
1369
|
}
|
|
1346
1370
|
function playAd(bids) {
|
|
1347
1371
|
return _async_to_generator(function() {
|
|
1348
|
-
var winner, ad, contentVolume, _contentVideo_parentElement, container, adVolume, mediaFile;
|
|
1372
|
+
var winner, ad, contentVolume, adVolume2, mediaFile2, _contentVideo_parentElement, container, adVolume, mediaFile;
|
|
1349
1373
|
return _ts_generator(this, function(_state) {
|
|
1350
1374
|
switch(_state.label){
|
|
1351
1375
|
case 0:
|
|
@@ -1389,37 +1413,71 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1389
1413
|
trackingFired.impression = true;
|
|
1390
1414
|
contentVolume = contentVideo.volume;
|
|
1391
1415
|
originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
|
|
1392
|
-
if (singleElementMode)
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1416
|
+
if (!singleElementMode) return [
|
|
1417
|
+
3,
|
|
1418
|
+
3
|
|
1419
|
+
];
|
|
1420
|
+
mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
|
|
1421
|
+
teardownCurrentPlayback();
|
|
1422
|
+
adVideoElement = contentVideo;
|
|
1423
|
+
adHls = void 0;
|
|
1424
|
+
adPlaying = true;
|
|
1425
|
+
setAdPlayingFlag(true);
|
|
1426
|
+
contentVideo.removeAttribute("src");
|
|
1427
|
+
contentVideo.load();
|
|
1428
|
+
if (!continueLiveStreamDuringAds) {
|
|
1429
|
+
contentVideo.pause();
|
|
1430
|
+
}
|
|
1431
|
+
contentVideo.muted = true;
|
|
1432
|
+
contentVideo.volume = 0;
|
|
1433
|
+
return [
|
|
1434
|
+
4,
|
|
1435
|
+
new Promise(function(resolve) {
|
|
1436
|
+
return setTimeout(resolve, 200);
|
|
1437
|
+
})
|
|
1438
|
+
];
|
|
1439
|
+
case 2:
|
|
1440
|
+
_state.sent();
|
|
1441
|
+
if (destroyed || tornDown) return [
|
|
1442
|
+
2
|
|
1443
|
+
];
|
|
1444
|
+
contentVideo.style.visibility = "visible";
|
|
1445
|
+
contentVideo.style.opacity = "1";
|
|
1446
|
+
emit("content_pause");
|
|
1447
|
+
setupAdEventListeners();
|
|
1448
|
+
adVolume2 = originalMutedState ? 1 : originalVolume;
|
|
1449
|
+
adVideoElement.volume = Math.max(0, Math.min(1, adVolume2));
|
|
1450
|
+
adVideoElement.muted = false;
|
|
1451
|
+
mediaFile2 = selectBestMediaFile(ad.mediaFiles);
|
|
1452
|
+
if (debug) console.log("".concat(LOG, " Loading ad from: ").concat(mediaFile2.url));
|
|
1453
|
+
startPlayback(mediaFile2);
|
|
1454
|
+
return [
|
|
1455
|
+
2
|
|
1456
|
+
];
|
|
1457
|
+
case 3:
|
|
1458
|
+
if (!adContainerEl) {
|
|
1459
|
+
;
|
|
1460
|
+
container = document.createElement("div");
|
|
1461
|
+
container.style.position = "absolute";
|
|
1462
|
+
container.style.left = "0";
|
|
1463
|
+
container.style.top = "0";
|
|
1464
|
+
container.style.right = "0";
|
|
1465
|
+
container.style.bottom = "0";
|
|
1466
|
+
container.style.display = "none";
|
|
1467
|
+
container.style.alignItems = "center";
|
|
1468
|
+
container.style.justifyContent = "center";
|
|
1469
|
+
container.style.pointerEvents = "none";
|
|
1470
|
+
container.style.zIndex = "10";
|
|
1471
|
+
container.style.backgroundColor = "#000";
|
|
1472
|
+
(_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
|
|
1473
|
+
adContainerEl = container;
|
|
1474
|
+
}
|
|
1475
|
+
if (!adVideoElement) {
|
|
1476
|
+
adVideoElement = createAdVideoElement();
|
|
1477
|
+
adContainerEl.appendChild(adVideoElement);
|
|
1397
1478
|
setupAdEventListeners();
|
|
1398
1479
|
} else {
|
|
1399
|
-
|
|
1400
|
-
;
|
|
1401
|
-
container = document.createElement("div");
|
|
1402
|
-
container.style.position = "absolute";
|
|
1403
|
-
container.style.left = "0";
|
|
1404
|
-
container.style.top = "0";
|
|
1405
|
-
container.style.right = "0";
|
|
1406
|
-
container.style.bottom = "0";
|
|
1407
|
-
container.style.display = "none";
|
|
1408
|
-
container.style.alignItems = "center";
|
|
1409
|
-
container.style.justifyContent = "center";
|
|
1410
|
-
container.style.pointerEvents = "none";
|
|
1411
|
-
container.style.zIndex = "10";
|
|
1412
|
-
container.style.backgroundColor = "#000";
|
|
1413
|
-
(_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
|
|
1414
|
-
adContainerEl = container;
|
|
1415
|
-
}
|
|
1416
|
-
if (!adVideoElement) {
|
|
1417
|
-
adVideoElement = createAdVideoElement();
|
|
1418
|
-
adContainerEl.appendChild(adVideoElement);
|
|
1419
|
-
setupAdEventListeners();
|
|
1420
|
-
} else {
|
|
1421
|
-
teardownCurrentPlayback();
|
|
1422
|
-
}
|
|
1480
|
+
teardownCurrentPlayback();
|
|
1423
1481
|
}
|
|
1424
1482
|
if (!continueLiveStreamDuringAds) {
|
|
1425
1483
|
contentVideo.pause();
|
|
@@ -1431,7 +1489,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1431
1489
|
adVolume = originalMutedState ? 1 : originalVolume;
|
|
1432
1490
|
adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
|
|
1433
1491
|
adVideoElement.muted = false;
|
|
1434
|
-
if (
|
|
1492
|
+
if (adContainerEl) {
|
|
1435
1493
|
adContainerEl.style.display = "flex";
|
|
1436
1494
|
adContainerEl.style.pointerEvents = "auto";
|
|
1437
1495
|
}
|
|
@@ -1535,6 +1593,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1535
1593
|
if (debug) console.log("".concat(LOG, " [preload] HLS manifest parsed, token=").concat(token));
|
|
1536
1594
|
});
|
|
1537
1595
|
hls.on(import_hls.default.Events.ERROR, function(_evt, data) {
|
|
1596
|
+
if (!preloadSlots.has(token)) return;
|
|
1538
1597
|
if (data.fatal) {
|
|
1539
1598
|
if (debug) console.warn("".concat(LOG, " [preload] HLS error for token=").concat(token));
|
|
1540
1599
|
preloadSlots.delete(token);
|
|
@@ -1571,113 +1630,146 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1571
1630
|
}
|
|
1572
1631
|
function playPreloaded(token) {
|
|
1573
1632
|
return _async_to_generator(function() {
|
|
1574
|
-
var slot, contentVolume, adVolume2, videoEl, container2, adVolume21, adVolume, container;
|
|
1633
|
+
var slot, contentVolume, adVolume2, videoEl, container2, adVolume21, nonFatalNetworkErrors, adVolume, container;
|
|
1575
1634
|
return _ts_generator(this, function(_state) {
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1635
|
+
switch(_state.label){
|
|
1636
|
+
case 0:
|
|
1637
|
+
if (destroyed) return [
|
|
1638
|
+
2,
|
|
1639
|
+
Promise.reject(new Error("Layer has been destroyed"))
|
|
1640
|
+
];
|
|
1641
|
+
slot = preloadSlots.get(token);
|
|
1642
|
+
if (!slot) {
|
|
1643
|
+
if (debug) console.warn("".concat(LOG, " [preload] No slot found for token=").concat(token, ", nothing to play"));
|
|
1644
|
+
return [
|
|
1645
|
+
2
|
|
1646
|
+
];
|
|
1647
|
+
}
|
|
1648
|
+
preloadSlots.delete(token);
|
|
1649
|
+
if (debug) console.log("".concat(LOG, " [preload] Playing preloaded ad, token=").concat(token, ", ready=").concat(slot.ready));
|
|
1650
|
+
contentVolume = contentVideo.volume;
|
|
1651
|
+
originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
|
|
1652
|
+
sessionId = generateSessionId();
|
|
1653
|
+
currentAd = slot.ad;
|
|
1654
|
+
trackingFired = _object_spread({}, createEmptyTrackingState());
|
|
1655
|
+
fireTrackingPixels2(slot.ad.trackingUrls.impression);
|
|
1656
|
+
trackingFired.impression = true;
|
|
1657
|
+
if (!singleElementMode) return [
|
|
1658
|
+
3,
|
|
1659
|
+
2
|
|
1660
|
+
];
|
|
1661
|
+
mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
|
|
1662
|
+
teardownCurrentPlayback();
|
|
1663
|
+
adVideoElement = contentVideo;
|
|
1664
|
+
adHls = void 0;
|
|
1665
|
+
adPlaying = true;
|
|
1666
|
+
setAdPlayingFlag(true);
|
|
1667
|
+
contentVideo.removeAttribute("src");
|
|
1668
|
+
contentVideo.load();
|
|
1669
|
+
contentVideo.muted = true;
|
|
1670
|
+
contentVideo.volume = 0;
|
|
1671
|
+
return [
|
|
1672
|
+
4,
|
|
1673
|
+
new Promise(function(resolve) {
|
|
1674
|
+
return setTimeout(resolve, 200);
|
|
1675
|
+
})
|
|
1676
|
+
];
|
|
1677
|
+
case 1:
|
|
1678
|
+
_state.sent();
|
|
1679
|
+
if (destroyed || tornDown) return [
|
|
1680
|
+
2
|
|
1681
|
+
];
|
|
1682
|
+
contentVideo.style.visibility = "visible";
|
|
1683
|
+
contentVideo.style.opacity = "1";
|
|
1684
|
+
emit("content_pause");
|
|
1685
|
+
setupAdEventListeners();
|
|
1686
|
+
adVolume2 = originalMutedState ? 1 : originalVolume;
|
|
1687
|
+
contentVideo.volume = Math.max(0, Math.min(1, adVolume2));
|
|
1688
|
+
contentVideo.muted = false;
|
|
1689
|
+
if (debug) console.log("".concat(LOG, " [preload] singleElementMode: attaching ad to contentVideo, url=").concat(slot.mediaFile.url));
|
|
1690
|
+
startPlayback(slot.mediaFile);
|
|
1691
|
+
return [
|
|
1692
|
+
2
|
|
1693
|
+
];
|
|
1694
|
+
case 2:
|
|
1695
|
+
if (smartTVMode && !slot.videoEl) {
|
|
1696
|
+
teardownCurrentPlayback();
|
|
1697
|
+
if (adVideoElement) {
|
|
1698
|
+
adVideoElement.remove();
|
|
1699
|
+
adVideoElement = void 0;
|
|
1700
|
+
}
|
|
1701
|
+
videoEl = createAdVideoElement();
|
|
1702
|
+
videoEl.style.visibility = "visible";
|
|
1703
|
+
videoEl.style.pointerEvents = "none";
|
|
1704
|
+
container2 = ensureAdContainer();
|
|
1705
|
+
container2.appendChild(videoEl);
|
|
1706
|
+
adVideoElement = videoEl;
|
|
1707
|
+
setupAdEventListeners();
|
|
1708
|
+
if (!continueLiveStreamDuringAds) {
|
|
1709
|
+
contentVideo.pause();
|
|
1710
|
+
}
|
|
1711
|
+
contentVideo.muted = true;
|
|
1712
|
+
contentVideo.volume = 0;
|
|
1713
|
+
adPlaying = true;
|
|
1714
|
+
setAdPlayingFlag(true);
|
|
1715
|
+
adVolume21 = originalMutedState ? 1 : originalVolume;
|
|
1716
|
+
adVideoElement.volume = Math.max(0, Math.min(1, adVolume21));
|
|
1717
|
+
adVideoElement.muted = false;
|
|
1718
|
+
container2.style.display = "flex";
|
|
1719
|
+
container2.style.pointerEvents = "auto";
|
|
1720
|
+
emit("content_pause");
|
|
1721
|
+
if (debug) console.log("".concat(LOG, " [preload] smartTVMode deferred: creating video element and loading, url=").concat(slot.mediaFile.url));
|
|
1722
|
+
startPlayback(slot.mediaFile);
|
|
1723
|
+
return [
|
|
1724
|
+
2
|
|
1725
|
+
];
|
|
1726
|
+
}
|
|
1727
|
+
teardownCurrentPlayback();
|
|
1728
|
+
if (adVideoElement && adVideoElement !== slot.videoEl) {
|
|
1729
|
+
adVideoElement.remove();
|
|
1730
|
+
}
|
|
1731
|
+
slot.videoEl.style.visibility = "visible";
|
|
1732
|
+
slot.videoEl.style.pointerEvents = "none";
|
|
1733
|
+
adVideoElement = slot.videoEl;
|
|
1734
|
+
adHls = slot.hlsInstance;
|
|
1735
|
+
if (adHls) {
|
|
1736
|
+
nonFatalNetworkErrors = 0;
|
|
1737
|
+
adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
|
|
1738
|
+
if (!adPlaying) return;
|
|
1739
|
+
if (data.fatal) {
|
|
1740
|
+
handleAdError();
|
|
1741
|
+
} else if (data.type === import_hls.default.ErrorTypes.NETWORK_ERROR) {
|
|
1742
|
+
nonFatalNetworkErrors++;
|
|
1743
|
+
if (nonFatalNetworkErrors >= 3) {
|
|
1744
|
+
if (debug) console.warn("".concat(LOG, " [preload] Too many non-fatal HLS network errors during playback, treating as fatal"));
|
|
1745
|
+
handleAdError();
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
setupAdEventListeners();
|
|
1751
|
+
if (!continueLiveStreamDuringAds) {
|
|
1752
|
+
contentVideo.pause();
|
|
1753
|
+
}
|
|
1754
|
+
contentVideo.muted = true;
|
|
1755
|
+
contentVideo.volume = 0;
|
|
1756
|
+
adPlaying = true;
|
|
1757
|
+
setAdPlayingFlag(true);
|
|
1758
|
+
adVolume = originalMutedState ? 1 : originalVolume;
|
|
1759
|
+
adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
|
|
1760
|
+
adVideoElement.muted = false;
|
|
1761
|
+
container = ensureAdContainer();
|
|
1762
|
+
container.style.display = "flex";
|
|
1763
|
+
container.style.pointerEvents = "auto";
|
|
1764
|
+
emit("content_pause");
|
|
1765
|
+
adVideoElement.play().catch(function(error) {
|
|
1766
|
+
console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
|
|
1767
|
+
handleAdError();
|
|
1768
|
+
});
|
|
1769
|
+
return [
|
|
1770
|
+
2
|
|
1771
|
+
];
|
|
1662
1772
|
}
|
|
1663
|
-
contentVideo.muted = true;
|
|
1664
|
-
contentVideo.volume = 0;
|
|
1665
|
-
adPlaying = true;
|
|
1666
|
-
setAdPlayingFlag(true);
|
|
1667
|
-
adVolume = originalMutedState ? 1 : originalVolume;
|
|
1668
|
-
adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
|
|
1669
|
-
adVideoElement.muted = false;
|
|
1670
|
-
container = ensureAdContainer();
|
|
1671
|
-
container.style.display = "flex";
|
|
1672
|
-
container.style.pointerEvents = "auto";
|
|
1673
|
-
emit("content_pause");
|
|
1674
|
-
adVideoElement.play().catch(function(error) {
|
|
1675
|
-
console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
|
|
1676
|
-
handleAdError();
|
|
1677
|
-
});
|
|
1678
|
-
return [
|
|
1679
|
-
2
|
|
1680
|
-
];
|
|
1681
1773
|
});
|
|
1682
1774
|
})();
|
|
1683
1775
|
}
|
|
@@ -1862,6 +1954,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1862
1954
|
return 1;
|
|
1863
1955
|
},
|
|
1864
1956
|
showPlaceholder: function showPlaceholder() {
|
|
1957
|
+
if (singleElementMode) return;
|
|
1865
1958
|
contentVideo.style.opacity = "0";
|
|
1866
1959
|
contentVideo.style.visibility = "hidden";
|
|
1867
1960
|
if (!adContainerEl) {
|
|
@@ -3558,7 +3651,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3558
3651
|
}
|
|
3559
3652
|
_this.adLayer.cancelPreload(token);
|
|
3560
3653
|
} else {
|
|
3561
|
-
_this.
|
|
3654
|
+
if (!_this.config.singlePipelineMode) {
|
|
3655
|
+
_this.showPlaceholderLayer();
|
|
3656
|
+
}
|
|
3562
3657
|
_this.adLayer.showPlaceholder();
|
|
3563
3658
|
_this.isInAdTransition = true;
|
|
3564
3659
|
setTimeout(function() {
|
|
@@ -3582,7 +3677,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3582
3677
|
console.log("[StormcloudVideoPlayer] content_resume: skip pending bids, only", remainingNow1, "ms left");
|
|
3583
3678
|
}
|
|
3584
3679
|
} else {
|
|
3585
|
-
_this.
|
|
3680
|
+
if (!_this.config.singlePipelineMode) {
|
|
3681
|
+
_this.showPlaceholderLayer();
|
|
3682
|
+
}
|
|
3586
3683
|
_this.adLayer.showPlaceholder();
|
|
3587
3684
|
_this.isInAdTransition = true;
|
|
3588
3685
|
setTimeout(function() {
|
|
@@ -3933,7 +4030,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3933
4030
|
};
|
|
3934
4031
|
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
3935
4032
|
}
|
|
3936
|
-
if (!this.config.disableFiller && !this.video.muted) {
|
|
4033
|
+
if (!this.config.disableFiller && !this.video.muted && !this.adLayer.isAdPlaying()) {
|
|
3937
4034
|
this.video.muted = true;
|
|
3938
4035
|
this.video.volume = 0;
|
|
3939
4036
|
if (this.config.debugAdTiming) {
|
|
@@ -4950,7 +5047,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4950
5047
|
if (!this.config.disableFiller) this.showAds = true;
|
|
4951
5048
|
if (adBreakDurationMs != null) {
|
|
4952
5049
|
this.startFillerBreakTimer(adBreakDurationMs);
|
|
4953
|
-
} else if (!this.config.disableFiller) {
|
|
5050
|
+
} else if (!this.config.disableFiller && this.preloadedTokens.length === 0) {
|
|
4954
5051
|
this.showPlaceholderLayer();
|
|
4955
5052
|
}
|
|
4956
5053
|
if (!this.config.disableFiller) this.adLayer.showPlaceholder();
|
|
@@ -5567,7 +5664,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5567
5664
|
console.log("[StormcloudVideoPlayer] Smart TV: audio state restored on MANIFEST_PARSED after re-attach");
|
|
5568
5665
|
}
|
|
5569
5666
|
hlsRef.startLoad(-1);
|
|
5570
|
-
tryPlay(0);
|
|
5571
5667
|
if (debugEnabled) {
|
|
5572
5668
|
console.log("[StormcloudVideoPlayer] Smart TV: seeking to live edge and resuming playback after re-attach");
|
|
5573
5669
|
}
|