stormcloud-video-player 0.8.51 → 0.8.52

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.
package/lib/index.js CHANGED
@@ -578,6 +578,7 @@ function createHlsAdPlayer(contentVideo, options) {
578
578
  var AD_CONTAINER_PROP = "__stormcloudAdContainer";
579
579
  var AD_VIDEO_PROP = "__stormcloudAdVideo";
580
580
  var FRAME_COUNTER_RELIABLE_PROP = "__stormcloudFrameCounterReliable";
581
+ var RVFC_RELIABLE_PROP = "__stormcloudRvfcReliable";
581
582
  var adVideoElement = (_contentVideo_AD_VIDEO_PROP = contentVideo[AD_VIDEO_PROP]) !== null && _contentVideo_AD_VIDEO_PROP !== void 0 ? _contentVideo_AD_VIDEO_PROP : void 0;
582
583
  var adHls;
583
584
  var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
@@ -1579,6 +1580,12 @@ function createHlsAdPlayer(contentVideo, options) {
1579
1580
  function markFrameCounterReliable() {
1580
1581
  contentVideo[FRAME_COUNTER_RELIABLE_PROP] = true;
1581
1582
  }
1583
+ function isRvfcReliable() {
1584
+ return contentVideo[RVFC_RELIABLE_PROP] === true;
1585
+ }
1586
+ function markRvfcReliable() {
1587
+ contentVideo[RVFC_RELIABLE_PROP] = true;
1588
+ }
1582
1589
  function cancelVideoFrameProbe() {
1583
1590
  if (videoFrameCallbackHandle != null && adVideoElement && typeof adVideoElement.cancelVideoFrameCallback === "function") {
1584
1591
  try {
@@ -1598,6 +1605,7 @@ function createHlsAdPlayer(contentVideo, options) {
1598
1605
  videoFrameCallbackHandle = void 0;
1599
1606
  if (!adPlaying) return;
1600
1607
  sawDecodedVideoFrame = true;
1608
+ markRvfcReliable();
1601
1609
  };
1602
1610
  try {
1603
1611
  videoFrameCallbackHandle = rvfc.call(adVideoElement, onPresentedFrame);
@@ -1622,18 +1630,19 @@ function createHlsAdPlayer(contentVideo, options) {
1622
1630
  noteAdProgress();
1623
1631
  sawDecodedVideoFrame = false;
1624
1632
  startVideoFrameProbe();
1633
+ var blackFrameDetectionEnabled = !requiresMediaPipelineResetAfterAds();
1625
1634
  stallWatchdogId = window.setInterval(function() {
1626
1635
  if (!adPlaying || !adVideoElement) {
1627
1636
  return;
1628
1637
  }
1629
- if (!sawDecodedVideoFrame && !adVideoElement.paused) {
1638
+ if (blackFrameDetectionEnabled && !sawDecodedVideoFrame && !adVideoElement.paused) {
1630
1639
  var decodedFrames = getDecodedVideoFrameCount(adVideoElement);
1631
1640
  if (decodedFrames !== void 0 && decodedFrames > 0) {
1632
1641
  sawDecodedVideoFrame = true;
1633
1642
  markFrameCounterReliable();
1634
1643
  } else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
1635
1644
  var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
1636
- if (isRvfcSupported(adVideoElement) && timeAdvancing) {
1645
+ if (isRvfcSupported(adVideoElement) && timeAdvancing && isRvfcReliable()) {
1637
1646
  handleVideoDecodeFailure();
1638
1647
  return;
1639
1648
  }
@@ -2034,7 +2043,7 @@ function createHlsAdPlayer(contentVideo, options) {
2034
2043
  }
2035
2044
  },
2036
2045
  hidePlaceholder: function hidePlaceholder() {
2037
- if (adContainerEl) {
2046
+ if (adContainerEl && !adPlaying) {
2038
2047
  adContainerEl.style.display = "none";
2039
2048
  adContainerEl.style.pointerEvents = "none";
2040
2049
  }