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.js
CHANGED
|
@@ -963,6 +963,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
963
963
|
var destroyed = false;
|
|
964
964
|
var tornDown = false;
|
|
965
965
|
var trackingFired = createEmptyTrackingState();
|
|
966
|
+
var adStallTimerId;
|
|
966
967
|
var currentAdEventHandlers;
|
|
967
968
|
var preloadSlots = /* @__PURE__ */ new Map();
|
|
968
969
|
function emit(event, payload) {
|
|
@@ -1078,7 +1079,14 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1078
1079
|
video.volume = 1;
|
|
1079
1080
|
return video;
|
|
1080
1081
|
}
|
|
1082
|
+
function clearAdStallTimer() {
|
|
1083
|
+
if (adStallTimerId != null) {
|
|
1084
|
+
clearTimeout(adStallTimerId);
|
|
1085
|
+
adStallTimerId = void 0;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1081
1088
|
function removeAdEventListeners() {
|
|
1089
|
+
clearAdStallTimer();
|
|
1082
1090
|
if (!currentAdEventHandlers || !adVideoElement) return;
|
|
1083
1091
|
var el = adVideoElement;
|
|
1084
1092
|
el.removeEventListener("timeupdate", currentAdEventHandlers.timeupdate);
|
|
@@ -1088,6 +1096,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1088
1096
|
el.removeEventListener("volumechange", currentAdEventHandlers.volumechange);
|
|
1089
1097
|
el.removeEventListener("pause", currentAdEventHandlers.pause);
|
|
1090
1098
|
el.removeEventListener("play", currentAdEventHandlers.play);
|
|
1099
|
+
el.removeEventListener("waiting", currentAdEventHandlers.waiting);
|
|
1091
1100
|
currentAdEventHandlers = void 0;
|
|
1092
1101
|
}
|
|
1093
1102
|
function setupAdEventListeners() {
|
|
@@ -1112,6 +1121,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1112
1121
|
}
|
|
1113
1122
|
},
|
|
1114
1123
|
playing: function playing() {
|
|
1124
|
+
clearAdStallTimer();
|
|
1115
1125
|
var ad = currentAd;
|
|
1116
1126
|
if (!ad || trackingFired.start) return;
|
|
1117
1127
|
trackingFired.start = true;
|
|
@@ -1148,6 +1158,16 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1148
1158
|
if (currentAd && adVideoElement && adVideoElement.currentTime > 0) {
|
|
1149
1159
|
fireTrackingPixels2(currentAd.trackingUrls.resume);
|
|
1150
1160
|
}
|
|
1161
|
+
},
|
|
1162
|
+
waiting: function waiting() {
|
|
1163
|
+
clearAdStallTimer();
|
|
1164
|
+
adStallTimerId = setTimeout(function() {
|
|
1165
|
+
adStallTimerId = void 0;
|
|
1166
|
+
if (adPlaying) {
|
|
1167
|
+
if (debug) console.warn("".concat(LOG, " Ad video stalled for too long, treating as error"));
|
|
1168
|
+
handleAdError();
|
|
1169
|
+
}
|
|
1170
|
+
}, 8e3);
|
|
1151
1171
|
}
|
|
1152
1172
|
};
|
|
1153
1173
|
adVideoElement.addEventListener("timeupdate", handlers.timeupdate);
|
|
@@ -1157,6 +1177,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1157
1177
|
adVideoElement.addEventListener("volumechange", handlers.volumechange);
|
|
1158
1178
|
adVideoElement.addEventListener("pause", handlers.pause);
|
|
1159
1179
|
adVideoElement.addEventListener("play", handlers.play);
|
|
1180
|
+
adVideoElement.addEventListener("waiting", handlers.waiting);
|
|
1160
1181
|
currentAdEventHandlers = handlers;
|
|
1161
1182
|
}
|
|
1162
1183
|
function setAdPlayingFlag(isPlaying) {
|
|
@@ -1168,6 +1189,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1168
1189
|
}
|
|
1169
1190
|
function handleAdComplete() {
|
|
1170
1191
|
if (tornDown) return;
|
|
1192
|
+
clearAdStallTimer();
|
|
1171
1193
|
if (debug) console.log("".concat(LOG, " Handling ad completion"));
|
|
1172
1194
|
adPlaying = false;
|
|
1173
1195
|
setAdPlayingFlag(false);
|
|
@@ -1181,6 +1203,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1181
1203
|
function handleAdError() {
|
|
1182
1204
|
if (tornDown) return;
|
|
1183
1205
|
if (!adPlaying) return;
|
|
1206
|
+
clearAdStallTimer();
|
|
1184
1207
|
if (debug) console.log("".concat(LOG, " Handling ad error"));
|
|
1185
1208
|
adPlaying = false;
|
|
1186
1209
|
setAdPlayingFlag(false);
|
|
@@ -1231,6 +1254,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1231
1254
|
adHls.loadSource(mediaFile.url);
|
|
1232
1255
|
adHls.attachMedia(adVideoElement);
|
|
1233
1256
|
adHls.on(Hls.Events.MANIFEST_PARSED, function() {
|
|
1257
|
+
if (!adPlaying) return;
|
|
1234
1258
|
adVideoElement.play().catch(function(error) {
|
|
1235
1259
|
console.error("".concat(LOG, " Error starting HLS ad playback:"), error);
|
|
1236
1260
|
handleAdError();
|
|
@@ -1279,7 +1303,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1279
1303
|
}
|
|
1280
1304
|
function playAd(bids) {
|
|
1281
1305
|
return _async_to_generator(function() {
|
|
1282
|
-
var winner, ad, contentVolume, _contentVideo_parentElement, container, adVolume, mediaFile;
|
|
1306
|
+
var winner, ad, contentVolume, adVolume2, mediaFile2, _contentVideo_parentElement, container, adVolume, mediaFile;
|
|
1283
1307
|
return _ts_generator(this, function(_state) {
|
|
1284
1308
|
switch(_state.label){
|
|
1285
1309
|
case 0:
|
|
@@ -1323,37 +1347,71 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1323
1347
|
trackingFired.impression = true;
|
|
1324
1348
|
contentVolume = contentVideo.volume;
|
|
1325
1349
|
originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
|
|
1326
|
-
if (singleElementMode)
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1350
|
+
if (!singleElementMode) return [
|
|
1351
|
+
3,
|
|
1352
|
+
3
|
|
1353
|
+
];
|
|
1354
|
+
mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
|
|
1355
|
+
teardownCurrentPlayback();
|
|
1356
|
+
adVideoElement = contentVideo;
|
|
1357
|
+
adHls = void 0;
|
|
1358
|
+
adPlaying = true;
|
|
1359
|
+
setAdPlayingFlag(true);
|
|
1360
|
+
contentVideo.removeAttribute("src");
|
|
1361
|
+
contentVideo.load();
|
|
1362
|
+
if (!continueLiveStreamDuringAds) {
|
|
1363
|
+
contentVideo.pause();
|
|
1364
|
+
}
|
|
1365
|
+
contentVideo.muted = true;
|
|
1366
|
+
contentVideo.volume = 0;
|
|
1367
|
+
return [
|
|
1368
|
+
4,
|
|
1369
|
+
new Promise(function(resolve) {
|
|
1370
|
+
return setTimeout(resolve, 200);
|
|
1371
|
+
})
|
|
1372
|
+
];
|
|
1373
|
+
case 2:
|
|
1374
|
+
_state.sent();
|
|
1375
|
+
if (destroyed || tornDown) return [
|
|
1376
|
+
2
|
|
1377
|
+
];
|
|
1378
|
+
contentVideo.style.visibility = "visible";
|
|
1379
|
+
contentVideo.style.opacity = "1";
|
|
1380
|
+
emit("content_pause");
|
|
1381
|
+
setupAdEventListeners();
|
|
1382
|
+
adVolume2 = originalMutedState ? 1 : originalVolume;
|
|
1383
|
+
adVideoElement.volume = Math.max(0, Math.min(1, adVolume2));
|
|
1384
|
+
adVideoElement.muted = false;
|
|
1385
|
+
mediaFile2 = selectBestMediaFile(ad.mediaFiles);
|
|
1386
|
+
if (debug) console.log("".concat(LOG, " Loading ad from: ").concat(mediaFile2.url));
|
|
1387
|
+
startPlayback(mediaFile2);
|
|
1388
|
+
return [
|
|
1389
|
+
2
|
|
1390
|
+
];
|
|
1391
|
+
case 3:
|
|
1392
|
+
if (!adContainerEl) {
|
|
1393
|
+
;
|
|
1394
|
+
container = document.createElement("div");
|
|
1395
|
+
container.style.position = "absolute";
|
|
1396
|
+
container.style.left = "0";
|
|
1397
|
+
container.style.top = "0";
|
|
1398
|
+
container.style.right = "0";
|
|
1399
|
+
container.style.bottom = "0";
|
|
1400
|
+
container.style.display = "none";
|
|
1401
|
+
container.style.alignItems = "center";
|
|
1402
|
+
container.style.justifyContent = "center";
|
|
1403
|
+
container.style.pointerEvents = "none";
|
|
1404
|
+
container.style.zIndex = "10";
|
|
1405
|
+
container.style.backgroundColor = "#000";
|
|
1406
|
+
(_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
|
|
1407
|
+
adContainerEl = container;
|
|
1408
|
+
}
|
|
1409
|
+
if (!adVideoElement) {
|
|
1410
|
+
adVideoElement = createAdVideoElement();
|
|
1411
|
+
adContainerEl.appendChild(adVideoElement);
|
|
1331
1412
|
setupAdEventListeners();
|
|
1332
1413
|
} else {
|
|
1333
|
-
|
|
1334
|
-
;
|
|
1335
|
-
container = document.createElement("div");
|
|
1336
|
-
container.style.position = "absolute";
|
|
1337
|
-
container.style.left = "0";
|
|
1338
|
-
container.style.top = "0";
|
|
1339
|
-
container.style.right = "0";
|
|
1340
|
-
container.style.bottom = "0";
|
|
1341
|
-
container.style.display = "none";
|
|
1342
|
-
container.style.alignItems = "center";
|
|
1343
|
-
container.style.justifyContent = "center";
|
|
1344
|
-
container.style.pointerEvents = "none";
|
|
1345
|
-
container.style.zIndex = "10";
|
|
1346
|
-
container.style.backgroundColor = "#000";
|
|
1347
|
-
(_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
|
|
1348
|
-
adContainerEl = container;
|
|
1349
|
-
}
|
|
1350
|
-
if (!adVideoElement) {
|
|
1351
|
-
adVideoElement = createAdVideoElement();
|
|
1352
|
-
adContainerEl.appendChild(adVideoElement);
|
|
1353
|
-
setupAdEventListeners();
|
|
1354
|
-
} else {
|
|
1355
|
-
teardownCurrentPlayback();
|
|
1356
|
-
}
|
|
1414
|
+
teardownCurrentPlayback();
|
|
1357
1415
|
}
|
|
1358
1416
|
if (!continueLiveStreamDuringAds) {
|
|
1359
1417
|
contentVideo.pause();
|
|
@@ -1365,7 +1423,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1365
1423
|
adVolume = originalMutedState ? 1 : originalVolume;
|
|
1366
1424
|
adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
|
|
1367
1425
|
adVideoElement.muted = false;
|
|
1368
|
-
if (
|
|
1426
|
+
if (adContainerEl) {
|
|
1369
1427
|
adContainerEl.style.display = "flex";
|
|
1370
1428
|
adContainerEl.style.pointerEvents = "auto";
|
|
1371
1429
|
}
|
|
@@ -1469,6 +1527,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1469
1527
|
if (debug) console.log("".concat(LOG, " [preload] HLS manifest parsed, token=").concat(token));
|
|
1470
1528
|
});
|
|
1471
1529
|
hls.on(Hls.Events.ERROR, function(_evt, data) {
|
|
1530
|
+
if (!preloadSlots.has(token)) return;
|
|
1472
1531
|
if (data.fatal) {
|
|
1473
1532
|
if (debug) console.warn("".concat(LOG, " [preload] HLS error for token=").concat(token));
|
|
1474
1533
|
preloadSlots.delete(token);
|
|
@@ -1505,113 +1564,146 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1505
1564
|
}
|
|
1506
1565
|
function playPreloaded(token) {
|
|
1507
1566
|
return _async_to_generator(function() {
|
|
1508
|
-
var slot, contentVolume, adVolume2, videoEl, container2, adVolume21, adVolume, container;
|
|
1567
|
+
var slot, contentVolume, adVolume2, videoEl, container2, adVolume21, nonFatalNetworkErrors, adVolume, container;
|
|
1509
1568
|
return _ts_generator(this, function(_state) {
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1569
|
+
switch(_state.label){
|
|
1570
|
+
case 0:
|
|
1571
|
+
if (destroyed) return [
|
|
1572
|
+
2,
|
|
1573
|
+
Promise.reject(new Error("Layer has been destroyed"))
|
|
1574
|
+
];
|
|
1575
|
+
slot = preloadSlots.get(token);
|
|
1576
|
+
if (!slot) {
|
|
1577
|
+
if (debug) console.warn("".concat(LOG, " [preload] No slot found for token=").concat(token, ", nothing to play"));
|
|
1578
|
+
return [
|
|
1579
|
+
2
|
|
1580
|
+
];
|
|
1581
|
+
}
|
|
1582
|
+
preloadSlots.delete(token);
|
|
1583
|
+
if (debug) console.log("".concat(LOG, " [preload] Playing preloaded ad, token=").concat(token, ", ready=").concat(slot.ready));
|
|
1584
|
+
contentVolume = contentVideo.volume;
|
|
1585
|
+
originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
|
|
1586
|
+
sessionId = generateSessionId();
|
|
1587
|
+
currentAd = slot.ad;
|
|
1588
|
+
trackingFired = _object_spread({}, createEmptyTrackingState());
|
|
1589
|
+
fireTrackingPixels2(slot.ad.trackingUrls.impression);
|
|
1590
|
+
trackingFired.impression = true;
|
|
1591
|
+
if (!singleElementMode) return [
|
|
1592
|
+
3,
|
|
1593
|
+
2
|
|
1594
|
+
];
|
|
1595
|
+
mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
|
|
1596
|
+
teardownCurrentPlayback();
|
|
1597
|
+
adVideoElement = contentVideo;
|
|
1598
|
+
adHls = void 0;
|
|
1599
|
+
adPlaying = true;
|
|
1600
|
+
setAdPlayingFlag(true);
|
|
1601
|
+
contentVideo.removeAttribute("src");
|
|
1602
|
+
contentVideo.load();
|
|
1603
|
+
contentVideo.muted = true;
|
|
1604
|
+
contentVideo.volume = 0;
|
|
1605
|
+
return [
|
|
1606
|
+
4,
|
|
1607
|
+
new Promise(function(resolve) {
|
|
1608
|
+
return setTimeout(resolve, 200);
|
|
1609
|
+
})
|
|
1610
|
+
];
|
|
1611
|
+
case 1:
|
|
1612
|
+
_state.sent();
|
|
1613
|
+
if (destroyed || tornDown) return [
|
|
1614
|
+
2
|
|
1615
|
+
];
|
|
1616
|
+
contentVideo.style.visibility = "visible";
|
|
1617
|
+
contentVideo.style.opacity = "1";
|
|
1618
|
+
emit("content_pause");
|
|
1619
|
+
setupAdEventListeners();
|
|
1620
|
+
adVolume2 = originalMutedState ? 1 : originalVolume;
|
|
1621
|
+
contentVideo.volume = Math.max(0, Math.min(1, adVolume2));
|
|
1622
|
+
contentVideo.muted = false;
|
|
1623
|
+
if (debug) console.log("".concat(LOG, " [preload] singleElementMode: attaching ad to contentVideo, url=").concat(slot.mediaFile.url));
|
|
1624
|
+
startPlayback(slot.mediaFile);
|
|
1625
|
+
return [
|
|
1626
|
+
2
|
|
1627
|
+
];
|
|
1628
|
+
case 2:
|
|
1629
|
+
if (smartTVMode && !slot.videoEl) {
|
|
1630
|
+
teardownCurrentPlayback();
|
|
1631
|
+
if (adVideoElement) {
|
|
1632
|
+
adVideoElement.remove();
|
|
1633
|
+
adVideoElement = void 0;
|
|
1634
|
+
}
|
|
1635
|
+
videoEl = createAdVideoElement();
|
|
1636
|
+
videoEl.style.visibility = "visible";
|
|
1637
|
+
videoEl.style.pointerEvents = "none";
|
|
1638
|
+
container2 = ensureAdContainer();
|
|
1639
|
+
container2.appendChild(videoEl);
|
|
1640
|
+
adVideoElement = videoEl;
|
|
1641
|
+
setupAdEventListeners();
|
|
1642
|
+
if (!continueLiveStreamDuringAds) {
|
|
1643
|
+
contentVideo.pause();
|
|
1644
|
+
}
|
|
1645
|
+
contentVideo.muted = true;
|
|
1646
|
+
contentVideo.volume = 0;
|
|
1647
|
+
adPlaying = true;
|
|
1648
|
+
setAdPlayingFlag(true);
|
|
1649
|
+
adVolume21 = originalMutedState ? 1 : originalVolume;
|
|
1650
|
+
adVideoElement.volume = Math.max(0, Math.min(1, adVolume21));
|
|
1651
|
+
adVideoElement.muted = false;
|
|
1652
|
+
container2.style.display = "flex";
|
|
1653
|
+
container2.style.pointerEvents = "auto";
|
|
1654
|
+
emit("content_pause");
|
|
1655
|
+
if (debug) console.log("".concat(LOG, " [preload] smartTVMode deferred: creating video element and loading, url=").concat(slot.mediaFile.url));
|
|
1656
|
+
startPlayback(slot.mediaFile);
|
|
1657
|
+
return [
|
|
1658
|
+
2
|
|
1659
|
+
];
|
|
1660
|
+
}
|
|
1661
|
+
teardownCurrentPlayback();
|
|
1662
|
+
if (adVideoElement && adVideoElement !== slot.videoEl) {
|
|
1663
|
+
adVideoElement.remove();
|
|
1664
|
+
}
|
|
1665
|
+
slot.videoEl.style.visibility = "visible";
|
|
1666
|
+
slot.videoEl.style.pointerEvents = "none";
|
|
1667
|
+
adVideoElement = slot.videoEl;
|
|
1668
|
+
adHls = slot.hlsInstance;
|
|
1669
|
+
if (adHls) {
|
|
1670
|
+
nonFatalNetworkErrors = 0;
|
|
1671
|
+
adHls.on(Hls.Events.ERROR, function(_event, data) {
|
|
1672
|
+
if (!adPlaying) return;
|
|
1673
|
+
if (data.fatal) {
|
|
1674
|
+
handleAdError();
|
|
1675
|
+
} else if (data.type === Hls.ErrorTypes.NETWORK_ERROR) {
|
|
1676
|
+
nonFatalNetworkErrors++;
|
|
1677
|
+
if (nonFatalNetworkErrors >= 3) {
|
|
1678
|
+
if (debug) console.warn("".concat(LOG, " [preload] Too many non-fatal HLS network errors during playback, treating as fatal"));
|
|
1679
|
+
handleAdError();
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
});
|
|
1683
|
+
}
|
|
1684
|
+
setupAdEventListeners();
|
|
1685
|
+
if (!continueLiveStreamDuringAds) {
|
|
1686
|
+
contentVideo.pause();
|
|
1687
|
+
}
|
|
1688
|
+
contentVideo.muted = true;
|
|
1689
|
+
contentVideo.volume = 0;
|
|
1690
|
+
adPlaying = true;
|
|
1691
|
+
setAdPlayingFlag(true);
|
|
1692
|
+
adVolume = originalMutedState ? 1 : originalVolume;
|
|
1693
|
+
adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
|
|
1694
|
+
adVideoElement.muted = false;
|
|
1695
|
+
container = ensureAdContainer();
|
|
1696
|
+
container.style.display = "flex";
|
|
1697
|
+
container.style.pointerEvents = "auto";
|
|
1698
|
+
emit("content_pause");
|
|
1699
|
+
adVideoElement.play().catch(function(error) {
|
|
1700
|
+
console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
|
|
1701
|
+
handleAdError();
|
|
1702
|
+
});
|
|
1703
|
+
return [
|
|
1704
|
+
2
|
|
1705
|
+
];
|
|
1588
1706
|
}
|
|
1589
|
-
slot.videoEl.style.visibility = "visible";
|
|
1590
|
-
slot.videoEl.style.pointerEvents = "none";
|
|
1591
|
-
adVideoElement = slot.videoEl;
|
|
1592
|
-
adHls = slot.hlsInstance;
|
|
1593
|
-
setupAdEventListeners();
|
|
1594
|
-
if (!continueLiveStreamDuringAds) {
|
|
1595
|
-
contentVideo.pause();
|
|
1596
|
-
}
|
|
1597
|
-
contentVideo.muted = true;
|
|
1598
|
-
contentVideo.volume = 0;
|
|
1599
|
-
adPlaying = true;
|
|
1600
|
-
setAdPlayingFlag(true);
|
|
1601
|
-
adVolume = originalMutedState ? 1 : originalVolume;
|
|
1602
|
-
adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
|
|
1603
|
-
adVideoElement.muted = false;
|
|
1604
|
-
container = ensureAdContainer();
|
|
1605
|
-
container.style.display = "flex";
|
|
1606
|
-
container.style.pointerEvents = "auto";
|
|
1607
|
-
emit("content_pause");
|
|
1608
|
-
adVideoElement.play().catch(function(error) {
|
|
1609
|
-
console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
|
|
1610
|
-
handleAdError();
|
|
1611
|
-
});
|
|
1612
|
-
return [
|
|
1613
|
-
2
|
|
1614
|
-
];
|
|
1615
1707
|
});
|
|
1616
1708
|
})();
|
|
1617
1709
|
}
|
|
@@ -1796,6 +1888,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1796
1888
|
return 1;
|
|
1797
1889
|
},
|
|
1798
1890
|
showPlaceholder: function showPlaceholder() {
|
|
1891
|
+
if (singleElementMode) return;
|
|
1799
1892
|
contentVideo.style.opacity = "0";
|
|
1800
1893
|
contentVideo.style.visibility = "hidden";
|
|
1801
1894
|
if (!adContainerEl) {
|
|
@@ -3520,7 +3613,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3520
3613
|
}
|
|
3521
3614
|
_this.adLayer.cancelPreload(token);
|
|
3522
3615
|
} else {
|
|
3523
|
-
_this.
|
|
3616
|
+
if (!_this.config.singlePipelineMode) {
|
|
3617
|
+
_this.showPlaceholderLayer();
|
|
3618
|
+
}
|
|
3524
3619
|
_this.adLayer.showPlaceholder();
|
|
3525
3620
|
_this.isInAdTransition = true;
|
|
3526
3621
|
setTimeout(function() {
|
|
@@ -3544,7 +3639,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3544
3639
|
console.log("[StormcloudVideoPlayer] content_resume: skip pending bids, only", remainingNow1, "ms left");
|
|
3545
3640
|
}
|
|
3546
3641
|
} else {
|
|
3547
|
-
_this.
|
|
3642
|
+
if (!_this.config.singlePipelineMode) {
|
|
3643
|
+
_this.showPlaceholderLayer();
|
|
3644
|
+
}
|
|
3548
3645
|
_this.adLayer.showPlaceholder();
|
|
3549
3646
|
_this.isInAdTransition = true;
|
|
3550
3647
|
setTimeout(function() {
|
|
@@ -3895,7 +3992,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3895
3992
|
};
|
|
3896
3993
|
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
3897
3994
|
}
|
|
3898
|
-
if (!this.config.disableFiller && !this.video.muted) {
|
|
3995
|
+
if (!this.config.disableFiller && !this.video.muted && !this.adLayer.isAdPlaying()) {
|
|
3899
3996
|
this.video.muted = true;
|
|
3900
3997
|
this.video.volume = 0;
|
|
3901
3998
|
if (this.config.debugAdTiming) {
|
|
@@ -4912,7 +5009,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4912
5009
|
if (!this.config.disableFiller) this.showAds = true;
|
|
4913
5010
|
if (adBreakDurationMs != null) {
|
|
4914
5011
|
this.startFillerBreakTimer(adBreakDurationMs);
|
|
4915
|
-
} else if (!this.config.disableFiller) {
|
|
5012
|
+
} else if (!this.config.disableFiller && this.preloadedTokens.length === 0) {
|
|
4916
5013
|
this.showPlaceholderLayer();
|
|
4917
5014
|
}
|
|
4918
5015
|
if (!this.config.disableFiller) this.adLayer.showPlaceholder();
|
|
@@ -5529,7 +5626,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5529
5626
|
console.log("[StormcloudVideoPlayer] Smart TV: audio state restored on MANIFEST_PARSED after re-attach");
|
|
5530
5627
|
}
|
|
5531
5628
|
hlsRef.startLoad(-1);
|
|
5532
|
-
tryPlay(0);
|
|
5533
5629
|
if (debugEnabled) {
|
|
5534
5630
|
console.log("[StormcloudVideoPlayer] Smart TV: seeking to live edge and resuming playback after re-attach");
|
|
5535
5631
|
}
|