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.
@@ -993,6 +993,7 @@ function createVastAdLayer(contentVideo, options) {
993
993
  var destroyed = false;
994
994
  var tornDown = false;
995
995
  var trackingFired = createEmptyTrackingState();
996
+ var adStallTimerId;
996
997
  var currentAdEventHandlers;
997
998
  var preloadSlots = /* @__PURE__ */ new Map();
998
999
  function emit(event, payload) {
@@ -1108,7 +1109,14 @@ function createVastAdLayer(contentVideo, options) {
1108
1109
  video.volume = 1;
1109
1110
  return video;
1110
1111
  }
1112
+ function clearAdStallTimer() {
1113
+ if (adStallTimerId != null) {
1114
+ clearTimeout(adStallTimerId);
1115
+ adStallTimerId = void 0;
1116
+ }
1117
+ }
1111
1118
  function removeAdEventListeners() {
1119
+ clearAdStallTimer();
1112
1120
  if (!currentAdEventHandlers || !adVideoElement) return;
1113
1121
  var el = adVideoElement;
1114
1122
  el.removeEventListener("timeupdate", currentAdEventHandlers.timeupdate);
@@ -1118,6 +1126,7 @@ function createVastAdLayer(contentVideo, options) {
1118
1126
  el.removeEventListener("volumechange", currentAdEventHandlers.volumechange);
1119
1127
  el.removeEventListener("pause", currentAdEventHandlers.pause);
1120
1128
  el.removeEventListener("play", currentAdEventHandlers.play);
1129
+ el.removeEventListener("waiting", currentAdEventHandlers.waiting);
1121
1130
  currentAdEventHandlers = void 0;
1122
1131
  }
1123
1132
  function setupAdEventListeners() {
@@ -1142,6 +1151,7 @@ function createVastAdLayer(contentVideo, options) {
1142
1151
  }
1143
1152
  },
1144
1153
  playing: function playing() {
1154
+ clearAdStallTimer();
1145
1155
  var ad = currentAd;
1146
1156
  if (!ad || trackingFired.start) return;
1147
1157
  trackingFired.start = true;
@@ -1178,6 +1188,16 @@ function createVastAdLayer(contentVideo, options) {
1178
1188
  if (currentAd && adVideoElement && adVideoElement.currentTime > 0) {
1179
1189
  fireTrackingPixels2(currentAd.trackingUrls.resume);
1180
1190
  }
1191
+ },
1192
+ waiting: function waiting() {
1193
+ clearAdStallTimer();
1194
+ adStallTimerId = setTimeout(function() {
1195
+ adStallTimerId = void 0;
1196
+ if (adPlaying) {
1197
+ if (debug) console.warn("".concat(LOG, " Ad video stalled for too long, treating as error"));
1198
+ handleAdError();
1199
+ }
1200
+ }, 8e3);
1181
1201
  }
1182
1202
  };
1183
1203
  adVideoElement.addEventListener("timeupdate", handlers.timeupdate);
@@ -1187,6 +1207,7 @@ function createVastAdLayer(contentVideo, options) {
1187
1207
  adVideoElement.addEventListener("volumechange", handlers.volumechange);
1188
1208
  adVideoElement.addEventListener("pause", handlers.pause);
1189
1209
  adVideoElement.addEventListener("play", handlers.play);
1210
+ adVideoElement.addEventListener("waiting", handlers.waiting);
1190
1211
  currentAdEventHandlers = handlers;
1191
1212
  }
1192
1213
  function setAdPlayingFlag(isPlaying) {
@@ -1198,6 +1219,7 @@ function createVastAdLayer(contentVideo, options) {
1198
1219
  }
1199
1220
  function handleAdComplete() {
1200
1221
  if (tornDown) return;
1222
+ clearAdStallTimer();
1201
1223
  if (debug) console.log("".concat(LOG, " Handling ad completion"));
1202
1224
  adPlaying = false;
1203
1225
  setAdPlayingFlag(false);
@@ -1211,6 +1233,7 @@ function createVastAdLayer(contentVideo, options) {
1211
1233
  function handleAdError() {
1212
1234
  if (tornDown) return;
1213
1235
  if (!adPlaying) return;
1236
+ clearAdStallTimer();
1214
1237
  if (debug) console.log("".concat(LOG, " Handling ad error"));
1215
1238
  adPlaying = false;
1216
1239
  setAdPlayingFlag(false);
@@ -1261,6 +1284,7 @@ function createVastAdLayer(contentVideo, options) {
1261
1284
  adHls.loadSource(mediaFile.url);
1262
1285
  adHls.attachMedia(adVideoElement);
1263
1286
  adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
1287
+ if (!adPlaying) return;
1264
1288
  adVideoElement.play().catch(function(error) {
1265
1289
  console.error("".concat(LOG, " Error starting HLS ad playback:"), error);
1266
1290
  handleAdError();
@@ -1309,7 +1333,7 @@ function createVastAdLayer(contentVideo, options) {
1309
1333
  }
1310
1334
  function playAd(bids) {
1311
1335
  return _async_to_generator(function() {
1312
- var winner, ad, contentVolume, _contentVideo_parentElement, container, adVolume, mediaFile;
1336
+ var winner, ad, contentVolume, adVolume2, mediaFile2, _contentVideo_parentElement, container, adVolume, mediaFile;
1313
1337
  return _ts_generator(this, function(_state) {
1314
1338
  switch(_state.label){
1315
1339
  case 0:
@@ -1353,37 +1377,71 @@ function createVastAdLayer(contentVideo, options) {
1353
1377
  trackingFired.impression = true;
1354
1378
  contentVolume = contentVideo.volume;
1355
1379
  originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1356
- if (singleElementMode) {
1357
- mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1358
- teardownCurrentPlayback();
1359
- adVideoElement = contentVideo;
1360
- adHls = void 0;
1380
+ if (!singleElementMode) return [
1381
+ 3,
1382
+ 3
1383
+ ];
1384
+ mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1385
+ teardownCurrentPlayback();
1386
+ adVideoElement = contentVideo;
1387
+ adHls = void 0;
1388
+ adPlaying = true;
1389
+ setAdPlayingFlag(true);
1390
+ contentVideo.removeAttribute("src");
1391
+ contentVideo.load();
1392
+ if (!continueLiveStreamDuringAds) {
1393
+ contentVideo.pause();
1394
+ }
1395
+ contentVideo.muted = true;
1396
+ contentVideo.volume = 0;
1397
+ return [
1398
+ 4,
1399
+ new Promise(function(resolve) {
1400
+ return setTimeout(resolve, 200);
1401
+ })
1402
+ ];
1403
+ case 2:
1404
+ _state.sent();
1405
+ if (destroyed || tornDown) return [
1406
+ 2
1407
+ ];
1408
+ contentVideo.style.visibility = "visible";
1409
+ contentVideo.style.opacity = "1";
1410
+ emit("content_pause");
1411
+ setupAdEventListeners();
1412
+ adVolume2 = originalMutedState ? 1 : originalVolume;
1413
+ adVideoElement.volume = Math.max(0, Math.min(1, adVolume2));
1414
+ adVideoElement.muted = false;
1415
+ mediaFile2 = selectBestMediaFile(ad.mediaFiles);
1416
+ if (debug) console.log("".concat(LOG, " Loading ad from: ").concat(mediaFile2.url));
1417
+ startPlayback(mediaFile2);
1418
+ return [
1419
+ 2
1420
+ ];
1421
+ case 3:
1422
+ if (!adContainerEl) {
1423
+ ;
1424
+ container = document.createElement("div");
1425
+ container.style.position = "absolute";
1426
+ container.style.left = "0";
1427
+ container.style.top = "0";
1428
+ container.style.right = "0";
1429
+ container.style.bottom = "0";
1430
+ container.style.display = "none";
1431
+ container.style.alignItems = "center";
1432
+ container.style.justifyContent = "center";
1433
+ container.style.pointerEvents = "none";
1434
+ container.style.zIndex = "10";
1435
+ container.style.backgroundColor = "#000";
1436
+ (_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
1437
+ adContainerEl = container;
1438
+ }
1439
+ if (!adVideoElement) {
1440
+ adVideoElement = createAdVideoElement();
1441
+ adContainerEl.appendChild(adVideoElement);
1361
1442
  setupAdEventListeners();
1362
1443
  } else {
1363
- if (!adContainerEl) {
1364
- ;
1365
- container = document.createElement("div");
1366
- container.style.position = "absolute";
1367
- container.style.left = "0";
1368
- container.style.top = "0";
1369
- container.style.right = "0";
1370
- container.style.bottom = "0";
1371
- container.style.display = "none";
1372
- container.style.alignItems = "center";
1373
- container.style.justifyContent = "center";
1374
- container.style.pointerEvents = "none";
1375
- container.style.zIndex = "10";
1376
- container.style.backgroundColor = "#000";
1377
- (_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
1378
- adContainerEl = container;
1379
- }
1380
- if (!adVideoElement) {
1381
- adVideoElement = createAdVideoElement();
1382
- adContainerEl.appendChild(adVideoElement);
1383
- setupAdEventListeners();
1384
- } else {
1385
- teardownCurrentPlayback();
1386
- }
1444
+ teardownCurrentPlayback();
1387
1445
  }
1388
1446
  if (!continueLiveStreamDuringAds) {
1389
1447
  contentVideo.pause();
@@ -1395,7 +1453,7 @@ function createVastAdLayer(contentVideo, options) {
1395
1453
  adVolume = originalMutedState ? 1 : originalVolume;
1396
1454
  adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
1397
1455
  adVideoElement.muted = false;
1398
- if (!singleElementMode && adContainerEl) {
1456
+ if (adContainerEl) {
1399
1457
  adContainerEl.style.display = "flex";
1400
1458
  adContainerEl.style.pointerEvents = "auto";
1401
1459
  }
@@ -1499,6 +1557,7 @@ function createVastAdLayer(contentVideo, options) {
1499
1557
  if (debug) console.log("".concat(LOG, " [preload] HLS manifest parsed, token=").concat(token));
1500
1558
  });
1501
1559
  hls.on(import_hls.default.Events.ERROR, function(_evt, data) {
1560
+ if (!preloadSlots.has(token)) return;
1502
1561
  if (data.fatal) {
1503
1562
  if (debug) console.warn("".concat(LOG, " [preload] HLS error for token=").concat(token));
1504
1563
  preloadSlots.delete(token);
@@ -1535,113 +1594,146 @@ function createVastAdLayer(contentVideo, options) {
1535
1594
  }
1536
1595
  function playPreloaded(token) {
1537
1596
  return _async_to_generator(function() {
1538
- var slot, contentVolume, adVolume2, videoEl, container2, adVolume21, adVolume, container;
1597
+ var slot, contentVolume, adVolume2, videoEl, container2, adVolume21, nonFatalNetworkErrors, adVolume, container;
1539
1598
  return _ts_generator(this, function(_state) {
1540
- if (destroyed) return [
1541
- 2,
1542
- Promise.reject(new Error("Layer has been destroyed"))
1543
- ];
1544
- slot = preloadSlots.get(token);
1545
- if (!slot) {
1546
- if (debug) console.warn("".concat(LOG, " [preload] No slot found for token=").concat(token, ", nothing to play"));
1547
- return [
1548
- 2
1549
- ];
1550
- }
1551
- preloadSlots.delete(token);
1552
- if (debug) console.log("".concat(LOG, " [preload] Playing preloaded ad, token=").concat(token, ", ready=").concat(slot.ready));
1553
- contentVolume = contentVideo.volume;
1554
- originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1555
- sessionId = generateSessionId();
1556
- currentAd = slot.ad;
1557
- trackingFired = _object_spread({}, createEmptyTrackingState());
1558
- fireTrackingPixels2(slot.ad.trackingUrls.impression);
1559
- trackingFired.impression = true;
1560
- if (singleElementMode) {
1561
- mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1562
- teardownCurrentPlayback();
1563
- adVideoElement = contentVideo;
1564
- adHls = void 0;
1565
- setupAdEventListeners();
1566
- if (!continueLiveStreamDuringAds) {
1567
- contentVideo.pause();
1568
- }
1569
- contentVideo.muted = true;
1570
- contentVideo.volume = 0;
1571
- adPlaying = true;
1572
- setAdPlayingFlag(true);
1573
- adVolume2 = originalMutedState ? 1 : originalVolume;
1574
- contentVideo.volume = Math.max(0, Math.min(1, adVolume2));
1575
- contentVideo.muted = false;
1576
- emit("content_pause");
1577
- if (debug) console.log("".concat(LOG, " [preload] singleElementMode: attaching ad to contentVideo, url=").concat(slot.mediaFile.url));
1578
- startPlayback(slot.mediaFile);
1579
- return [
1580
- 2
1581
- ];
1582
- }
1583
- if (smartTVMode && !slot.videoEl) {
1584
- teardownCurrentPlayback();
1585
- if (adVideoElement) {
1586
- adVideoElement.remove();
1587
- adVideoElement = void 0;
1588
- }
1589
- videoEl = createAdVideoElement();
1590
- videoEl.style.visibility = "visible";
1591
- videoEl.style.pointerEvents = "none";
1592
- container2 = ensureAdContainer();
1593
- container2.appendChild(videoEl);
1594
- adVideoElement = videoEl;
1595
- setupAdEventListeners();
1596
- if (!continueLiveStreamDuringAds) {
1597
- contentVideo.pause();
1598
- }
1599
- contentVideo.muted = true;
1600
- contentVideo.volume = 0;
1601
- adPlaying = true;
1602
- setAdPlayingFlag(true);
1603
- adVolume21 = originalMutedState ? 1 : originalVolume;
1604
- adVideoElement.volume = Math.max(0, Math.min(1, adVolume21));
1605
- adVideoElement.muted = false;
1606
- container2.style.display = "flex";
1607
- container2.style.pointerEvents = "auto";
1608
- emit("content_pause");
1609
- if (debug) console.log("".concat(LOG, " [preload] smartTVMode deferred: creating video element and loading, url=").concat(slot.mediaFile.url));
1610
- startPlayback(slot.mediaFile);
1611
- return [
1612
- 2
1613
- ];
1614
- }
1615
- teardownCurrentPlayback();
1616
- if (adVideoElement && adVideoElement !== slot.videoEl) {
1617
- adVideoElement.remove();
1618
- }
1619
- slot.videoEl.style.visibility = "visible";
1620
- slot.videoEl.style.pointerEvents = "none";
1621
- adVideoElement = slot.videoEl;
1622
- adHls = slot.hlsInstance;
1623
- setupAdEventListeners();
1624
- if (!continueLiveStreamDuringAds) {
1625
- contentVideo.pause();
1599
+ switch(_state.label){
1600
+ case 0:
1601
+ if (destroyed) return [
1602
+ 2,
1603
+ Promise.reject(new Error("Layer has been destroyed"))
1604
+ ];
1605
+ slot = preloadSlots.get(token);
1606
+ if (!slot) {
1607
+ if (debug) console.warn("".concat(LOG, " [preload] No slot found for token=").concat(token, ", nothing to play"));
1608
+ return [
1609
+ 2
1610
+ ];
1611
+ }
1612
+ preloadSlots.delete(token);
1613
+ if (debug) console.log("".concat(LOG, " [preload] Playing preloaded ad, token=").concat(token, ", ready=").concat(slot.ready));
1614
+ contentVolume = contentVideo.volume;
1615
+ originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1616
+ sessionId = generateSessionId();
1617
+ currentAd = slot.ad;
1618
+ trackingFired = _object_spread({}, createEmptyTrackingState());
1619
+ fireTrackingPixels2(slot.ad.trackingUrls.impression);
1620
+ trackingFired.impression = true;
1621
+ if (!singleElementMode) return [
1622
+ 3,
1623
+ 2
1624
+ ];
1625
+ mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1626
+ teardownCurrentPlayback();
1627
+ adVideoElement = contentVideo;
1628
+ adHls = void 0;
1629
+ adPlaying = true;
1630
+ setAdPlayingFlag(true);
1631
+ contentVideo.removeAttribute("src");
1632
+ contentVideo.load();
1633
+ contentVideo.muted = true;
1634
+ contentVideo.volume = 0;
1635
+ return [
1636
+ 4,
1637
+ new Promise(function(resolve) {
1638
+ return setTimeout(resolve, 200);
1639
+ })
1640
+ ];
1641
+ case 1:
1642
+ _state.sent();
1643
+ if (destroyed || tornDown) return [
1644
+ 2
1645
+ ];
1646
+ contentVideo.style.visibility = "visible";
1647
+ contentVideo.style.opacity = "1";
1648
+ emit("content_pause");
1649
+ setupAdEventListeners();
1650
+ adVolume2 = originalMutedState ? 1 : originalVolume;
1651
+ contentVideo.volume = Math.max(0, Math.min(1, adVolume2));
1652
+ contentVideo.muted = false;
1653
+ if (debug) console.log("".concat(LOG, " [preload] singleElementMode: attaching ad to contentVideo, url=").concat(slot.mediaFile.url));
1654
+ startPlayback(slot.mediaFile);
1655
+ return [
1656
+ 2
1657
+ ];
1658
+ case 2:
1659
+ if (smartTVMode && !slot.videoEl) {
1660
+ teardownCurrentPlayback();
1661
+ if (adVideoElement) {
1662
+ adVideoElement.remove();
1663
+ adVideoElement = void 0;
1664
+ }
1665
+ videoEl = createAdVideoElement();
1666
+ videoEl.style.visibility = "visible";
1667
+ videoEl.style.pointerEvents = "none";
1668
+ container2 = ensureAdContainer();
1669
+ container2.appendChild(videoEl);
1670
+ adVideoElement = videoEl;
1671
+ setupAdEventListeners();
1672
+ if (!continueLiveStreamDuringAds) {
1673
+ contentVideo.pause();
1674
+ }
1675
+ contentVideo.muted = true;
1676
+ contentVideo.volume = 0;
1677
+ adPlaying = true;
1678
+ setAdPlayingFlag(true);
1679
+ adVolume21 = originalMutedState ? 1 : originalVolume;
1680
+ adVideoElement.volume = Math.max(0, Math.min(1, adVolume21));
1681
+ adVideoElement.muted = false;
1682
+ container2.style.display = "flex";
1683
+ container2.style.pointerEvents = "auto";
1684
+ emit("content_pause");
1685
+ if (debug) console.log("".concat(LOG, " [preload] smartTVMode deferred: creating video element and loading, url=").concat(slot.mediaFile.url));
1686
+ startPlayback(slot.mediaFile);
1687
+ return [
1688
+ 2
1689
+ ];
1690
+ }
1691
+ teardownCurrentPlayback();
1692
+ if (adVideoElement && adVideoElement !== slot.videoEl) {
1693
+ adVideoElement.remove();
1694
+ }
1695
+ slot.videoEl.style.visibility = "visible";
1696
+ slot.videoEl.style.pointerEvents = "none";
1697
+ adVideoElement = slot.videoEl;
1698
+ adHls = slot.hlsInstance;
1699
+ if (adHls) {
1700
+ nonFatalNetworkErrors = 0;
1701
+ adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
1702
+ if (!adPlaying) return;
1703
+ if (data.fatal) {
1704
+ handleAdError();
1705
+ } else if (data.type === import_hls.default.ErrorTypes.NETWORK_ERROR) {
1706
+ nonFatalNetworkErrors++;
1707
+ if (nonFatalNetworkErrors >= 3) {
1708
+ if (debug) console.warn("".concat(LOG, " [preload] Too many non-fatal HLS network errors during playback, treating as fatal"));
1709
+ handleAdError();
1710
+ }
1711
+ }
1712
+ });
1713
+ }
1714
+ setupAdEventListeners();
1715
+ if (!continueLiveStreamDuringAds) {
1716
+ contentVideo.pause();
1717
+ }
1718
+ contentVideo.muted = true;
1719
+ contentVideo.volume = 0;
1720
+ adPlaying = true;
1721
+ setAdPlayingFlag(true);
1722
+ adVolume = originalMutedState ? 1 : originalVolume;
1723
+ adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
1724
+ adVideoElement.muted = false;
1725
+ container = ensureAdContainer();
1726
+ container.style.display = "flex";
1727
+ container.style.pointerEvents = "auto";
1728
+ emit("content_pause");
1729
+ adVideoElement.play().catch(function(error) {
1730
+ console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
1731
+ handleAdError();
1732
+ });
1733
+ return [
1734
+ 2
1735
+ ];
1626
1736
  }
1627
- contentVideo.muted = true;
1628
- contentVideo.volume = 0;
1629
- adPlaying = true;
1630
- setAdPlayingFlag(true);
1631
- adVolume = originalMutedState ? 1 : originalVolume;
1632
- adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
1633
- adVideoElement.muted = false;
1634
- container = ensureAdContainer();
1635
- container.style.display = "flex";
1636
- container.style.pointerEvents = "auto";
1637
- emit("content_pause");
1638
- adVideoElement.play().catch(function(error) {
1639
- console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
1640
- handleAdError();
1641
- });
1642
- return [
1643
- 2
1644
- ];
1645
1737
  });
1646
1738
  })();
1647
1739
  }
@@ -1826,6 +1918,7 @@ function createVastAdLayer(contentVideo, options) {
1826
1918
  return 1;
1827
1919
  },
1828
1920
  showPlaceholder: function showPlaceholder() {
1921
+ if (singleElementMode) return;
1829
1922
  contentVideo.style.opacity = "0";
1830
1923
  contentVideo.style.visibility = "hidden";
1831
1924
  if (!adContainerEl) {
@@ -3522,7 +3615,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3522
3615
  }
3523
3616
  _this.adLayer.cancelPreload(token);
3524
3617
  } else {
3525
- _this.showPlaceholderLayer();
3618
+ if (!_this.config.singlePipelineMode) {
3619
+ _this.showPlaceholderLayer();
3620
+ }
3526
3621
  _this.adLayer.showPlaceholder();
3527
3622
  _this.isInAdTransition = true;
3528
3623
  setTimeout(function() {
@@ -3546,7 +3641,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3546
3641
  console.log("[StormcloudVideoPlayer] content_resume: skip pending bids, only", remainingNow1, "ms left");
3547
3642
  }
3548
3643
  } else {
3549
- _this.showPlaceholderLayer();
3644
+ if (!_this.config.singlePipelineMode) {
3645
+ _this.showPlaceholderLayer();
3646
+ }
3550
3647
  _this.adLayer.showPlaceholder();
3551
3648
  _this.isInAdTransition = true;
3552
3649
  setTimeout(function() {
@@ -3897,7 +3994,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3897
3994
  };
3898
3995
  this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
3899
3996
  }
3900
- if (!this.config.disableFiller && !this.video.muted) {
3997
+ if (!this.config.disableFiller && !this.video.muted && !this.adLayer.isAdPlaying()) {
3901
3998
  this.video.muted = true;
3902
3999
  this.video.volume = 0;
3903
4000
  if (this.config.debugAdTiming) {
@@ -4914,7 +5011,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4914
5011
  if (!this.config.disableFiller) this.showAds = true;
4915
5012
  if (adBreakDurationMs != null) {
4916
5013
  this.startFillerBreakTimer(adBreakDurationMs);
4917
- } else if (!this.config.disableFiller) {
5014
+ } else if (!this.config.disableFiller && this.preloadedTokens.length === 0) {
4918
5015
  this.showPlaceholderLayer();
4919
5016
  }
4920
5017
  if (!this.config.disableFiller) this.adLayer.showPlaceholder();
@@ -5531,7 +5628,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5531
5628
  console.log("[StormcloudVideoPlayer] Smart TV: audio state restored on MANIFEST_PARSED after re-attach");
5532
5629
  }
5533
5630
  hlsRef.startLoad(-1);
5534
- tryPlay(0);
5535
5631
  if (debugEnabled) {
5536
5632
  console.log("[StormcloudVideoPlayer] Smart TV: seeking to live edge and resuming playback after re-attach");
5537
5633
  }