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.
@@ -941,6 +941,7 @@ function createVastAdLayer(contentVideo, options) {
941
941
  var destroyed = false;
942
942
  var tornDown = false;
943
943
  var trackingFired = createEmptyTrackingState();
944
+ var adStallTimerId;
944
945
  var currentAdEventHandlers;
945
946
  var preloadSlots = /* @__PURE__ */ new Map();
946
947
  function emit(event, payload) {
@@ -1056,7 +1057,14 @@ function createVastAdLayer(contentVideo, options) {
1056
1057
  video.volume = 1;
1057
1058
  return video;
1058
1059
  }
1060
+ function clearAdStallTimer() {
1061
+ if (adStallTimerId != null) {
1062
+ clearTimeout(adStallTimerId);
1063
+ adStallTimerId = void 0;
1064
+ }
1065
+ }
1059
1066
  function removeAdEventListeners() {
1067
+ clearAdStallTimer();
1060
1068
  if (!currentAdEventHandlers || !adVideoElement) return;
1061
1069
  var el = adVideoElement;
1062
1070
  el.removeEventListener("timeupdate", currentAdEventHandlers.timeupdate);
@@ -1066,6 +1074,7 @@ function createVastAdLayer(contentVideo, options) {
1066
1074
  el.removeEventListener("volumechange", currentAdEventHandlers.volumechange);
1067
1075
  el.removeEventListener("pause", currentAdEventHandlers.pause);
1068
1076
  el.removeEventListener("play", currentAdEventHandlers.play);
1077
+ el.removeEventListener("waiting", currentAdEventHandlers.waiting);
1069
1078
  currentAdEventHandlers = void 0;
1070
1079
  }
1071
1080
  function setupAdEventListeners() {
@@ -1090,6 +1099,7 @@ function createVastAdLayer(contentVideo, options) {
1090
1099
  }
1091
1100
  },
1092
1101
  playing: function playing() {
1102
+ clearAdStallTimer();
1093
1103
  var ad = currentAd;
1094
1104
  if (!ad || trackingFired.start) return;
1095
1105
  trackingFired.start = true;
@@ -1126,6 +1136,16 @@ function createVastAdLayer(contentVideo, options) {
1126
1136
  if (currentAd && adVideoElement && adVideoElement.currentTime > 0) {
1127
1137
  fireTrackingPixels2(currentAd.trackingUrls.resume);
1128
1138
  }
1139
+ },
1140
+ waiting: function waiting() {
1141
+ clearAdStallTimer();
1142
+ adStallTimerId = setTimeout(function() {
1143
+ adStallTimerId = void 0;
1144
+ if (adPlaying) {
1145
+ if (debug) console.warn("".concat(LOG, " Ad video stalled for too long, treating as error"));
1146
+ handleAdError();
1147
+ }
1148
+ }, 8e3);
1129
1149
  }
1130
1150
  };
1131
1151
  adVideoElement.addEventListener("timeupdate", handlers.timeupdate);
@@ -1135,6 +1155,7 @@ function createVastAdLayer(contentVideo, options) {
1135
1155
  adVideoElement.addEventListener("volumechange", handlers.volumechange);
1136
1156
  adVideoElement.addEventListener("pause", handlers.pause);
1137
1157
  adVideoElement.addEventListener("play", handlers.play);
1158
+ adVideoElement.addEventListener("waiting", handlers.waiting);
1138
1159
  currentAdEventHandlers = handlers;
1139
1160
  }
1140
1161
  function setAdPlayingFlag(isPlaying) {
@@ -1146,6 +1167,7 @@ function createVastAdLayer(contentVideo, options) {
1146
1167
  }
1147
1168
  function handleAdComplete() {
1148
1169
  if (tornDown) return;
1170
+ clearAdStallTimer();
1149
1171
  if (debug) console.log("".concat(LOG, " Handling ad completion"));
1150
1172
  adPlaying = false;
1151
1173
  setAdPlayingFlag(false);
@@ -1159,6 +1181,7 @@ function createVastAdLayer(contentVideo, options) {
1159
1181
  function handleAdError() {
1160
1182
  if (tornDown) return;
1161
1183
  if (!adPlaying) return;
1184
+ clearAdStallTimer();
1162
1185
  if (debug) console.log("".concat(LOG, " Handling ad error"));
1163
1186
  adPlaying = false;
1164
1187
  setAdPlayingFlag(false);
@@ -1209,6 +1232,7 @@ function createVastAdLayer(contentVideo, options) {
1209
1232
  adHls.loadSource(mediaFile.url);
1210
1233
  adHls.attachMedia(adVideoElement);
1211
1234
  adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
1235
+ if (!adPlaying) return;
1212
1236
  adVideoElement.play().catch(function(error) {
1213
1237
  console.error("".concat(LOG, " Error starting HLS ad playback:"), error);
1214
1238
  handleAdError();
@@ -1257,7 +1281,7 @@ function createVastAdLayer(contentVideo, options) {
1257
1281
  }
1258
1282
  function playAd(bids) {
1259
1283
  return _async_to_generator(function() {
1260
- var winner, ad, contentVolume, _contentVideo_parentElement, container, adVolume, mediaFile;
1284
+ var winner, ad, contentVolume, adVolume2, mediaFile2, _contentVideo_parentElement, container, adVolume, mediaFile;
1261
1285
  return _ts_generator(this, function(_state) {
1262
1286
  switch(_state.label){
1263
1287
  case 0:
@@ -1301,37 +1325,71 @@ function createVastAdLayer(contentVideo, options) {
1301
1325
  trackingFired.impression = true;
1302
1326
  contentVolume = contentVideo.volume;
1303
1327
  originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1304
- if (singleElementMode) {
1305
- mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1306
- teardownCurrentPlayback();
1307
- adVideoElement = contentVideo;
1308
- adHls = void 0;
1328
+ if (!singleElementMode) return [
1329
+ 3,
1330
+ 3
1331
+ ];
1332
+ mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1333
+ teardownCurrentPlayback();
1334
+ adVideoElement = contentVideo;
1335
+ adHls = void 0;
1336
+ adPlaying = true;
1337
+ setAdPlayingFlag(true);
1338
+ contentVideo.removeAttribute("src");
1339
+ contentVideo.load();
1340
+ if (!continueLiveStreamDuringAds) {
1341
+ contentVideo.pause();
1342
+ }
1343
+ contentVideo.muted = true;
1344
+ contentVideo.volume = 0;
1345
+ return [
1346
+ 4,
1347
+ new Promise(function(resolve) {
1348
+ return setTimeout(resolve, 200);
1349
+ })
1350
+ ];
1351
+ case 2:
1352
+ _state.sent();
1353
+ if (destroyed || tornDown) return [
1354
+ 2
1355
+ ];
1356
+ contentVideo.style.visibility = "visible";
1357
+ contentVideo.style.opacity = "1";
1358
+ emit("content_pause");
1359
+ setupAdEventListeners();
1360
+ adVolume2 = originalMutedState ? 1 : originalVolume;
1361
+ adVideoElement.volume = Math.max(0, Math.min(1, adVolume2));
1362
+ adVideoElement.muted = false;
1363
+ mediaFile2 = selectBestMediaFile(ad.mediaFiles);
1364
+ if (debug) console.log("".concat(LOG, " Loading ad from: ").concat(mediaFile2.url));
1365
+ startPlayback(mediaFile2);
1366
+ return [
1367
+ 2
1368
+ ];
1369
+ case 3:
1370
+ if (!adContainerEl) {
1371
+ ;
1372
+ container = document.createElement("div");
1373
+ container.style.position = "absolute";
1374
+ container.style.left = "0";
1375
+ container.style.top = "0";
1376
+ container.style.right = "0";
1377
+ container.style.bottom = "0";
1378
+ container.style.display = "none";
1379
+ container.style.alignItems = "center";
1380
+ container.style.justifyContent = "center";
1381
+ container.style.pointerEvents = "none";
1382
+ container.style.zIndex = "10";
1383
+ container.style.backgroundColor = "#000";
1384
+ (_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
1385
+ adContainerEl = container;
1386
+ }
1387
+ if (!adVideoElement) {
1388
+ adVideoElement = createAdVideoElement();
1389
+ adContainerEl.appendChild(adVideoElement);
1309
1390
  setupAdEventListeners();
1310
1391
  } else {
1311
- if (!adContainerEl) {
1312
- ;
1313
- container = document.createElement("div");
1314
- container.style.position = "absolute";
1315
- container.style.left = "0";
1316
- container.style.top = "0";
1317
- container.style.right = "0";
1318
- container.style.bottom = "0";
1319
- container.style.display = "none";
1320
- container.style.alignItems = "center";
1321
- container.style.justifyContent = "center";
1322
- container.style.pointerEvents = "none";
1323
- container.style.zIndex = "10";
1324
- container.style.backgroundColor = "#000";
1325
- (_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
1326
- adContainerEl = container;
1327
- }
1328
- if (!adVideoElement) {
1329
- adVideoElement = createAdVideoElement();
1330
- adContainerEl.appendChild(adVideoElement);
1331
- setupAdEventListeners();
1332
- } else {
1333
- teardownCurrentPlayback();
1334
- }
1392
+ teardownCurrentPlayback();
1335
1393
  }
1336
1394
  if (!continueLiveStreamDuringAds) {
1337
1395
  contentVideo.pause();
@@ -1343,7 +1401,7 @@ function createVastAdLayer(contentVideo, options) {
1343
1401
  adVolume = originalMutedState ? 1 : originalVolume;
1344
1402
  adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
1345
1403
  adVideoElement.muted = false;
1346
- if (!singleElementMode && adContainerEl) {
1404
+ if (adContainerEl) {
1347
1405
  adContainerEl.style.display = "flex";
1348
1406
  adContainerEl.style.pointerEvents = "auto";
1349
1407
  }
@@ -1447,6 +1505,7 @@ function createVastAdLayer(contentVideo, options) {
1447
1505
  if (debug) console.log("".concat(LOG, " [preload] HLS manifest parsed, token=").concat(token));
1448
1506
  });
1449
1507
  hls.on(import_hls.default.Events.ERROR, function(_evt, data) {
1508
+ if (!preloadSlots.has(token)) return;
1450
1509
  if (data.fatal) {
1451
1510
  if (debug) console.warn("".concat(LOG, " [preload] HLS error for token=").concat(token));
1452
1511
  preloadSlots.delete(token);
@@ -1483,113 +1542,146 @@ function createVastAdLayer(contentVideo, options) {
1483
1542
  }
1484
1543
  function playPreloaded(token) {
1485
1544
  return _async_to_generator(function() {
1486
- var slot, contentVolume, adVolume2, videoEl, container2, adVolume21, adVolume, container;
1545
+ var slot, contentVolume, adVolume2, videoEl, container2, adVolume21, nonFatalNetworkErrors, adVolume, container;
1487
1546
  return _ts_generator(this, function(_state) {
1488
- if (destroyed) return [
1489
- 2,
1490
- Promise.reject(new Error("Layer has been destroyed"))
1491
- ];
1492
- slot = preloadSlots.get(token);
1493
- if (!slot) {
1494
- if (debug) console.warn("".concat(LOG, " [preload] No slot found for token=").concat(token, ", nothing to play"));
1495
- return [
1496
- 2
1497
- ];
1498
- }
1499
- preloadSlots.delete(token);
1500
- if (debug) console.log("".concat(LOG, " [preload] Playing preloaded ad, token=").concat(token, ", ready=").concat(slot.ready));
1501
- contentVolume = contentVideo.volume;
1502
- originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1503
- sessionId = generateSessionId();
1504
- currentAd = slot.ad;
1505
- trackingFired = _object_spread({}, createEmptyTrackingState());
1506
- fireTrackingPixels2(slot.ad.trackingUrls.impression);
1507
- trackingFired.impression = true;
1508
- if (singleElementMode) {
1509
- mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1510
- teardownCurrentPlayback();
1511
- adVideoElement = contentVideo;
1512
- adHls = void 0;
1513
- setupAdEventListeners();
1514
- if (!continueLiveStreamDuringAds) {
1515
- contentVideo.pause();
1516
- }
1517
- contentVideo.muted = true;
1518
- contentVideo.volume = 0;
1519
- adPlaying = true;
1520
- setAdPlayingFlag(true);
1521
- adVolume2 = originalMutedState ? 1 : originalVolume;
1522
- contentVideo.volume = Math.max(0, Math.min(1, adVolume2));
1523
- contentVideo.muted = false;
1524
- emit("content_pause");
1525
- if (debug) console.log("".concat(LOG, " [preload] singleElementMode: attaching ad to contentVideo, url=").concat(slot.mediaFile.url));
1526
- startPlayback(slot.mediaFile);
1527
- return [
1528
- 2
1529
- ];
1530
- }
1531
- if (smartTVMode && !slot.videoEl) {
1532
- teardownCurrentPlayback();
1533
- if (adVideoElement) {
1534
- adVideoElement.remove();
1535
- adVideoElement = void 0;
1536
- }
1537
- videoEl = createAdVideoElement();
1538
- videoEl.style.visibility = "visible";
1539
- videoEl.style.pointerEvents = "none";
1540
- container2 = ensureAdContainer();
1541
- container2.appendChild(videoEl);
1542
- adVideoElement = videoEl;
1543
- setupAdEventListeners();
1544
- if (!continueLiveStreamDuringAds) {
1545
- contentVideo.pause();
1546
- }
1547
- contentVideo.muted = true;
1548
- contentVideo.volume = 0;
1549
- adPlaying = true;
1550
- setAdPlayingFlag(true);
1551
- adVolume21 = originalMutedState ? 1 : originalVolume;
1552
- adVideoElement.volume = Math.max(0, Math.min(1, adVolume21));
1553
- adVideoElement.muted = false;
1554
- container2.style.display = "flex";
1555
- container2.style.pointerEvents = "auto";
1556
- emit("content_pause");
1557
- if (debug) console.log("".concat(LOG, " [preload] smartTVMode deferred: creating video element and loading, url=").concat(slot.mediaFile.url));
1558
- startPlayback(slot.mediaFile);
1559
- return [
1560
- 2
1561
- ];
1562
- }
1563
- teardownCurrentPlayback();
1564
- if (adVideoElement && adVideoElement !== slot.videoEl) {
1565
- adVideoElement.remove();
1566
- }
1567
- slot.videoEl.style.visibility = "visible";
1568
- slot.videoEl.style.pointerEvents = "none";
1569
- adVideoElement = slot.videoEl;
1570
- adHls = slot.hlsInstance;
1571
- setupAdEventListeners();
1572
- if (!continueLiveStreamDuringAds) {
1573
- contentVideo.pause();
1547
+ switch(_state.label){
1548
+ case 0:
1549
+ if (destroyed) return [
1550
+ 2,
1551
+ Promise.reject(new Error("Layer has been destroyed"))
1552
+ ];
1553
+ slot = preloadSlots.get(token);
1554
+ if (!slot) {
1555
+ if (debug) console.warn("".concat(LOG, " [preload] No slot found for token=").concat(token, ", nothing to play"));
1556
+ return [
1557
+ 2
1558
+ ];
1559
+ }
1560
+ preloadSlots.delete(token);
1561
+ if (debug) console.log("".concat(LOG, " [preload] Playing preloaded ad, token=").concat(token, ", ready=").concat(slot.ready));
1562
+ contentVolume = contentVideo.volume;
1563
+ originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1564
+ sessionId = generateSessionId();
1565
+ currentAd = slot.ad;
1566
+ trackingFired = _object_spread({}, createEmptyTrackingState());
1567
+ fireTrackingPixels2(slot.ad.trackingUrls.impression);
1568
+ trackingFired.impression = true;
1569
+ if (!singleElementMode) return [
1570
+ 3,
1571
+ 2
1572
+ ];
1573
+ mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1574
+ teardownCurrentPlayback();
1575
+ adVideoElement = contentVideo;
1576
+ adHls = void 0;
1577
+ adPlaying = true;
1578
+ setAdPlayingFlag(true);
1579
+ contentVideo.removeAttribute("src");
1580
+ contentVideo.load();
1581
+ contentVideo.muted = true;
1582
+ contentVideo.volume = 0;
1583
+ return [
1584
+ 4,
1585
+ new Promise(function(resolve) {
1586
+ return setTimeout(resolve, 200);
1587
+ })
1588
+ ];
1589
+ case 1:
1590
+ _state.sent();
1591
+ if (destroyed || tornDown) return [
1592
+ 2
1593
+ ];
1594
+ contentVideo.style.visibility = "visible";
1595
+ contentVideo.style.opacity = "1";
1596
+ emit("content_pause");
1597
+ setupAdEventListeners();
1598
+ adVolume2 = originalMutedState ? 1 : originalVolume;
1599
+ contentVideo.volume = Math.max(0, Math.min(1, adVolume2));
1600
+ contentVideo.muted = false;
1601
+ if (debug) console.log("".concat(LOG, " [preload] singleElementMode: attaching ad to contentVideo, url=").concat(slot.mediaFile.url));
1602
+ startPlayback(slot.mediaFile);
1603
+ return [
1604
+ 2
1605
+ ];
1606
+ case 2:
1607
+ if (smartTVMode && !slot.videoEl) {
1608
+ teardownCurrentPlayback();
1609
+ if (adVideoElement) {
1610
+ adVideoElement.remove();
1611
+ adVideoElement = void 0;
1612
+ }
1613
+ videoEl = createAdVideoElement();
1614
+ videoEl.style.visibility = "visible";
1615
+ videoEl.style.pointerEvents = "none";
1616
+ container2 = ensureAdContainer();
1617
+ container2.appendChild(videoEl);
1618
+ adVideoElement = videoEl;
1619
+ setupAdEventListeners();
1620
+ if (!continueLiveStreamDuringAds) {
1621
+ contentVideo.pause();
1622
+ }
1623
+ contentVideo.muted = true;
1624
+ contentVideo.volume = 0;
1625
+ adPlaying = true;
1626
+ setAdPlayingFlag(true);
1627
+ adVolume21 = originalMutedState ? 1 : originalVolume;
1628
+ adVideoElement.volume = Math.max(0, Math.min(1, adVolume21));
1629
+ adVideoElement.muted = false;
1630
+ container2.style.display = "flex";
1631
+ container2.style.pointerEvents = "auto";
1632
+ emit("content_pause");
1633
+ if (debug) console.log("".concat(LOG, " [preload] smartTVMode deferred: creating video element and loading, url=").concat(slot.mediaFile.url));
1634
+ startPlayback(slot.mediaFile);
1635
+ return [
1636
+ 2
1637
+ ];
1638
+ }
1639
+ teardownCurrentPlayback();
1640
+ if (adVideoElement && adVideoElement !== slot.videoEl) {
1641
+ adVideoElement.remove();
1642
+ }
1643
+ slot.videoEl.style.visibility = "visible";
1644
+ slot.videoEl.style.pointerEvents = "none";
1645
+ adVideoElement = slot.videoEl;
1646
+ adHls = slot.hlsInstance;
1647
+ if (adHls) {
1648
+ nonFatalNetworkErrors = 0;
1649
+ adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
1650
+ if (!adPlaying) return;
1651
+ if (data.fatal) {
1652
+ handleAdError();
1653
+ } else if (data.type === import_hls.default.ErrorTypes.NETWORK_ERROR) {
1654
+ nonFatalNetworkErrors++;
1655
+ if (nonFatalNetworkErrors >= 3) {
1656
+ if (debug) console.warn("".concat(LOG, " [preload] Too many non-fatal HLS network errors during playback, treating as fatal"));
1657
+ handleAdError();
1658
+ }
1659
+ }
1660
+ });
1661
+ }
1662
+ setupAdEventListeners();
1663
+ if (!continueLiveStreamDuringAds) {
1664
+ contentVideo.pause();
1665
+ }
1666
+ contentVideo.muted = true;
1667
+ contentVideo.volume = 0;
1668
+ adPlaying = true;
1669
+ setAdPlayingFlag(true);
1670
+ adVolume = originalMutedState ? 1 : originalVolume;
1671
+ adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
1672
+ adVideoElement.muted = false;
1673
+ container = ensureAdContainer();
1674
+ container.style.display = "flex";
1675
+ container.style.pointerEvents = "auto";
1676
+ emit("content_pause");
1677
+ adVideoElement.play().catch(function(error) {
1678
+ console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
1679
+ handleAdError();
1680
+ });
1681
+ return [
1682
+ 2
1683
+ ];
1574
1684
  }
1575
- contentVideo.muted = true;
1576
- contentVideo.volume = 0;
1577
- adPlaying = true;
1578
- setAdPlayingFlag(true);
1579
- adVolume = originalMutedState ? 1 : originalVolume;
1580
- adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
1581
- adVideoElement.muted = false;
1582
- container = ensureAdContainer();
1583
- container.style.display = "flex";
1584
- container.style.pointerEvents = "auto";
1585
- emit("content_pause");
1586
- adVideoElement.play().catch(function(error) {
1587
- console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
1588
- handleAdError();
1589
- });
1590
- return [
1591
- 2
1592
- ];
1593
1685
  });
1594
1686
  })();
1595
1687
  }
@@ -1774,6 +1866,7 @@ function createVastAdLayer(contentVideo, options) {
1774
1866
  return 1;
1775
1867
  },
1776
1868
  showPlaceholder: function showPlaceholder() {
1869
+ if (singleElementMode) return;
1777
1870
  contentVideo.style.opacity = "0";
1778
1871
  contentVideo.style.visibility = "hidden";
1779
1872
  if (!adContainerEl) {
@@ -3470,7 +3563,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3470
3563
  }
3471
3564
  _this.adLayer.cancelPreload(token);
3472
3565
  } else {
3473
- _this.showPlaceholderLayer();
3566
+ if (!_this.config.singlePipelineMode) {
3567
+ _this.showPlaceholderLayer();
3568
+ }
3474
3569
  _this.adLayer.showPlaceholder();
3475
3570
  _this.isInAdTransition = true;
3476
3571
  setTimeout(function() {
@@ -3494,7 +3589,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3494
3589
  console.log("[StormcloudVideoPlayer] content_resume: skip pending bids, only", remainingNow1, "ms left");
3495
3590
  }
3496
3591
  } else {
3497
- _this.showPlaceholderLayer();
3592
+ if (!_this.config.singlePipelineMode) {
3593
+ _this.showPlaceholderLayer();
3594
+ }
3498
3595
  _this.adLayer.showPlaceholder();
3499
3596
  _this.isInAdTransition = true;
3500
3597
  setTimeout(function() {
@@ -3845,7 +3942,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3845
3942
  };
3846
3943
  this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
3847
3944
  }
3848
- if (!this.config.disableFiller && !this.video.muted) {
3945
+ if (!this.config.disableFiller && !this.video.muted && !this.adLayer.isAdPlaying()) {
3849
3946
  this.video.muted = true;
3850
3947
  this.video.volume = 0;
3851
3948
  if (this.config.debugAdTiming) {
@@ -4862,7 +4959,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4862
4959
  if (!this.config.disableFiller) this.showAds = true;
4863
4960
  if (adBreakDurationMs != null) {
4864
4961
  this.startFillerBreakTimer(adBreakDurationMs);
4865
- } else if (!this.config.disableFiller) {
4962
+ } else if (!this.config.disableFiller && this.preloadedTokens.length === 0) {
4866
4963
  this.showPlaceholderLayer();
4867
4964
  }
4868
4965
  if (!this.config.disableFiller) this.adLayer.showPlaceholder();
@@ -5479,7 +5576,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5479
5576
  console.log("[StormcloudVideoPlayer] Smart TV: audio state restored on MANIFEST_PARSED after re-attach");
5480
5577
  }
5481
5578
  hlsRef.startLoad(-1);
5482
- tryPlay(0);
5483
5579
  if (debugEnabled) {
5484
5580
  console.log("[StormcloudVideoPlayer] Smart TV: seeking to live edge and resuming playback after re-attach");
5485
5581
  }