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.
@@ -979,6 +979,7 @@ function createVastAdLayer(contentVideo, options) {
979
979
  var destroyed = false;
980
980
  var tornDown = false;
981
981
  var trackingFired = createEmptyTrackingState();
982
+ var adStallTimerId;
982
983
  var currentAdEventHandlers;
983
984
  var preloadSlots = /* @__PURE__ */ new Map();
984
985
  function emit(event, payload) {
@@ -1094,7 +1095,14 @@ function createVastAdLayer(contentVideo, options) {
1094
1095
  video.volume = 1;
1095
1096
  return video;
1096
1097
  }
1098
+ function clearAdStallTimer() {
1099
+ if (adStallTimerId != null) {
1100
+ clearTimeout(adStallTimerId);
1101
+ adStallTimerId = void 0;
1102
+ }
1103
+ }
1097
1104
  function removeAdEventListeners() {
1105
+ clearAdStallTimer();
1098
1106
  if (!currentAdEventHandlers || !adVideoElement) return;
1099
1107
  var el = adVideoElement;
1100
1108
  el.removeEventListener("timeupdate", currentAdEventHandlers.timeupdate);
@@ -1104,6 +1112,7 @@ function createVastAdLayer(contentVideo, options) {
1104
1112
  el.removeEventListener("volumechange", currentAdEventHandlers.volumechange);
1105
1113
  el.removeEventListener("pause", currentAdEventHandlers.pause);
1106
1114
  el.removeEventListener("play", currentAdEventHandlers.play);
1115
+ el.removeEventListener("waiting", currentAdEventHandlers.waiting);
1107
1116
  currentAdEventHandlers = void 0;
1108
1117
  }
1109
1118
  function setupAdEventListeners() {
@@ -1128,6 +1137,7 @@ function createVastAdLayer(contentVideo, options) {
1128
1137
  }
1129
1138
  },
1130
1139
  playing: function playing() {
1140
+ clearAdStallTimer();
1131
1141
  var ad = currentAd;
1132
1142
  if (!ad || trackingFired.start) return;
1133
1143
  trackingFired.start = true;
@@ -1164,6 +1174,16 @@ function createVastAdLayer(contentVideo, options) {
1164
1174
  if (currentAd && adVideoElement && adVideoElement.currentTime > 0) {
1165
1175
  fireTrackingPixels2(currentAd.trackingUrls.resume);
1166
1176
  }
1177
+ },
1178
+ waiting: function waiting() {
1179
+ clearAdStallTimer();
1180
+ adStallTimerId = setTimeout(function() {
1181
+ adStallTimerId = void 0;
1182
+ if (adPlaying) {
1183
+ if (debug) console.warn("".concat(LOG, " Ad video stalled for too long, treating as error"));
1184
+ handleAdError();
1185
+ }
1186
+ }, 8e3);
1167
1187
  }
1168
1188
  };
1169
1189
  adVideoElement.addEventListener("timeupdate", handlers.timeupdate);
@@ -1173,6 +1193,7 @@ function createVastAdLayer(contentVideo, options) {
1173
1193
  adVideoElement.addEventListener("volumechange", handlers.volumechange);
1174
1194
  adVideoElement.addEventListener("pause", handlers.pause);
1175
1195
  adVideoElement.addEventListener("play", handlers.play);
1196
+ adVideoElement.addEventListener("waiting", handlers.waiting);
1176
1197
  currentAdEventHandlers = handlers;
1177
1198
  }
1178
1199
  function setAdPlayingFlag(isPlaying) {
@@ -1184,6 +1205,7 @@ function createVastAdLayer(contentVideo, options) {
1184
1205
  }
1185
1206
  function handleAdComplete() {
1186
1207
  if (tornDown) return;
1208
+ clearAdStallTimer();
1187
1209
  if (debug) console.log("".concat(LOG, " Handling ad completion"));
1188
1210
  adPlaying = false;
1189
1211
  setAdPlayingFlag(false);
@@ -1197,6 +1219,7 @@ function createVastAdLayer(contentVideo, options) {
1197
1219
  function handleAdError() {
1198
1220
  if (tornDown) return;
1199
1221
  if (!adPlaying) return;
1222
+ clearAdStallTimer();
1200
1223
  if (debug) console.log("".concat(LOG, " Handling ad error"));
1201
1224
  adPlaying = false;
1202
1225
  setAdPlayingFlag(false);
@@ -1247,6 +1270,7 @@ function createVastAdLayer(contentVideo, options) {
1247
1270
  adHls.loadSource(mediaFile.url);
1248
1271
  adHls.attachMedia(adVideoElement);
1249
1272
  adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
1273
+ if (!adPlaying) return;
1250
1274
  adVideoElement.play().catch(function(error) {
1251
1275
  console.error("".concat(LOG, " Error starting HLS ad playback:"), error);
1252
1276
  handleAdError();
@@ -1295,7 +1319,7 @@ function createVastAdLayer(contentVideo, options) {
1295
1319
  }
1296
1320
  function playAd(bids) {
1297
1321
  return _async_to_generator(function() {
1298
- var winner, ad, contentVolume, _contentVideo_parentElement, container, adVolume, mediaFile;
1322
+ var winner, ad, contentVolume, adVolume2, mediaFile2, _contentVideo_parentElement, container, adVolume, mediaFile;
1299
1323
  return _ts_generator(this, function(_state) {
1300
1324
  switch(_state.label){
1301
1325
  case 0:
@@ -1339,37 +1363,71 @@ function createVastAdLayer(contentVideo, options) {
1339
1363
  trackingFired.impression = true;
1340
1364
  contentVolume = contentVideo.volume;
1341
1365
  originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1342
- if (singleElementMode) {
1343
- mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1344
- teardownCurrentPlayback();
1345
- adVideoElement = contentVideo;
1346
- adHls = void 0;
1366
+ if (!singleElementMode) return [
1367
+ 3,
1368
+ 3
1369
+ ];
1370
+ mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1371
+ teardownCurrentPlayback();
1372
+ adVideoElement = contentVideo;
1373
+ adHls = void 0;
1374
+ adPlaying = true;
1375
+ setAdPlayingFlag(true);
1376
+ contentVideo.removeAttribute("src");
1377
+ contentVideo.load();
1378
+ if (!continueLiveStreamDuringAds) {
1379
+ contentVideo.pause();
1380
+ }
1381
+ contentVideo.muted = true;
1382
+ contentVideo.volume = 0;
1383
+ return [
1384
+ 4,
1385
+ new Promise(function(resolve) {
1386
+ return setTimeout(resolve, 200);
1387
+ })
1388
+ ];
1389
+ case 2:
1390
+ _state.sent();
1391
+ if (destroyed || tornDown) return [
1392
+ 2
1393
+ ];
1394
+ contentVideo.style.visibility = "visible";
1395
+ contentVideo.style.opacity = "1";
1396
+ emit("content_pause");
1397
+ setupAdEventListeners();
1398
+ adVolume2 = originalMutedState ? 1 : originalVolume;
1399
+ adVideoElement.volume = Math.max(0, Math.min(1, adVolume2));
1400
+ adVideoElement.muted = false;
1401
+ mediaFile2 = selectBestMediaFile(ad.mediaFiles);
1402
+ if (debug) console.log("".concat(LOG, " Loading ad from: ").concat(mediaFile2.url));
1403
+ startPlayback(mediaFile2);
1404
+ return [
1405
+ 2
1406
+ ];
1407
+ case 3:
1408
+ if (!adContainerEl) {
1409
+ ;
1410
+ container = document.createElement("div");
1411
+ container.style.position = "absolute";
1412
+ container.style.left = "0";
1413
+ container.style.top = "0";
1414
+ container.style.right = "0";
1415
+ container.style.bottom = "0";
1416
+ container.style.display = "none";
1417
+ container.style.alignItems = "center";
1418
+ container.style.justifyContent = "center";
1419
+ container.style.pointerEvents = "none";
1420
+ container.style.zIndex = "10";
1421
+ container.style.backgroundColor = "#000";
1422
+ (_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
1423
+ adContainerEl = container;
1424
+ }
1425
+ if (!adVideoElement) {
1426
+ adVideoElement = createAdVideoElement();
1427
+ adContainerEl.appendChild(adVideoElement);
1347
1428
  setupAdEventListeners();
1348
1429
  } else {
1349
- if (!adContainerEl) {
1350
- ;
1351
- container = document.createElement("div");
1352
- container.style.position = "absolute";
1353
- container.style.left = "0";
1354
- container.style.top = "0";
1355
- container.style.right = "0";
1356
- container.style.bottom = "0";
1357
- container.style.display = "none";
1358
- container.style.alignItems = "center";
1359
- container.style.justifyContent = "center";
1360
- container.style.pointerEvents = "none";
1361
- container.style.zIndex = "10";
1362
- container.style.backgroundColor = "#000";
1363
- (_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
1364
- adContainerEl = container;
1365
- }
1366
- if (!adVideoElement) {
1367
- adVideoElement = createAdVideoElement();
1368
- adContainerEl.appendChild(adVideoElement);
1369
- setupAdEventListeners();
1370
- } else {
1371
- teardownCurrentPlayback();
1372
- }
1430
+ teardownCurrentPlayback();
1373
1431
  }
1374
1432
  if (!continueLiveStreamDuringAds) {
1375
1433
  contentVideo.pause();
@@ -1381,7 +1439,7 @@ function createVastAdLayer(contentVideo, options) {
1381
1439
  adVolume = originalMutedState ? 1 : originalVolume;
1382
1440
  adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
1383
1441
  adVideoElement.muted = false;
1384
- if (!singleElementMode && adContainerEl) {
1442
+ if (adContainerEl) {
1385
1443
  adContainerEl.style.display = "flex";
1386
1444
  adContainerEl.style.pointerEvents = "auto";
1387
1445
  }
@@ -1485,6 +1543,7 @@ function createVastAdLayer(contentVideo, options) {
1485
1543
  if (debug) console.log("".concat(LOG, " [preload] HLS manifest parsed, token=").concat(token));
1486
1544
  });
1487
1545
  hls.on(import_hls.default.Events.ERROR, function(_evt, data) {
1546
+ if (!preloadSlots.has(token)) return;
1488
1547
  if (data.fatal) {
1489
1548
  if (debug) console.warn("".concat(LOG, " [preload] HLS error for token=").concat(token));
1490
1549
  preloadSlots.delete(token);
@@ -1521,113 +1580,146 @@ function createVastAdLayer(contentVideo, options) {
1521
1580
  }
1522
1581
  function playPreloaded(token) {
1523
1582
  return _async_to_generator(function() {
1524
- var slot, contentVolume, adVolume2, videoEl, container2, adVolume21, adVolume, container;
1583
+ var slot, contentVolume, adVolume2, videoEl, container2, adVolume21, nonFatalNetworkErrors, adVolume, container;
1525
1584
  return _ts_generator(this, function(_state) {
1526
- if (destroyed) return [
1527
- 2,
1528
- Promise.reject(new Error("Layer has been destroyed"))
1529
- ];
1530
- slot = preloadSlots.get(token);
1531
- if (!slot) {
1532
- if (debug) console.warn("".concat(LOG, " [preload] No slot found for token=").concat(token, ", nothing to play"));
1533
- return [
1534
- 2
1535
- ];
1536
- }
1537
- preloadSlots.delete(token);
1538
- if (debug) console.log("".concat(LOG, " [preload] Playing preloaded ad, token=").concat(token, ", ready=").concat(slot.ready));
1539
- contentVolume = contentVideo.volume;
1540
- originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1541
- sessionId = generateSessionId();
1542
- currentAd = slot.ad;
1543
- trackingFired = _object_spread({}, createEmptyTrackingState());
1544
- fireTrackingPixels2(slot.ad.trackingUrls.impression);
1545
- trackingFired.impression = true;
1546
- if (singleElementMode) {
1547
- mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1548
- teardownCurrentPlayback();
1549
- adVideoElement = contentVideo;
1550
- adHls = void 0;
1551
- setupAdEventListeners();
1552
- if (!continueLiveStreamDuringAds) {
1553
- contentVideo.pause();
1554
- }
1555
- contentVideo.muted = true;
1556
- contentVideo.volume = 0;
1557
- adPlaying = true;
1558
- setAdPlayingFlag(true);
1559
- adVolume2 = originalMutedState ? 1 : originalVolume;
1560
- contentVideo.volume = Math.max(0, Math.min(1, adVolume2));
1561
- contentVideo.muted = false;
1562
- emit("content_pause");
1563
- if (debug) console.log("".concat(LOG, " [preload] singleElementMode: attaching ad to contentVideo, url=").concat(slot.mediaFile.url));
1564
- startPlayback(slot.mediaFile);
1565
- return [
1566
- 2
1567
- ];
1568
- }
1569
- if (smartTVMode && !slot.videoEl) {
1570
- teardownCurrentPlayback();
1571
- if (adVideoElement) {
1572
- adVideoElement.remove();
1573
- adVideoElement = void 0;
1574
- }
1575
- videoEl = createAdVideoElement();
1576
- videoEl.style.visibility = "visible";
1577
- videoEl.style.pointerEvents = "none";
1578
- container2 = ensureAdContainer();
1579
- container2.appendChild(videoEl);
1580
- adVideoElement = videoEl;
1581
- setupAdEventListeners();
1582
- if (!continueLiveStreamDuringAds) {
1583
- contentVideo.pause();
1584
- }
1585
- contentVideo.muted = true;
1586
- contentVideo.volume = 0;
1587
- adPlaying = true;
1588
- setAdPlayingFlag(true);
1589
- adVolume21 = originalMutedState ? 1 : originalVolume;
1590
- adVideoElement.volume = Math.max(0, Math.min(1, adVolume21));
1591
- adVideoElement.muted = false;
1592
- container2.style.display = "flex";
1593
- container2.style.pointerEvents = "auto";
1594
- emit("content_pause");
1595
- if (debug) console.log("".concat(LOG, " [preload] smartTVMode deferred: creating video element and loading, url=").concat(slot.mediaFile.url));
1596
- startPlayback(slot.mediaFile);
1597
- return [
1598
- 2
1599
- ];
1600
- }
1601
- teardownCurrentPlayback();
1602
- if (adVideoElement && adVideoElement !== slot.videoEl) {
1603
- adVideoElement.remove();
1604
- }
1605
- slot.videoEl.style.visibility = "visible";
1606
- slot.videoEl.style.pointerEvents = "none";
1607
- adVideoElement = slot.videoEl;
1608
- adHls = slot.hlsInstance;
1609
- setupAdEventListeners();
1610
- if (!continueLiveStreamDuringAds) {
1611
- contentVideo.pause();
1585
+ switch(_state.label){
1586
+ case 0:
1587
+ if (destroyed) return [
1588
+ 2,
1589
+ Promise.reject(new Error("Layer has been destroyed"))
1590
+ ];
1591
+ slot = preloadSlots.get(token);
1592
+ if (!slot) {
1593
+ if (debug) console.warn("".concat(LOG, " [preload] No slot found for token=").concat(token, ", nothing to play"));
1594
+ return [
1595
+ 2
1596
+ ];
1597
+ }
1598
+ preloadSlots.delete(token);
1599
+ if (debug) console.log("".concat(LOG, " [preload] Playing preloaded ad, token=").concat(token, ", ready=").concat(slot.ready));
1600
+ contentVolume = contentVideo.volume;
1601
+ originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1602
+ sessionId = generateSessionId();
1603
+ currentAd = slot.ad;
1604
+ trackingFired = _object_spread({}, createEmptyTrackingState());
1605
+ fireTrackingPixels2(slot.ad.trackingUrls.impression);
1606
+ trackingFired.impression = true;
1607
+ if (!singleElementMode) return [
1608
+ 3,
1609
+ 2
1610
+ ];
1611
+ mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1612
+ teardownCurrentPlayback();
1613
+ adVideoElement = contentVideo;
1614
+ adHls = void 0;
1615
+ adPlaying = true;
1616
+ setAdPlayingFlag(true);
1617
+ contentVideo.removeAttribute("src");
1618
+ contentVideo.load();
1619
+ contentVideo.muted = true;
1620
+ contentVideo.volume = 0;
1621
+ return [
1622
+ 4,
1623
+ new Promise(function(resolve) {
1624
+ return setTimeout(resolve, 200);
1625
+ })
1626
+ ];
1627
+ case 1:
1628
+ _state.sent();
1629
+ if (destroyed || tornDown) return [
1630
+ 2
1631
+ ];
1632
+ contentVideo.style.visibility = "visible";
1633
+ contentVideo.style.opacity = "1";
1634
+ emit("content_pause");
1635
+ setupAdEventListeners();
1636
+ adVolume2 = originalMutedState ? 1 : originalVolume;
1637
+ contentVideo.volume = Math.max(0, Math.min(1, adVolume2));
1638
+ contentVideo.muted = false;
1639
+ if (debug) console.log("".concat(LOG, " [preload] singleElementMode: attaching ad to contentVideo, url=").concat(slot.mediaFile.url));
1640
+ startPlayback(slot.mediaFile);
1641
+ return [
1642
+ 2
1643
+ ];
1644
+ case 2:
1645
+ if (smartTVMode && !slot.videoEl) {
1646
+ teardownCurrentPlayback();
1647
+ if (adVideoElement) {
1648
+ adVideoElement.remove();
1649
+ adVideoElement = void 0;
1650
+ }
1651
+ videoEl = createAdVideoElement();
1652
+ videoEl.style.visibility = "visible";
1653
+ videoEl.style.pointerEvents = "none";
1654
+ container2 = ensureAdContainer();
1655
+ container2.appendChild(videoEl);
1656
+ adVideoElement = videoEl;
1657
+ setupAdEventListeners();
1658
+ if (!continueLiveStreamDuringAds) {
1659
+ contentVideo.pause();
1660
+ }
1661
+ contentVideo.muted = true;
1662
+ contentVideo.volume = 0;
1663
+ adPlaying = true;
1664
+ setAdPlayingFlag(true);
1665
+ adVolume21 = originalMutedState ? 1 : originalVolume;
1666
+ adVideoElement.volume = Math.max(0, Math.min(1, adVolume21));
1667
+ adVideoElement.muted = false;
1668
+ container2.style.display = "flex";
1669
+ container2.style.pointerEvents = "auto";
1670
+ emit("content_pause");
1671
+ if (debug) console.log("".concat(LOG, " [preload] smartTVMode deferred: creating video element and loading, url=").concat(slot.mediaFile.url));
1672
+ startPlayback(slot.mediaFile);
1673
+ return [
1674
+ 2
1675
+ ];
1676
+ }
1677
+ teardownCurrentPlayback();
1678
+ if (adVideoElement && adVideoElement !== slot.videoEl) {
1679
+ adVideoElement.remove();
1680
+ }
1681
+ slot.videoEl.style.visibility = "visible";
1682
+ slot.videoEl.style.pointerEvents = "none";
1683
+ adVideoElement = slot.videoEl;
1684
+ adHls = slot.hlsInstance;
1685
+ if (adHls) {
1686
+ nonFatalNetworkErrors = 0;
1687
+ adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
1688
+ if (!adPlaying) return;
1689
+ if (data.fatal) {
1690
+ handleAdError();
1691
+ } else if (data.type === import_hls.default.ErrorTypes.NETWORK_ERROR) {
1692
+ nonFatalNetworkErrors++;
1693
+ if (nonFatalNetworkErrors >= 3) {
1694
+ if (debug) console.warn("".concat(LOG, " [preload] Too many non-fatal HLS network errors during playback, treating as fatal"));
1695
+ handleAdError();
1696
+ }
1697
+ }
1698
+ });
1699
+ }
1700
+ setupAdEventListeners();
1701
+ if (!continueLiveStreamDuringAds) {
1702
+ contentVideo.pause();
1703
+ }
1704
+ contentVideo.muted = true;
1705
+ contentVideo.volume = 0;
1706
+ adPlaying = true;
1707
+ setAdPlayingFlag(true);
1708
+ adVolume = originalMutedState ? 1 : originalVolume;
1709
+ adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
1710
+ adVideoElement.muted = false;
1711
+ container = ensureAdContainer();
1712
+ container.style.display = "flex";
1713
+ container.style.pointerEvents = "auto";
1714
+ emit("content_pause");
1715
+ adVideoElement.play().catch(function(error) {
1716
+ console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
1717
+ handleAdError();
1718
+ });
1719
+ return [
1720
+ 2
1721
+ ];
1612
1722
  }
1613
- contentVideo.muted = true;
1614
- contentVideo.volume = 0;
1615
- adPlaying = true;
1616
- setAdPlayingFlag(true);
1617
- adVolume = originalMutedState ? 1 : originalVolume;
1618
- adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
1619
- adVideoElement.muted = false;
1620
- container = ensureAdContainer();
1621
- container.style.display = "flex";
1622
- container.style.pointerEvents = "auto";
1623
- emit("content_pause");
1624
- adVideoElement.play().catch(function(error) {
1625
- console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
1626
- handleAdError();
1627
- });
1628
- return [
1629
- 2
1630
- ];
1631
1723
  });
1632
1724
  })();
1633
1725
  }
@@ -1812,6 +1904,7 @@ function createVastAdLayer(contentVideo, options) {
1812
1904
  return 1;
1813
1905
  },
1814
1906
  showPlaceholder: function showPlaceholder() {
1907
+ if (singleElementMode) return;
1815
1908
  contentVideo.style.opacity = "0";
1816
1909
  contentVideo.style.visibility = "hidden";
1817
1910
  if (!adContainerEl) {
@@ -3508,7 +3601,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3508
3601
  }
3509
3602
  _this.adLayer.cancelPreload(token);
3510
3603
  } else {
3511
- _this.showPlaceholderLayer();
3604
+ if (!_this.config.singlePipelineMode) {
3605
+ _this.showPlaceholderLayer();
3606
+ }
3512
3607
  _this.adLayer.showPlaceholder();
3513
3608
  _this.isInAdTransition = true;
3514
3609
  setTimeout(function() {
@@ -3532,7 +3627,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3532
3627
  console.log("[StormcloudVideoPlayer] content_resume: skip pending bids, only", remainingNow1, "ms left");
3533
3628
  }
3534
3629
  } else {
3535
- _this.showPlaceholderLayer();
3630
+ if (!_this.config.singlePipelineMode) {
3631
+ _this.showPlaceholderLayer();
3632
+ }
3536
3633
  _this.adLayer.showPlaceholder();
3537
3634
  _this.isInAdTransition = true;
3538
3635
  setTimeout(function() {
@@ -3883,7 +3980,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3883
3980
  };
3884
3981
  this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
3885
3982
  }
3886
- if (!this.config.disableFiller && !this.video.muted) {
3983
+ if (!this.config.disableFiller && !this.video.muted && !this.adLayer.isAdPlaying()) {
3887
3984
  this.video.muted = true;
3888
3985
  this.video.volume = 0;
3889
3986
  if (this.config.debugAdTiming) {
@@ -4900,7 +4997,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4900
4997
  if (!this.config.disableFiller) this.showAds = true;
4901
4998
  if (adBreakDurationMs != null) {
4902
4999
  this.startFillerBreakTimer(adBreakDurationMs);
4903
- } else if (!this.config.disableFiller) {
5000
+ } else if (!this.config.disableFiller && this.preloadedTokens.length === 0) {
4904
5001
  this.showPlaceholderLayer();
4905
5002
  }
4906
5003
  if (!this.config.disableFiller) this.adLayer.showPlaceholder();
@@ -5517,7 +5614,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5517
5614
  console.log("[StormcloudVideoPlayer] Smart TV: audio state restored on MANIFEST_PARSED after re-attach");
5518
5615
  }
5519
5616
  hlsRef.startLoad(-1);
5520
- tryPlay(0);
5521
5617
  if (debugEnabled) {
5522
5618
  console.log("[StormcloudVideoPlayer] Smart TV: seeking to live edge and resuming playback after re-attach");
5523
5619
  }