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.
@@ -354,6 +354,7 @@ function createHlsAdPlayer(contentVideo, options) {
354
354
  var AD_CONTAINER_PROP = "__stormcloudAdContainer";
355
355
  var AD_VIDEO_PROP = "__stormcloudAdVideo";
356
356
  var FRAME_COUNTER_RELIABLE_PROP = "__stormcloudFrameCounterReliable";
357
+ var RVFC_RELIABLE_PROP = "__stormcloudRvfcReliable";
357
358
  var adVideoElement = (_contentVideo_AD_VIDEO_PROP = contentVideo[AD_VIDEO_PROP]) !== null && _contentVideo_AD_VIDEO_PROP !== void 0 ? _contentVideo_AD_VIDEO_PROP : void 0;
358
359
  var adHls;
359
360
  var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
@@ -854,7 +855,7 @@ function createHlsAdPlayer(contentVideo, options) {
854
855
  }
855
856
  function fetchAndParsePod(vastTagUrl) {
856
857
  return _async_to_generator(function() {
857
- var vastXml, parser, xmlDoc, adElements, ads, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, adElement, parsed, resolved, error, err;
858
+ var vastXml, trimmedXml, parser, xmlDoc, adElements, ads, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, adElement, parsed, resolved, error, err;
858
859
  return _ts_generator(this, function(_state) {
859
860
  switch(_state.label){
860
861
  case 0:
@@ -864,11 +865,19 @@ function createHlsAdPlayer(contentVideo, options) {
864
865
  ];
865
866
  case 1:
866
867
  vastXml = _state.sent();
867
- console.log("[HlsAdPlayer] Pod VAST XML received");
868
+ console.log("[HlsAdPlayer] Pod VAST XML received (length=".concat(vastXml.length, ")"));
869
+ trimmedXml = vastXml.trim();
870
+ if (trimmedXml.length === 0) {
871
+ console.warn("[HlsAdPlayer] Pod VAST response body is empty (no fill)");
872
+ return [
873
+ 2,
874
+ []
875
+ ];
876
+ }
868
877
  parser = new DOMParser();
869
878
  xmlDoc = parser.parseFromString(vastXml, "text/xml");
870
879
  if (xmlDoc.querySelector("parsererror")) {
871
- console.error("[HlsAdPlayer] Pod VAST XML parsing error (malformed)");
880
+ console.error("[HlsAdPlayer] Pod VAST XML parsing error (malformed). Content (first 2000 chars):", vastXml.substring(0, 2e3));
872
881
  return [
873
882
  2,
874
883
  []
@@ -876,7 +885,7 @@ function createHlsAdPlayer(contentVideo, options) {
876
885
  }
877
886
  adElements = Array.from(xmlDoc.querySelectorAll("Ad"));
878
887
  if (adElements.length === 0) {
879
- console.warn("[HlsAdPlayer] No <Ad> elements found in pod VAST response");
888
+ console.warn("[HlsAdPlayer] No <Ad> elements found in pod VAST response (no fill). Content (first 2000 chars):", vastXml.substring(0, 2e3));
880
889
  return [
881
890
  2,
882
891
  []
@@ -1355,6 +1364,12 @@ function createHlsAdPlayer(contentVideo, options) {
1355
1364
  function markFrameCounterReliable() {
1356
1365
  contentVideo[FRAME_COUNTER_RELIABLE_PROP] = true;
1357
1366
  }
1367
+ function isRvfcReliable() {
1368
+ return contentVideo[RVFC_RELIABLE_PROP] === true;
1369
+ }
1370
+ function markRvfcReliable() {
1371
+ contentVideo[RVFC_RELIABLE_PROP] = true;
1372
+ }
1358
1373
  function cancelVideoFrameProbe() {
1359
1374
  if (videoFrameCallbackHandle != null && adVideoElement && typeof adVideoElement.cancelVideoFrameCallback === "function") {
1360
1375
  try {
@@ -1374,6 +1389,7 @@ function createHlsAdPlayer(contentVideo, options) {
1374
1389
  videoFrameCallbackHandle = void 0;
1375
1390
  if (!adPlaying) return;
1376
1391
  sawDecodedVideoFrame = true;
1392
+ markRvfcReliable();
1377
1393
  };
1378
1394
  try {
1379
1395
  videoFrameCallbackHandle = rvfc.call(adVideoElement, onPresentedFrame);
@@ -1398,18 +1414,19 @@ function createHlsAdPlayer(contentVideo, options) {
1398
1414
  noteAdProgress();
1399
1415
  sawDecodedVideoFrame = false;
1400
1416
  startVideoFrameProbe();
1417
+ var blackFrameDetectionEnabled = !requiresMediaPipelineResetAfterAds();
1401
1418
  stallWatchdogId = window.setInterval(function() {
1402
1419
  if (!adPlaying || !adVideoElement) {
1403
1420
  return;
1404
1421
  }
1405
- if (!sawDecodedVideoFrame && !adVideoElement.paused) {
1422
+ if (blackFrameDetectionEnabled && !sawDecodedVideoFrame && !adVideoElement.paused) {
1406
1423
  var decodedFrames = getDecodedVideoFrameCount(adVideoElement);
1407
1424
  if (decodedFrames !== void 0 && decodedFrames > 0) {
1408
1425
  sawDecodedVideoFrame = true;
1409
1426
  markFrameCounterReliable();
1410
1427
  } else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
1411
1428
  var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
1412
- if (isRvfcSupported(adVideoElement) && timeAdvancing) {
1429
+ if (isRvfcSupported(adVideoElement) && timeAdvancing && isRvfcReliable()) {
1413
1430
  handleVideoDecodeFailure();
1414
1431
  return;
1415
1432
  }
@@ -1810,7 +1827,7 @@ function createHlsAdPlayer(contentVideo, options) {
1810
1827
  }
1811
1828
  },
1812
1829
  hidePlaceholder: function hidePlaceholder() {
1813
- if (adContainerEl) {
1830
+ if (adContainerEl && !adPlaying) {
1814
1831
  adContainerEl.style.display = "none";
1815
1832
  adContainerEl.style.pointerEvents = "none";
1816
1833
  }