stormcloud-video-player 0.8.51 → 0.8.53

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.
@@ -1,4 +1,4 @@
1
- import { S as StormcloudVideoPlayerConfig } from '../types-iDjS8f_7.cjs';
1
+ import { a as StormcloudVideoPlayerConfig } from '../types-cTqIKw_D.cjs';
2
2
 
3
3
  declare class StormcloudVideoPlayer {
4
4
  private readonly video;
@@ -1,4 +1,4 @@
1
- import { a as Scte35Marker } from '../types-iDjS8f_7.cjs';
1
+ import { S as Scte35Marker } from '../types-cTqIKw_D.cjs';
2
2
 
3
3
  type Scte35CueSource = "manifest" | "id3" | "ts";
4
4
  type Scte35CueReadiness = "early" | "playback";
@@ -585,6 +585,7 @@ function createHlsAdPlayer(contentVideo, options) {
585
585
  var AD_CONTAINER_PROP = "__stormcloudAdContainer";
586
586
  var AD_VIDEO_PROP = "__stormcloudAdVideo";
587
587
  var FRAME_COUNTER_RELIABLE_PROP = "__stormcloudFrameCounterReliable";
588
+ var RVFC_RELIABLE_PROP = "__stormcloudRvfcReliable";
588
589
  var adVideoElement = (_contentVideo_AD_VIDEO_PROP = contentVideo[AD_VIDEO_PROP]) !== null && _contentVideo_AD_VIDEO_PROP !== void 0 ? _contentVideo_AD_VIDEO_PROP : void 0;
589
590
  var adHls;
590
591
  var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
@@ -1085,7 +1086,7 @@ function createHlsAdPlayer(contentVideo, options) {
1085
1086
  }
1086
1087
  function fetchAndParsePod(vastTagUrl) {
1087
1088
  return _async_to_generator(function() {
1088
- var vastXml, parser, xmlDoc, adElements, ads, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, adElement, parsed, resolved, error, err;
1089
+ var vastXml, trimmedXml, parser, xmlDoc, adElements, ads, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, adElement, parsed, resolved, error, err;
1089
1090
  return _ts_generator(this, function(_state) {
1090
1091
  switch(_state.label){
1091
1092
  case 0:
@@ -1095,11 +1096,19 @@ function createHlsAdPlayer(contentVideo, options) {
1095
1096
  ];
1096
1097
  case 1:
1097
1098
  vastXml = _state.sent();
1098
- console.log("[HlsAdPlayer] Pod VAST XML received");
1099
+ console.log("[HlsAdPlayer] Pod VAST XML received (length=".concat(vastXml.length, ")"));
1100
+ trimmedXml = vastXml.trim();
1101
+ if (trimmedXml.length === 0) {
1102
+ console.warn("[HlsAdPlayer] Pod VAST response body is empty (no fill)");
1103
+ return [
1104
+ 2,
1105
+ []
1106
+ ];
1107
+ }
1099
1108
  parser = new DOMParser();
1100
1109
  xmlDoc = parser.parseFromString(vastXml, "text/xml");
1101
1110
  if (xmlDoc.querySelector("parsererror")) {
1102
- console.error("[HlsAdPlayer] Pod VAST XML parsing error (malformed)");
1111
+ console.error("[HlsAdPlayer] Pod VAST XML parsing error (malformed). Content (first 2000 chars):", vastXml.substring(0, 2e3));
1103
1112
  return [
1104
1113
  2,
1105
1114
  []
@@ -1107,7 +1116,7 @@ function createHlsAdPlayer(contentVideo, options) {
1107
1116
  }
1108
1117
  adElements = Array.from(xmlDoc.querySelectorAll("Ad"));
1109
1118
  if (adElements.length === 0) {
1110
- console.warn("[HlsAdPlayer] No <Ad> elements found in pod VAST response");
1119
+ console.warn("[HlsAdPlayer] No <Ad> elements found in pod VAST response (no fill). Content (first 2000 chars):", vastXml.substring(0, 2e3));
1111
1120
  return [
1112
1121
  2,
1113
1122
  []
@@ -1586,6 +1595,12 @@ function createHlsAdPlayer(contentVideo, options) {
1586
1595
  function markFrameCounterReliable() {
1587
1596
  contentVideo[FRAME_COUNTER_RELIABLE_PROP] = true;
1588
1597
  }
1598
+ function isRvfcReliable() {
1599
+ return contentVideo[RVFC_RELIABLE_PROP] === true;
1600
+ }
1601
+ function markRvfcReliable() {
1602
+ contentVideo[RVFC_RELIABLE_PROP] = true;
1603
+ }
1589
1604
  function cancelVideoFrameProbe() {
1590
1605
  if (videoFrameCallbackHandle != null && adVideoElement && typeof adVideoElement.cancelVideoFrameCallback === "function") {
1591
1606
  try {
@@ -1605,6 +1620,7 @@ function createHlsAdPlayer(contentVideo, options) {
1605
1620
  videoFrameCallbackHandle = void 0;
1606
1621
  if (!adPlaying) return;
1607
1622
  sawDecodedVideoFrame = true;
1623
+ markRvfcReliable();
1608
1624
  };
1609
1625
  try {
1610
1626
  videoFrameCallbackHandle = rvfc.call(adVideoElement, onPresentedFrame);
@@ -1629,18 +1645,19 @@ function createHlsAdPlayer(contentVideo, options) {
1629
1645
  noteAdProgress();
1630
1646
  sawDecodedVideoFrame = false;
1631
1647
  startVideoFrameProbe();
1648
+ var blackFrameDetectionEnabled = !requiresMediaPipelineResetAfterAds();
1632
1649
  stallWatchdogId = window.setInterval(function() {
1633
1650
  if (!adPlaying || !adVideoElement) {
1634
1651
  return;
1635
1652
  }
1636
- if (!sawDecodedVideoFrame && !adVideoElement.paused) {
1653
+ if (blackFrameDetectionEnabled && !sawDecodedVideoFrame && !adVideoElement.paused) {
1637
1654
  var decodedFrames = getDecodedVideoFrameCount(adVideoElement);
1638
1655
  if (decodedFrames !== void 0 && decodedFrames > 0) {
1639
1656
  sawDecodedVideoFrame = true;
1640
1657
  markFrameCounterReliable();
1641
1658
  } else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
1642
1659
  var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
1643
- if (isRvfcSupported(adVideoElement) && timeAdvancing) {
1660
+ if (isRvfcSupported(adVideoElement) && timeAdvancing && isRvfcReliable()) {
1644
1661
  handleVideoDecodeFailure();
1645
1662
  return;
1646
1663
  }
@@ -2041,7 +2058,7 @@ function createHlsAdPlayer(contentVideo, options) {
2041
2058
  }
2042
2059
  },
2043
2060
  hidePlaceholder: function hidePlaceholder() {
2044
- if (adContainerEl) {
2061
+ if (adContainerEl && !adPlaying) {
2045
2062
  adContainerEl.style.display = "none";
2046
2063
  adContainerEl.style.pointerEvents = "none";
2047
2064
  }