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,5 +1,5 @@
1
1
  import { Component } from 'react';
2
- import { S as StormcloudVideoPlayerConfig } from '../types-iDjS8f_7.cjs';
2
+ import { a as StormcloudVideoPlayerConfig } from '../types-cTqIKw_D.cjs';
3
3
 
4
4
  interface HlsPlayerProps extends StormcloudVideoPlayerConfig {
5
5
  onMount?: (player: any) => void;
@@ -621,6 +621,7 @@ function createHlsAdPlayer(contentVideo, options) {
621
621
  var AD_CONTAINER_PROP = "__stormcloudAdContainer";
622
622
  var AD_VIDEO_PROP = "__stormcloudAdVideo";
623
623
  var FRAME_COUNTER_RELIABLE_PROP = "__stormcloudFrameCounterReliable";
624
+ var RVFC_RELIABLE_PROP = "__stormcloudRvfcReliable";
624
625
  var adVideoElement = (_contentVideo_AD_VIDEO_PROP = contentVideo[AD_VIDEO_PROP]) !== null && _contentVideo_AD_VIDEO_PROP !== void 0 ? _contentVideo_AD_VIDEO_PROP : void 0;
625
626
  var adHls;
626
627
  var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
@@ -1121,7 +1122,7 @@ function createHlsAdPlayer(contentVideo, options) {
1121
1122
  }
1122
1123
  function fetchAndParsePod(vastTagUrl) {
1123
1124
  return _async_to_generator(function() {
1124
- var vastXml, parser, xmlDoc, adElements, ads, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, adElement, parsed, resolved, error, err;
1125
+ var vastXml, trimmedXml, parser, xmlDoc, adElements, ads, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, adElement, parsed, resolved, error, err;
1125
1126
  return _ts_generator(this, function(_state) {
1126
1127
  switch(_state.label){
1127
1128
  case 0:
@@ -1131,11 +1132,19 @@ function createHlsAdPlayer(contentVideo, options) {
1131
1132
  ];
1132
1133
  case 1:
1133
1134
  vastXml = _state.sent();
1134
- console.log("[HlsAdPlayer] Pod VAST XML received");
1135
+ console.log("[HlsAdPlayer] Pod VAST XML received (length=".concat(vastXml.length, ")"));
1136
+ trimmedXml = vastXml.trim();
1137
+ if (trimmedXml.length === 0) {
1138
+ console.warn("[HlsAdPlayer] Pod VAST response body is empty (no fill)");
1139
+ return [
1140
+ 2,
1141
+ []
1142
+ ];
1143
+ }
1135
1144
  parser = new DOMParser();
1136
1145
  xmlDoc = parser.parseFromString(vastXml, "text/xml");
1137
1146
  if (xmlDoc.querySelector("parsererror")) {
1138
- console.error("[HlsAdPlayer] Pod VAST XML parsing error (malformed)");
1147
+ console.error("[HlsAdPlayer] Pod VAST XML parsing error (malformed). Content (first 2000 chars):", vastXml.substring(0, 2e3));
1139
1148
  return [
1140
1149
  2,
1141
1150
  []
@@ -1143,7 +1152,7 @@ function createHlsAdPlayer(contentVideo, options) {
1143
1152
  }
1144
1153
  adElements = Array.from(xmlDoc.querySelectorAll("Ad"));
1145
1154
  if (adElements.length === 0) {
1146
- console.warn("[HlsAdPlayer] No <Ad> elements found in pod VAST response");
1155
+ console.warn("[HlsAdPlayer] No <Ad> elements found in pod VAST response (no fill). Content (first 2000 chars):", vastXml.substring(0, 2e3));
1147
1156
  return [
1148
1157
  2,
1149
1158
  []
@@ -1622,6 +1631,12 @@ function createHlsAdPlayer(contentVideo, options) {
1622
1631
  function markFrameCounterReliable() {
1623
1632
  contentVideo[FRAME_COUNTER_RELIABLE_PROP] = true;
1624
1633
  }
1634
+ function isRvfcReliable() {
1635
+ return contentVideo[RVFC_RELIABLE_PROP] === true;
1636
+ }
1637
+ function markRvfcReliable() {
1638
+ contentVideo[RVFC_RELIABLE_PROP] = true;
1639
+ }
1625
1640
  function cancelVideoFrameProbe() {
1626
1641
  if (videoFrameCallbackHandle != null && adVideoElement && typeof adVideoElement.cancelVideoFrameCallback === "function") {
1627
1642
  try {
@@ -1641,6 +1656,7 @@ function createHlsAdPlayer(contentVideo, options) {
1641
1656
  videoFrameCallbackHandle = void 0;
1642
1657
  if (!adPlaying) return;
1643
1658
  sawDecodedVideoFrame = true;
1659
+ markRvfcReliable();
1644
1660
  };
1645
1661
  try {
1646
1662
  videoFrameCallbackHandle = rvfc.call(adVideoElement, onPresentedFrame);
@@ -1665,18 +1681,19 @@ function createHlsAdPlayer(contentVideo, options) {
1665
1681
  noteAdProgress();
1666
1682
  sawDecodedVideoFrame = false;
1667
1683
  startVideoFrameProbe();
1684
+ var blackFrameDetectionEnabled = !requiresMediaPipelineResetAfterAds();
1668
1685
  stallWatchdogId = window.setInterval(function() {
1669
1686
  if (!adPlaying || !adVideoElement) {
1670
1687
  return;
1671
1688
  }
1672
- if (!sawDecodedVideoFrame && !adVideoElement.paused) {
1689
+ if (blackFrameDetectionEnabled && !sawDecodedVideoFrame && !adVideoElement.paused) {
1673
1690
  var decodedFrames = getDecodedVideoFrameCount(adVideoElement);
1674
1691
  if (decodedFrames !== void 0 && decodedFrames > 0) {
1675
1692
  sawDecodedVideoFrame = true;
1676
1693
  markFrameCounterReliable();
1677
1694
  } else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
1678
1695
  var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
1679
- if (isRvfcSupported(adVideoElement) && timeAdvancing) {
1696
+ if (isRvfcSupported(adVideoElement) && timeAdvancing && isRvfcReliable()) {
1680
1697
  handleVideoDecodeFailure();
1681
1698
  return;
1682
1699
  }
@@ -2077,7 +2094,7 @@ function createHlsAdPlayer(contentVideo, options) {
2077
2094
  }
2078
2095
  },
2079
2096
  hidePlaceholder: function hidePlaceholder() {
2080
- if (adContainerEl) {
2097
+ if (adContainerEl && !adPlaying) {
2081
2098
  adContainerEl.style.display = "none";
2082
2099
  adContainerEl.style.pointerEvents = "none";
2083
2100
  }